public EjbDescriptorImpl(EJBComponentDescription componentDescription, BeanDeploymentArchiveImpl beanDeploymentArchive, final DeploymentReflectionIndex reflectionIndex) {
final SessionBeanComponentDescription description = componentDescription instanceof SessionBeanComponentDescription ? (SessionBeanComponentDescription) componentDescription : null;
final Set<BusinessInterfaceDescriptor<?>> localInterfaces = new HashSet<BusinessInterfaceDescriptor<?>>();
final Set<BusinessInterfaceDescriptor<?>> remoteInterfaces = new HashSet<BusinessInterfaceDescriptor<?>>();
final ResourceLoader loader = beanDeploymentArchive.getServices().get(ResourceLoader.class);
ejbClass = (Class<T>) loader.classForName(componentDescription.getEJBClassName());
if (componentDescription.getViews() != null) {
for (ViewDescription view : componentDescription.getViews()) {
if (description == null || getMethodIntf(view) == MethodIntf.LOCAL) {
final String viewClassName = view.getViewClassName();
localInterfaces.add(new BusinessInterfaceDescriptorImpl<Object>(beanDeploymentArchive, viewClassName));
} else if (getMethodIntf(view) == MethodIntf.REMOTE) {
remoteInterfaces.add(new BusinessInterfaceDescriptorImpl<Object>(beanDeploymentArchive, view.getViewClassName()));
}
}
}
if(componentDescription instanceof StatefulComponentDescription) {
Set<Method> removeMethods = new HashSet<Method>();
final Collection<StatefulComponentDescription.StatefulRemoveMethod> methods = ((StatefulComponentDescription) componentDescription).getRemoveMethods();
for(final StatefulComponentDescription.StatefulRemoveMethod method : methods) {
Class<?> c = ejbClass;
while (c != null && c != Object.class) {
ClassReflectionIndex<?> index = reflectionIndex.getClassIndex(c);
Method m = index.getMethod(method.getMethodIdentifier());
if(m != null) {
removeMethods.add(m);
}
c = c.getSuperclass();
}
}
this.removeMethods = Collections.unmodifiableSet(removeMethods);
} else {
removeMethods = Collections.emptySet();
}
this.ejbName = componentDescription.getEJBName();
Map<Class<?>, ServiceName> viewServices = new HashMap<Class<?>, ServiceName>();
for (ViewDescription view : componentDescription.getViews()) {
viewServices.put(loader.classForName(view.getViewClassName()), view.getServiceName());
}
this.viewServices = Collections.unmodifiableMap(viewServices);
this.localInterfaces = localInterfaces;
this.remoteInterfaces = remoteInterfaces;
this.baseName = componentDescription.getServiceName();