当前位置: 首页>>代码示例>>Java>>正文


Java Agent.getText方法代码示例

本文整理汇总了Java中sun.management.Agent.getText方法的典型用法代码示例。如果您正苦于以下问题:Java Agent.getText方法的具体用法?Java Agent.getText怎么用?Java Agent.getText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sun.management.Agent的用法示例。


在下文中一共展示了Agent.getText方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import sun.management.Agent; //导入方法依赖的package包/类
public static void main(String[] args){
    String [][] testStrings = {
        {"agent.err.error", "", ""},
        {"jmxremote.ConnectorBootstrap.starting", "", ""},
        {"jmxremote.ConnectorBootstrap.noAuthentication", "", ""},
        {"jmxremote.ConnectorBootstrap.ready", "Phony JMXServiceURL", ""},
        {"jmxremote.ConnectorBootstrap.password.readonly", "Phony passwordFileName", ""},
    };

    boolean pass = true;
    System.out.println("Start...");
    for (int ii = 0; ii < testStrings.length; ii++) {
        String key = testStrings[ii][0];
        String p1 = testStrings[ii][1];
        String p2 = testStrings[ii][2];
        String ss = Agent.getText(key, p1, p2);
        if (ss.startsWith("missing resource key")) {
            pass = false;
            System.out.println("    lookup failed for key = " + key);
        }
    }
    if (!pass) {
        throw new Error ("Resource lookup(s) failed; Test failed");
    }
    System.out.println("...Finished.");
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:27,代码来源:AgentCheckTest.java

示例2: checkPasswordFile

import sun.management.Agent; //导入方法依赖的package包/类
private static void checkPasswordFile(String passwordFileName) {
    if (passwordFileName == null || passwordFileName.length() == 0) {
        throw new AgentConfigurationError(PASSWORD_FILE_NOT_SET);
    }
    File file = new File(passwordFileName);
    if (!file.exists()) {
        throw new AgentConfigurationError(PASSWORD_FILE_NOT_FOUND, passwordFileName);
    }

    if (!file.canRead()) {
        throw new AgentConfigurationError(PASSWORD_FILE_NOT_READABLE, passwordFileName);
    }

    FileSystem fs = FileSystem.open();
    try {
        if (fs.supportsFileSecurity(file)) {
            if (!fs.isAccessUserOnly(file)) {
                final String msg = Agent.getText("jmxremote.ConnectorBootstrap.password.readonly",
                        passwordFileName);
                log.config("startRemoteConnectorServer", msg);
                throw new AgentConfigurationError(PASSWORD_FILE_ACCESS_NOT_RESTRICTED,
                        passwordFileName);
            }
        }
    } catch (IOException e) {
        throw new AgentConfigurationError(PASSWORD_FILE_READ_FAILED,
                e, passwordFileName);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:30,代码来源:ConnectorBootstrap.java

示例3: checkRestrictedFile

import sun.management.Agent; //导入方法依赖的package包/类
private static void checkRestrictedFile(String restrictedFileName) {
    if (restrictedFileName == null || restrictedFileName.length() == 0) {
        throw new AgentConfigurationError(FILE_NOT_SET);
    }
    File file = new File(restrictedFileName);
    if (!file.exists()) {
        throw new AgentConfigurationError(FILE_NOT_FOUND, restrictedFileName);
    }
    if (!file.canRead()) {
        throw new AgentConfigurationError(FILE_NOT_READABLE, restrictedFileName);
    }
    FileSystem fs = FileSystem.open();
    try {
        if (fs.supportsFileSecurity(file)) {
            if (!fs.isAccessUserOnly(file)) {
                final String msg = Agent.getText(
                        "jmxremote.ConnectorBootstrap.file.readonly",
                        restrictedFileName);
                log.config("startRemoteConnectorServer", msg);
                throw new AgentConfigurationError(
                        FILE_ACCESS_NOT_RESTRICTED, restrictedFileName);
            }
        }
    } catch (IOException e) {
        throw new AgentConfigurationError(
                FILE_READ_FAILED, e, restrictedFileName);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:29,代码来源:ConnectorBootstrap.java

示例4: main

import sun.management.Agent; //导入方法依赖的package包/类
public static void main(String[] args){
    String [][] testStrings = {
        {"agent.err.error", "", ""},
        {"jmxremote.ConnectorBootstrap.starting", "", ""},
        {"jmxremote.ConnectorBootstrap.noAuthentication", "", ""},
        {"jmxremote.ConnectorBootstrap.ready", "Phony JMXServiceURL", ""},
        {"jmxremote.ConnectorBootstrap.password.readonly", "Phony passwordFileName", ""},
        {"jmxremote.AdaptorBootstrap.getTargetList.processing", "", ""},
        {"jmxremote.AdaptorBootstrap.getTargetList.adding", "Phony target", ""},
        {"jmxremote.AdaptorBootstrap.getTargetList.starting", "", ""},
        {"jmxremote.AdaptorBootstrap.getTargetList.initialize1", "", ""},
        {"jmxremote.AdaptorBootstrap.getTargetList.initialize2", "Phony hostname", "Phony port"},
        {"jmxremote.AdaptorBootstrap.getTargetList.terminate", "Phony exception", ""},
    };

    boolean pass = true;
    System.out.println("Start...");
    for (int ii = 0; ii < testStrings.length; ii++) {
        String key = testStrings[ii][0];
        String p1 = testStrings[ii][1];
        String p2 = testStrings[ii][2];
        String ss = Agent.getText(key, p1, p2);
        if (ss.startsWith("missing resource key")) {
            pass = false;
            System.out.println("    lookup failed for key = " + key);
        }
    }
    if (!pass) {
        throw new Error ("Resource lookup(s) failed; Test failed");
    }
    System.out.println("...Finished.");
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:33,代码来源:AgentCheckTest.java

示例5: checkPasswordFile

import sun.management.Agent; //导入方法依赖的package包/类
private static void checkPasswordFile(String passwordFileName) {
    if (passwordFileName == null || passwordFileName.length() == 0) {
        throw new AgentConfigurationError(PASSWORD_FILE_NOT_SET);
    }
    File file = new File(passwordFileName);
    if (!file.exists()) {
        throw new AgentConfigurationError(PASSWORD_FILE_NOT_FOUND, passwordFileName);
    }

    if (!file.canRead()) {
        throw new AgentConfigurationError(PASSWORD_FILE_NOT_READABLE, passwordFileName);
    }

    FileSystem fs = FileSystem.open();
    try {
        if (fs.supportsFileSecurity(file)) {
            if (!fs.isAccessUserOnly(file)) {
                final String msg = Agent.getText("jmxremote.ConnectorBootstrap.initialize.password.readonly",
                        passwordFileName);
                log.config("initialize", msg);
                throw new AgentConfigurationError(PASSWORD_FILE_ACCESS_NOT_RESTRICTED,
                        passwordFileName);
            }
        }
    } catch (IOException e) {
        throw new AgentConfigurationError(PASSWORD_FILE_READ_FAILED,
                e, passwordFileName);
    }
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:30,代码来源:ConnectorBootstrap.java

示例6: checkRestrictedFile

import sun.management.Agent; //导入方法依赖的package包/类
private static void checkRestrictedFile(String restrictedFileName) {
    if (restrictedFileName == null || restrictedFileName.length() == 0) {
        throw new AgentConfigurationError(FILE_NOT_SET);
    }
    File file = new File(restrictedFileName);
    if (!file.exists()) {
        throw new AgentConfigurationError(FILE_NOT_FOUND, restrictedFileName);
    }
    if (!file.canRead()) {
        throw new AgentConfigurationError(FILE_NOT_READABLE, restrictedFileName);
    }
    FileSystem fs = FileSystem.open();
    try {
        if (fs.supportsFileSecurity(file)) {
            if (!fs.isAccessUserOnly(file)) {
                final String msg = Agent.getText(
                        "jmxremote.ConnectorBootstrap.initialize.file.readonly",
                        restrictedFileName);
                log.config("initialize", msg);
                throw new AgentConfigurationError(
                        FILE_ACCESS_NOT_RESTRICTED, restrictedFileName);
            }
        }
    } catch (IOException e) {
        throw new AgentConfigurationError(
                FILE_READ_FAILED, e, restrictedFileName);
    }
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:29,代码来源:ConnectorBootstrap.java

示例7: main

import sun.management.Agent; //导入方法依赖的package包/类
public static void main(String[] args){
    String [][] testStrings = {
        {"agent.err.error", "", ""},
        {"jmxremote.ConnectorBootstrap.initialize", "", ""},
        {"jmxremote.ConnectorBootstrap.initialize.noAuthentication", "", ""},
        {"jmxremote.ConnectorBootstrap.initialize.ready", "Phony JMXServiceURL", ""},
        {"jmxremote.ConnectorBootstrap.initialize.password.readonly", "Phony passwordFileName", ""},
        {"jmxremote.AdaptorBootstrap.getTargetList.processing", "", ""},
        {"jmxremote.AdaptorBootstrap.getTargetList.adding", "Phony target", ""},
        {"jmxremote.AdaptorBootstrap.getTargetList.starting", "", ""},
        {"jmxremote.AdaptorBootstrap.getTargetList.initialize1", "", ""},
        {"jmxremote.AdaptorBootstrap.getTargetList.initialize2", "Phony hostname", "Phony port"},
        {"jmxremote.AdaptorBootstrap.getTargetList.terminate", "Phony exception", ""},
    };

    boolean pass = true;
    System.out.println("Start...");
    for (int ii = 0; ii < testStrings.length; ii++) {
        String key = testStrings[ii][0];
        String p1 = testStrings[ii][1];
        String p2 = testStrings[ii][2];
        String ss = Agent.getText(key, p1, p2);
        if (ss.startsWith("missing resource key")) {
            pass = false;
            System.out.println("    lookup failed for key = " + key);
        }
    }
    if (!pass) {
        throw new Error ("Resource lookup(s) failed; Test failed");
    }
    System.out.println("...Finished.");
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:33,代码来源:AgentCheckTest.java


注:本文中的sun.management.Agent.getText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。