use of org.jboss.as.ejb3.timerservice.TimerServiceBindingSource in project wildfly by wildfly.
the class TimerServiceJndiBindingProcessor method processComponentConfig.
@Override
protected void processComponentConfig(DeploymentUnit deploymentUnit, DeploymentPhaseContext phaseContext, CompositeIndex index, ComponentDescription componentDescription) throws DeploymentUnitProcessingException {
if (!(componentDescription instanceof EJBComponentDescription)) {
// Only process EJBs
return;
}
// if the EJB is packaged in a .war, then we need to bind the java:comp/TimerService only once for the entire module
if (componentDescription.getNamingMode() != ComponentNamingMode.CREATE) {
// get the module description
final EEModuleDescription moduleDescription = componentDescription.getModuleDescription();
// the java:module/TimerService binding configuration
// Note that we bind to java:module/TimerService since it's a .war. End users can still lookup java:comp/TimerService
// and that will internally get translated to java:module/TimerService for .war, since java:comp == java:module in
// a web ENC. So binding to java:module/TimerService is OK.
final BindingConfiguration timerServiceBinding = new BindingConfiguration("java:module/TimerService", new TimerServiceBindingSource());
moduleDescription.getBindingConfigurations().add(timerServiceBinding);
} else {
// EJB packaged outside of a .war. So process normally.
// add the binding configuration to the component description
final BindingConfiguration timerServiceBinding = new BindingConfiguration("java:comp/TimerService", new TimerServiceBindingSource());
componentDescription.getBindingConfigurations().add(timerServiceBinding);
}
}
Aggregations