use of org.jboss.as.server.DeploymentProcessorTarget in project teiid by teiid.
the class TeiidAdd method initilaizeTeiidEngine.
private void initilaizeTeiidEngine(final OperationContext context, final ModelNode operation) throws OperationFailedException {
ServiceTarget target = context.getServiceTarget();
final String nodeName = getNodeName();
Environment environment = context.getCallEnvironment();
final JBossLifeCycleListener shutdownListener = new JBossLifeCycleListener(environment);
// $NON-NLS-1$
ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory("Teiid Timer"));
// async thread-pool
int maxThreads = 10;
if (asInt(THREAD_COUNT_ATTRIBUTE, operation, context) != null) {
maxThreads = asInt(THREAD_COUNT_ATTRIBUTE, operation, context);
}
buildThreadService(maxThreads, target);
// translator repository
final TranslatorRepository translatorRepo = new TranslatorRepository();
ValueService<TranslatorRepository> translatorService = new ValueService<TranslatorRepository>(new org.jboss.msc.value.Value<TranslatorRepository>() {
@Override
public TranslatorRepository getValue() throws IllegalStateException, IllegalArgumentException {
return translatorRepo;
}
});
ServiceController<TranslatorRepository> service = target.addService(TeiidServiceNames.TRANSLATOR_REPO, translatorService).install();
final ConnectorManagerRepository connectorManagerRepo = buildConnectorManagerRepository(translatorRepo);
// system function tree
SystemFunctionManager systemFunctionManager = SystemMetadata.getInstance().getSystemFunctionManager();
// VDB repository
final VDBRepository vdbRepository = new VDBRepository();
vdbRepository.setSystemFunctionManager(systemFunctionManager);
if (isDefined(DATA_ROLES_REQUIRED_ELEMENT, operation, context) && asBoolean(DATA_ROLES_REQUIRED_ELEMENT, operation, context)) {
vdbRepository.setDataRolesRequired(true);
}
if (isDefined(ALLOW_ENV_FUNCTION_ELEMENT, operation, context)) {
vdbRepository.setAllowEnvFunction(asBoolean(ALLOW_ENV_FUNCTION_ELEMENT, operation, context));
} else {
vdbRepository.setAllowEnvFunction(false);
}
VDBRepositoryService vdbRepositoryService = new VDBRepositoryService(vdbRepository);
ServiceBuilder<VDBRepository> vdbRepoService = target.addService(TeiidServiceNames.VDB_REPO, vdbRepositoryService);
vdbRepoService.addDependency(TeiidServiceNames.BUFFER_MGR, BufferManager.class, vdbRepositoryService.bufferManagerInjector);
vdbRepoService.addDependency(DependencyType.OPTIONAL, TeiidServiceNames.OBJECT_REPLICATOR, ObjectReplicator.class, vdbRepositoryService.objectReplicatorInjector);
vdbRepoService.install();
// VDB Status manager
final VDBStatusCheckerExecutorService statusChecker = new VDBStatusCheckerExecutorService();
ValueService<VDBStatusChecker> statusService = new ValueService<VDBStatusChecker>(new org.jboss.msc.value.Value<VDBStatusChecker>() {
@Override
public VDBStatusChecker getValue() throws IllegalStateException, IllegalArgumentException {
return statusChecker;
}
});
ServiceBuilder<VDBStatusChecker> statusBuilder = target.addService(TeiidServiceNames.VDB_STATUS_CHECKER, statusService);
statusBuilder.addDependency(TeiidServiceNames.THREAD_POOL_SERVICE, Executor.class, statusChecker.executorInjector);
statusBuilder.addDependency(TeiidServiceNames.VDB_REPO, VDBRepository.class, statusChecker.vdbRepoInjector);
statusBuilder.install();
// $NON-NLS-1$ //$NON-NLS-2$
RelativePathService.addService(TeiidServiceNames.DATA_DIR, "teiid-data", "jboss.server.data.dir", target);
final ObjectsSerializerService serializer = new ObjectsSerializerService();
ServiceBuilder<ObjectSerializer> objectSerializerService = target.addService(TeiidServiceNames.OBJECT_SERIALIZER, serializer);
objectSerializerService.addDependency(TeiidServiceNames.DATA_DIR, String.class, serializer.getPathInjector());
objectSerializerService.install();
// Object Replicator
boolean replicatorAvailable = false;
if (isDefined(DC_STACK_ATTRIBUTE, operation, context)) {
String stack = asString(DC_STACK_ATTRIBUTE, operation, context);
replicatorAvailable = true;
JGroupsObjectReplicatorService replicatorService = new JGroupsObjectReplicatorService();
ServiceBuilder<JGroupsObjectReplicator> serviceBuilder = target.addService(TeiidServiceNames.OBJECT_REPLICATOR, replicatorService);
// $NON-NLS-1$ //$NON-NLS-2$
serviceBuilder.addDependency(JGroupsRequirement.CHANNEL_FACTORY.getServiceName(context, stack), ChannelFactory.class, replicatorService.channelFactoryInjector);
serviceBuilder.addDependency(TeiidServiceNames.THREAD_POOL_SERVICE, Executor.class, replicatorService.executorInjector);
serviceBuilder.install();
LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50003));
NodeTrackerService trackerService = new NodeTrackerService(nodeName, scheduler);
ServiceBuilder<NodeTracker> nodeTrackerBuilder = target.addService(TeiidServiceNames.NODE_TRACKER_SERVICE, trackerService);
// $NON-NLS-1$ //$NON-NLS-2$
nodeTrackerBuilder.addDependency(JGroupsRequirement.CHANNEL_FACTORY.getServiceName(context, stack), ChannelFactory.class, trackerService.channelFactoryInjector);
nodeTrackerBuilder.install();
} else {
// $NON-NLS-1$
LogManager.logDetail(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("distributed_cache_not_enabled"));
}
// TODO: remove verbose service by moving the buffer service from runtime project
// $NON-NLS-1$ //$NON-NLS-2$
RelativePathService.addService(TeiidServiceNames.BUFFER_DIR, "teiid-buffer", "jboss.server.temp.dir", target);
BufferManagerService bufferService = buildBufferManager(context, operation);
ServiceBuilder<BufferManager> bufferServiceBuilder = target.addService(TeiidServiceNames.BUFFER_MGR, bufferService);
bufferServiceBuilder.addDependency(TeiidServiceNames.BUFFER_DIR, String.class, bufferService.pathInjector);
bufferServiceBuilder.install();
TupleBufferCacheService tupleBufferService = new TupleBufferCacheService();
ServiceBuilder<TupleBufferCache> tupleBufferBuilder = target.addService(TeiidServiceNames.TUPLE_BUFFER, tupleBufferService);
tupleBufferBuilder.addDependency(TeiidServiceNames.BUFFER_MGR, BufferManager.class, tupleBufferService.bufferMgrInjector);
tupleBufferBuilder.addDependency(replicatorAvailable ? DependencyType.REQUIRED : DependencyType.OPTIONAL, TeiidServiceNames.OBJECT_REPLICATOR, ObjectReplicator.class, tupleBufferService.replicatorInjector);
tupleBufferBuilder.install();
PolicyDecider policyDecider = null;
if (isDefined(POLICY_DECIDER_MODULE_ELEMENT, operation, context)) {
policyDecider = buildService(PolicyDecider.class, asString(POLICY_DECIDER_MODULE_ELEMENT, operation, context));
}
final AuthorizationValidator authValidator;
if (isDefined(AUTHORIZATION_VALIDATOR_MODULE_ELEMENT, operation, context)) {
authValidator = buildService(AuthorizationValidator.class, asString(AUTHORIZATION_VALIDATOR_MODULE_ELEMENT, operation, context));
} else {
DefaultAuthorizationValidator dap = new DefaultAuthorizationValidator();
dap.setPolicyDecider(policyDecider);
authValidator = dap;
}
ValueService<AuthorizationValidator> authValidatorService = new ValueService<AuthorizationValidator>(new org.jboss.msc.value.Value<AuthorizationValidator>() {
@Override
public AuthorizationValidator getValue() throws IllegalStateException, IllegalArgumentException {
return authValidator;
}
});
target.addService(TeiidServiceNames.AUTHORIZATION_VALIDATOR, authValidatorService).install();
final PreParser preParser;
if (isDefined(PREPARSER_MODULE_ELEMENT, operation, context)) {
preParser = buildService(PreParser.class, asString(PREPARSER_MODULE_ELEMENT, operation, context));
} else {
preParser = new PreParser() {
@Override
public String preParse(String command, CommandContext context) {
return command;
}
};
}
ValueService<PreParser> preParserService = new ValueService<PreParser>(new org.jboss.msc.value.Value<PreParser>() {
@Override
public PreParser getValue() throws IllegalStateException, IllegalArgumentException {
return preParser;
}
});
target.addService(TeiidServiceNames.PREPARSER, preParserService).install();
// resultset cache
boolean rsCache = true;
if (isDefined(RSC_ENABLE_ATTRIBUTE, operation, context) && !asBoolean(RSC_ENABLE_ATTRIBUTE, operation, context)) {
rsCache = false;
}
if (!isDefined(RSC_CONTAINER_NAME_ATTRIBUTE, operation, context)) {
throw new OperationFailedException(IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50094));
}
// $NON-NLS-1$
String cacheName = "resultset";
if (isDefined(RSC_NAME_ATTRIBUTE, operation, context)) {
// if null; default cache will be used
cacheName = asString(RSC_NAME_ATTRIBUTE, operation, context);
}
if (rsCache) {
CacheFactoryService cfs = new CacheFactoryService();
ServiceBuilder<CacheFactory> cacheFactoryBuilder = target.addService(TeiidServiceNames.RESULTSET_CACHE_FACTORY, cfs);
String ispnName = asString(RSC_CONTAINER_NAME_ATTRIBUTE, operation, context);
cacheFactoryBuilder.addDependency(InfinispanRequirement.CONTAINER.getServiceName(context, ispnName), EmbeddedCacheManager.class, // $NON-NLS-1$
cfs.cacheContainerInjector);
cacheFactoryBuilder.install();
int maxStaleness = DQPConfiguration.DEFAULT_MAX_STALENESS_SECONDS;
if (isDefined(RSC_MAX_STALENESS_ATTRIBUTE, operation, context)) {
maxStaleness = asInt(RSC_MAX_STALENESS_ATTRIBUTE, operation, context);
}
CacheService<CachedResults> resultSetService = new CacheService<CachedResults>(cacheName, SessionAwareCache.Type.RESULTSET, maxStaleness);
ServiceBuilder<SessionAwareCache<CachedResults>> resultsCacheBuilder = target.addService(TeiidServiceNames.CACHE_RESULTSET, resultSetService);
resultsCacheBuilder.addDependency(TeiidServiceNames.TUPLE_BUFFER, TupleBufferCache.class, resultSetService.tupleBufferCacheInjector);
resultsCacheBuilder.addDependency(TeiidServiceNames.RESULTSET_CACHE_FACTORY, CacheFactory.class, resultSetService.cacheFactoryInjector);
// $NON-NLS-1$
resultsCacheBuilder.addDependency(InfinispanCacheRequirement.CACHE.getServiceName(context, ispnName, cacheName));
// $NON-NLS-1$
resultsCacheBuilder.addDependency(InfinispanCacheRequirement.CACHE.getServiceName(context, ispnName, cacheName + SessionAwareCache.REPL));
resultsCacheBuilder.install();
}
// prepared-plan cache
boolean ppCache = true;
if (isDefined(PPC_ENABLE_ATTRIBUTE, operation, context)) {
ppCache = asBoolean(PPC_ENABLE_ATTRIBUTE, operation, context);
}
if (!isDefined(PPC_CONTAINER_NAME_ATTRIBUTE, operation, context)) {
throw new OperationFailedException(IntegrationPlugin.Util.gs(IntegrationPlugin.Event.TEIID50095));
}
// $NON-NLS-1$
cacheName = "preparedplan";
if (isDefined(PPC_NAME_ATTRIBUTE, operation, context)) {
cacheName = asString(PPC_NAME_ATTRIBUTE, operation, context);
}
if (ppCache) {
CacheFactoryService cfs = new CacheFactoryService();
ServiceBuilder<CacheFactory> cacheFactoryBuilder = target.addService(TeiidServiceNames.PREPAREDPLAN_CACHE_FACTORY, cfs);
String ispnName = asString(PPC_CONTAINER_NAME_ATTRIBUTE, operation, context);
cacheFactoryBuilder.addDependency(InfinispanRequirement.CONTAINER.getServiceName(context, ispnName), EmbeddedCacheManager.class, // $NON-NLS-1$
cfs.cacheContainerInjector);
cacheFactoryBuilder.install();
CacheService<PreparedPlan> preparedPlanService = new CacheService<PreparedPlan>(cacheName, SessionAwareCache.Type.PREPAREDPLAN, 0);
ServiceBuilder<SessionAwareCache<PreparedPlan>> preparedPlanCacheBuilder = target.addService(TeiidServiceNames.CACHE_PREPAREDPLAN, preparedPlanService);
preparedPlanCacheBuilder.addDependency(TeiidServiceNames.PREPAREDPLAN_CACHE_FACTORY, CacheFactory.class, preparedPlanService.cacheFactoryInjector);
// $NON-NLS-1$
preparedPlanCacheBuilder.addDependency(InfinispanCacheRequirement.CACHE.getServiceName(context, ispnName, cacheName));
preparedPlanCacheBuilder.install();
}
// Query Engine
final DQPCoreService engine = buildQueryEngine(context, operation);
EventDistributorFactoryService edfs = new EventDistributorFactoryService();
ServiceBuilder<InternalEventDistributorFactory> edfsServiceBuilder = target.addService(TeiidServiceNames.EVENT_DISTRIBUTOR_FACTORY, edfs);
edfsServiceBuilder.addDependency(TeiidServiceNames.VDB_REPO, VDBRepository.class, edfs.vdbRepositoryInjector);
edfsServiceBuilder.addDependency(replicatorAvailable ? DependencyType.REQUIRED : DependencyType.OPTIONAL, TeiidServiceNames.OBJECT_REPLICATOR, ObjectReplicator.class, edfs.objectReplicatorInjector);
edfs.dqpCore = engine.getValue();
edfsServiceBuilder.install();
// $NON-NLS-1$
String workManager = "default";
if (isDefined(WORKMANAGER, operation, context)) {
workManager = asString(WORKMANAGER, operation, context);
}
ServiceBuilder<DQPCore> engineBuilder = target.addService(TeiidServiceNames.ENGINE, engine);
// $NON-NLS-1$ //$NON-NLS-2$
engineBuilder.addDependency(ServiceName.JBOSS.append("connector", "workmanager", workManager), WorkManager.class, engine.getWorkManagerInjector());
// $NON-NLS-1$ //$NON-NLS-2$
engineBuilder.addDependency(ServiceName.JBOSS.append("txn", "XATerminator"), XATerminator.class, engine.getXaTerminatorInjector());
// $NON-NLS-1$ //$NON-NLS-2$
engineBuilder.addDependency(ServiceName.JBOSS.append("txn", "TransactionManager"), TransactionManager.class, engine.getTxnManagerInjector());
engineBuilder.addDependency(TeiidServiceNames.BUFFER_MGR, BufferManager.class, engine.getBufferManagerInjector());
engineBuilder.addDependency(TeiidServiceNames.TRANSLATOR_REPO, TranslatorRepository.class, engine.getTranslatorRepositoryInjector());
engineBuilder.addDependency(TeiidServiceNames.VDB_REPO, VDBRepository.class, engine.getVdbRepositoryInjector());
engineBuilder.addDependency(TeiidServiceNames.AUTHORIZATION_VALIDATOR, AuthorizationValidator.class, engine.getAuthorizationValidatorInjector());
engineBuilder.addDependency(TeiidServiceNames.PREPARSER, PreParser.class, engine.getPreParserInjector());
engineBuilder.addDependency(rsCache ? DependencyType.REQUIRED : DependencyType.OPTIONAL, TeiidServiceNames.CACHE_RESULTSET, SessionAwareCache.class, engine.getResultSetCacheInjector());
engineBuilder.addDependency(TeiidServiceNames.CACHE_PREPAREDPLAN, SessionAwareCache.class, engine.getPreparedPlanCacheInjector());
engineBuilder.addDependency(TeiidServiceNames.EVENT_DISTRIBUTOR_FACTORY, InternalEventDistributorFactory.class, engine.getEventDistributorFactoryInjector());
engineBuilder.setInitialMode(ServiceController.Mode.ACTIVE);
engineBuilder.install();
// add JNDI for event distributor
final ReferenceFactoryService<EventDistributorFactory> referenceFactoryService = new ReferenceFactoryService<EventDistributorFactory>();
// $NON-NLS-1$
final ServiceName referenceFactoryServiceName = TeiidServiceNames.EVENT_DISTRIBUTOR_FACTORY.append("reference-factory");
final ServiceBuilder<?> referenceBuilder = target.addService(referenceFactoryServiceName, referenceFactoryService);
referenceBuilder.addDependency(TeiidServiceNames.EVENT_DISTRIBUTOR_FACTORY, EventDistributorFactory.class, referenceFactoryService.getInjector());
referenceBuilder.setInitialMode(ServiceController.Mode.ACTIVE);
// $NON-NLS-1$
String jndiName = "teiid/event-distributor-factory";
final ContextNames.BindInfo bindInfo = ContextNames.bindInfoFor(jndiName);
final BinderService binderService = new BinderService(bindInfo.getBindName());
final ServiceBuilder<?> binderBuilder = target.addService(bindInfo.getBinderServiceName(), binderService);
binderBuilder.addDependency(referenceFactoryServiceName, ManagedReferenceFactory.class, binderService.getManagedObjectInjector());
binderBuilder.addDependency(bindInfo.getParentContextServiceName(), ServiceBasedNamingStore.class, binderService.getNamingStoreInjector());
binderBuilder.setInitialMode(ServiceController.Mode.ACTIVE);
referenceBuilder.install();
binderBuilder.install();
// $NON-NLS-1$
LogManager.logDetail(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("event_distributor_bound", jndiName));
// Materialization management service
MaterializationManagementService matviewService = new MaterializationManagementService(shutdownListener, scheduler);
ServiceBuilder<MaterializationManager> matviewBuilder = target.addService(TeiidServiceNames.MATVIEW_SERVICE, matviewService);
matviewBuilder.addDependency(TeiidServiceNames.ENGINE, DQPCore.class, matviewService.dqpInjector);
matviewBuilder.addDependency(TeiidServiceNames.VDB_REPO, VDBRepository.class, matviewService.vdbRepositoryInjector);
matviewBuilder.addDependency(replicatorAvailable ? DependencyType.REQUIRED : DependencyType.OPTIONAL, TeiidServiceNames.NODE_TRACKER_SERVICE, NodeTracker.class, matviewService.nodeTrackerInjector);
matviewBuilder.install();
// Register VDB deployer
context.addStep(new AbstractDeploymentChainStep() {
@Override
public void execute(DeploymentProcessorTarget processorTarget) {
// vdb deployers
processorTarget.addDeploymentProcessor(TeiidExtension.TEIID_SUBSYSTEM, Phase.STRUCTURE, 0, new FileRootMountProcessor(".ddl"));
processorTarget.addDeploymentProcessor(TeiidExtension.TEIID_SUBSYSTEM, Phase.STRUCTURE, Phase.STRUCTURE_WAR_DEPLOYMENT_INIT | 0xFF75, new DynamicVDBRootMountDeployer());
processorTarget.addDeploymentProcessor(TeiidExtension.TEIID_SUBSYSTEM, Phase.STRUCTURE, Phase.STRUCTURE_WAR_DEPLOYMENT_INIT | 0xFF76, new VDBStructureDeployer());
processorTarget.addDeploymentProcessor(TeiidExtension.TEIID_SUBSYSTEM, Phase.PARSE, Phase.PARSE_WEB_DEPLOYMENT | 0x0001, new VDBParserDeployer(vdbRepository));
processorTarget.addDeploymentProcessor(TeiidExtension.TEIID_SUBSYSTEM, Phase.DEPENDENCIES, Phase.DEPENDENCIES_WAR_MODULE | 0x0001, new VDBDependencyDeployer());
processorTarget.addDeploymentProcessor(TeiidExtension.TEIID_SUBSYSTEM, Phase.INSTALL, Phase.INSTALL_WAR_DEPLOYMENT | 0x1000, new VDBDeployer(translatorRepo, vdbRepository, shutdownListener));
// translator deployers
processorTarget.addDeploymentProcessor(TeiidExtension.TEIID_SUBSYSTEM, Phase.STRUCTURE, Phase.STRUCTURE_JDBC_DRIVER | 0x0001, new TranslatorStructureDeployer());
processorTarget.addDeploymentProcessor(TeiidExtension.TEIID_SUBSYSTEM, Phase.DEPENDENCIES, Phase.DEPENDENCIES_MODULE | 0x0001, new TranslatorDependencyDeployer());
processorTarget.addDeploymentProcessor(TeiidExtension.TEIID_SUBSYSTEM, Phase.INSTALL, Phase.INSTALL_JDBC_DRIVER | 0x0001, new TranslatorDeployer());
}
}, OperationContext.Stage.RUNTIME);
// install a session service
// TODO: may eventually couple this with DQPCore
final SessionServiceImpl sessionServiceImpl = new SessionServiceImpl();
if (isDefined(AUTHENTICATION_SECURITY_DOMAIN_ATTRIBUTE, operation, context)) {
String securityDomain = asString(AUTHENTICATION_SECURITY_DOMAIN_ATTRIBUTE, operation, context);
sessionServiceImpl.setSecurityDomain(securityDomain);
}
if (isDefined(AUTHENTICATION_MAX_SESSIONS_ALLOWED_ATTRIBUTE, operation, context)) {
sessionServiceImpl.setSessionMaxLimit(asLong(AUTHENTICATION_MAX_SESSIONS_ALLOWED_ATTRIBUTE, operation, context));
}
if (isDefined(AUTHENTICATION_SESSION_EXPIRATION_TIME_LIMIT_ATTRIBUTE, operation, context)) {
sessionServiceImpl.setSessionExpirationTimeLimit(asLong(AUTHENTICATION_SESSION_EXPIRATION_TIME_LIMIT_ATTRIBUTE, operation, context));
}
if (isDefined(AUTHENTICATION_TYPE_ATTRIBUTE, operation, context)) {
sessionServiceImpl.setAuthenticationType(AuthenticationType.valueOf(asString(AUTHENTICATION_TYPE_ATTRIBUTE, operation, context)));
} else {
sessionServiceImpl.setAuthenticationType(AuthenticationType.USERPASSWORD);
}
if (isDefined(AUTHENTICATION_TRUST_ALL_LOCAL_ATTRIBUTE, operation, context)) {
boolean allowUnauthenticated = asBoolean(AUTHENTICATION_TRUST_ALL_LOCAL_ATTRIBUTE, operation, context);
sessionServiceImpl.setTrustAllLocal(allowUnauthenticated);
}
if (isDefined(AUTHENTICATION_ALLOW_SECURITY_DOMAIN_QUALIFIER, operation, context)) {
boolean allowSecurityDomainQualifier = asBoolean(AUTHENTICATION_ALLOW_SECURITY_DOMAIN_QUALIFIER, operation, context);
sessionServiceImpl.setAllowSecurityDomainQualifier(allowSecurityDomainQualifier);
}
sessionServiceImpl.setDqp(engine.getValue());
sessionServiceImpl.setVDBRepository(vdbRepository);
sessionServiceImpl.setSecurityHelper(new JBossSecurityHelper());
sessionServiceImpl.start();
ContainerSessionService containerSessionService = new ContainerSessionService(sessionServiceImpl);
ServiceBuilder<SessionService> sessionServiceBuilder = target.addService(TeiidServiceNames.SESSION, containerSessionService);
sessionServiceBuilder.install();
// rest war service
RestWarGenerator warGenerator = TeiidAdd.buildService(RestWarGenerator.class, "org.jboss.teiid.rest-service");
ResteasyEnabler restEnabler = new ResteasyEnabler(warGenerator);
ServiceBuilder<Void> warGeneratorSvc = target.addService(TeiidServiceNames.REST_WAR_SERVICE, restEnabler);
warGeneratorSvc.addDependency(Services.JBOSS_SERVER_CONTROLLER, ModelController.class, restEnabler.controllerValue);
warGeneratorSvc.addDependency(TeiidServiceNames.THREAD_POOL_SERVICE, Executor.class, restEnabler.executorInjector);
warGeneratorSvc.addDependency(TeiidServiceNames.VDB_REPO, VDBRepository.class, restEnabler.vdbRepoInjector);
warGeneratorSvc.install();
}
use of org.jboss.as.server.DeploymentProcessorTarget in project wildfly by wildfly.
the class TransactionSubsystemAdd method performBoottime.
@Override
protected void performBoottime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException {
checkIfNodeIdentifierIsDefault(context, model);
boolean jts = model.hasDefined(JTS) && model.get(JTS).asBoolean();
final Resource subsystemResource = context.readResourceFromRoot(PathAddress.pathAddress(TransactionExtension.SUBSYSTEM_PATH), false);
final List<ServiceName> deps = new LinkedList<>();
for (String name : subsystemResource.getChildrenNames(CM_RESOURCE)) {
deps.add(TxnServices.JBOSS_TXN_CMR.append(name));
}
// recovery environment
performRecoveryEnvBoottime(context, model, jts, deps);
// core environment
performCoreEnvironmentBootTime(context, model);
// coordinator environment
performCoordinatorEnvBoottime(context, model, jts);
// object store
performObjectStoreBoottime(context, model);
// always propagate the transaction context
// TODO: need a better way to do this, but this value gets cached in a static
// so we need to make sure we set it before anything tries to read it
jtsPropertyManager.getJTSEnvironmentBean().setAlwaysPropagateContext(true);
context.addStep(new AbstractDeploymentChainStep() {
protected void execute(final DeploymentProcessorTarget processorTarget) {
processorTarget.addDeploymentProcessor(TransactionExtension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_TRANSACTION_ROLLBACK_ACTION, new TransactionLeakRollbackProcessor());
processorTarget.addDeploymentProcessor(TransactionExtension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_TRANSACTIONS_EE_CONCURRENCY, new EEConcurrencyContextHandleFactoryProcessor());
processorTarget.addDeploymentProcessor(TransactionExtension.SUBSYSTEM_NAME, Phase.INSTALL, Phase.INSTALL_TRANSACTION_BINDINGS, new TransactionJndiBindingProcessor());
processorTarget.addDeploymentProcessor(TransactionExtension.SUBSYSTEM_NAME, Phase.DEPENDENCIES, Phase.DEPENDENCIES_TRANSACTIONS, new TransactionDependenciesProcessor());
}
}, OperationContext.Stage.RUNTIME);
// bind the TransactionManger and the TSR into JNDI
final BinderService tmBinderService = new BinderService("TransactionManager");
final ServiceBuilder<ManagedReferenceFactory> tmBuilder = context.getServiceTarget().addService(ContextNames.JBOSS_CONTEXT_SERVICE_NAME.append("TransactionManager"), tmBinderService);
tmBuilder.addDependency(ContextNames.JBOSS_CONTEXT_SERVICE_NAME, ServiceBasedNamingStore.class, tmBinderService.getNamingStoreInjector());
tmBuilder.addDependency(TransactionManagerService.INTERNAL_SERVICE_NAME, javax.transaction.TransactionManager.class, new Injector<javax.transaction.TransactionManager>() {
@Override
public void inject(final javax.transaction.TransactionManager value) throws InjectionException {
tmBinderService.getManagedObjectInjector().inject(new ValueManagedReferenceFactory(new ImmediateValue<Object>(value)));
}
@Override
public void uninject() {
tmBinderService.getManagedObjectInjector().uninject();
}
});
tmBuilder.install();
final BinderService tmLegacyBinderService = new BinderService("TransactionManager");
final ServiceBuilder<ManagedReferenceFactory> tmLegacyBuilder = context.getServiceTarget().addService(ContextNames.JAVA_CONTEXT_SERVICE_NAME.append("TransactionManager"), tmLegacyBinderService);
tmLegacyBuilder.addDependency(ContextNames.JAVA_CONTEXT_SERVICE_NAME, ServiceBasedNamingStore.class, tmLegacyBinderService.getNamingStoreInjector());
tmLegacyBuilder.addDependency(TransactionManagerService.INTERNAL_SERVICE_NAME, javax.transaction.TransactionManager.class, new Injector<javax.transaction.TransactionManager>() {
@Override
public void inject(final javax.transaction.TransactionManager value) throws InjectionException {
tmLegacyBinderService.getManagedObjectInjector().inject(new ValueManagedReferenceFactory(new ImmediateValue<Object>(value)));
}
@Override
public void uninject() {
tmLegacyBinderService.getManagedObjectInjector().uninject();
}
});
tmLegacyBuilder.install();
final BinderService tsrBinderService = new BinderService("TransactionSynchronizationRegistry");
final ServiceBuilder<ManagedReferenceFactory> tsrBuilder = context.getServiceTarget().addService(ContextNames.JBOSS_CONTEXT_SERVICE_NAME.append("TransactionSynchronizationRegistry"), tsrBinderService);
tsrBuilder.addDependency(ContextNames.JBOSS_CONTEXT_SERVICE_NAME, ServiceBasedNamingStore.class, tsrBinderService.getNamingStoreInjector());
tsrBuilder.addDependency(TransactionSynchronizationRegistryService.INTERNAL_SERVICE_NAME, TransactionSynchronizationRegistry.class, new Injector<TransactionSynchronizationRegistry>() {
@Override
public void inject(final TransactionSynchronizationRegistry value) throws InjectionException {
tsrBinderService.getManagedObjectInjector().inject(new ValueManagedReferenceFactory(new ImmediateValue<Object>(value)));
}
@Override
public void uninject() {
tsrBinderService.getManagedObjectInjector().uninject();
}
});
tsrBuilder.install();
// Install the UserTransactionAccessControlService
final UserTransactionAccessControlService lookupControlService = new UserTransactionAccessControlService();
context.getServiceTarget().addService(UserTransactionAccessControlService.SERVICE_NAME, lookupControlService).install();
// Bind the UserTransaction into JNDI
final UserTransactionBindingService userTransactionBindingService = new UserTransactionBindingService("UserTransaction");
final ServiceBuilder<ManagedReferenceFactory> utBuilder = context.getServiceTarget().addService(ContextNames.JBOSS_CONTEXT_SERVICE_NAME.append("UserTransaction"), userTransactionBindingService);
utBuilder.addDependency(ContextNames.JBOSS_CONTEXT_SERVICE_NAME, ServiceBasedNamingStore.class, userTransactionBindingService.getNamingStoreInjector()).addDependency(UserTransactionAccessControlService.SERVICE_NAME, UserTransactionAccessControlService.class, userTransactionBindingService.getUserTransactionAccessControlServiceInjector()).addDependency(UserTransactionService.INTERNAL_SERVICE_NAME, UserTransaction.class, new ManagedReferenceInjector<UserTransaction>(userTransactionBindingService.getManagedObjectInjector()));
utBuilder.install();
// install the EE Concurrency transaction setup provider's service
final TransactionSetupProviderService transactionSetupProviderService = new TransactionSetupProviderService();
context.getServiceTarget().addService(ConcurrentServiceNames.TRANSACTION_SETUP_PROVIDER_SERVICE_NAME, transactionSetupProviderService).addDependency(TransactionManagerService.INTERNAL_SERVICE_NAME, TransactionManager.class, transactionSetupProviderService.getTransactionManagerInjectedValue()).install();
}
use of org.jboss.as.server.DeploymentProcessorTarget in project wildfly by wildfly.
the class WeldSubsystemAdd method performBoottime.
@Override
protected void performBoottime(final OperationContext context, ModelNode operation, Resource resource) throws OperationFailedException {
final ModelNode model = resource.getModel();
final boolean requireBeanDescriptor = REQUIRE_BEAN_DESCRIPTOR_ATTRIBUTE.resolveModelAttribute(context, model).asBoolean();
final boolean legacyEmptyBeansXmlTreatment = LEGACY_EMPTY_BEANS_XML_TREATMENT_ATTRIBUTE.resolveModelAttribute(context, model).asBoolean();
final boolean nonPortableMode = WeldResourceDefinition.NON_PORTABLE_MODE_ATTRIBUTE.resolveModelAttribute(context, model).asBoolean();
final boolean developmentMode = WeldResourceDefinition.DEVELOPMENT_MODE_ATTRIBUTE.resolveModelAttribute(context, model).asBoolean();
final int threadPoolSize = WeldResourceDefinition.THREAD_POOL_SIZE_ATTRIBUTE.resolveModelAttribute(context, model).asInt(WeldExecutorServices.DEFAULT_BOUND);
context.addStep(new AbstractDeploymentChainStep() {
@Override
protected void execute(DeploymentProcessorTarget processorTarget) {
final JBossAllXmlParserRegisteringProcessor<?> jbossAllParsers = JBossAllXmlParserRegisteringProcessor.builder().addParser(WeldJBossAll10Parser.ROOT_ELEMENT, WeldJBossAllConfiguration.ATTACHMENT_KEY, WeldJBossAll10Parser.INSTANCE).addParser(WeldJBossAll11Parser.ROOT_ELEMENT, WeldJBossAllConfiguration.ATTACHMENT_KEY, WeldJBossAll11Parser.INSTANCE).build();
processorTarget.addDeploymentProcessor(WeldExtension.SUBSYSTEM_NAME, Phase.STRUCTURE, Phase.STRUCTURE_REGISTER_JBOSS_ALL_WELD, jbossAllParsers);
processorTarget.addDeploymentProcessor(WeldExtension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_WELD_CONFIGURATION, new WeldConfigurationProcessor(requireBeanDescriptor, nonPortableMode, developmentMode, legacyEmptyBeansXmlTreatment));
processorTarget.addDeploymentProcessor(WeldExtension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_CDI_ANNOTATIONS, new CdiAnnotationProcessor());
processorTarget.addDeploymentProcessor(WeldExtension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_CDI_BEAN_DEFINING_ANNOTATIONS, new BeanDefiningAnnotationProcessor());
processorTarget.addDeploymentProcessor(WeldExtension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_WELD_DEPLOYMENT, new BeansXmlProcessor());
processorTarget.addDeploymentProcessor(WeldExtension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_WELD_IMPLICIT_DEPLOYMENT_DETECTION, new WeldImplicitDeploymentProcessor());
processorTarget.addDeploymentProcessor(WeldExtension.SUBSYSTEM_NAME, Phase.DEPENDENCIES, Phase.DEPENDENCIES_WELD, new WeldDependencyProcessor());
processorTarget.addDeploymentProcessor(WeldExtension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_WELD_WEB_INTEGRATION, new WebIntegrationProcessor());
processorTarget.addDeploymentProcessor(WeldExtension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_WELD_DEVELOPMENT_MODE, new DevelopmentModeProcessor());
processorTarget.addDeploymentProcessor(WeldExtension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_WELD_BEAN_ARCHIVE, new BeanArchiveProcessor());
processorTarget.addDeploymentProcessor(WeldExtension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_WELD_EXTERNAL_BEAN_ARCHIVE, new ExternalBeanArchiveProcessor());
processorTarget.addDeploymentProcessor(WeldExtension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_WELD_PORTABLE_EXTENSIONS, new WeldPortableExtensionProcessor());
// TODO add processor priority to Phase
processorTarget.addDeploymentProcessor(WeldExtension.SUBSYSTEM_NAME, Phase.POST_MODULE, 0x0F10, new EarApplicationScopedObserverMethodProcessor());
processorTarget.addDeploymentProcessor(WeldExtension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_WELD_COMPONENT_INTEGRATION, new WeldComponentIntegrationProcessor());
processorTarget.addDeploymentProcessor(WeldExtension.SUBSYSTEM_NAME, Phase.INSTALL, Phase.INSTALL_WELD_DEPLOYMENT, new WeldDeploymentProcessor(checkJtsEnabled(context)));
processorTarget.addDeploymentProcessor(WeldExtension.SUBSYSTEM_NAME, Phase.INSTALL, Phase.INSTALL_WELD_BEAN_MANAGER, new WeldBeanManagerServiceProcessor());
// note that we want to go one step before Phase.CLEANUP_EE because we use metadata that it then cleans up
processorTarget.addDeploymentProcessor(WeldExtension.SUBSYSTEM_NAME, Phase.CLEANUP, Phase.CLEANUP_EE - 1, new WeldDeploymentCleanupProcessor());
// Add additional deployment processors
ServiceLoader<DeploymentUnitProcessorProvider> processorProviders = ServiceLoader.load(DeploymentUnitProcessorProvider.class, WildFlySecurityManager.getClassLoaderPrivileged(WeldSubsystemAdd.class));
for (DeploymentUnitProcessorProvider provider : processorProviders) {
processorTarget.addDeploymentProcessor(WeldExtension.SUBSYSTEM_NAME, provider.getPhase(), provider.getPriority(), provider.getProcessor());
}
}
}, OperationContext.Stage.RUNTIME);
context.getServiceTarget().addService(TCCLSingletonService.SERVICE_NAME).setInstance(new TCCLSingletonService()).setInitialMode(Mode.ON_DEMAND).install();
ServiceBuilder<?> builder = context.getServiceTarget().addService(WeldExecutorServices.SERVICE_NAME);
final Consumer<ExecutorServices> executorServicesConsumer = builder.provides(WeldExecutorServices.SERVICE_NAME);
builder.setInstance(new WeldExecutorServices(executorServicesConsumer, threadPoolSize));
builder.setInitialMode(Mode.ON_DEMAND);
builder.install();
}
use of org.jboss.as.server.DeploymentProcessorTarget in project wildfly by wildfly.
the class WSSubsystemAdd method performBoottime.
protected void performBoottime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException {
WSLogger.ROOT_LOGGER.activatingWebservicesExtension();
ModuleClassLoaderProvider.register();
final boolean appclient = context.getProcessType() == ProcessType.APPLICATION_CLIENT;
context.addStep(new AbstractDeploymentChainStep() {
protected void execute(DeploymentProcessorTarget processorTarget) {
// add the DUP for dealing with WS deployments
WSDeploymentActivator.activate(processorTarget, appclient);
}
}, OperationContext.Stage.RUNTIME);
ServiceTarget serviceTarget = context.getServiceTarget();
final boolean jmxAvailable = isJMXSubsystemAvailable(context);
if (appclient && model.hasDefined(WSDL_HOST)) {
ServerConfigImpl serverConfig = createServerConfig(model, true, context);
ServerConfigFactoryImpl.setConfig(serverConfig);
ServerConfigService.install(serviceTarget, serverConfig, getServerConfigDependencies(context, appclient), jmxAvailable, false);
}
if (!appclient) {
ServerConfigImpl serverConfig = createServerConfig(model, false, context);
ServerConfigFactoryImpl.setConfig(serverConfig);
ServerConfigService.install(serviceTarget, serverConfig, getServerConfigDependencies(context, appclient), jmxAvailable, true);
}
XTSClientIntegrationService.install(serviceTarget);
}
use of org.jboss.as.server.DeploymentProcessorTarget in project wildfly by wildfly.
the class EJB3SubsystemAdd method performBoottime.
@Override
protected void performBoottime(OperationContext context, ModelNode operation, Resource resource) throws OperationFailedException {
final ModelNode model = resource.getModel();
// Install the server association service
final AssociationService associationService = new AssociationService();
final ServiceName suspendControllerServiceName = context.getCapabilityServiceName("org.wildfly.server.suspend-controller", SuspendController.class);
final ServiceBuilder<AssociationService> associationServiceBuilder = context.getServiceTarget().addService(AssociationService.SERVICE_NAME, associationService);
associationServiceBuilder.addDependency(DeploymentRepositoryService.SERVICE_NAME, DeploymentRepository.class, associationService.getDeploymentRepositoryInjector()).addDependency(suspendControllerServiceName, SuspendController.class, associationService.getSuspendControllerInjector()).addDependency(ServerEnvironmentService.SERVICE_NAME, ServerEnvironment.class, associationService.getServerEnvironmentServiceInjector()).setInitialMode(ServiceController.Mode.LAZY);
if (resource.hasChild(EJB3SubsystemModel.REMOTE_SERVICE_PATH)) {
ModelNode remoteModel = resource.getChild(EJB3SubsystemModel.REMOTE_SERVICE_PATH).getModel();
String clusterName = EJB3RemoteResourceDefinition.CLIENT_MAPPINGS_CLUSTER_NAME.resolveModelAttribute(context, remoteModel).asString();
// For each connector
for (ModelNode connector : EJB3RemoteResourceDefinition.CONNECTORS.resolveModelAttribute(context, remoteModel).asList()) {
String connectorName = connector.asString();
Map.Entry<Injector<ProtocolSocketBinding>, Injector<Registry>> entry = associationService.addConnectorInjectors(connectorName);
associationServiceBuilder.addDependency(context.getCapabilityServiceName(CONNECTOR_CAPABILITY_NAME, connectorName, ProtocolSocketBinding.class), ProtocolSocketBinding.class, entry.getKey());
associationServiceBuilder.addDependency(ClusteringCacheRequirement.REGISTRY.getServiceName(context, clusterName, connectorName), Registry.class, entry.getValue());
}
}
associationServiceBuilder.install();
// setup IIOP related stuff
// This goes here rather than in EJB3IIOPAdd as it affects the server when it is acting as an iiop client
// setup our dynamic stub factory
DelegatingStubFactoryFactory.setOverriddenDynamicFactory(new DynamicStubFactoryFactory());
// setup the substitution service, that translates between ejb proxies and IIOP stubs
final RemoteObjectSubstitutionService substitutionService = new RemoteObjectSubstitutionService();
context.getServiceTarget().addService(RemoteObjectSubstitutionService.SERVICE_NAME, substitutionService).addDependency(DeploymentRepositoryService.SERVICE_NAME, DeploymentRepository.class, substitutionService.getDeploymentRepositoryInjectedValue()).install();
// register EJB context selector
RemoteObjectSubstitutionManager.setRemoteObjectSubstitution(substitutionService);
final boolean appclient = context.getProcessType() == ProcessType.APPLICATION_CLIENT;
final ModelNode defaultDistinctName = EJB3SubsystemRootResourceDefinition.DEFAULT_DISTINCT_NAME.resolveModelAttribute(context, model);
final DefaultDistinctNameService defaultDistinctNameService = new DefaultDistinctNameService(defaultDistinctName.isDefined() ? defaultDistinctName.asString() : null);
context.getServiceTarget().addService(DefaultDistinctNameService.SERVICE_NAME, defaultDistinctNameService).install();
final ModelNode ejbNameRegex = EJB3SubsystemRootResourceDefinition.ALLOW_EJB_NAME_REGEX.resolveModelAttribute(context, model);
final EjbNameRegexService ejbNameRegexService = new EjbNameRegexService(ejbNameRegex.isDefined() ? ejbNameRegex.asBoolean() : false);
context.getServiceTarget().addService(EjbNameRegexService.SERVICE_NAME, ejbNameRegexService).install();
// set the default security domain name in the deployment unit processor, configured at the subsystem level
final ModelNode defaultSecurityDomainModelNode = EJB3SubsystemRootResourceDefinition.DEFAULT_SECURITY_DOMAIN.resolveModelAttribute(context, model);
final String defaultSecurityDomain = defaultSecurityDomainModelNode.isDefined() ? defaultSecurityDomainModelNode.asString() : null;
this.defaultSecurityDomainDeploymentProcessor.setDefaultSecurityDomainName(defaultSecurityDomain);
// set the default security domain name in the deployment unit processor, configured at the subsytem level
final ModelNode defaultMissingMethod = EJB3SubsystemRootResourceDefinition.DEFAULT_MISSING_METHOD_PERMISSIONS_DENY_ACCESS.resolveModelAttribute(context, model);
final boolean defaultMissingMethodValue = defaultMissingMethod.asBoolean();
this.missingMethodPermissionsDenyAccessMergingProcessor.setDenyAccessByDefault(defaultMissingMethodValue);
final ModelNode defaultStatefulSessionTimeout = EJB3SubsystemRootResourceDefinition.DEFAULT_STATEFUL_BEAN_SESSION_TIMEOUT.resolveModelAttribute(context, model);
final ValueService<AtomicLong> defaultStatefulSessionTimeoutService = new ValueService<>(new ImmediateValue<>(defaultStatefulSessionTimeout.isDefined() ? new AtomicLong(defaultStatefulSessionTimeout.asLong()) : DefaultStatefulBeanSessionTimeoutWriteHandler.INITIAL_TIMEOUT_VALUE));
context.getServiceTarget().addService(DefaultStatefulBeanSessionTimeoutWriteHandler.SERVICE_NAME, defaultStatefulSessionTimeoutService).install();
final boolean defaultMdbPoolAvailable = model.hasDefined(DEFAULT_MDB_INSTANCE_POOL);
final boolean defaultSlsbPoolAvailable = model.hasDefined(DEFAULT_SLSB_INSTANCE_POOL);
CapabilityServiceSupport capabilitySupport = context.getCapabilityServiceSupport();
final boolean elytronJacc = capabilitySupport.hasCapability(ELYTRON_JACC_CAPABILITY);
final boolean legacyJacc = !elytronJacc && capabilitySupport.hasCapability(LEGACY_JACC_CAPABILITY);
context.addStep(new AbstractDeploymentChainStep() {
@Override
protected void execute(DeploymentProcessorTarget processorTarget) {
// DUP's that are used even for app client deployments
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.STRUCTURE, Phase.STRUCTURE_REGISTER_JBOSS_ALL_EJB, new JBossAllXmlParserRegisteringProcessor<EjbJarMetaData>(EjbJarJBossAllParser.ROOT_ELEMENT, EjbJarJBossAllParser.ATTACHMENT_KEY, new EjbJarJBossAllParser()));
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_EJB_DEFAULT_DISTINCT_NAME, new EjbDefaultDistinctNameProcessor(defaultDistinctNameService));
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_EJB_CONTEXT_BINDING, new EjbContextJndiBindingProcessor());
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_EJB_DEPLOYMENT, new EjbJarParsingDeploymentUnitProcessor());
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_CREATE_COMPONENT_DESCRIPTIONS, new AnnotatedEJBComponentDescriptionDeploymentUnitProcessor(appclient, defaultMdbPoolAvailable, defaultSlsbPoolAvailable));
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_EJB_SESSION_BEAN_DD, new SessionBeanXmlDescriptorProcessor(appclient));
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_ANNOTATION_EJB, new EjbAnnotationProcessor());
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_EJB_INJECTION_ANNOTATION, new EjbResourceInjectionAnnotationProcessor(appclient));
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_EJB_ASSEMBLY_DESC_DD, new AssemblyDescriptorProcessor());
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.DEPENDENCIES, Phase.DEPENDENCIES_EJB, new EjbDependencyDeploymentUnitProcessor());
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_EJB_HOME_MERGE, new HomeViewMergingProcessor(appclient));
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_EJB_REF, new EjbRefProcessor(appclient));
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_EJB_BUSINESS_VIEW_ANNOTATION, new BusinessViewAnnotationProcessor(appclient));
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_EJB_ORB_BIND, new IIOPJndiBindingProcessor());
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_EJB_JNDI_BINDINGS, new EjbJndiBindingsDeploymentUnitProcessor(appclient));
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_EJB_CLIENT_METADATA, new EJBClientDescriptorMetaDataProcessor(appclient));
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_EJB_DISCOVERY, new DiscoveryRegistrationProcessor(appclient));
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_EJB_DEFAULT_SECURITY_DOMAIN, EJB3SubsystemAdd.this.defaultSecurityDomainDeploymentProcessor);
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_EE_COMPONENT_SUSPEND, new EJBComponentSuspendDeploymentUnitProcessor());
// TODO: real phase numbers
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_EE_COMPONENT_SUSPEND + 1, new EjbClientContextSetupProcessor());
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_EE_COMPONENT_SUSPEND + 2, new StartupAwaitDeploymentUnitProcessor());
if (legacyJacc || elytronJacc) {
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.INSTALL, Phase.INSTALL_EJB_JACC_PROCESSING, new JaccEjbDeploymentProcessor(elytronJacc ? ELYTRON_JACC_CAPABILITY : LEGACY_JACC_CAPABILITY));
}
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.CLEANUP, Phase.CLEANUP_EJB, new EjbCleanUpProcessor());
if (!appclient) {
// add the metadata parser deployment processor
// Process @DependsOn after the @Singletons have been registered.
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_EJB_TIMERSERVICE_BINDING, new TimerServiceJndiBindingProcessor());
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_EJB_APPLICATION_EXCEPTION_ANNOTATION, new ApplicationExceptionAnnotationProcessor());
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_EJB_DD_INTERCEPTORS, new InterceptorClassDeploymentDescriptorProcessor());
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_EJB_SECURITY_ROLE_REF_DD, new SecurityRoleRefDDProcessor());
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_PASSIVATION_ANNOTATION, new PassivationAnnotationParsingProcessor());
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_EJB_IMPLICIT_NO_INTERFACE_VIEW, new ImplicitLocalViewProcessor());
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_EJB_APPLICATION_EXCEPTIONS, new ApplicationExceptionMergingProcessor());
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_EJB_DD_INTERCEPTORS, new DeploymentDescriptorInterceptorBindingsProcessor(ejbNameRegexService));
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_EJB_DD_METHOD_RESOLUTION, new DeploymentDescriptorMethodProcessor());
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_EJB_TRANSACTION_MANAGEMENT, new TransactionManagementMergingProcessor());
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_EJB_CONCURRENCY_MANAGEMENT_MERGE, new ConcurrencyManagementMergingProcessor());
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_EJB_CONCURRENCY_MERGE, new EjbConcurrencyMergingProcessor());
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_EJB_TX_ATTR_MERGE, new TransactionAttributeMergingProcessor());
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_EJB_RUN_AS_MERGE, new RunAsMergingProcessor());
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_EJB_RESOURCE_ADAPTER_MERGE, new ResourceAdaptorMergingProcessor());
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_EJB_CLUSTERED, new ClusteredSingletonMergingProcessor());
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_EJB_DELIVERY_ACTIVE_MERGE, new MdbDeliveryMergingProcessor());
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_EJB_REMOVE_METHOD, new RemoveMethodMergingProcessor());
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_EJB_STARTUP_MERGE, new StartupMergingProcessor());
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_EJB_SECURITY_DOMAIN, new SecurityDomainMergingProcessor());
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_EJB_SECURITY_MISSING_METHOD_PERMISSIONS, missingMethodPermissionsDenyAccessMergingProcessor);
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_EJB_ROLES, new DeclareRolesMergingProcessor());
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_METHOD_PERMISSIONS, new MethodPermissionsMergingProcessor());
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_EJB_STATEFUL_TIMEOUT, new StatefulTimeoutMergingProcessor());
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_EJB_SESSION_SYNCHRONIZATION, new SessionSynchronizationMergingProcessor());
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_EJB_INIT_METHOD, new InitMethodMergingProcessor());
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_EJB_SESSION_BEAN, new SessionBeanMergingProcessor());
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_EJB_SECURITY_PRINCIPAL_ROLE_MAPPING_MERGE, new SecurityRolesMergingProcessor());
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_LOCAL_HOME, new SessionBeanHomeProcessor());
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_EJB_CACHE, new CacheMergingProcessor());
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_EJB_SLSB_POOL_NAME_MERGE, new StatelessSessionBeanPoolMergingProcessor());
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_EJB_MDB_POOL_NAME_MERGE, new MessageDrivenBeanPoolMergingProcessor());
// Add the deployment unit processor responsible for processing the user application specific container interceptors configured in jboss-ejb3.xml
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_EJB_USER_APP_SPECIFIC_CONTAINER_INTERCEPTORS, new ContainerInterceptorBindingsDDProcessor());
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_EJB_HIBERNATE_VALIDATOR, new HibernateValidatorDeploymentUnitProcessor());
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.INSTALL, Phase.INSTALL_DEPENDS_ON_ANNOTATION, new EjbDependsOnMergingProcessor());
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.INSTALL, Phase.INSTALL_DEPLOYMENT_REPOSITORY, new DeploymentRepositoryProcessor());
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.INSTALL, Phase.INSTALL_EJB_MANAGEMENT_RESOURCES, new EjbManagementDeploymentUnitProcessor());
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.INSTALL, Phase.INSTALL_CACHE_DEPENDENCIES, new CacheDependenciesProcessor());
// TODO Phase: replace by Phase.INSTALL_MDB_DELIVERY_DEPENDENCIES
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.INSTALL, Phase.INSTALL_EE_MODULE_CONFIG + 1, new MdbDeliveryDependenciesProcessor());
if (model.hasDefined(SERVER_INTERCEPTORS)) {
final List<ServerInterceptorMetaData> serverInterceptors = new ArrayList<>();
final ModelNode serverInterceptorsNode = model.get(SERVER_INTERCEPTORS);
for (final ModelNode serverInterceptor : serverInterceptorsNode.asList()) {
serverInterceptors.add(new ServerInterceptorMetaData(serverInterceptor.get("module").asString(), serverInterceptor.get("class").asString()));
}
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.DEPENDENCIES, Phase.DEPENDENCIES_EJB_SERVER_INTERCEPTORS, new StaticInterceptorsDependenciesDeploymentUnitProcessor(serverInterceptors));
final ServerInterceptorCache serverInterceptorCache = new ServerInterceptorCache(serverInterceptors);
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_EJB_SERVER_INTERCEPTORS, new ServerInterceptorsBindingsProcessor(serverInterceptorCache));
}
if (model.hasDefined(CLIENT_INTERCEPTORS)) {
final List<ServerInterceptorMetaData> clientInterceptors = new ArrayList<>();
final ModelNode clientInterceptorsNode = model.get(CLIENT_INTERCEPTORS);
for (final ModelNode clientInterceptor : clientInterceptorsNode.asList()) {
clientInterceptors.add(new ServerInterceptorMetaData(clientInterceptor.get("module").asString(), clientInterceptor.get("class").asString()));
}
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.DEPENDENCIES, Phase.DEPENDENCIES_EJB_SERVER_INTERCEPTORS, new StaticInterceptorsDependenciesDeploymentUnitProcessor(clientInterceptors));
final ClientInterceptorCache clientInterceptorCache = new ClientInterceptorCache(clientInterceptors);
processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.DEPENDENCIES, Phase.POST_MODULE_EJB_SERVER_INTERCEPTORS, new ClientInterceptorsBindingsProcessor(clientInterceptorCache));
}
}
}
}, OperationContext.Stage.RUNTIME);
// todo maybe needs EJB3SubsystemRootResourceDefinition.DEFAULT_MDB_INSTANCE_POOL.resolveModelAttribute(context,model).isDefined()
if (model.hasDefined(DEFAULT_MDB_INSTANCE_POOL)) {
EJB3SubsystemDefaultPoolWriteHandler.MDB_POOL.updatePoolService(context, model);
}
if (model.hasDefined(DEFAULT_SLSB_INSTANCE_POOL)) {
EJB3SubsystemDefaultPoolWriteHandler.SLSB_POOL.updatePoolService(context, model);
}
if (model.hasDefined(DEFAULT_ENTITY_BEAN_INSTANCE_POOL)) {
EJB3SubsystemDefaultPoolWriteHandler.ENTITY_BEAN_POOL.updatePoolService(context, model);
}
if (model.hasDefined(DEFAULT_SFSB_CACHE)) {
EJB3SubsystemDefaultCacheWriteHandler.SFSB_CACHE.updateCacheService(context, model);
}
if (model.hasDefined(DEFAULT_SFSB_PASSIVATION_DISABLED_CACHE)) {
EJB3SubsystemDefaultCacheWriteHandler.SFSB_PASSIVATION_DISABLED_CACHE.updateCacheService(context, model);
}
if (model.hasDefined(DEFAULT_RESOURCE_ADAPTER_NAME)) {
DefaultResourceAdapterWriteHandler.INSTANCE.updateDefaultAdapterService(context, model);
}
if (model.hasDefined(DEFAULT_SINGLETON_BEAN_ACCESS_TIMEOUT)) {
DefaultSingletonBeanAccessTimeoutWriteHandler.INSTANCE.updateOrCreateDefaultSingletonBeanAccessTimeoutService(context, model);
}
if (model.hasDefined(DEFAULT_STATEFUL_BEAN_ACCESS_TIMEOUT)) {
DefaultStatefulBeanAccessTimeoutWriteHandler.INSTANCE.updateOrCreateDefaultStatefulBeanAccessTimeoutService(context, model);
}
if (model.hasDefined(DEFAULT_ENTITY_BEAN_OPTIMISTIC_LOCKING)) {
EJB3SubsystemDefaultEntityBeanOptimisticLockingWriteHandler.INSTANCE.updateOptimisticLocking(context, model);
}
ExceptionLoggingWriteHandler.INSTANCE.updateOrCreateDefaultExceptionLoggingEnabledService(context, model);
final ServiceTarget serviceTarget = context.getServiceTarget();
context.getServiceTarget().addService(DeploymentRepositoryService.SERVICE_NAME, new DeploymentRepositoryService()).install();
addRemoteInvocationServices(context, model, appclient);
// add clustering service
addClusteringServices(context, appclient);
// add user transaction access control service
final EJB3UserTransactionAccessControlService userTxAccessControlService = new EJB3UserTransactionAccessControlService();
context.getServiceTarget().addService(EJB3UserTransactionAccessControlService.SERVICE_NAME, userTxAccessControlService).addDependency(UserTransactionAccessControlService.SERVICE_NAME, UserTransactionAccessControlService.class, userTxAccessControlService.getUserTransactionAccessControlServiceInjector()).install();
// add ejb suspend handler service
boolean enableGracefulShutdown = EJB3SubsystemRootResourceDefinition.ENABLE_GRACEFUL_TXN_SHUTDOWN.resolveModelAttribute(context, model).asBoolean();
final EJBSuspendHandlerService ejbSuspendHandlerService = new EJBSuspendHandlerService(enableGracefulShutdown);
context.getServiceTarget().addService(EJBSuspendHandlerService.SERVICE_NAME, ejbSuspendHandlerService).addDependency(suspendControllerServiceName, SuspendController.class, ejbSuspendHandlerService.getSuspendControllerInjectedValue()).addDependency(TxnServices.JBOSS_TXN_LOCAL_TRANSACTION_CONTEXT, LocalTransactionContext.class, ejbSuspendHandlerService.getLocalTransactionContextInjectedValue()).addDependency(DeploymentRepositoryService.SERVICE_NAME, DeploymentRepository.class, ejbSuspendHandlerService.getDeploymentRepositoryInjectedValue()).install();
if (!appclient) {
// create the POA Registry use by iiop
final POARegistry poaRegistry = new POARegistry();
context.getServiceTarget().addService(POARegistry.SERVICE_NAME, poaRegistry).addDependency(CorbaPOAService.ROOT_SERVICE_NAME, POA.class, poaRegistry.getRootPOA()).setInitialMode(ServiceController.Mode.PASSIVE).install();
StatisticsEnabledWriteHandler.INSTANCE.updateToRuntime(context, model);
if (context.hasOptionalCapability(UNDERTOW_HTTP_INVOKER_CAPABILITY_NAME, EJB3SubsystemRootResourceDefinition.EJB_CAPABILITY.getName(), null)) {
EJB3RemoteHTTPService service = new EJB3RemoteHTTPService(FilterSpecClassResolverFilter.getFilterForOperationContext(context));
context.getServiceTarget().addService(EJB3RemoteHTTPService.SERVICE_NAME, service).addDependency(context.getCapabilityServiceName(UNDERTOW_HTTP_INVOKER_CAPABILITY_NAME, PathHandler.class), PathHandler.class, service.getPathHandlerInjectedValue()).addDependency(TxnServices.JBOSS_TXN_LOCAL_TRANSACTION_CONTEXT, LocalTransactionContext.class, service.getLocalTransactionContextInjectedValue()).addDependency(AssociationService.SERVICE_NAME, AssociationService.class, service.getAssociationServiceInjectedValue()).setInitialMode(ServiceController.Mode.PASSIVE).install();
}
}
}
Aggregations