private int value = 0;
}
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final EEApplicationDescription applicationDescription = deploymentUnit.getAttachment(Attachments.EE_APPLICATION_DESCRIPTION);
final EEModuleConfiguration moduleConfiguration = deploymentUnit.getAttachment(Attachments.EE_MODULE_CONFIGURATION);
if (moduleConfiguration == null) {
return;
}
final Set<ServiceName> dependencies = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.JNDI_DEPENDENCIES);
final Map<ServiceName, BindingConfiguration> deploymentDescriptorBindings = new HashMap<ServiceName, BindingConfiguration>();
// bindings
// Handle duplicates binding from the same source
// TODO: Should the view configuration just return a Set instead of a List? Or is there a better way to
// handle these duplicates?
IntHolder moduleCount = new IntHolder();
final List<BindingConfiguration> bindingConfigurations = moduleConfiguration.getBindingConfigurations();
final ServiceName moduleOwnerName = deploymentUnit.getServiceName().append("module").append(moduleConfiguration.getApplicationName()).append(moduleConfiguration.getModuleName());
for (BindingConfiguration binding : bindingConfigurations) {
final ContextNames.BindInfo bindInfo = ContextNames.bindInfoForEnvEntry(moduleConfiguration.getApplicationName(), moduleConfiguration.getModuleName(), null, false, binding.getName());
deploymentDescriptorBindings.put(bindInfo.getBinderServiceName(), binding);
addJndiBinding(moduleConfiguration, binding, phaseContext, bindInfo.getBinderServiceName(), moduleOwnerName, moduleCount, dependencies);
}
//now we process all component level bindings, for components that do not have their own java:comp namespace.
// these are bindings that have been added via a deployment descriptor
for (final ComponentConfiguration componentConfiguration : moduleConfiguration.getComponentConfigurations()) {
// TODO: Should the view configuration just return a Set instead of a List? Or is there a better way to
// handle these duplicates?
for (BindingConfiguration binding : componentConfiguration.getComponentDescription().getBindingConfigurations()) {
final String bindingName = binding.getName();
final boolean compBinding = bindingName.startsWith("java:comp") || !bindingName.startsWith("java:");
if (componentConfiguration.getComponentDescription().getNamingMode() == ComponentNamingMode.CREATE && compBinding) {
//components with there own comp context do their own binding
continue;
}
final ContextNames.BindInfo bindInfo = ContextNames.bindInfoForEnvEntry(moduleConfiguration.getApplicationName(), moduleConfiguration.getModuleName(), null, false, binding.getName());
deploymentDescriptorBindings.put(bindInfo.getBinderServiceName(), binding);
addJndiBinding(moduleConfiguration, binding, phaseContext, bindInfo.getBinderServiceName(), moduleOwnerName, moduleCount, dependencies);
}
}
//now add all class level bindings
final Set<String> handledClasses = new HashSet<String>();
for (final ComponentConfiguration componentConfiguration : moduleConfiguration.getComponentConfigurations()) {
final Set<EEModuleClassConfiguration> classConfigurations = new HashSet<EEModuleClassConfiguration>();
classConfigurations.add(componentConfiguration.getModuleClassConfiguration());
for (final InterceptorDescription interceptor : componentConfiguration.getComponentDescription().getAllInterceptors()) {
final EEModuleClassConfiguration interceptorClass = applicationDescription.getClassConfiguration(interceptor.getInterceptorClassName());
if (interceptorClass != null) {
classConfigurations.add(interceptorClass);
}
}
processClassConfigurations(phaseContext, applicationDescription, moduleConfiguration, deploymentDescriptorBindings, handledClasses, componentConfiguration.getComponentDescription().getNamingMode(), classConfigurations, componentConfiguration.getComponentName(), moduleOwnerName, moduleCount, dependencies);