本文整理汇总了Java中sun.management.AgentConfigurationError类的典型用法代码示例。如果您正苦于以下问题:Java AgentConfigurationError类的具体用法?Java AgentConfigurationError怎么用?Java AgentConfigurationError使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AgentConfigurationError类属于sun.management包,在下文中一共展示了AgentConfigurationError类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkAclFile
import sun.management.AgentConfigurationError; //导入依赖的package包/类
private static void checkAclFile(String aclFileName) {
if (aclFileName == null || aclFileName.length()==0) {
throw new AgentConfigurationError(SNMP_ACL_FILE_NOT_SET);
}
final File file = new File(aclFileName);
if (!file.exists()) {
throw new AgentConfigurationError(SNMP_ACL_FILE_NOT_FOUND, aclFileName);
}
if (!file.canRead()) {
throw new AgentConfigurationError(SNMP_ACL_FILE_NOT_READABLE, aclFileName);
}
FileSystem fs = FileSystem.open();
try {
if (fs.supportsFileSecurity(file)) {
if (!fs.isAccessUserOnly(file)) {
throw new AgentConfigurationError(SNMP_ACL_FILE_ACCESS_NOT_RESTRICTED,
aclFileName);
}
}
} catch (IOException e) {
throw new AgentConfigurationError(SNMP_ACL_FILE_READ_FAILED, aclFileName);
}
}
示例2: checkPasswordFile
import sun.management.AgentConfigurationError; //导入依赖的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);
}
}
示例3: checkAccessFile
import sun.management.AgentConfigurationError; //导入依赖的package包/类
private static void checkAccessFile(String accessFileName) {
if (accessFileName == null || accessFileName.length() == 0) {
throw new AgentConfigurationError(ACCESS_FILE_NOT_SET);
}
File file = new File(accessFileName);
if (!file.exists()) {
throw new AgentConfigurationError(ACCESS_FILE_NOT_FOUND, accessFileName);
}
if (!file.canRead()) {
throw new AgentConfigurationError(ACCESS_FILE_NOT_READABLE, accessFileName);
}
}
示例4: checkRestrictedFile
import sun.management.AgentConfigurationError; //导入依赖的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);
}
}
示例5: checkPasswordFile
import sun.management.AgentConfigurationError; //导入依赖的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);
}
}
示例6: checkRestrictedFile
import sun.management.AgentConfigurationError; //导入依赖的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);
}
}