}
@RemoteMethod
public List<EjbInformation> getDeploymentInfo(String containerId,
String deploymentId, HttpServletRequest request) {
Container container = containerSystem.getContainer(containerId);
DeploymentInfo deploymentInfo = container
.getDeploymentInfo(deploymentId);
List<EjbInformation> informations = new ArrayList<EjbInformation>();
EjbInformation information = new EjbInformation();
information.setName(getLocalizedString(request, BUNDLE_NAME, BEANCLASSNAME_KEY));
information.setValue(deploymentInfo.getBeanClass().getName());
informations.add(information);
if (deploymentInfo.getBusinessLocalInterface() != null) {
information = new EjbInformation();
information.setName(getLocalizedString(request, BUNDLE_NAME, BLI_KEY));
information.setValue(appendMultipleInterfaces(deploymentInfo
.getBusinessLocalInterfaces()));
informations.add(information);
}
if (deploymentInfo.getBusinessRemoteInterface() != null) {
information = new EjbInformation();
information.setName(getLocalizedString(request, BUNDLE_NAME, BRI_KEY));
information.setValue(appendMultipleInterfaces(deploymentInfo
.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(deploymentInfo.getEjbName());
informations.add(information);
if (deploymentInfo.getHomeInterface() != null) {
information = new EjbInformation();
information.setValue(deploymentInfo.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(deploymentInfo.get(cls));
StringBuffer names = new StringBuffer();
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 (deploymentInfo.getLocalHomeInterface() != null) {
information = new EjbInformation();
information.setName(getLocalizedString(request, BUNDLE_NAME, LHI_KEY));
information.setValue(deploymentInfo.getLocalHomeInterface()
.getName());
informations.add(information);
}
if (deploymentInfo.getLocalInterface() != null) {
information = new EjbInformation();
information.setName(getLocalizedString(request, BUNDLE_NAME, LI_KEY));
information.setValue(deploymentInfo.getLocalInterface().getName());
informations.add(information);
}
if (deploymentInfo.getRemoteInterface() != null) {
information = new EjbInformation();
information.setName(getLocalizedString(request, BUNDLE_NAME, RI_KEY));
information.setValue(deploymentInfo.getRemoteInterface().getName());
informations.add(information);
}
if (deploymentInfo.getPrimaryKeyClass() != null) {
information = new EjbInformation();
information.setName(getLocalizedString(request, BUNDLE_NAME, PKC_KEY));
information.setValue(deploymentInfo.getPrimaryKeyClass().getName());
informations.add(information);
}
if (deploymentInfo.getPrimaryKeyField() != null) {
information = new EjbInformation();
information.setName(getLocalizedString(request, BUNDLE_NAME, PKF_KEY));
information.setValue(deploymentInfo.getPrimaryKeyField());
informations.add(information);
}
if (deploymentInfo.getServiceEndpointInterface() != null) {
information = new EjbInformation();
information.setName(getLocalizedString(request, BUNDLE_NAME, SEI_KEY));
information.setValue(deploymentInfo.getServiceEndpointInterface()
.getName());
informations.add(information);
}
return informations;