use of org.jboss.as.server.DeploymentProcessorTarget in project wildfly by wildfly.
the class AppClientSubsystemAdd method performBoottime.
protected void performBoottime(final OperationContext context, ModelNode operation, final ModelNode model) throws OperationFailedException {
final String deployment = AppClientSubsystemResourceDefinition.DEPLOYMENT.resolveModelAttribute(context, model).asString();
final File file = new File(AppClientSubsystemResourceDefinition.FILE.resolveModelAttribute(context, model).asString());
if (!file.exists()) {
context.setRollbackOnly();
throw AppClientLogger.ROOT_LOGGER.cannotFindAppClientFile(file.getAbsoluteFile());
}
final String hostUrl = model.hasDefined(HOST_URL) ? AppClientSubsystemResourceDefinition.HOST_URL.resolveModelAttribute(context, model).asString() : null;
final String connectionPropertiesUrl = model.hasDefined(CONNECTION_PROPERTIES_URL) ? AppClientSubsystemResourceDefinition.CONNECTION_PROPERTIES_URL.resolveModelAttribute(context, model).asString() : null;
final List<String> parameters = AppClientSubsystemResourceDefinition.PARAMETERS.unwrap(context, model);
context.addStep(new AbstractDeploymentChainStep() {
protected void execute(DeploymentProcessorTarget processorTarget) {
if (deployment != null && !deployment.isEmpty()) {
processorTarget.addDeploymentProcessor(Constants.SUBSYSTEM_NAME, Phase.STRUCTURE, Phase.STRUCTURE_APP_CLIENT, new ApplicationClientStructureProcessor(deployment));
}
processorTarget.addDeploymentProcessor(Constants.SUBSYSTEM_NAME, Phase.STRUCTURE, Phase.STRUCTURE_REGISTER_JBOSS_ALL_APPCLIENT, new JBossAllXmlParserRegisteringProcessor<>(AppClientJBossAllParser.ROOT_ELEMENT, AppClientJBossAllParser.ATTACHMENT_KEY, new AppClientJBossAllParser()));
processorTarget.addDeploymentProcessor(Constants.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_APP_CLIENT_XML, new ApplicationClientParsingDeploymentProcessor());
processorTarget.addDeploymentProcessor(Constants.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_APPLICATION_CLIENT_MANIFEST, new ApplicationClientManifestProcessor());
processorTarget.addDeploymentProcessor(Constants.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_APPLICATION_CLIENT_ACTIVE, new ActiveApplicationClientProcessor(deployment));
processorTarget.addDeploymentProcessor(Constants.SUBSYSTEM_NAME, Phase.DEPENDENCIES, Phase.DEPENDENCIES_APPLICATION_CLIENT, new ApplicationClientDependencyProcessor());
processorTarget.addDeploymentProcessor(Constants.SUBSYSTEM_NAME, Phase.INSTALL, Phase.INSTALL_APPLICATION_CLIENT, new ApplicationClientStartProcessor(parameters.toArray(EMPTY_STRING)));
}
}, OperationContext.Stage.RUNTIME);
final ApplicationClientDeploymentService service = new ApplicationClientDeploymentService(file);
context.getServiceTarget().addService(ApplicationClientDeploymentService.SERVICE_NAME, service).addDependency(Services.JBOSS_SERVER_CONTROLLER, ModelController.class, service.getControllerValue()).install();
try {
if (connectionPropertiesUrl != null) {
context.getServiceTarget().addService(APP_CLIENT_URI_SERVICE_NAME, new ConstantService<>(null)).install();
context.getServiceTarget().addService(APP_CLIENT_EJB_PROPERTIES_SERVICE_NAME, new ConstantService<>(connectionPropertiesUrl)).install();
} else {
URI uri;
if (hostUrl == null) {
uri = new URI("remote+http://localhost:8080");
} else {
uri = new URI(hostUrl);
}
context.getServiceTarget().addService(APP_CLIENT_URI_SERVICE_NAME, new ConstantService<>(uri)).install();
context.getServiceTarget().addService(APP_CLIENT_EJB_PROPERTIES_SERVICE_NAME, new ConstantService<>(connectionPropertiesUrl)).install();
}
} catch (URISyntaxException e) {
throw new OperationFailedException(e);
}
}
use of org.jboss.as.server.DeploymentProcessorTarget in project wildfly by wildfly.
the class DataSourcesSubsystemAdd method performBoottime.
@Override
protected void performBoottime(final OperationContext context, final ModelNode operation, final ModelNode model) throws OperationFailedException {
final DsDeploymentActivator dsDeploymentActivator = new DsDeploymentActivator();
context.addStep(new AbstractDeploymentChainStep() {
protected void execute(DeploymentProcessorTarget processorTarget) {
dsDeploymentActivator.activateProcessors(processorTarget);
processorTarget.addDeploymentProcessor(DataSourcesExtension.SUBSYSTEM_NAME, Phase.STRUCTURE, Phase.STRUCTURE_DATASOURCE_RESOURCE_INJECTION, new DefaultDataSourceResourceReferenceProcessor());
processorTarget.addDeploymentProcessor(DataSourcesExtension.SUBSYSTEM_NAME, Phase.INSTALL, Phase.INSTALL_DEFAULT_BINDINGS_DATASOURCE, new DefaultDataSourceBindingProcessor());
}
}, OperationContext.Stage.RUNTIME);
}
use of org.jboss.as.server.DeploymentProcessorTarget in project wildfly by wildfly.
the class NamingSubsystemAdd method performBoottime.
@SuppressWarnings("deprecation")
@Override
protected void performBoottime(OperationContext context, ModelNode operation, ModelNode model) {
ROOT_LOGGER.activatingSubsystem();
NamingContext.initializeNamingManager();
final ServiceTarget target = context.getServiceTarget();
// Create the java: namespace
target.addService(ContextNames.JAVA_CONTEXT_SERVICE_NAME, new NamingStoreService()).setInitialMode(ServiceController.Mode.ACTIVE).install();
// Create the Naming Service
final NamingService namingService = new NamingService();
target.addService(Capability.NAMING_STORE.getDefinition().getCapabilityServiceName(), namingService).addAliases(NamingService.SERVICE_NAME).addDependency(ContextNames.JAVA_CONTEXT_SERVICE_NAME, NamingStore.class, namingService.getNamingStore()).setInitialMode(ServiceController.Mode.ACTIVE).install();
// Create the java:global namespace
target.addService(ContextNames.GLOBAL_CONTEXT_SERVICE_NAME, new NamingStoreService()).setInitialMode(ServiceController.Mode.ACTIVE).install();
// Create the java:jboss vendor namespace
target.addService(ContextNames.JBOSS_CONTEXT_SERVICE_NAME, new NamingStoreService()).setInitialMode(ServiceController.Mode.ACTIVE).install();
// Setup remote naming store
// we always install the naming store, but we don't install the server unless it has been explicitly enabled
target.addService(ContextNames.EXPORTED_CONTEXT_SERVICE_NAME, new NamingStoreService()).setInitialMode(ServiceController.Mode.ACTIVE).install();
// add the default namespace context selector service
DefaultNamespaceContextSelectorService defaultNamespaceContextSelectorService = new DefaultNamespaceContextSelectorService();
target.addService(DefaultNamespaceContextSelectorService.SERVICE_NAME, defaultNamespaceContextSelectorService).addDependency(ContextNames.GLOBAL_CONTEXT_SERVICE_NAME, NamingStore.class, defaultNamespaceContextSelectorService.getGlobalNamingStore()).addDependency(ContextNames.JBOSS_CONTEXT_SERVICE_NAME, NamingStore.class, defaultNamespaceContextSelectorService.getJbossNamingStore()).addDependency(ContextNames.EXPORTED_CONTEXT_SERVICE_NAME, NamingStore.class, defaultNamespaceContextSelectorService.getRemoteExposedNamingStore()).setInitialMode(ServiceController.Mode.ACTIVE).install();
target.addService(JndiViewExtensionRegistry.SERVICE_NAME, new JndiViewExtensionRegistry()).install();
// create the subsystem's external context instance, and install related Service and DUP
final ExternalContexts externalContexts = new ExternalContextsNavigableSet();
target.addService(ExternalContextsService.SERVICE_NAME, new ExternalContextsService(externalContexts)).install();
context.addStep(new AbstractDeploymentChainStep() {
@Override
protected void execute(DeploymentProcessorTarget processorTarget) {
processorTarget.addDeploymentProcessor(NamingExtension.SUBSYSTEM_NAME, Phase.STRUCTURE, Phase.STRUCTURE_NAMING_EXTERNAL_CONTEXTS, new ExternalContextsProcessor(externalContexts));
processorTarget.addDeploymentProcessor(NamingExtension.SUBSYSTEM_NAME, Phase.INSTALL, Phase.INSTALL_JNDI_DEPENDENCIES, new JndiNamingDependencyProcessor());
}
}, OperationContext.Stage.RUNTIME);
if (context.hasOptionalCapability(UNDERTOW_HTTP_INVOKER_CAPABILITY_NAME, NamingService.CAPABILITY_NAME, null)) {
HttpRemoteNamingServerService httpRemoteNamingServerService = new HttpRemoteNamingServerService();
context.getServiceTarget().addService(HttpRemoteNamingServerService.SERVICE_NAME, httpRemoteNamingServerService).addDependency(context.getCapabilityServiceName(UNDERTOW_HTTP_INVOKER_CAPABILITY_NAME, PathHandler.class), PathHandler.class, httpRemoteNamingServerService.getPathHandlerInjectedValue()).addDependency(ContextNames.EXPORTED_CONTEXT_SERVICE_NAME, NamingStore.class, httpRemoteNamingServerService.getNamingStore()).install();
}
}
use of org.jboss.as.server.DeploymentProcessorTarget in project wildfly by wildfly.
the class OpenTelemetrySubsystemAdd method performBoottime.
/**
* {@inheritDoc}
*/
@Override
protected void performBoottime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException {
super.performBoottime(context, operation, model);
final OpenTelemetryConfig config = OpenTelemetryConfigBuilder.config().withServiceName(OpenTelemetrySubsystemDefinition.SERVICE_NAME.resolveModelAttribute(context, model).asStringOrNull()).withExporter(OpenTelemetrySubsystemDefinition.EXPORTER.resolveModelAttribute(context, model).asString()).withEndpoint(OpenTelemetrySubsystemDefinition.ENDPOINT.resolveModelAttribute(context, model).asStringOrNull()).withSpanProcessor(OpenTelemetrySubsystemDefinition.SPAN_PROCESSOR_TYPE.resolveModelAttribute(context, model).asString()).withBatchDelay(OpenTelemetrySubsystemDefinition.BATCH_DELAY.resolveModelAttribute(context, model).asLong()).withMaxQueueSize(OpenTelemetrySubsystemDefinition.MAX_QUEUE_SIZE.resolveModelAttribute(context, model).asInt()).withMaxExportBatchSize(OpenTelemetrySubsystemDefinition.MAX_EXPORT_BATCH_SIZE.resolveModelAttribute(context, model).asInt()).withExportTimeout(OpenTelemetrySubsystemDefinition.EXPORT_TIMEOUT.resolveModelAttribute(context, model).asLong()).withSampler(OpenTelemetrySubsystemDefinition.SAMPLER.resolveModelAttribute(context, model).asStringOrNull()).withRatio(OpenTelemetrySubsystemDefinition.RATIO.resolveModelAttribute(context, model).asDoubleOrNull()).build();
final OpenTelemetryHolder holder = new OpenTelemetryHolder(config);
context.addStep(new AbstractDeploymentChainStep() {
@Override
public void execute(DeploymentProcessorTarget processorTarget) {
processorTarget.addDeploymentProcessor(OpenTelemetrySubsystemExtension.SUBSYSTEM_NAME, Phase.DEPENDENCIES, 0x1910, new OpenTelemetryDependencyProcessor());
processorTarget.addDeploymentProcessor(OpenTelemetrySubsystemExtension.SUBSYSTEM_NAME, Phase.POST_MODULE, 0x3810, new OpenTelemetrySubsystemDeploymentProcessor(holder));
}
}, OperationContext.Stage.RUNTIME);
}
Aggregations