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));
}
});
}
});
}
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());
}
});
}
});
}
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());
}
});
}
});
}
}
}
Aggregations