for (int i = 0; i < messagelistenerArray.length; i++) {
MessagelistenerType messagelistenerType = messagelistenerArray[i];
String messageListenerInterface = messagelistenerType.getMessagelistenerType().getStringValue().trim();
ActivationspecType activationspec = messagelistenerType.getActivationspec();
String activationSpecClassName = activationspec.getActivationspecClass().getStringValue().trim();
GBeanInfoBuilder infoBuilder = new GBeanInfoBuilder(ActivationSpecWrapperGBean.class, ActivationSpecWrapperGBean.GBEAN_INFO);
//add all javabean properties that have both getter and setter. Ignore the "required" flag from the dd.
Map getters = new HashMap();
Set setters = new HashSet();
Method[] methods = null;
try {
Class activationSpecClass = cl.loadClass(activationSpecClassName);
methods = activationSpecClass.getMethods();
} catch (ClassNotFoundException e) {
throw new DeploymentException("Can not load activation spec class", e);
}
for (int j = 0; j < methods.length; j++) {
Method method = methods[j];
String methodName = method.getName();
if ((methodName.startsWith("get") || methodName.startsWith("is")) && method.getParameterTypes().length == 0) {
String attributeName = (methodName.startsWith("get")) ? methodName.substring(3) : methodName.substring(2);
getters.put(Introspector.decapitalize(attributeName), method.getReturnType().getName());
} else if (methodName.startsWith("set") && method.getParameterTypes().length == 1) {
setters.add(Introspector.decapitalize(methodName.substring(3)));
}
}
getters.keySet().retainAll(setters);
getters.remove("resourceAdapter");
for (Iterator iterator = getters.entrySet().iterator(); iterator.hasNext();) {
Map.Entry entry = (Map.Entry) iterator.next();
infoBuilder.addAttribute(new DynamicGAttributeInfo((String) entry.getKey(), (String) entry.getValue(), true, false, true, true));
}
GBeanInfo gbeanInfo = infoBuilder.getBeanInfo();
try {
//make sure the class is available, but we don't use it.
cl.loadClass(activationSpecClassName);
} catch (ClassNotFoundException e) {
throw new DeploymentException("Could not load ActivationSpec class", e);