Class<?> clazz = cl.loadClass(intfName);
ic = helper.createInterfaceContract(clazz);
ic.getInterface().setConversational(conversational);
ic.getInterface().setRemotable(true);
} catch (Exception e) {
throw new ContributionException(e);
}
service.setInterfaceContract(ic);
if (conversational) {
service.getRequiredIntents().add(AssemblyHelper.CONVERSATIONAL_INTENT);
}
componentType.getServices().add(service);
}
// Process Local Business interfaces of the SessionBean
for (String intfName : bean.getBusinessLocal()) {
String serviceName =
intfName.lastIndexOf(".") != -1 ? intfName.substring(intfName.lastIndexOf(".") + 1) : intfName;
Service service = helper.createComponentService();
service.setName(serviceName);
InterfaceContract ic = null;
try {
Class<?> clazz = cl.loadClass(intfName);
ic = helper.createInterfaceContract(clazz);
ic.getInterface().setConversational(conversational);
} catch (Exception e) {
throw new ContributionException(e);
}
service.setInterfaceContract(ic);
if (conversational) {
service.getRequiredIntents().add(AssemblyHelper.CONVERSATIONAL_INTENT);
}
componentType.getServices().add(service);
}
// Process Remote EJB References
for (Map.Entry<String, EjbRef> entry : bean.getEjbRefMap().entrySet()) {
EjbRef ejbRef = entry.getValue();
if(ejbRef.getHome() != null) {
// References to only EJB3 beans need to be considered.
// Skip the current on as it is not a reference to an EJB3 bean.
continue;
}
if (ejbRef.getRefType().compareTo(EjbReference.Type.REMOTE) != 0) {
// Only Remote EJB references need to be considered.
// Skip the current one as it is not a remote reference.
continue;
}
//FIXME: ejbRef.getEjbRefType() is null sometimes. Need a different way to figure the type.
if(ejbRef.getEjbRefType() != null && ejbRef.getEjbRefType().compareTo(EjbRefType.SESSION) != 0) {
// Only references to Session beans need to be considered.
// Skip the current one as it is not a Session bean.
continue;
}
String referenceName = entry.getKey();
referenceName = referenceName.replace("/", "_");
Reference reference = helper.createComponentReference();
reference.setName(referenceName);
InterfaceContract ic = null;
try {
Class<?> clazz = cl.loadClass(ejbRef.getInterface());
ic = helper.createInterfaceContract(clazz);
} catch (Exception e) {
throw new ContributionException(e);
}
reference.setInterfaceContract(ic);
reference.getRequiredIntents().add(AssemblyHelper.EJB_INTENT);
componentType.getReferences().add(reference);
}