private static String getProperty(final String name) { return WildFlySecurityManager.getPropertyPrivileged(name, null); }
public WebParsingDeploymentProcessor() { String property = WildFlySecurityManager.getPropertyPrivileged(XMLSchemaValidator.PROPERTY_SCHEMA_VALIDATION, "false"); this.schemaValidation = Boolean.parseBoolean(property); }
private static boolean checkForPresence(final String key, final String value) { final String tmp = WildFlySecurityManager.getPropertyPrivileged(key, value); try { return tmp != null && tmp.trim().toLowerCase(Locale.ENGLISH).startsWith(value); } catch (Throwable t) { return false; } }
private static int getMajorJavaVersion() { int major = 8; String version = WildFlySecurityManager.getPropertyPrivileged("java.specification.version", null); if (version != null) { Matcher matcher = Pattern.compile("^(?:1\\.)?(\\d+)$").matcher(version); if (matcher.find()) { major = Integer.valueOf(matcher.group(1)); } } return major; } }
/** * Initialize the naming components required by {@link javax.naming.spi.NamingManager}. */ public static void initializeNamingManager() { // Setup naming environment final String property = WildFlySecurityManager.getPropertyPrivileged(Context.URL_PKG_PREFIXES, null); if(property == null || property.isEmpty()) { WildFlySecurityManager.setPropertyPrivileged(Context.URL_PKG_PREFIXES, PACKAGE_PREFIXES); } else if(!Arrays.asList(property.split(":")).contains(PACKAGE_PREFIXES)) { WildFlySecurityManager.setPropertyPrivileged(Context.URL_PKG_PREFIXES, PACKAGE_PREFIXES + ":" + property); } try { //If we are reusing the JVM. e.g. in tests we should not set this again if (!NamingManager.hasInitialContextFactoryBuilder()) NamingManager.setInitialContextFactoryBuilder(new InitialContextFactoryBuilder()); } catch (NamingException e) { ROOT_LOGGER.failedToSet(e, "InitialContextFactoryBuilder"); } }
private HttpHandler configureRootHandler() { AccessLogService logService = accessLogService; HttpHandler rootHandler = pathHandler; ArrayList<UndertowFilter> filters = new ArrayList<>(this.filters); //handle options * requests rootHandler = new OptionsHandler(rootHandler); //handle requests that use the Expect: 100-continue header rootHandler = Handlers.httpContinueRead(rootHandler); rootHandler = LocationService.configureHandlerChain(rootHandler, filters); if (logService != null) { rootHandler = logService.configureAccessLogHandler(rootHandler); } // handle .well-known requests from ACME certificate authorities String path = WildFlySecurityManager.getPropertyPrivileged("jboss.home.dir", "."); Path base; try { base = Paths.get(path).normalize().toRealPath(); } catch (IOException e) { throw new RuntimeException(e); } final int cacheBufferSize = 1024; final int cacheBuffers = 1024; PathResourceManager resourceManager = new PathResourceManager(base, cacheBufferSize * cacheBuffers, true, false); rootHandler = new AcmeResourceHandler(resourceManager, rootHandler); GateHandlerWrapper gateHandlerWrapper = this.gateHandlerWrapper; if(gateHandlerWrapper != null) { rootHandler = gateHandlerWrapper.wrap(rootHandler); } return rootHandler; }
private PolicyConfigurationFactory getPolicyConfigurationFactory() throws ModuleLoadException, ClassNotFoundException, PolicyContextException { String module = WildFlySecurityManager.getPropertyPrivileged(JACC_MODULE, null); final ClassLoader originalClassLoader; final ClassLoader jaccClassLoader; if (module != null) { jaccClassLoader = SecurityActions.getModuleClassLoader(module); originalClassLoader = SecurityActions.setThreadContextClassLoader(jaccClassLoader); } else { jaccClassLoader = null; originalClassLoader = null; } try { return PolicyConfigurationFactory.getPolicyConfigurationFactory(); } finally { if (originalClassLoader != null) { SecurityActions.setThreadContextClassLoader(originalClassLoader); } } }
@Override protected void performRuntime(final OperationContext context, final ModelNode operation, final ModelNode model) throws OperationFailedException { final String jndiName = DatabaseDataStoreResourceDefinition.DATASOURCE_JNDI_NAME.resolveModelAttribute(context, model).asString(); final ModelNode dataBaseValue = DatabaseDataStoreResourceDefinition.DATABASE.resolveModelAttribute(context, model); final String database; if(dataBaseValue.isDefined()) { database = dataBaseValue.asString(); } else { database = null; } final String partition = DatabaseDataStoreResourceDefinition.PARTITION.resolveModelAttribute(context, model).asString(); final String name = PathAddress.pathAddress(operation.get(OP_ADDR)).getLastElement().getValue(); int refreshInterval = DatabaseDataStoreResourceDefinition.REFRESH_INTERVAL.resolveModelAttribute(context, model).asInt(); boolean allowExecution = DatabaseDataStoreResourceDefinition.ALLOW_EXECUTION.resolveModelAttribute(context, model).asBoolean(); final String nodeName = WildFlySecurityManager.getPropertyPrivileged(ServerEnvironment.NODE_NAME, null); final DatabaseTimerPersistence databaseTimerPersistence = new DatabaseTimerPersistence(database, partition, nodeName, refreshInterval, allowExecution); final ServiceName serviceName = TimerPersistence.SERVICE_NAME.append(name); context.getServiceTarget().addService(serviceName, databaseTimerPersistence) .addDependency(Services.JBOSS_SERVICE_MODULE_LOADER, ModuleLoader.class, databaseTimerPersistence.getModuleLoader()) .addDependency(ContextNames.bindInfoFor(jndiName).getBinderServiceName(), ManagedReferenceFactory.class, databaseTimerPersistence.getDataSourceInjectedValue()) .addDependency(TimerServiceDeploymentProcessor.TIMER_SERVICE_NAME, java.util.Timer.class, databaseTimerPersistence.getTimerInjectedValue()) .install(); }
String module = WildFlySecurityManager.getPropertyPrivileged(JACC_MODULE, null); String provider = WildFlySecurityManager.getPropertyPrivileged(JACC_POLICY_PROVIDER, "org.jboss.security.jacc.DelegatingPolicy"); Class<?> providerClass = loadClass(module, provider); try {
@Override protected boolean requiresRuntime(OperationContext context) { //TODO Gigantic HACK to disable the runtime part of this for the core model testing. //The core model testing currently uses RunningMode.ADMIN_ONLY, but in the real world //the http interface needs to be enabled even when that happens. //I don't want to wire up all the services unless I can avoid it, so for now the tests set this system property return WildFlySecurityManager.getPropertyPrivileged("jboss.as.test.disable.runtime", null) == null; }
private CliConfigImpl() { defaultControllerProtocol = "remote+http"; historyEnabled = true; historyFileName = ".jboss-cli-history"; historyFileDir = WildFlySecurityManager.getPropertyPrivileged("user.home", null); historyMaxSize = 500; connectionTimeout = 5000; }
@Override protected boolean requiresRuntime(OperationContext context) { //TODO Gigantic HACK to disable the runtime part of this for the core model testing. //The core model testing currently uses RunningMode.ADMIN_ONLY, but in the real world //the http interface needs to be enabled even when that happens. //I don't want to wire up all the services unless I can avoid it, so for now the tests set this system property if (WildFlySecurityManager.getPropertyPrivileged("jboss.as.test.disable.runtime", null) != null) { return false; } return true; }
private int getInteger(final String name, final int defaultValue) { final String val = WildFlySecurityManager.getPropertyPrivileged(name, null); try { return val == null ? defaultValue : Integer.parseInt(val); } catch (NumberFormatException ignored) { return defaultValue; } }
private String getBindAddress() { if (bindAddress != null) { return bindAddress; } else { boolean v4Stack = Boolean.valueOf(WildFlySecurityManager.getPropertyPrivileged(CommandLineConstants.PREFER_IPV4_STACK, "false")); boolean useV6 = !v4Stack && Boolean.valueOf(WildFlySecurityManager.getPropertyPrivileged(CommandLineConstants.PREFER_IPV6_ADDRESSES, "false")); return useV6 ? "::1" : "127.0.0.1"; } }
private int getInteger(final String name, final int defaultValue) { final String val = WildFlySecurityManager.getPropertyPrivileged(name, null); try { return val == null ? defaultValue : Integer.parseInt(val); } catch (NumberFormatException ignored) { return defaultValue; } }
EnvironmentRestorer(final String... propertyKeys) { this.propertiesToReset = new HashMap<>(); for (String key : propertyKeys) { final String value = WildFlySecurityManager.getPropertyPrivileged(key, null); propertiesToReset.put(key, value); } propertiesToReset.put("jboss.home.dir", WildFlySecurityManager.getPropertyPrivileged("jboss.home.dir", null)); propertiesToReset.put("org.jboss.boot.log.file", WildFlySecurityManager.getPropertyPrivileged("org.jboss.boot.log.file", null)); }
private static String usageNote() { boolean isWindows = (WildFlySecurityManager.getPropertyPrivileged("os.name", null)).toLowerCase(Locale.ENGLISH).contains("windows"); String command = isWindows ? "domain" : "domain.sh"; return HostControllerLogger.ROOT_LOGGER.usageNote(command); }
private void setSystemProperty(final String name, final Object value) { if (value != null) { final String currentValue = WildFlySecurityManager.getPropertyPrivileged(name, null); WildFlySecurityManager.setPropertyPrivileged(name, value.toString()); propertiesToReset.put(name, currentValue); } }
@Override protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model, ServiceVerificationHandler verificationHandler, List<ServiceController<?>> newControllers) throws OperationFailedException { final ServiceTarget serviceTarget = context.getServiceTarget(); final ServiceName endpointName = ManagementRemotingServices.MANAGEMENT_ENDPOINT; final String hostName = WildFlySecurityManager.getPropertyPrivileged(ServerEnvironment.NODE_NAME, null); NativeManagementServices.installRemotingServicesIfNotInstalled(serviceTarget, hostName, verificationHandler, newControllers, context.getServiceRegistry(false)); installNativeManagementConnector(context, model, endpointName, serviceTarget, verificationHandler, newControllers); }
private ConfigurationFile getStandardDomainConfigurationFile() { final String defaultDomainConfig = WildFlySecurityManager.getPropertyPrivileged(HostControllerEnvironment.JBOSS_DOMAIN_DEFAULT_CONFIG, "domain.xml"); final String initialDomainConfig = environment.getInitialDomainConfig(); return new ConfigurationFile(environment.getDomainConfigurationDir(), defaultDomainConfig, initialDomainConfig == null ? environment.getDomainConfig() : initialDomainConfig, environment.getDomainConfigurationFileInteractionPolicy(), false); }