Search in sources :

Example 11 with DependencyConfigurator

use of org.jboss.as.ee.component.DependencyConfigurator in project wildfly by wildfly.

the class EJBComponentDescription method setupRemoteView.

protected void setupRemoteView(final EJBViewDescription viewDescription) {
    viewDescription.getConfigurators().add(new ViewConfigurator() {

        @Override
        public void configure(final DeploymentPhaseContext context, final ComponentConfiguration componentConfiguration, final ViewDescription description, final ViewConfiguration configuration) throws DeploymentUnitProcessingException {
            configuration.getDependencies().add(new DependencyConfigurator<ViewService>() {

                @Override
                public void configureDependency(final ServiceBuilder<?> serviceBuilder, final ViewService service) throws DeploymentUnitProcessingException {
                    CapabilityServiceSupport support = context.getDeploymentUnit().getAttachment(org.jboss.as.server.deployment.Attachments.CAPABILITY_SERVICE_SUPPORT);
                    serviceBuilder.requires(support.getCapabilityServiceName(EJB3RemoteResourceDefinition.EJB_REMOTE_CAPABILITY_NAME));
                }
            });
        }
    });
}
Also used : NamespaceViewConfigurator(org.jboss.as.ee.component.NamespaceViewConfigurator) EJBSecurityViewConfigurator(org.jboss.as.ejb3.security.EJBSecurityViewConfigurator) ViewConfigurator(org.jboss.as.ee.component.ViewConfigurator) ComponentConfiguration(org.jboss.as.ee.component.ComponentConfiguration) DeploymentUnitProcessingException(org.jboss.as.server.deployment.DeploymentUnitProcessingException) ViewConfiguration(org.jboss.as.ee.component.ViewConfiguration) ViewDescription(org.jboss.as.ee.component.ViewDescription) DependencyConfigurator(org.jboss.as.ee.component.DependencyConfigurator) ViewService(org.jboss.as.ee.component.ViewService) DeploymentPhaseContext(org.jboss.as.server.deployment.DeploymentPhaseContext) ServiceBuilder(org.jboss.msc.service.ServiceBuilder) CapabilityServiceSupport(org.jboss.as.controller.capability.CapabilityServiceSupport)

Example 12 with DependencyConfigurator

use of org.jboss.as.ee.component.DependencyConfigurator in project wildfly by wildfly.

the class EJBComponentDescription method addTransactionManagerDependencies.

/**
 * Sets up a {@link ComponentConfigurator} which then sets up the relevant dependencies on the transaction manager services for the {@link EJBComponentCreateService}
 */
protected void addTransactionManagerDependencies() {
    this.getConfigurators().add(new ComponentConfigurator() {

        @Override
        public void configure(final DeploymentPhaseContext context, final ComponentDescription description, final ComponentConfiguration componentConfiguration) throws DeploymentUnitProcessingException {
            componentConfiguration.getCreateDependencies().add(new DependencyConfigurator<EJBComponentCreateService>() {

                @Override
                public void configureDependency(final ServiceBuilder<?> serviceBuilder, final EJBComponentCreateService ejbComponentCreateService) throws DeploymentUnitProcessingException {
                    CapabilityServiceSupport support = context.getDeploymentUnit().getAttachment(org.jboss.as.server.deployment.Attachments.CAPABILITY_SERVICE_SUPPORT);
                    // add dependency on the local transaction provider
                    serviceBuilder.requires(support.getCapabilityServiceName(TRANSACTION_GLOBAL_DEFAULT_LOCAL_PROVIDER_CAPABILITY_NAME));
                    // add dependency on TransactionSynchronizationRegistry
                    serviceBuilder.addDependency(support.getCapabilityServiceName(TRANSACTION_SYNCHRONIZATION_REGISTRY_CAPABILITY_NAME), TransactionSynchronizationRegistry.class, ejbComponentCreateService.getTransactionSynchronizationRegistryInjector());
                }
            });
        }
    });
}
Also used : ComponentConfiguration(org.jboss.as.ee.component.ComponentConfiguration) DeploymentUnitProcessingException(org.jboss.as.server.deployment.DeploymentUnitProcessingException) ComponentDescription(org.jboss.as.ee.component.ComponentDescription) ComponentConfigurator(org.jboss.as.ee.component.ComponentConfigurator) DependencyConfigurator(org.jboss.as.ee.component.DependencyConfigurator) DeploymentPhaseContext(org.jboss.as.server.deployment.DeploymentPhaseContext) ServiceBuilder(org.jboss.msc.service.ServiceBuilder) CapabilityServiceSupport(org.jboss.as.controller.capability.CapabilityServiceSupport)

Example 13 with DependencyConfigurator

use of org.jboss.as.ee.component.DependencyConfigurator in project wildfly by wildfly.

the class EJBComponentSuspendDeploymentUnitProcessor method deploy.

@Override
public void deploy(DeploymentPhaseContext context) {
    final DeploymentUnit deploymentUnit = context.getDeploymentUnit();
    final String topLevelName;
    // check if the controller is installed
    if (!RequestControllerActivationMarker.isRequestControllerEnabled(deploymentUnit)) {
        return;
    }
    if (deploymentUnit.getParent() == null) {
        topLevelName = deploymentUnit.getName();
    } else {
        topLevelName = deploymentUnit.getParent().getName();
    }
    for (ComponentDescription component : deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION).getComponentDescriptions()) {
        if (component instanceof EJBComponentDescription) {
            final String entryPoint = ENTRY_POINT_NAME + deploymentUnit.getName() + "." + component.getComponentName();
            ControlPointService.install(context.getServiceTarget(), topLevelName, entryPoint);
            component.getConfigurators().add(new ComponentConfigurator() {

                @Override
                public void configure(DeploymentPhaseContext context, ComponentDescription description, ComponentConfiguration configuration) {
                    EjbSuspendInterceptor interceptor = null;
                    ImmediateInterceptorFactory factory = null;
                    for (ViewConfiguration view : configuration.getViews()) {
                        EJBViewConfiguration ejbView = (EJBViewConfiguration) view;
                        if (INTERFACES.contains(ejbView.getMethodIntf())) {
                            if (factory == null) {
                                interceptor = new EjbSuspendInterceptor();
                                factory = new ImmediateInterceptorFactory(interceptor);
                            }
                            view.addViewInterceptor(factory, InterceptorOrder.View.GRACEFUL_SHUTDOWN);
                        }
                    }
                    configuration.getCreateDependencies().add(new DependencyConfigurator<EJBComponentCreateService>() {

                        @Override
                        public void configureDependency(ServiceBuilder<?> serviceBuilder, EJBComponentCreateService service) {
                            serviceBuilder.addDependency(ControlPointService.serviceName(topLevelName, entryPoint), ControlPoint.class, service.getControlPointInjector());
                        }
                    });
                }
            });
        }
    }
}
Also used : EJBComponentDescription(org.jboss.as.ejb3.component.EJBComponentDescription) ComponentDescription(org.jboss.as.ee.component.ComponentDescription) ComponentConfigurator(org.jboss.as.ee.component.ComponentConfigurator) EJBViewConfiguration(org.jboss.as.ejb3.component.EJBViewConfiguration) DependencyConfigurator(org.jboss.as.ee.component.DependencyConfigurator) EJBComponentDescription(org.jboss.as.ejb3.component.EJBComponentDescription) DeploymentPhaseContext(org.jboss.as.server.deployment.DeploymentPhaseContext) ServiceBuilder(org.jboss.msc.service.ServiceBuilder) ComponentConfiguration(org.jboss.as.ee.component.ComponentConfiguration) ViewConfiguration(org.jboss.as.ee.component.ViewConfiguration) EJBViewConfiguration(org.jboss.as.ejb3.component.EJBViewConfiguration) ImmediateInterceptorFactory(org.jboss.invocation.ImmediateInterceptorFactory) EJBComponentCreateService(org.jboss.as.ejb3.component.EJBComponentCreateService) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit)

Aggregations

DependencyConfigurator (org.jboss.as.ee.component.DependencyConfigurator)13 DeploymentUnitProcessingException (org.jboss.as.server.deployment.DeploymentUnitProcessingException)12 ServiceBuilder (org.jboss.msc.service.ServiceBuilder)12 ComponentConfiguration (org.jboss.as.ee.component.ComponentConfiguration)11 DeploymentPhaseContext (org.jboss.as.server.deployment.DeploymentPhaseContext)11 ComponentConfigurator (org.jboss.as.ee.component.ComponentConfigurator)8 ComponentDescription (org.jboss.as.ee.component.ComponentDescription)8 ViewConfiguration (org.jboss.as.ee.component.ViewConfiguration)7 CapabilityServiceSupport (org.jboss.as.controller.capability.CapabilityServiceSupport)6 ComponentStartService (org.jboss.as.ee.component.ComponentStartService)6 ImmediateInterceptorFactory (org.jboss.invocation.ImmediateInterceptorFactory)6 Method (java.lang.reflect.Method)4 ComponentView (org.jboss.as.ee.component.ComponentView)4 ViewDescription (org.jboss.as.ee.component.ViewDescription)4 ViewService (org.jboss.as.ee.component.ViewService)4 ServiceName (org.jboss.msc.service.ServiceName)4 HashSet (java.util.HashSet)3 Component (org.jboss.as.ee.component.Component)3 EEApplicationClasses (org.jboss.as.ee.component.EEApplicationClasses)3 ViewConfigurator (org.jboss.as.ee.component.ViewConfigurator)3