use of org.jboss.as.server.DeploymentProcessorTarget in project wildfly by wildfly.
the class JSR77ManagementSubsystemAdd method performBoottime.
@Override
protected void performBoottime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException {
context.addStep(new AbstractDeploymentChainStep() {
protected void execute(DeploymentProcessorTarget processorTarget) {
processorTarget.addDeploymentProcessor(JSR77ManagementExtension.SUBSYSTEM_NAME, Phase.DEPENDENCIES, Phase.DEPENDENCIES_JSR77, new Jsr77DependenciesProcessor());
}
}, OperationContext.Stage.RUNTIME);
final boolean appclient = context.getProcessType() == ProcessType.APPLICATION_CLIENT;
if (!appclient) {
context.addStep(new OperationStepHandler() {
@Override
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
ServiceTarget target = context.getServiceTarget();
ServiceName mbeanServerServiceName = context.getCapabilityServiceName(JSR77ManagementRootResource.JMX_CAPABILITY, MBeanServer.class);
RegisterMBeanServerDelegateService mbeanServerService = new RegisterMBeanServerDelegateService();
target.addService(RegisterMBeanServerDelegateService.SERVICE_NAME, mbeanServerService).addDependency(mbeanServerServiceName, PluggableMBeanServer.class, mbeanServerService.injectedMbeanServer).addDependency(Services.JBOSS_SERVER_CONTROLLER, ModelController.class, mbeanServerService.injectedController).setInitialMode(Mode.ACTIVE).install();
RegisterManagementEJBService managementEjbService = new RegisterManagementEJBService();
target.addService(RegisterManagementEJBService.SERVICE_NAME, managementEjbService).addDependency(DeploymentRepositoryService.SERVICE_NAME, DeploymentRepository.class, managementEjbService.deploymentRepositoryValue).addDependency(mbeanServerServiceName, MBeanServer.class, managementEjbService.mbeanServerValue).addDependency(EJBClientContextService.DEFAULT_SERVICE_NAME, EJBClientContextService.class, managementEjbService.ejbClientContextValue).addDependency(AssociationService.SERVICE_NAME, AssociationService.class, managementEjbService.associationServiceInjector).setInitialMode(Mode.PASSIVE).install();
// TODO null for source ok?
final ContextNames.BindInfo bindInfo = ContextNames.bindInfoFor(JNDI_NAME);
final BinderService binderService = new BinderService(bindInfo.getBindName(), null);
final InjectedValue<ClassLoader> viewClassLoader = new InjectedValue<ClassLoader>();
binderService.getManagedObjectInjector().inject(new RemoteViewManagedReferenceFactory(APP_NAME, MODULE_NAME, DISTINCT_NAME, EJB_NAME, ManagementHome.class.getName(), false, viewClassLoader, appclient));
viewClassLoader.setValue(Values.immediateValue(ManagementHome.class.getClassLoader()));
target.addService(bindInfo.getBinderServiceName(), binderService).addDependency(bindInfo.getParentContextServiceName(), ServiceBasedNamingStore.class, binderService.getNamingStoreInjector()).install();
// Rollback is handled by the parent step
context.completeStep(OperationContext.RollbackHandler.NOOP_ROLLBACK_HANDLER);
}
}, Stage.RUNTIME);
}
}
use of org.jboss.as.server.DeploymentProcessorTarget in project wildfly by wildfly.
the class MetricsSubsystemAdd method performBoottime.
@Override
protected void performBoottime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException {
super.performBoottime(context, operation, model);
List<String> exposedSubsystems = MetricsSubsystemDefinition.EXPOSED_SUBSYSTEMS.unwrap(context, model);
boolean exposeAnySubsystem = exposedSubsystems.remove("*");
String prefix = MetricsSubsystemDefinition.PREFIX.resolveModelAttribute(context, model).asStringOrNull();
boolean securityEnabled = MetricsSubsystemDefinition.SECURITY_ENABLED.resolveModelAttribute(context, model).asBoolean();
WildFlyMetricRegistryService.install(context);
MetricsCollectorService.install(context);
MetricsContextService.install(context, securityEnabled);
// handles that instead.
if (!context.getCapabilityServiceSupport().hasCapability(MetricsSubsystemDefinition.METRICS_SCAN_CAPABILITY)) {
context.addStep(new AbstractDeploymentChainStep() {
public void execute(DeploymentProcessorTarget processorTarget) {
processorTarget.addDeploymentProcessor(SUBSYSTEM_NAME, INSTALL, POST_MODULE_METRICS, new DeploymentMetricProcessor(exposeAnySubsystem, exposedSubsystems, prefix));
}
}, RUNTIME);
// delay the registration of the metrics in the VERIFY stage so that all resources
// created during the RUNTIME phase will have been registered in the MRR.
context.addStep(new OperationStepHandler() {
@Override
public void execute(OperationContext operationContext, ModelNode modelNode) {
ServiceController<?> serviceController = context.getServiceRegistry(false).getService(WILDFLY_COLLECTOR);
MetricCollector metricCollector = MetricCollector.class.cast(serviceController.getValue());
ServiceController<?> wildflyRegistryController = context.getServiceRegistry(false).getService(METRICS_REGISTRY_RUNTIME_CAPABILITY.getCapabilityServiceName());
WildFlyMetricRegistry metricRegistry = WildFlyMetricRegistry.class.cast(wildflyRegistryController.getValue());
ImmutableManagementResourceRegistration rootResourceRegistration = context.getRootResourceRegistration();
Resource rootResource = context.readResourceFromRoot(EMPTY_ADDRESS);
MetricRegistration registration = new MetricRegistration(metricRegistry);
metricCollector.collectResourceMetrics(rootResource, rootResourceRegistration, Function.identity(), exposeAnySubsystem, exposedSubsystems, prefix, registration);
}
}, VERIFY);
}
LOGGER.activatingSubsystem();
}
use of org.jboss.as.server.DeploymentProcessorTarget in project wildfly by wildfly.
the class MicroProfileConfigSubsystemAdd method performBoottime.
/**
* {@inheritDoc}
*/
@Override
public void performBoottime(OperationContext context, ModelNode operation, ModelNode model) {
MicroProfileConfigLogger.ROOT_LOGGER.activatingSubsystem();
context.addStep(new AbstractDeploymentChainStep() {
@Override
public void execute(DeploymentProcessorTarget processorTarget) {
processorTarget.addDeploymentProcessor(MicroProfileConfigExtension.SUBSYSTEM_NAME, Phase.DEPENDENCIES, Phase.DEPENDENCIES_MICROPROFILE_CONFIG, new DependencyProcessor());
processorTarget.addDeploymentProcessor(MicroProfileConfigExtension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_MICROPROFILE_CONFIG, new SubsystemDeploymentProcessor());
}
}, OperationContext.Stage.RUNTIME);
}
use of org.jboss.as.server.DeploymentProcessorTarget in project wildfly by wildfly.
the class JcaSubsystemAdd method performBoottime.
protected void performBoottime(OperationContext context, ModelNode operation, ModelNode model) {
final boolean appclient = context.getProcessType() == ProcessType.APPLICATION_CLIENT;
final boolean legacySecurityAvailable = context.hasOptionalCapability("org.wildfly.legacy-security", null, null);
final RaDeploymentActivator raDeploymentActivator = new RaDeploymentActivator(appclient, legacySecurityAvailable);
context.addStep(new AbstractDeploymentChainStep() {
protected void execute(DeploymentProcessorTarget processorTarget) {
raDeploymentActivator.activateProcessors(processorTarget);
}
}, OperationContext.Stage.RUNTIME);
CapabilityServiceTarget serviceTarget = context.getCapabilityServiceTarget();
TransactionIntegrationService tiService = new TransactionIntegrationService();
serviceTarget.addCapability(TRANSACTION_INTEGRATION_CAPABILITY).setInstance(tiService).addCapabilityRequirement(LOCAL_TRANSACTION_PROVIDER_CAPABILITY, Void.class).addCapabilityRequirement(TRANSACTION_XA_RESOURCE_RECOVERY_REGISTRY_CAPABILITY, XAResourceRecoveryRegistry.class, tiService.getRrInjector()).addCapabilityRequirement(TRANSACTION_SYNCHRONIZATION_REGISTRY_CAPABILITY, TransactionSynchronizationRegistry.class, tiService.getTsrInjector()).addDependency(TxnServices.JBOSS_TXN_USER_TRANSACTION_REGISTRY, org.jboss.tm.usertx.UserTransactionRegistry.class, tiService.getUtrInjector()).addDependency(TxnServices.JBOSS_TXN_CONTEXT_XA_TERMINATOR, JBossContextXATerminator.class, tiService.getTerminatorInjector()).setInitialMode(ServiceController.Mode.ACTIVE).addAliases(ConnectorServices.TRANSACTION_INTEGRATION_SERVICE).install();
// Cache the some capability service names for use by our runtime services
final CapabilityServiceSupport support = context.getCapabilityServiceSupport();
ConnectorServices.registerCapabilityServiceName(LOCAL_TRANSACTION_PROVIDER_CAPABILITY, support.getCapabilityServiceName(LOCAL_TRANSACTION_PROVIDER_CAPABILITY));
ConnectorServices.registerCapabilityServiceName(NamingService.CAPABILITY_NAME, support.getCapabilityServiceName(NamingService.CAPABILITY_NAME));
ConnectorServices.registerCapabilityServiceName(TRANSACTION_INTEGRATION_CAPABILITY_NAME, support.getCapabilityServiceName(TRANSACTION_INTEGRATION_CAPABILITY_NAME));
final JcaSubsystemConfiguration config = new JcaSubsystemConfiguration();
final JcaConfigService connectorConfigService = new JcaConfigService(config);
serviceTarget.addService(ConnectorServices.CONNECTOR_CONFIG_SERVICE, connectorConfigService).setInitialMode(Mode.ACTIVE).install();
final IdleRemoverService idleRemoverService = new IdleRemoverService();
serviceTarget.addService(ConnectorServices.IDLE_REMOVER_SERVICE, idleRemoverService).setInitialMode(Mode.ACTIVE).install();
final ConnectionValidatorService connectionValidatorService = new ConnectionValidatorService();
serviceTarget.addService(ConnectorServices.CONNECTION_VALIDATOR_SERVICE, connectionValidatorService).setInitialMode(Mode.ACTIVE).install();
// TODO does the install of this and the DriverProcessor
// belong in DataSourcesSubsystemAdd?
final DriverRegistryService driverRegistryService = new DriverRegistryService();
serviceTarget.addService(ConnectorServices.JDBC_DRIVER_REGISTRY_SERVICE, driverRegistryService).install();
raDeploymentActivator.activateServices(serviceTarget);
}
use of org.jboss.as.server.DeploymentProcessorTarget in project wildfly by wildfly.
the class EESecuritySubsystemAdd method performBoottime.
protected void performBoottime(final OperationContext context, ModelNode operation, Resource resource) {
final ServiceTarget serviceTarget = context.getServiceTarget();
context.addStep(new AbstractDeploymentChainStep() {
public void execute(DeploymentProcessorTarget processorTarget) {
processorTarget.addDeploymentProcessor(EESecurityExtension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_EE_SECURITY_ANNOTATIONS, new EESecurityAnnotationProcessor());
processorTarget.addDeploymentProcessor(EESecurityExtension.SUBSYSTEM_NAME, Phase.DEPENDENCIES, Phase.DEPENDENCIES_EE_SECURITY, new EESecurityDependencyProcessor());
}
}, OperationContext.Stage.RUNTIME);
}
Aggregations