Search in sources :

Example 1 with DeploymentRepository

use of org.jboss.as.ejb3.deployment.DeploymentRepository in project wildfly by wildfly.

the class EJB3SubsystemAdd method performBoottime.

@Override
protected void performBoottime(final OperationContext context, ModelNode operation, final ModelNode model) throws OperationFailedException {
    // Install the server association service
    final AssociationService associationService = new AssociationService();
    final ServiceBuilder<AssociationService> associationServiceBuilder = context.getServiceTarget().addService(AssociationService.SERVICE_NAME, associationService);
    associationServiceBuilder.addDependency(DeploymentRepository.SERVICE_NAME, DeploymentRepository.class, associationService.getDeploymentRepositoryInjector()).addDependency(RegistryCollectorService.SERVICE_NAME, RegistryCollector.class, associationService.getRegistryCollectorInjector()).addDependency(SuspendController.SERVICE_NAME, SuspendController.class, associationService.getSuspendControllerInjector()).addDependency(ServerEnvironmentService.SERVICE_NAME, ServerEnvironment.class, associationService.getServerEnvironmentServiceInjector()).setInitialMode(ServiceController.Mode.ACTIVE);
    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(DeploymentRepository.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);
    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));
            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());
            processorTarget.addDeploymentProcessor(EJB3Extension.SUBSYSTEM_NAME, Phase.INSTALL, Phase.INSTALL_EJB_JACC_PROCESSING, new JaccEjbDeploymentProcessor());
            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.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());
            }
        }
    }, 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(DeploymentRepository.SERVICE_NAME, new DeploymentRepository()).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(SuspendController.SERVICE_NAME, SuspendController.class, ejbSuspendHandlerService.getSuspendControllerInjectedValue()).addDependency(TxnServices.JBOSS_TXN_LOCAL_TRANSACTION_CONTEXT, LocalTransactionContext.class, ejbSuspendHandlerService.getLocalTransactionContextInjectedValue()).addDependency(DeploymentRepository.SERVICE_NAME, DeploymentRepository.class, ejbSuspendHandlerService.getDeploymentRepositoryInjectedValue()).install();
    if (!appclient) {
        final EJBUtilities utilities = new EJBUtilities();
        ServiceBuilder<EJBUtilities> ejbUtilsBuilder = serviceTarget.addService(EJBUtilities.SERVICE_NAME, utilities).addDependency(ConnectorServices.RA_REPOSITORY_SERVICE, ResourceAdapterRepository.class, utilities.getResourceAdapterRepositoryInjector()).addDependency(TxnServices.JBOSS_TXN_TRANSACTION_MANAGER, TransactionManager.class, utilities.getTransactionManagerInjector()).addDependency(TxnServices.JBOSS_TXN_SYNCHRONIZATION_REGISTRY, TransactionSynchronizationRegistry.class, utilities.getTransactionSynchronizationRegistryInjector()).addDependency(TxnServices.JBOSS_TXN_USER_TRANSACTION, UserTransaction.class, utilities.getUserTransactionInjector()).setInitialMode(ServiceController.Mode.ACTIVE);
        if (context.hasOptionalCapability(LEGACY_SECURITY_CAPABILITY_NAME, EJB3SubsystemRootResourceDefinition.EJB_CAPABILITY.getName(), null)) {
            ejbUtilsBuilder.addDependency(context.getCapabilityServiceName(LEGACY_SECURITY_CAPABILITY_NAME, ServerSecurityManager.class), ServerSecurityManager.class, utilities.getSecurityManagerInjector());
        }
        ejbUtilsBuilder.install();
        // 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();
        EnableStatisticsWriteHandler.INSTANCE.updateToRuntime(context, model);
        if (context.hasOptionalCapability(UNDERTOW_HTTP_INVOKER_CAPABILITY_NAME, EJB3SubsystemRootResourceDefinition.EJB_CAPABILITY.getName(), null)) {
            EJB3RemoteHTTPService service = new EJB3RemoteHTTPService();
            ServiceBuilder<EJB3RemoteHTTPService> builder = 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());
            builder.install();
        }
    }
}
Also used : EjbConcurrencyMergingProcessor(org.jboss.as.ejb3.deployment.processors.merging.EjbConcurrencyMergingProcessor) PathHandler(io.undertow.server.handlers.PathHandler) DynamicStubFactoryFactory(org.jboss.as.ejb3.iiop.stub.DynamicStubFactoryFactory) EJBComponentSuspendDeploymentUnitProcessor(org.jboss.as.ejb3.deployment.processors.EJBComponentSuspendDeploymentUnitProcessor) EjbDependsOnMergingProcessor(org.jboss.as.ejb3.deployment.processors.merging.EjbDependsOnMergingProcessor) EjbResourceInjectionAnnotationProcessor(org.jboss.as.ejb3.deployment.processors.EjbResourceInjectionAnnotationProcessor) AssemblyDescriptorProcessor(org.jboss.as.ejb3.deployment.processors.dd.AssemblyDescriptorProcessor) SecurityDomainMergingProcessor(org.jboss.as.ejb3.deployment.processors.merging.SecurityDomainMergingProcessor) DeploymentRepositoryProcessor(org.jboss.as.ejb3.deployment.processors.DeploymentRepositoryProcessor) MdbDeliveryDependenciesProcessor(org.jboss.as.ejb3.deployment.processors.MdbDeliveryDependenciesProcessor) EjbJndiBindingsDeploymentUnitProcessor(org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor) ServerEnvironment(org.jboss.as.server.ServerEnvironment) MdbDeliveryMergingProcessor(org.jboss.as.ejb3.deployment.processors.merging.MdbDeliveryMergingProcessor) InterceptorClassDeploymentDescriptorProcessor(org.jboss.as.ejb3.deployment.processors.dd.InterceptorClassDeploymentDescriptorProcessor) ImplicitLocalViewProcessor(org.jboss.as.ejb3.deployment.processors.ImplicitLocalViewProcessor) ServerSecurityManager(org.jboss.as.core.security.ServerSecurityManager) EJBClientDescriptorMetaDataProcessor(org.jboss.as.ejb3.deployment.processors.EJBClientDescriptorMetaDataProcessor) EjbDependencyDeploymentUnitProcessor(org.jboss.as.ejb3.deployment.processors.EjbDependencyDeploymentUnitProcessor) UserTransaction(javax.transaction.UserTransaction) ConcurrencyManagementMergingProcessor(org.jboss.as.ejb3.deployment.processors.merging.ConcurrencyManagementMergingProcessor) ServiceTarget(org.jboss.msc.service.ServiceTarget) EJBUtilities(org.jboss.as.ejb3.component.EJBUtilities) DeploymentDescriptorMethodProcessor(org.jboss.as.ejb3.deployment.processors.dd.DeploymentDescriptorMethodProcessor) EJB3RemoteHTTPService(org.jboss.as.ejb3.remote.http.EJB3RemoteHTTPService) EjbRefProcessor(org.jboss.as.ejb3.deployment.processors.EjbRefProcessor) StartupMergingProcessor(org.jboss.as.ejb3.deployment.processors.merging.StartupMergingProcessor) SessionSynchronizationMergingProcessor(org.jboss.as.ejb3.deployment.processors.merging.SessionSynchronizationMergingProcessor) MessageDrivenBeanPoolMergingProcessor(org.jboss.as.ejb3.deployment.processors.merging.MessageDrivenBeanPoolMergingProcessor) CacheDependenciesProcessor(org.jboss.as.ejb3.deployment.processors.CacheDependenciesProcessor) LocalTransactionContext(org.wildfly.transaction.client.LocalTransactionContext) TransactionAttributeMergingProcessor(org.jboss.as.ejb3.deployment.processors.merging.TransactionAttributeMergingProcessor) ApplicationExceptionAnnotationProcessor(org.jboss.as.ejb3.deployment.processors.ApplicationExceptionAnnotationProcessor) EjbJarParsingDeploymentUnitProcessor(org.jboss.as.ejb3.deployment.processors.EjbJarParsingDeploymentUnitProcessor) SessionBeanHomeProcessor(org.jboss.as.ejb3.deployment.processors.SessionBeanHomeProcessor) InitMethodMergingProcessor(org.jboss.as.ejb3.deployment.processors.merging.InitMethodMergingProcessor) TransactionManager(javax.transaction.TransactionManager) EjbManagementDeploymentUnitProcessor(org.jboss.as.ejb3.deployment.processors.EjbManagementDeploymentUnitProcessor) EjbAnnotationProcessor(org.jboss.as.ejb3.deployment.processors.annotation.EjbAnnotationProcessor) AbstractDeploymentChainStep(org.jboss.as.server.AbstractDeploymentChainStep) EjbClientContextSetupProcessor(org.jboss.as.ejb3.deployment.processors.EjbClientContextSetupProcessor) UserTransactionAccessControlService(org.jboss.as.txn.service.UserTransactionAccessControlService) ModelNode(org.jboss.dmr.ModelNode) PassivationAnnotationParsingProcessor(org.jboss.as.ejb3.deployment.processors.PassivationAnnotationParsingProcessor) DeclareRolesMergingProcessor(org.jboss.as.ejb3.deployment.processors.merging.DeclareRolesMergingProcessor) MethodPermissionsMergingProcessor(org.jboss.as.ejb3.deployment.processors.merging.MethodPermissionsMergingProcessor) POARegistry(org.jboss.as.ejb3.iiop.POARegistry) HomeViewMergingProcessor(org.jboss.as.ejb3.deployment.processors.merging.HomeViewMergingProcessor) CacheMergingProcessor(org.jboss.as.ejb3.deployment.processors.merging.CacheMergingProcessor) AnnotatedEJBComponentDescriptionDeploymentUnitProcessor(org.jboss.as.ejb3.deployment.processors.AnnotatedEJBComponentDescriptionDeploymentUnitProcessor) StatelessSessionBeanPoolMergingProcessor(org.jboss.as.ejb3.deployment.processors.merging.StatelessSessionBeanPoolMergingProcessor) EjbDefaultDistinctNameProcessor(org.jboss.as.ejb3.deployment.processors.EjbDefaultDistinctNameProcessor) TransactionManagementMergingProcessor(org.jboss.as.ejb3.deployment.processors.merging.TransactionManagementMergingProcessor) IIOPJndiBindingProcessor(org.jboss.as.ejb3.deployment.processors.IIOPJndiBindingProcessor) TimerServiceJndiBindingProcessor(org.jboss.as.ejb3.deployment.processors.TimerServiceJndiBindingProcessor) EJBSuspendHandlerService(org.jboss.as.ejb3.suspend.EJBSuspendHandlerService) BusinessViewAnnotationProcessor(org.jboss.as.ejb3.deployment.processors.BusinessViewAnnotationProcessor) DeploymentRepository(org.jboss.as.ejb3.deployment.DeploymentRepository) RemoveMethodMergingProcessor(org.jboss.as.ejb3.deployment.processors.merging.RemoveMethodMergingProcessor) SuspendController(org.jboss.as.server.suspend.SuspendController) EjbCleanUpProcessor(org.jboss.as.ejb3.deployment.processors.EjbCleanUpProcessor) RemoteObjectSubstitutionService(org.jboss.as.ejb3.iiop.RemoteObjectSubstitutionService) RegistryCollector(org.jboss.as.ejb3.remote.RegistryCollector) DeploymentDescriptorInterceptorBindingsProcessor(org.jboss.as.ejb3.deployment.processors.dd.DeploymentDescriptorInterceptorBindingsProcessor) ResourceAdaptorMergingProcessor(org.jboss.as.ejb3.deployment.processors.merging.ResourceAdaptorMergingProcessor) JBossAllXmlParserRegisteringProcessor(org.jboss.as.server.deployment.jbossallxml.JBossAllXmlParserRegisteringProcessor) StartupAwaitDeploymentUnitProcessor(org.jboss.as.ejb3.deployment.processors.StartupAwaitDeploymentUnitProcessor) ContainerInterceptorBindingsDDProcessor(org.jboss.as.ejb3.deployment.processors.dd.ContainerInterceptorBindingsDDProcessor) ApplicationExceptionMergingProcessor(org.jboss.as.ejb3.deployment.processors.merging.ApplicationExceptionMergingProcessor) EjbJarJBossAllParser(org.jboss.as.ejb3.deployment.processors.EjbJarJBossAllParser) RunAsMergingProcessor(org.jboss.as.ejb3.deployment.processors.merging.RunAsMergingProcessor) AssociationService(org.jboss.as.ejb3.remote.AssociationService) SecurityRolesMergingProcessor(org.jboss.as.ejb3.deployment.processors.merging.SecurityRolesMergingProcessor) DeploymentProcessorTarget(org.jboss.as.server.DeploymentProcessorTarget) SecurityRoleRefDDProcessor(org.jboss.as.ejb3.deployment.processors.dd.SecurityRoleRefDDProcessor) DiscoveryRegistrationProcessor(org.jboss.as.ejb3.deployment.processors.DiscoveryRegistrationProcessor) SessionBeanMergingProcessor(org.jboss.as.ejb3.deployment.processors.merging.SessionBeanMergingProcessor) ClusteredSingletonMergingProcessor(org.jboss.as.ejb3.deployment.processors.merging.ClusteredSingletonMergingProcessor) JaccEjbDeploymentProcessor(org.jboss.as.ejb3.deployment.processors.security.JaccEjbDeploymentProcessor) SessionBeanXmlDescriptorProcessor(org.jboss.as.ejb3.deployment.processors.dd.SessionBeanXmlDescriptorProcessor) StatefulTimeoutMergingProcessor(org.jboss.as.ejb3.deployment.processors.merging.StatefulTimeoutMergingProcessor) EjbContextJndiBindingProcessor(org.jboss.as.ejb3.deployment.processors.EjbContextJndiBindingProcessor)

Example 2 with DeploymentRepository

use of org.jboss.as.ejb3.deployment.DeploymentRepository in project wildfly by wildfly.

the class RemoteObjectSubstitutionService method writeReplaceRemote.

@Override
public Object writeReplaceRemote(final Object object) {
    final DeploymentRepository deploymentRepository = deploymentRepositoryInjectedValue.getOptionalValue();
    // if we are not started yet just return
    if (deploymentRepository == null) {
        return object;
    }
    if (EJBClient.isEJBProxy(object)) {
        return createIIOPReferenceForBean(object, deploymentRepository);
    } else if (object instanceof EJBHandle) {
        final EJBHandle<?> handle = (EJBHandle<?>) object;
        final EJBLocator<?> locator = handle.getLocator();
        final EjbIIOPService factory = serviceForLocator(locator, deploymentRepository);
        if (factory != null) {
            return factory.handleForLocator(locator);
        }
    } else if (object instanceof EJBHomeHandle) {
        final EJBHomeHandle<?> handle = (EJBHomeHandle<?>) object;
        final EJBLocator<?> locator = handle.getLocator();
        final EjbIIOPService factory = serviceForLocator(locator, deploymentRepository);
        if (factory != null) {
            return factory.handleForLocator(locator);
        }
    } else if (object instanceof EJBMetaDataImpl) {
        final EJBMetaDataImpl metadata = (EJBMetaDataImpl) object;
        Class<?> pk = null;
        if (!metadata.isSession()) {
            pk = metadata.getPrimaryKeyClass();
        }
        final EJBLocator<?> locator = EJBClient.getLocatorFor(metadata.getEJBHome());
        final EjbIIOPService factory = serviceForLocator(locator, deploymentRepository);
        if (factory != null) {
            return new EJBMetaDataImplIIOP(metadata.getRemoteInterfaceClass(), metadata.getHomeInterfaceClass(), pk, metadata.isSession(), metadata.isStatelessSession(), (HomeHandle) factory.handleForLocator(locator));
        }
    } else if (object instanceof AbstractEJBMetaData) {
        final AbstractEJBMetaData<?, ?> metadata = (AbstractEJBMetaData<?, ?>) object;
        final EJBHomeLocator<?> locator = metadata.getHomeLocator();
        final EjbIIOPService factory = serviceForLocator(locator, deploymentRepository);
        Class<?> pk = metadata instanceof EntityEJBMetaData ? metadata.getPrimaryKeyClass() : null;
        if (factory != null) {
            return new EJBMetaDataImplIIOP(metadata.getRemoteInterfaceClass(), metadata.getHomeInterfaceClass(), pk, metadata.isSession(), metadata.isStatelessSession(), (HomeHandle) factory.handleForLocator(locator));
        }
    }
    return object;
}
Also used : AbstractEJBMetaData(org.jboss.ejb.client.AbstractEJBMetaData) EntityEJBMetaData(org.jboss.ejb.client.EntityEJBMetaData) EJBHandle(org.jboss.ejb.client.EJBHandle) EJBMetaDataImpl(org.jboss.ejb.client.EJBMetaDataImpl) EJBHomeHandle(org.jboss.ejb.client.EJBHomeHandle) HomeHandle(javax.ejb.HomeHandle) EJBHomeHandle(org.jboss.ejb.client.EJBHomeHandle) EJBMetaDataImplIIOP(org.jboss.ejb.iiop.EJBMetaDataImplIIOP) DeploymentRepository(org.jboss.as.ejb3.deployment.DeploymentRepository) EJBLocator(org.jboss.ejb.client.EJBLocator)

Example 3 with DeploymentRepository

use of org.jboss.as.ejb3.deployment.DeploymentRepository in project wildfly by wildfly.

the class RemoteObjectSubstitutionService method serviceForLocator.

private EjbIIOPService serviceForLocator(final EJBLocator<?> locator, DeploymentRepository deploymentRepository) {
    final ModuleDeployment module = deploymentRepository.getModules().get(new DeploymentModuleIdentifier(locator.getAppName(), locator.getModuleName(), locator.getDistinctName()));
    if (module == null) {
        EjbLogger.ROOT_LOGGER.couldNotFindEjbForLocatorIIOP(locator);
        return null;
    }
    final EjbDeploymentInformation ejb = module.getEjbs().get(locator.getBeanName());
    if (ejb == null) {
        EjbLogger.ROOT_LOGGER.couldNotFindEjbForLocatorIIOP(locator);
        return null;
    }
    final EjbIIOPService factory = ejb.getIorFactory();
    if (factory == null) {
        EjbLogger.ROOT_LOGGER.ejbNotExposedOverIIOP(locator);
        return null;
    }
    return factory;
}
Also used : ModuleDeployment(org.jboss.as.ejb3.deployment.ModuleDeployment) EjbDeploymentInformation(org.jboss.as.ejb3.deployment.EjbDeploymentInformation) DeploymentModuleIdentifier(org.jboss.as.ejb3.deployment.DeploymentModuleIdentifier)

Example 4 with DeploymentRepository

use of org.jboss.as.ejb3.deployment.DeploymentRepository in project wildfly by wildfly.

the class AssociationImpl method registerModuleAvailabilityListener.

@Override
public ListenerHandle registerModuleAvailabilityListener(@NotNull final ModuleAvailabilityListener moduleAvailabilityListener) {
    final DeploymentRepositoryListener listener = new DeploymentRepositoryListener() {

        @Override
        public void listenerAdded(final DeploymentRepository repository) {
            List<EJBModuleIdentifier> list = new ArrayList<>();
            if (!repositoryIsSuspended()) {
                // only send out the initial list if the deployment repository (i.e. the server + clean transaction state) is not in a suspended state
                for (DeploymentModuleIdentifier deploymentModuleIdentifier : repository.getModules().keySet()) {
                    EJBModuleIdentifier ejbModuleIdentifier = toModuleIdentifier(deploymentModuleIdentifier);
                    list.add(ejbModuleIdentifier);
                }
                EjbLogger.EJB3_INVOCATION_LOGGER.debugf("Sending initial module availability to connecting client: server is not suspended");
            } else {
                // send out empty list if the deploymentRepository is suspended
                EjbLogger.EJB3_INVOCATION_LOGGER.debugf("Sending empty initial module availability to connecting client: server is suspended");
            }
            moduleAvailabilityListener.moduleAvailable(list);
        }

        @Override
        public void deploymentAvailable(final DeploymentModuleIdentifier deployment, final ModuleDeployment moduleDeployment) {
        }

        @Override
        public void deploymentStarted(final DeploymentModuleIdentifier deployment, final ModuleDeployment moduleDeployment) {
            // only send out moduleAvailability until module has started (WFLY-13009)
            moduleAvailabilityListener.moduleAvailable(Collections.singletonList(toModuleIdentifier(deployment)));
        }

        @Override
        public void deploymentRemoved(final DeploymentModuleIdentifier deployment) {
            moduleAvailabilityListener.moduleUnavailable(Collections.singletonList(toModuleIdentifier(deployment)));
        }

        @Override
        public void deploymentSuspended(DeploymentModuleIdentifier deployment) {
            moduleAvailabilityListener.moduleUnavailable(Collections.singletonList(toModuleIdentifier(deployment)));
        }

        @Override
        public void deploymentResumed(DeploymentModuleIdentifier deployment) {
            moduleAvailabilityListener.moduleAvailable(Collections.singletonList(toModuleIdentifier(deployment)));
        }

        private boolean repositoryIsSuspended() {
            return deploymentRepository.isSuspended();
        }
    };
    deploymentRepository.addListener(listener);
    return () -> deploymentRepository.removeListener(listener);
}
Also used : ModuleDeployment(org.jboss.as.ejb3.deployment.ModuleDeployment) EJBModuleIdentifier(org.jboss.ejb.client.EJBModuleIdentifier) DeploymentRepositoryListener(org.jboss.as.ejb3.deployment.DeploymentRepositoryListener) ArrayList(java.util.ArrayList) DeploymentModuleIdentifier(org.jboss.as.ejb3.deployment.DeploymentModuleIdentifier) DeploymentRepository(org.jboss.as.ejb3.deployment.DeploymentRepository)

Example 5 with DeploymentRepository

use of org.jboss.as.ejb3.deployment.DeploymentRepository in project wildfly by wildfly.

the class RegisterManagementEJBService method start.

@Override
public void start(StartContext context) throws StartException {
    final DeploymentRepository repository = deploymentRepositoryValue.getValue();
    moduleIdentifier = new DeploymentModuleIdentifier(APP_NAME, MODULE_NAME, DISTINCT_NAME);
    final InjectedValue<ComponentView> injectedHomeView = new InjectedValue<ComponentView>();
    injectedHomeView.setValue(new ImmediateValue<ComponentView>(new ManagementHomeEjbComponentView()));
    final InjectedValue<ComponentView> injectedRemoteView = new InjectedValue<ComponentView>();
    injectedRemoteView.setValue(new ImmediateValue<ComponentView>(new ManagementRemoteEjbComponentView(mbeanServerValue.getValue())));
    Map<String, InjectedValue<ComponentView>> views = new HashMap<String, InjectedValue<ComponentView>>();
    views.put(ManagementHome.class.getName(), injectedHomeView);
    views.put(Management.class.getName(), injectedRemoteView);
    final EjbDeploymentInformation ejb = new ManagementEjbDeploymentInformation(EJB_NAME, views, SecurityActions.getClassLoader(this.getClass()));
    final ModuleDeployment deployment = new ModuleDeployment(moduleIdentifier, Collections.singletonMap(EJB_NAME, ejb));
    repository.add(moduleIdentifier, deployment);
    repository.startDeployment(moduleIdentifier);
    doPrivileged((PrivilegedAction<Void>) () -> {
        final ClassLoader classLoader = getClass().getClassLoader();
        EJBClientContext.getContextManager().setClassLoaderDefault(classLoader, ejbClientContextValue.getValue().getClientContext());
        Discovery.getContextManager().setClassLoaderDefault(classLoader, Discovery.create(associationServiceInjector.getValue().getLocalDiscoveryProvider()));
        return null;
    });
}
Also used : InjectedValue(org.jboss.msc.value.InjectedValue) ManagementEjbDeploymentInformation(org.jboss.as.jsr77.ejb.ManagementEjbDeploymentInformation) EjbDeploymentInformation(org.jboss.as.ejb3.deployment.EjbDeploymentInformation) HashMap(java.util.HashMap) Management(javax.management.j2ee.Management) ManagementHomeEjbComponentView(org.jboss.as.jsr77.ejb.ManagementHomeEjbComponentView) ManagementEjbDeploymentInformation(org.jboss.as.jsr77.ejb.ManagementEjbDeploymentInformation) ManagementRemoteEjbComponentView(org.jboss.as.jsr77.ejb.ManagementRemoteEjbComponentView) ManagementHome(javax.management.j2ee.ManagementHome) ModuleDeployment(org.jboss.as.ejb3.deployment.ModuleDeployment) ManagementHomeEjbComponentView(org.jboss.as.jsr77.ejb.ManagementHomeEjbComponentView) ManagementRemoteEjbComponentView(org.jboss.as.jsr77.ejb.ManagementRemoteEjbComponentView) ComponentView(org.jboss.as.ee.component.ComponentView) DeploymentModuleIdentifier(org.jboss.as.ejb3.deployment.DeploymentModuleIdentifier) DeploymentRepository(org.jboss.as.ejb3.deployment.DeploymentRepository)

Aggregations

DeploymentRepository (org.jboss.as.ejb3.deployment.DeploymentRepository)4 DeploymentModuleIdentifier (org.jboss.as.ejb3.deployment.DeploymentModuleIdentifier)3 ModuleDeployment (org.jboss.as.ejb3.deployment.ModuleDeployment)3 EjbDeploymentInformation (org.jboss.as.ejb3.deployment.EjbDeploymentInformation)2 PathHandler (io.undertow.server.handlers.PathHandler)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 HomeHandle (javax.ejb.HomeHandle)1 Management (javax.management.j2ee.Management)1 ManagementHome (javax.management.j2ee.ManagementHome)1 TransactionManager (javax.transaction.TransactionManager)1 UserTransaction (javax.transaction.UserTransaction)1 ServerSecurityManager (org.jboss.as.core.security.ServerSecurityManager)1 ComponentView (org.jboss.as.ee.component.ComponentView)1 EJBUtilities (org.jboss.as.ejb3.component.EJBUtilities)1 DeploymentRepositoryListener (org.jboss.as.ejb3.deployment.DeploymentRepositoryListener)1 AnnotatedEJBComponentDescriptionDeploymentUnitProcessor (org.jboss.as.ejb3.deployment.processors.AnnotatedEJBComponentDescriptionDeploymentUnitProcessor)1 ApplicationExceptionAnnotationProcessor (org.jboss.as.ejb3.deployment.processors.ApplicationExceptionAnnotationProcessor)1 BusinessViewAnnotationProcessor (org.jboss.as.ejb3.deployment.processors.BusinessViewAnnotationProcessor)1 CacheDependenciesProcessor (org.jboss.as.ejb3.deployment.processors.CacheDependenciesProcessor)1