componentDescription.setExposedViaIiop(true);
// Create bean method mappings for container invoker
final EJBViewDescription remoteView = componentDescription.getEjbRemoteView();
final ClassIndex remoteClass;
try {
remoteClass = classIndex.classIndex(remoteView.getViewClassName());
} catch (ClassNotFoundException e) {
throw MESSAGES.failedToLoadViewClassForComponent(e, componentDescription.getEJBClassName());
}
final EJBViewDescription homeView = componentDescription.getEjbHomeView();
final ClassIndex homeClass;
try {
homeClass = classIndex.classIndex(homeView.getViewClassName());
} catch (ClassNotFoundException e) {
throw MESSAGES.failedToLoadViewClassForComponent(e, componentDescription.getEJBClassName());
}
componentDescription.getEjbHomeView().getConfigurators().add(new IIOPInterceptorViewConfigurator());
componentDescription.getEjbRemoteView().getConfigurators().add(new IIOPInterceptorViewConfigurator());
final InterfaceAnalysis remoteInterfaceAnalysis;
try {
//TODO: change all this to use the deployment reflection index
remoteInterfaceAnalysis = InterfaceAnalysis.getInterfaceAnalysis(remoteClass.getModuleClass());
} catch (RMIIIOPViolationException e) {
throw MESSAGES.failedToAnalyzeRemoteInterface(e, componentDescription.getComponentName());
}
final Map<String, SkeletonStrategy> beanMethodMap = new HashMap<String, SkeletonStrategy>();
final AttributeAnalysis[] remoteAttrs = remoteInterfaceAnalysis.getAttributes();
for (int i = 0; i < remoteAttrs.length; i++) {
final OperationAnalysis op = remoteAttrs[i].getAccessorAnalysis();
if (op != null) {
EjbLogger.ROOT_LOGGER.debug(" " + op.getJavaName() + "\n " + op.getIDLName());
//translate to the deployment reflection index method
//TODO: this needs to be fixed so it just returns the correct method
final Method method = translateMethod(deploymentReflectionIndex, op);
beanMethodMap.put(op.getIDLName(), new SkeletonStrategy(method));
final OperationAnalysis setop = remoteAttrs[i].getMutatorAnalysis();
if (setop != null) {
EjbLogger.ROOT_LOGGER.debug(" " + setop.getJavaName() + "\n " + setop.getIDLName());
//translate to the deployment reflection index method
//TODO: this needs to be fixed so it just returns the correct method
final Method realSetmethod = translateMethod(deploymentReflectionIndex, setop);
beanMethodMap.put(setop.getIDLName(), new SkeletonStrategy(realSetmethod));
}
}
}
final OperationAnalysis[] ops = remoteInterfaceAnalysis.getOperations();
for (int i = 0; i < ops.length; i++) {
EjbLogger.ROOT_LOGGER.debug(" " + ops[i].getJavaName() + "\n " + ops[i].getIDLName());
beanMethodMap.put(ops[i].getIDLName(), new SkeletonStrategy(translateMethod(deploymentReflectionIndex, ops[i])));
}
// Initialize repository ids of remote interface
final String[] beanRepositoryIds = remoteInterfaceAnalysis.getAllTypeIds();
// Create home method mappings for container invoker
final InterfaceAnalysis homeInterfaceAnalysis;
try {
//TODO: change all this to use the deployment reflection index
homeInterfaceAnalysis = InterfaceAnalysis.getInterfaceAnalysis(homeClass.getModuleClass());
} catch (RMIIIOPViolationException e) {
throw MESSAGES.failedToAnalyzeRemoteInterface(e, componentDescription.getComponentName());
}
final Map<String, SkeletonStrategy> homeMethodMap = new HashMap<String, SkeletonStrategy>();
final AttributeAnalysis[] attrs = homeInterfaceAnalysis.getAttributes();
for (int i = 0; i < attrs.length; i++) {
final OperationAnalysis op = attrs[i].getAccessorAnalysis();
if (op != null) {
EjbLogger.ROOT_LOGGER.debug(" " + op.getJavaName() + "\n " + op.getIDLName());
homeMethodMap.put(op.getIDLName(), new SkeletonStrategy(translateMethod(deploymentReflectionIndex, op)));
final OperationAnalysis setop = attrs[i].getMutatorAnalysis();
if (setop != null) {
EjbLogger.ROOT_LOGGER.debug(" " + setop.getJavaName() + "\n " + setop.getIDLName());
homeMethodMap.put(setop.getIDLName(), new SkeletonStrategy(translateMethod(deploymentReflectionIndex, setop)));
}
}
}
final OperationAnalysis[] homeops = homeInterfaceAnalysis.getOperations();
for (int i = 0; i < homeops.length; i++) {
EjbLogger.ROOT_LOGGER.debug(" " + homeops[i].getJavaName() + "\n " + homeops[i].getIDLName());
homeMethodMap.put(homeops[i].getIDLName(), new SkeletonStrategy(translateMethod(deploymentReflectionIndex, homeops[i])));
}
// Initialize repository ids of home interface
final String[] homeRepositoryIds = homeInterfaceAnalysis.getAllTypeIds();
final EjbIIOPService service = new EjbIIOPService(beanMethodMap, beanRepositoryIds, homeMethodMap, homeRepositoryIds,
settingsService.isUseQualifiedName(), iiopMetaData, module);
final ServiceBuilder<EjbIIOPService> builder = serviceTarget.addService(componentDescription.getServiceName().append(EjbIIOPService.SERVICE_NAME), service);
builder.addDependency(componentDescription.getCreateServiceName(), EJBComponent.class, service.getEjbComponentInjectedValue());
builder.addDependency(homeView.getServiceName(), ComponentView.class, service.getHomeView());
builder.addDependency(remoteView.getServiceName(), ComponentView.class, service.getRemoteView());
builder.addDependency(CorbaORBService.SERVICE_NAME, ORB.class, service.getOrb());
builder.addDependency(POARegistry.SERVICE_NAME, POARegistry.class, service.getPoaRegistry());
builder.addDependency(CorbaPOAService.INTERFACE_REPOSITORY_SERVICE_NAME, POA.class, service.getIrPoa());
builder.addDependency(CorbaNamingService.SERVICE_NAME, NamingContextExt.class, service.getCorbaNamingContext());