Refine search
private static void validateORBInitializerConfig(final OperationContext context, final ModelNode resourceModel) throws OperationFailedException { // validate the elytron initializer configuration: it requires an authentication-context name. final ModelNode securityInitializerNode = IIOPRootDefinition.SECURITY.resolveModelAttribute(context, resourceModel); final ModelNode authContextNode = IIOPRootDefinition.AUTHENTICATION_CONTEXT.resolveModelAttribute(context, resourceModel); if (!securityInitializerNode.isDefined() || !securityInitializerNode.asString().equalsIgnoreCase(Constants.ELYTRON)) { if (authContextNode.isDefined()) { // authentication-context has been specified but is ineffective because the security initializer is not set to 'elytron'. throw IIOPLogger.ROOT_LOGGER.ineffectiveAuthenticationContextConfiguration(); } } } }
@Override protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException { super.performRuntime(context, operation, model); String name = context.getCurrentAddressValue(); int ordinal = ORDINAL.resolveModelAttribute(context, model).asInt(); ModelNode props = PROPERTIES.resolveModelAttribute(context, model); ModelNode classModel = CLASS.resolveModelAttribute(context, model); ModelNode dirModel = DIR.resolveModelAttribute(context, model); final ConfigSource configSource; if (classModel.isDefined()) { Class configSourceClass = unwrapClass(classModel); try { configSource = ConfigSource.class.cast(configSourceClass.newInstance()); MicroProfileConfigLogger.ROOT_LOGGER.loadConfigSourceFromClass(configSourceClass); ConfigSourceService.install(context, name, configSource); } catch (Exception e) { throw new OperationFailedException(e); } } else if (dirModel.isDefined()) { String path = PATH.resolveModelAttribute(context, dirModel).asString(); String relativeTo = RELATIVE_TO.resolveModelAttribute(context, dirModel).asStringOrNull(); DirConfigSourceService.install(context, name, path, relativeTo, ordinal); } else { Map<String, String> properties = PropertiesAttributeDefinition.unwrapModel(context, props); configSource = new PropertiesConfigSource(properties, name, ordinal); ConfigSourceService.install(context, name, configSource); } } }, new AbstractRemoveStepHandler() {
private void updateDefaultSecurityDomainDeploymentProcessor(final OperationContext context, final ModelNode model) throws OperationFailedException { if (this.ejbDefaultSecurityDomainProcessor == null) { return; } final ModelNode defaultSecurityDomainModelNode = this.attributeDefinition.resolveModelAttribute(context, model); final String defaultSecurityDomainName = defaultSecurityDomainModelNode.isDefined() ? defaultSecurityDomainModelNode.asString() : null; this.ejbDefaultSecurityDomainProcessor.setDefaultSecurityDomainName(defaultSecurityDomainName); }
private static void validateTrustInTarget(final OperationContext context, final ModelNode resourceModel, final boolean sslConfigured, final List<String> warnings) throws OperationFailedException { final ModelNode establishTrustInTargetNode = IIOPRootDefinition.TRUST_IN_TARGET.resolveModelAttribute(context, resourceModel); if(establishTrustInTargetNode.isDefined()){ final String establishTrustInTarget = establishTrustInTargetNode.asString(); if(sslConfigured && establishTrustInTarget.equals(Constants.IOR_NONE)){ final String warning = IIOPLogger.ROOT_LOGGER.inconsistentSupportedTransportConfig(Constants.IOR_TRANSPORT_TRUST_IN_TARGET, Constants.IOR_SUPPORTED); IIOPLogger.ROOT_LOGGER.warn(warning); warnings.add(warning); } } }
private static void validateSupportedAttribute(final OperationContext context, final ModelNode resourceModel, final AttributeDefinition attributeDefinition, final List<String> warnings) throws OperationFailedException{ final ModelNode attributeNode = attributeDefinition.resolveModelAttribute(context, resourceModel); if(attributeNode.isDefined() && !attributeNode.asString().equals(Constants.IOR_SUPPORTED)) { final String warning = IIOPLogger.ROOT_LOGGER.inconsistentSupportedTransportConfig(attributeDefinition.getName(), Constants.IOR_SUPPORTED); IIOPLogger.ROOT_LOGGER.warn(warning); warnings.add(warning); } }
@Override public HttpHandler createHandler(final OperationContext context, ModelNode model) throws OperationFailedException { final String path = PATH.resolveModelAttribute(context, model).asString(); final boolean directoryListing = DIRECTORY_LISTING.resolveModelAttribute(context, model).asBoolean(); final boolean followSymlink = FOLLOW_SYMLINK.resolveModelAttribute(context, model).asBoolean(); final boolean caseSensitive = CASE_SENSITIVE.resolveModelAttribute(context, model).asBoolean(); final int cacheBufferSize = CACHE_BUFFER_SIZE.resolveModelAttribute(context, model).asInt(); final int cacheBuffers = CACHE_BUFFERS.resolveModelAttribute(context, model).asInt(); final List<String> safePaths = SAFE_SYMLINK_PATHS.unwrap(context, model); final String[] paths = safePaths.toArray(new String[safePaths.size()]); UndertowLogger.ROOT_LOGGER.creatingFileHandler(path, directoryListing, followSymlink, caseSensitive, safePaths); Path base; try { base = Paths.get(path).normalize().toRealPath(); //workaround for JBEAP-10231 } catch (IOException e) { throw new OperationFailedException(UndertowLogger.ROOT_LOGGER.unableAddHandlerForPath(path)); } PathResourceManager resourceManager = new PathResourceManager(base, cacheBufferSize * cacheBuffers, caseSensitive, followSymlink, paths); ResourceHandler handler = new ResourceHandler(resourceManager); handler.setDirectoryListingEnabled(directoryListing); return handler; } }
@Override public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { final PathAddress address = PathAddress.pathAddress(operation.get(ModelDescriptionConstants.OP_ADDR)); final Resource web = context.readResourceFromRoot(address.subAddress(0, address.size() - 1), false); final ModelNode subModel = web.getModel(); final String host = DeploymentDefinition.VIRTUAL_HOST.resolveModelAttribute(context, subModel).asString(); final String path = DeploymentDefinition.CONTEXT_ROOT.resolveModelAttribute(context, subModel).asString(); final String server = DeploymentDefinition.SERVER.resolveModelAttribute(context, subModel).asString(); context.addStep(new OperationStepHandler() { @Override public void execute(final OperationContext context, final ModelNode operation) { final ServiceController<?> deploymentServiceController = context.getServiceRegistry(false).getService(UndertowService.deploymentServiceName(server, host, path)); if (deploymentServiceController == null) { return; } final UndertowDeploymentService deploymentService = (UndertowDeploymentService) deploymentServiceController.getService(); final DeploymentInfo deploymentInfo = deploymentService.getDeploymentInfoInjectedValue().getValue(); final ServletInfo servlet = deploymentInfo.getServlets().get(context.getCurrentAddressValue()); ModelNode response = new ModelNode(); response.setEmptyList(); for (String mapping : servlet.getMappings()) { response.add(mapping); } } }, OperationContext.Stage.RUNTIME); } });
@Override public void execute(final OperationContext context, final ModelNode operation) throws OperationFailedException { final PathAddress address = PathAddress.pathAddress(operation.get(ModelDescriptionConstants.OP_ADDR)); final Resource web = context.readResourceFromRoot(address.subAddress(0, address.size() - 1), false); final ModelNode subModel = web.getModel(); final String host = DeploymentDefinition.VIRTUAL_HOST.resolveModelAttribute(context, subModel).asString(); final String path = DeploymentDefinition.CONTEXT_ROOT.resolveModelAttribute(context, subModel).asString(); final String server = DeploymentDefinition.SERVER.resolveModelAttribute(context, subModel).asString(); context.addStep(new OperationStepHandler() { @Override public void execute(final OperationContext context, final ModelNode operation) { final ServiceController<?> deploymentServiceController = context.getServiceRegistry(false).getService(UndertowService.deploymentServiceName(server, host, path)); if (deploymentServiceController == null) { return; } final UndertowDeploymentService deploymentService = (UndertowDeploymentService) deploymentServiceController.getService(); final DeploymentInfo deploymentInfo = deploymentService.getDeploymentInfoInjectedValue().getValue(); final UndertowMetricsCollector collector = (UndertowMetricsCollector)deploymentInfo.getMetricsCollector(); MetricsHandler.MetricResult result = collector != null ? collector.getMetrics(context.getCurrentAddressValue()) : null; if (result != null) { final ModelNode response = new ModelNode(); handle(response, result); context.getResult().set(response); } } }, OperationContext.Stage.RUNTIME); } }
@Override public HttpHandler createHandler(final OperationContext context, ModelNode model) throws OperationFailedException { String sessionCookieNames = SESSION_COOKIE_NAMES.resolveModelAttribute(context, model).asString(); int connectionsPerThread = CONNECTIONS_PER_THREAD.resolveModelAttribute(context, model).asInt(); int problemServerRetry = PROBLEM_SERVER_RETRY.resolveModelAttribute(context, model).asInt(); int maxTime = MAX_REQUEST_TIME.resolveModelAttribute(context, model).asInt(); int requestQueueSize = REQUEST_QUEUE_SIZE.resolveModelAttribute(context, model).asInt(); int cachedConnectionsPerThread = CACHED_CONNECTIONS_PER_THREAD.resolveModelAttribute(context, model).asInt(); int connectionIdleTimeout = CONNECTION_IDLE_TIMEOUT.resolveModelAttribute(context, model).asInt(); int maxRetries = MAX_RETRIES.resolveModelAttribute(context, model).asInt();
continue; ModelNode resolvedModelAttribute = attrDefinition.resolveModelAttribute(context, model); if (resolvedModelAttribute.isDefined()) { String name = attrDefinition.getName(); String value = resolvedModelAttribute.asString(); String openjdkProperty = PropertiesMap.PROPS_MAP.get(name); if (openjdkProperty != null) { String name = property.getName(); ModelNode value = property.getValue(); props.setProperty(name, value.asString());
private void getResourceProperties(final Properties properties, PersistentResourceDefinition resource, OperationContext context, ModelNode model) throws OperationFailedException { for (AttributeDefinition attrDefinition : resource.getAttributes()) { if(attrDefinition instanceof PropertiesAttributeDefinition){ PropertiesAttributeDefinition pad=(PropertiesAttributeDefinition)attrDefinition; ModelNode resolvedModelAttribute = attrDefinition.resolveModelAttribute(context, model); if(resolvedModelAttribute.isDefined()) { for (final Property prop : resolvedModelAttribute.asPropertyList()) { properties.setProperty(prop.getName(), prop.getValue().asString()); } } continue; } ModelNode resolvedModelAttribute = attrDefinition.resolveModelAttribute(context, model); //FIXME if (resolvedModelAttribute.isDefined()) { String name = attrDefinition.getName(); String value = resolvedModelAttribute.asString(); String openjdkProperty = PropertiesMap.PROPS_MAP.get(name); if (openjdkProperty != null) { name = openjdkProperty; } properties.setProperty(name, value); } } }
void updatePoolService(final OperationContext context, final ModelNode model) throws OperationFailedException { final ModelNode poolName = poolAttribute.resolveModelAttribute(context, model); final ServiceRegistry serviceRegistry = context.getServiceRegistry(true); ServiceController<?> existingDefaultPoolConfigService = serviceRegistry.getService(poolConfigServiceName); // if a default MDB pool is already installed, then remove it first if (existingDefaultPoolConfigService != null) { context.removeService(existingDefaultPoolConfigService); } if (poolName.isDefined()) { // now install default pool config service which points to an existing pool config service final ValueInjectionService<PoolConfig> newDefaultPoolConfigService = new ValueInjectionService<PoolConfig>(); ServiceController<?> newController = context.getServiceTarget().addService(poolConfigServiceName, newDefaultPoolConfigService) .addDependency(StrictMaxPoolConfigService.EJB_POOL_CONFIG_BASE_SERVICE_NAME.append(poolName.asString()), PoolConfig.class, newDefaultPoolConfigService.getInjector()) .install(); } } }
void updateDefaultDistinctName(final OperationContext context, final ModelNode model) throws OperationFailedException { final ModelNode defaultDistinctName = this.attributeDefinition.resolveModelAttribute(context, model); final ServiceRegistry registry = context.getServiceRegistry(true); final ServiceController<?> existingDefaultLocalEJBReceiverServiceController = registry.getService(DefaultDistinctNameService.SERVICE_NAME); DefaultDistinctNameService service = (DefaultDistinctNameService) existingDefaultLocalEJBReceiverServiceController.getValue(); if (!defaultDistinctName.isDefined()) { service.setDefaultDistinctName(null); } else { service.setDefaultDistinctName(defaultDistinctName.asString()); } }
private static void validateSSLAttribute(final OperationContext context, final ModelNode resourceModel, final boolean sslConfigured, final boolean serverRequiresSsl, final AttributeDefinition attributeDefinition, final List<String> warnings) throws OperationFailedException { final ModelNode attributeNode = attributeDefinition.resolveModelAttribute(context, resourceModel); if(attributeNode.isDefined()){ final String attribute = attributeNode.asString(); if(sslConfigured) { if(attribute.equals(Constants.IOR_NONE)){ final String warning = IIOPLogger.ROOT_LOGGER.inconsistentSupportedTransportConfig(attributeDefinition.getName(), serverRequiresSsl ? Constants.IOR_REQUIRED : Constants.IOR_SUPPORTED); IIOPLogger.ROOT_LOGGER.warn(warning); warnings.add(warning); } if (serverRequiresSsl && attribute.equals(Constants.IOR_SUPPORTED)) { final String warning = IIOPLogger.ROOT_LOGGER.inconsistentRequiredTransportConfig(Constants.SECURITY_SERVER_REQUIRES_SSL, attributeDefinition.getName()); IIOPLogger.ROOT_LOGGER.warn(warning); warnings.add(warning); } } else { if(!attribute.equals(Constants.IOR_NONE)){ final String warning = IIOPLogger.ROOT_LOGGER.inconsistentUnsupportedTransportConfig(attributeDefinition.getName()); IIOPLogger.ROOT_LOGGER.warn(warning); warnings.add(warning); } } } }
static void install(String name, CapabilityServiceTarget serviceTarget, ModelNode model, OperationContext operationContext) throws OperationFailedException { String securityKey = null; ModelNode securityKeyNode = ModClusterDefinition.SECURITY_KEY.resolveModelAttribute(operationContext, model); if(securityKeyNode.isDefined()) { securityKey = securityKeyNode.asString(); ModelNode managementAccessPredicateNode = ModClusterDefinition.MANAGEMENT_ACCESS_PREDICATE.resolveModelAttribute(operationContext, model); if(managementAccessPredicateNode.isDefined()) { managementAccessPredicateString = managementAccessPredicateNode.asString(); ModClusterDefinition.HEALTH_CHECK_INTERVAL.resolveModelAttribute(operationContext, model).asInt(), ModClusterDefinition.MAX_REQUEST_TIME.resolveModelAttribute(operationContext, model).asInt(), ModClusterDefinition.BROKEN_NODE_TIMEOUT.resolveModelAttribute(operationContext, model).asInt(), ModClusterDefinition.ADVERTISE_FREQUENCY.resolveModelAttribute(operationContext, model).asInt(), ModClusterDefinition.ADVERTISE_PATH.resolveModelAttribute(operationContext, model).asString(), ModClusterDefinition.ADVERTISE_PROTOCOL.resolveModelAttribute(operationContext, model).asString(), securityKey, managementAccessPredicate, ModClusterDefinition.CONNECTIONS_PER_THREAD.resolveModelAttribute(operationContext, model).asInt(), ModClusterDefinition.CACHED_CONNECTIONS_PER_THREAD.resolveModelAttribute(operationContext, model).asInt(), ModClusterDefinition.CONNECTION_IDLE_TIMEOUT.resolveModelAttribute(operationContext, model).asInt(), ModClusterDefinition.REQUEST_QUEUE_SIZE.resolveModelAttribute(operationContext, model).asInt(), ModClusterDefinition.USE_ALIAS.resolveModelAttribute(operationContext, model).asBoolean(), ModClusterDefinition.MAX_RETRIES.resolveModelAttribute(operationContext, model).asInt(), Enum.valueOf(FailoverStrategy.class, ModClusterDefinition.FAILOVER_STRATEGY.resolveModelAttribute(operationContext, model).asString()), builder.getMap()); final String mgmtSocketBindingRef = ModClusterDefinition.MANAGEMENT_SOCKET_BINDING.resolveModelAttribute(operationContext, model).asString(); final ModelNode advertiseSocketBindingRef = ModClusterDefinition.ADVERTISE_SOCKET_BINDING.resolveModelAttribute(operationContext, model); final String workerRef = ModClusterDefinition.WORKER.resolveModelAttribute(operationContext, model).asString(); CapabilityServiceBuilder serviceBuilder = serviceTarget.addCapability(ModClusterDefinition.MOD_CLUSTER_FILTER_CAPABILITY, service);
private static SessionManager getSessionManager(OperationContext context, ModelNode operation) throws OperationFailedException { final PathAddress address = PathAddress.pathAddress(operation.get(ModelDescriptionConstants.OP_ADDR)); final Resource web = context.readResourceFromRoot(address.subAddress(0, address.size()), false); final ModelNode subModel = web.getModel(); final String host = VIRTUAL_HOST.resolveModelAttribute(context, subModel).asString(); final String path = CONTEXT_ROOT.resolveModelAttribute(context, subModel).asString(); final String server = SERVER.resolveModelAttribute(context, subModel).asString(); final UndertowDeploymentService deploymentService; final ServiceController<?> controller = context.getServiceRegistry(false).getService(UndertowService.deploymentServiceName(server, host, path)); if (controller != null && controller.getState() != ServiceController.State.UP) {//check if deployment is active at all throw UndertowLogger.ROOT_LOGGER.sessionManagerNotAvailable(); } else { deploymentService = (UndertowDeploymentService) controller.getService(); if (deploymentService == null || deploymentService.getDeployment() == null) { //we might be in shutdown and it is possible throw UndertowLogger.ROOT_LOGGER.sessionManagerNotAvailable(); } } Deployment deployment = deploymentService.getDeployment(); return deployment.getSessionManager(); }
SessionManager sessionManager = getSessionManager(operationContext, modelNode); String name = modelNode.get(OP).asString(); return; String sessionId = SESSIOND_ID.resolveModelAttribute(operationContext, modelNode).asString(); Session session = sessionManager.getSession(sessionId); if (session == null && !name.equals(Constants.INVALIDATE_SESSION)) { String a = ATTRIBUTE.resolveModelAttribute(operationContext, modelNode).asString(); Object attribute = session.getAttribute(a); if (attribute != null) {
sasContextMetaData.setCallerPropagation(IIOPRootDefinition.CALLER_PROPAGATION.resolveModelAttribute(context, resourceModel).asString()); securityConfigMetaData.setSasContext(sasContextMetaData); asContextMetaData.setAuthMethod(IIOPRootDefinition.AUTH_METHOD.resolveModelAttribute(context, resourceModel).asString()); if (resourceModel.hasDefined(IIOPRootDefinition.REALM.getName())) { asContextMetaData.setRealm(IIOPRootDefinition.REALM.resolveModelAttribute(context, resourceModel).asString()); asContextMetaData.setRequired(IIOPRootDefinition.REQUIRED.resolveModelAttribute(context, resourceModel).asBoolean()); securityConfigMetaData.setAsContext(asContextMetaData); final ModelNode integrityNode = IIOPRootDefinition.INTEGRITY.resolveModelAttribute(context, resourceModel); if(integrityNode.isDefined()){ transportConfigMetaData.setIntegrity(integrityNode.asString()); final ModelNode confidentialityNode = IIOPRootDefinition.CONFIDENTIALITY.resolveModelAttribute(context, resourceModel); if(confidentialityNode.isDefined()){ transportConfigMetaData.setConfidentiality(confidentialityNode.asString()); final ModelNode establishTrustInTargetNode = IIOPRootDefinition.TRUST_IN_TARGET.resolveModelAttribute(context, resourceModel); if (establishTrustInTargetNode.isDefined()) { transportConfigMetaData.setEstablishTrustInTarget(confidentialityNode.asString()); final ModelNode establishTrustInClientNode = IIOPRootDefinition.TRUST_IN_CLIENT.resolveModelAttribute(context, resourceModel); if(establishTrustInClientNode.isDefined()){ transportConfigMetaData.setEstablishTrustInClient(establishTrustInClientNode.asString());
void updateCacheService(final OperationContext context, final ModelNode model) throws OperationFailedException { ModelNode cacheName = this.attribute.resolveModelAttribute(context, model); ServiceRegistry registry = context.getServiceRegistry(true); if (registry.getService(this.serviceName) != null) { context.removeService(this.serviceName); } if (cacheName.isDefined()) { new IdentityServiceConfigurator<>(this.serviceName, new CacheFactoryBuilderServiceNameProvider(cacheName.asString()).getServiceName()).build(context.getServiceTarget()).install(); } } }
final ModelNode subModel = web.getModel(); final String host = VIRTUAL_HOST.resolveModelAttribute(context, subModel).asString(); final String path = CONTEXT_ROOT.resolveModelAttribute(context, subModel).asString(); final String server = SERVER.resolveModelAttribute(context, subModel).asString(); SessionStat stat = SessionStat.getStat(operation.require(ModelDescriptionConstants.NAME).asString());