org.wildfly.security.manager.WildFlySecurityManager.getEnvPropertyPrivileged()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(10.3k)|赞(0)|评价(0)|浏览(91)

本文整理了Java中org.wildfly.security.manager.WildFlySecurityManager.getEnvPropertyPrivileged()方法的一些代码示例,展示了WildFlySecurityManager.getEnvPropertyPrivileged()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WildFlySecurityManager.getEnvPropertyPrivileged()方法的具体详情如下:
包路径:org.wildfly.security.manager.WildFlySecurityManager
类名称:WildFlySecurityManager
方法名:getEnvPropertyPrivileged

WildFlySecurityManager.getEnvPropertyPrivileged介绍

[英]Get an environmental property, doing a faster permission check that skips having to execute a privileged action frame.
[中]获取一个环境属性,进行更快的权限检查,从而避免执行特权操作框架。

代码示例

代码示例来源:origin: wildfly/wildfly-core

private static File findCLIFileInJBossHome() {
  final String jbossHome = WildFlySecurityManager.getEnvPropertyPrivileged("JBOSS_HOME", null);
  if (jbossHome == null) return null;
  File jbossCliFile = new File(jbossHome + File.separatorChar + "bin", JBOSS_CLI_FILE);
  if (!jbossCliFile.exists()) return null;
  return jbossCliFile;
}

代码示例来源:origin: org.wildfly.core/wildfly-cli

private static File findCLIFileInJBossHome() {
  final String jbossHome = WildFlySecurityManager.getEnvPropertyPrivileged("JBOSS_HOME", null);
  if (jbossHome == null) return null;
  File jbossCliFile = new File(jbossHome + File.separatorChar + "bin", JBOSS_CLI_FILE);
  if (!jbossCliFile.exists()) return null;
  return jbossCliFile;
}

代码示例来源:origin: wildfly/wildfly-maven-plugin

private static Path findJavaHome() {
  String path = WildFlySecurityManager.getPropertyPrivileged("java.home", null);
  if (path != null) {
    path = WildFlySecurityManager.getEnvPropertyPrivileged("JAVA_HOME", null);
  }
  if (path == null) {
    return null;
  }
  Path resolved = Paths.get(path);
  if (Files.exists(resolved)) {
    return resolved;
  }
  return null;
}

代码示例来源:origin: wildfly/wildfly-core

private static JvmType createFromEnvironmentVariable(boolean forLaunch) {
  final String envJavaHome = WildFlySecurityManager.getEnvPropertyPrivileged(JAVA_HOME_ENV_VAR, null);
  if (envJavaHome != null && !"".equals(envJavaHome.trim())) {
    return createFromJavaHome(envJavaHome, forLaunch);
  } else {
    return createFromSystemProperty(forLaunch);
  }
}

代码示例来源:origin: org.wildfly.core/wildfly-host-controller

private static JvmType createFromEnvironmentVariable(boolean forLaunch) {
  final String envJavaHome = WildFlySecurityManager.getEnvPropertyPrivileged(JAVA_HOME_ENV_VAR, null);
  if (envJavaHome != null && !"".equals(envJavaHome.trim())) {
    return createFromJavaHome(envJavaHome, forLaunch);
  } else {
    return createFromSystemProperty(forLaunch);
  }
}

代码示例来源:origin: wildfly/wildfly-core

private File getJBossHome(final ParsedCommandLine parsedCmd) throws CommandLineException {
  String jbossHome = this.jbossHome == null ? null : this.jbossHome.getValue(parsedCmd);
  if (jbossHome == null || jbossHome.length() == 0) {
    jbossHome = WildFlySecurityManager.getEnvPropertyPrivileged("JBOSS_HOME", null);
    if (jbossHome == null || jbossHome.length() == 0) {
      if (this.jbossHome != null) {
        throw new CommandLineException("Missing configuration value for --jboss-home and environment variable JBOSS_HOME is not set");
      } else {
        throw new CommandLineException("Environment variable JBOSS_HOME is not set");
      }
    }
    return validateJBossHome(jbossHome, "environment variable JBOSS_HOME");
  } else {
    return validateJBossHome(jbossHome, "argument --jboss-home");
  }
}

代码示例来源:origin: org.wildfly.core/wildfly-cli

private File getJBossHome(final ParsedCommandLine parsedCmd) throws CommandLineException {
  String jbossHome = this.jbossHome == null ? null : this.jbossHome.getValue(parsedCmd);
  if (jbossHome == null || jbossHome.length() == 0) {
    jbossHome = WildFlySecurityManager.getEnvPropertyPrivileged("JBOSS_HOME", null);
    if (jbossHome == null || jbossHome.length() == 0) {
      if (this.jbossHome != null) {
        throw new CommandLineException("Missing configuration value for --jboss-home and environment variable JBOSS_HOME is not set");
      } else {
        throw new CommandLineException("Environment variable JBOSS_HOME is not set");
      }
    }
    return validateJBossHome(jbossHome, "environment variable JBOSS_HOME");
  } else {
    return validateJBossHome(jbossHome, "argument --jboss-home");
  }
}

代码示例来源:origin: org.wildfly.core/wildfly-cli

private File getJBossHome(final ParsedCommandLine parsedCmd) throws CommandLineException {
  String jbossHome = this.jbossHome == null ? null : this.jbossHome.getValue(parsedCmd);
  if (jbossHome == null || jbossHome.length() == 0) {
    jbossHome = WildFlySecurityManager.getEnvPropertyPrivileged("JBOSS_HOME", null);
    if (jbossHome == null || jbossHome.length() == 0) {
      if (this.jbossHome != null) {
        throw new CommandLineException("Missing configuration value for --jboss-home and environment variable JBOSS_HOME is not set");
      } else {
        throw new CommandLineException("Environment variable JBOSS_HOME is not set");
      }
    }
    return validateJBossHome(jbossHome, "environment variable JBOSS_HOME");
  } else {
    return validateJBossHome(jbossHome, "argument --jboss-home");
  }
}

代码示例来源:origin: wildfly/wildfly-core

private File getJBossHome(final ParsedCommandLine parsedCmd) throws CommandLineException {
  String jbossHome = this.jbossHome == null ? null : this.jbossHome.getValue(parsedCmd);
  if (jbossHome == null || jbossHome.length() == 0) {
    jbossHome = WildFlySecurityManager.getEnvPropertyPrivileged("JBOSS_HOME", null);
    if (jbossHome == null || jbossHome.length() == 0) {
      if (this.jbossHome != null) {
        throw new CommandLineException("Missing configuration value for --jboss-home and environment variable JBOSS_HOME is not set");
      } else {
        throw new CommandLineException("Environment variable JBOSS_HOME is not set");
      }
    }
    return validateJBossHome(jbossHome, "environment variable JBOSS_HOME");
  } else {
    return validateJBossHome(jbossHome, "argument --jboss-home");
  }
}

代码示例来源:origin: org.wildfly.core/wildfly-cli

final StringBuilder buf = new StringBuilder();
buf.append("JBoss Admin Command-line Interface\n");
buf.append("JBOSS_HOME: ").append(WildFlySecurityManager.getEnvPropertyPrivileged("JBOSS_HOME", null)).append('\n');
buf.append("Release: ");
final ModelControllerClient client = ctx.getModelControllerClient();
buf.append("JAVA_HOME: ").append(WildFlySecurityManager.getEnvPropertyPrivileged("JAVA_HOME", null)).append('\n');
buf.append("java.version: ").append(WildFlySecurityManager.getPropertyPrivileged("java.version", null)).append('\n');
buf.append("java.vm.vendor: ").append(WildFlySecurityManager.getPropertyPrivileged("java.vm.vendor", null)).append('\n');

代码示例来源:origin: org.wildfly.core/wildfly-cli

protected File getModulesDir(CommandContext ctx) throws CommandLineException {
  // First check if we have an option
  File modsDir = null;
  String moduleRootDirStr = moduleRootDir.getValue(ctx.getParsedCommandLine());
  if (moduleRootDirStr != null) {
    modsDir = new File(moduleRootDirStr);
  }
  if (modsDir == null) {
    if(modulesDir != null) {
      return modulesDir;
    }
    // First check the environment variable
    String rootDir = WildFlySecurityManager.getEnvPropertyPrivileged(JBOSS_HOME, null);
    if (rootDir == null) {
      // Not found, check the system property, this may be set from a client using the CLI API to execute commands
      rootDir = WildFlySecurityManager.getPropertyPrivileged(JBOSS_HOME_PROPERTY, null);
    }
    if (rootDir == null) {
      throw new CommandLineException(JBOSS_HOME + " environment variable is not set.");
    }
    modulesDir = new File(rootDir, "modules");
    modsDir = modulesDir;
  }
  if (!modsDir.exists()) {
    throw new CommandLineException("Failed to locate the modules dir on the filesystem: " + modsDir.getAbsolutePath());
  }
  return modsDir;
}

代码示例来源:origin: wildfly/wildfly-core

final StringBuilder buf = new StringBuilder();
buf.append("JBoss Admin Command-line Interface\n");
buf.append("JBOSS_HOME: ").append(WildFlySecurityManager.getEnvPropertyPrivileged("JBOSS_HOME", null)).append('\n');
buf.append("Release: ");
final ModelControllerClient client = ctx.getModelControllerClient();
buf.append("JAVA_HOME: ").append(WildFlySecurityManager.getEnvPropertyPrivileged("JAVA_HOME", null)).append('\n');
buf.append("java.version: ").append(WildFlySecurityManager.getPropertyPrivileged("java.version", null)).append('\n');
buf.append("java.vm.vendor: ").append(WildFlySecurityManager.getPropertyPrivileged("java.vm.vendor", null)).append('\n');

代码示例来源:origin: org.wildfly.core/wildfly-cli

if(!f.exists()) {
  dir = WildFlySecurityManager.getEnvPropertyPrivileged("JBOSS_HOME", null);
  if(dir != null) {
    f = new File(dir + File.separatorChar + "bin", JBOSS_CLI_RC_FILE);

代码示例来源:origin: wildfly/wildfly-core

if(!f.exists()) {
  dir = WildFlySecurityManager.getEnvPropertyPrivileged("JBOSS_HOME", null);
  if(dir != null) {
    f = new File(dir + File.separatorChar + "bin", JBOSS_CLI_RC_FILE);

代码示例来源:origin: wildfly/wildfly-core

protected File getModulesDir(CommandContext ctx) throws CommandLineException {
  // First check if we have an option
  File modsDir = null;
  String moduleRootDirStr = moduleRootDir.getValue(ctx.getParsedCommandLine());
  if (moduleRootDirStr != null) {
    modsDir = new File(moduleRootDirStr);
  }
  if (modsDir == null) {
    if(modulesDir != null) {
      return modulesDir;
    }
    // First check the environment variable
    String rootDir = WildFlySecurityManager.getEnvPropertyPrivileged(JBOSS_HOME, null);
    if (rootDir == null) {
      // Not found, check the system property, this may be set from a client using the CLI API to execute commands
      rootDir = WildFlySecurityManager.getPropertyPrivileged(JBOSS_HOME_PROPERTY, null);
    }
    if (rootDir == null) {
      throw new CommandLineException(JBOSS_HOME + " environment variable is not set.");
    }
    modulesDir = new File(rootDir, "modules");
    modsDir = modulesDir;
  }
  if (!modsDir.exists()) {
    throw new CommandLineException("Failed to locate the modules dir on the filesystem: " + modsDir.getAbsolutePath());
  }
  return modsDir;
}

代码示例来源:origin: org.wildfly.core/wildfly-cli

if(relativeTo != null) {
  if(relativeTo.equals("jboss.home.dir")) {
    final String jbossHome = WildFlySecurityManager.getEnvPropertyPrivileged("JBOSS_HOME", null);
    if(jbossHome == null) {
      throw new XMLStreamException("JBOSS_HOME is not set");

代码示例来源:origin: wildfly/wildfly-core

if(relativeTo != null) {
  if(relativeTo.equals("jboss.home.dir")) {
    final String jbossHome = WildFlySecurityManager.getEnvPropertyPrivileged("JBOSS_HOME", null);
    if(jbossHome == null) {
      throw new XMLStreamException("JBOSS_HOME is not set");

代码示例来源:origin: org.wildfly/wildfly-controller

} else if(subModel.hasDefined(ANY_IPV6_ADDRESS) && subModel.get(ANY_IPV6_ADDRESS).asBoolean(false)) {
  if (Boolean.parseBoolean(WildFlySecurityManager.getEnvPropertyPrivileged("java.net.preferIPv4Stack", "false"))) {
    parsed = new ParsedInterfaceCriteria(MESSAGES.invalidAnyIPv6());
  } else {

相关文章

微信公众号

最新文章

更多