}
@RemoteMethod
public List<EjbInformation> getDeploymentInfo(String containerId,
String deploymentId, HttpServletRequest request) {
Container container = containerSystem.getContainer(containerId);
BeanContext beanContext = container
.getBeanContext(deploymentId);
List<EjbInformation> informations = new ArrayList<EjbInformation>();
EjbInformation information = new EjbInformation();
information.setName(getLocalizedString(request, BUNDLE_NAME, BEANCLASSNAME_KEY));
information.setValue(beanContext.getBeanClass().getName());
informations.add(information);
if (beanContext.getBusinessLocalInterface() != null) {
information = new EjbInformation();
information.setName(getLocalizedString(request, BUNDLE_NAME, BLI_KEY));
information.setValue(appendMultipleInterfaces(beanContext
.getBusinessLocalInterfaces()));
informations.add(information);
}
if (beanContext.getBusinessRemoteInterface() != null) {
information = new EjbInformation();
information.setName(getLocalizedString(request, BUNDLE_NAME, BRI_KEY));
information.setValue(appendMultipleInterfaces(beanContext
.getBusinessRemoteInterfaces()));
informations.add(information);
}
information = new EjbInformation();
information.setName(getLocalizedString(request, BUNDLE_NAME, DEPLOYMENTID_KEY));
information.setValue(deploymentId);
informations.add(information);
information = new EjbInformation();
information.setName(getLocalizedString(request, BUNDLE_NAME, EJBNAME_KEY));
information.setValue(beanContext.getEjbName());
informations.add(information);
if (beanContext.getHomeInterface() != null) {
information = new EjbInformation();
information.setValue(beanContext.getHomeInterface().getName());
information.setName(getLocalizedString(request, BUNDLE_NAME, EJBHOMEI_KEY));
informations.add(information);
}
if (!container.getContainerType().equals(ContainerType.MESSAGE_DRIVEN)) {
information = new EjbInformation();
Class cls = null;
try {
cls = Class.forName("org.apache.openejb.assembler.classic.JndiBuilder$Bindings");
Method method = cls.getMethod("getBindings");
List<String> jndiNames = (List) method.invoke(beanContext.get(cls));
StringBuilder names = new StringBuilder();
for (String jndiName : jndiNames) {
if (jndiName.startsWith("openejb/local/")) {
jndiName = jndiName.replaceFirst("openejb/local/", "");
names.append(jndiName).append(",");
}
}
information.setValue(names.substring(0, names.length() - 1));
} catch (Exception e) {
log.error("Exception when trying to get JNDI name", e);
}
information.setName(getLocalizedString(request, BUNDLE_NAME, JNDINAMES_KEY));
informations.add(information);
}
if (beanContext.getLocalHomeInterface() != null) {
information = new EjbInformation();
information.setName(getLocalizedString(request, BUNDLE_NAME, LHI_KEY));
information.setValue(beanContext.getLocalHomeInterface()
.getName());
informations.add(information);
}
if (beanContext.getLocalInterface() != null) {
information = new EjbInformation();
information.setName(getLocalizedString(request, BUNDLE_NAME, LI_KEY));
information.setValue(beanContext.getLocalInterface().getName());
informations.add(information);
}
if (beanContext.getRemoteInterface() != null) {
information = new EjbInformation();
information.setName(getLocalizedString(request, BUNDLE_NAME, RI_KEY));
information.setValue(beanContext.getRemoteInterface().getName());
informations.add(information);
}
if (beanContext.getPrimaryKeyClass() != null) {
information = new EjbInformation();
information.setName(getLocalizedString(request, BUNDLE_NAME, PKC_KEY));
information.setValue(beanContext.getPrimaryKeyClass().getName());
informations.add(information);
}
if (beanContext.getPrimaryKeyField() != null) {
information = new EjbInformation();
information.setName(getLocalizedString(request, BUNDLE_NAME, PKF_KEY));
information.setValue(beanContext.getPrimaryKeyField());
informations.add(information);
}
if (beanContext.getServiceEndpointInterface() != null) {
information = new EjbInformation();
information.setName(getLocalizedString(request, BUNDLE_NAME, SEI_KEY));
information.setValue(beanContext.getServiceEndpointInterface()
.getName());
informations.add(information);
}
return informations;