private static void processRef(final DeploymentUnit unit, final String type, final WSRefAnnotationWrapper annotation, final ClassInfo classInfo, final InjectionTarget injectionTarget, final String bindingName) throws DeploymentUnitProcessingException {
boolean isEJB = false;
final EEModuleDescription moduleDescription = unit.getAttachment(Attachments.EE_MODULE_DESCRIPTION);
final String componentClassName = classInfo.name().toString();
final Module module = unit.getAttachment(org.jboss.as.server.deployment.Attachments.MODULE);
for (final ComponentDescription componentDescription : moduleDescription.getComponentsByClassName(componentClassName)) {
if (componentDescription instanceof SessionBeanComponentDescription) {
isEJB = true;
final UnifiedServiceRefMetaData serviceRefUMDM = getServiceRef(unit, componentDescription, bindingName);
initServiceRef(unit, serviceRefUMDM, type, annotation);
processWSFeatures(unit, serviceRefUMDM, injectionTarget, classInfo);
// Create the binding from whence our injection comes.
final InjectionSource serviceRefSource = new WSRefValueSource(serviceRefUMDM, module.getClassLoader());
final BindingConfiguration bindingConfiguration = new BindingConfiguration(bindingName, serviceRefSource);
componentDescription.getBindingConfigurations().add(bindingConfiguration);
// our injection comes from the local lookup, no matter what.
final ResourceInjectionConfiguration injectionConfiguration = injectionTarget != null ? new ResourceInjectionConfiguration(injectionTarget, new LookupInjectionSource(bindingName)) : null;
if (injectionConfiguration != null) {
componentDescription.addResourceInjection(injectionConfiguration);
}
}
}
if (!isEJB) {
final UnifiedServiceRefMetaData serviceRefUMDM = getServiceRef(unit, null, bindingName);
initServiceRef(unit, serviceRefUMDM, type, annotation);
processWSFeatures(unit, serviceRefUMDM, injectionTarget, classInfo);
// TODO: class hierarchies? shared bindings?
final EEModuleClassDescription classDescription = moduleDescription.addOrGetLocalClassDescription(classInfo.name().toString());
// Create the binding from whence our injection comes.
final InjectionSource serviceRefSource = new WSRefValueSource(serviceRefUMDM, module.getClassLoader());
final BindingConfiguration bindingConfiguration = new BindingConfiguration(bindingName, serviceRefSource);
classDescription.getBindingConfigurations().add(bindingConfiguration);
// our injection comes from the local lookup, no matter what.
final ResourceInjectionConfiguration injectionConfiguration = injectionTarget != null ?
new ResourceInjectionConfiguration(injectionTarget, new LookupInjectionSource(bindingName)) : null;