use of javax.ejb.MessageDriven in project Payara by payara.
the class MessageDrivenHandler method setEjbDescriptorInfo.
/**
* Set Annotation information to Descriptor.
* This method will also be invoked for an existing descriptor with
* annotation as user may not specific a complete xml.
* @param ejbDesc
* @param ainfo
* @return HandlerProcessingResult
*/
protected HandlerProcessingResult setEjbDescriptorInfo(EjbDescriptor ejbDesc, AnnotationInfo ainfo) throws AnnotationProcessorException {
MessageDriven mdAn = (MessageDriven) ainfo.getAnnotation();
Class ejbClass = (Class) ainfo.getAnnotatedElement();
EjbMessageBeanDescriptor ejbMsgBeanDesc = (EjbMessageBeanDescriptor) ejbDesc;
HandlerProcessingResult procResult = setMessageListenerInterface(mdAn, ejbMsgBeanDesc, ejbClass, ainfo);
doDescriptionProcessing(mdAn.description(), ejbMsgBeanDesc);
doMappedNameProcessing(mdAn.mappedName(), ejbMsgBeanDesc);
for (ActivationConfigProperty acProp : mdAn.activationConfig()) {
EnvironmentProperty envProp = new EnvironmentProperty(acProp.propertyName(), TranslatedConfigView.expandValue(acProp.propertyValue()), "");
// xml override
switch(acProp.propertyName()) {
case "resourceAdapter":
ejbMsgBeanDesc.setResourceAdapterMid(envProp.getValue());
break;
case DescriptorConstants.MAX_POOL_SIZE:
initialiseBeanPoolDescriptor(ejbMsgBeanDesc);
ejbMsgBeanDesc.getIASEjbExtraDescriptors().getBeanPool().setMaxPoolSize(Integer.valueOf(envProp.getValue()));
break;
case DescriptorConstants.POOL_RESIZE_QTY:
initialiseBeanPoolDescriptor(ejbMsgBeanDesc);
ejbMsgBeanDesc.getIASEjbExtraDescriptors().getBeanPool().setPoolResizeQuantity(Integer.valueOf(envProp.getValue()));
break;
case DescriptorConstants.STEADY_POOL_SIZE:
initialiseBeanPoolDescriptor(ejbMsgBeanDesc);
ejbMsgBeanDesc.getIASEjbExtraDescriptors().getBeanPool().setSteadyPoolSize(Integer.valueOf(envProp.getValue()));
break;
case DescriptorConstants.MAX_WAIT_TIME:
initialiseBeanPoolDescriptor(ejbMsgBeanDesc);
ejbMsgBeanDesc.getIASEjbExtraDescriptors().getBeanPool().setMaxWaitTimeInMillis(Integer.valueOf(envProp.getValue()));
break;
case DescriptorConstants.POOL_IDLE_TIMEOUT:
initialiseBeanPoolDescriptor(ejbMsgBeanDesc);
ejbMsgBeanDesc.getIASEjbExtraDescriptors().getBeanPool().setPoolIdleTimeoutInSeconds(Integer.valueOf(envProp.getValue()));
break;
case "SingletonBeanPool":
NameValuePairDescriptor singletonProperty = new NameValuePairDescriptor();
singletonProperty.setName("singleton-bean-pool");
singletonProperty.setValue(envProp.getValue());
ejbMsgBeanDesc.getEjbBundleDescriptor().addEnterpriseBeansProperty(singletonProperty);
break;
default:
if (ejbMsgBeanDesc.getActivationConfigValue(envProp.getName()) == null) {
ejbMsgBeanDesc.putActivationConfigProperty(envProp);
}
break;
}
}
return procResult;
}
Aggregations