use of com.sun.enterprise.deployment.annotation.context.RarBundleContext in project Payara by payara.
the class ConnectorAnnotationHandler method processAnnotation.
public HandlerProcessingResult processAnnotation(AnnotationInfo element) throws AnnotationProcessorException {
AnnotatedElementHandler aeHandler = element.getProcessingContext().getHandler();
Connector connector = (Connector) element.getAnnotation();
List<Class<? extends Annotation>> list = new ArrayList<Class<? extends Annotation>>();
list.add(getAnnotationType());
if (aeHandler instanceof RarBundleContext) {
RarBundleContext rarContext = (RarBundleContext) aeHandler;
ConnectorDescriptor desc = rarContext.getDescriptor();
Class annotatedClass = (Class) element.getAnnotatedElement();
if (desc.getResourceAdapterClass().equals("")) {
desc.addConnectorAnnotation(element);
return getSuccessfulProcessedResult(list);
} else if (!isResourceAdapterClass(annotatedClass)) {
desc.addConnectorAnnotation(element);
return getSuccessfulProcessedResult(list);
} else if (!desc.getResourceAdapterClass().equals(annotatedClass.getName())) {
desc.addConnectorAnnotation(element);
return getSuccessfulProcessedResult(list);
} else {
processDescriptor(annotatedClass, connector, desc);
desc.setValidConnectorAnnotationProcessed(true);
}
} else {
String logMessage = "Not a rar bundle context";
return getFailureResult(element, logMessage, true);
}
return getSuccessfulProcessedResult(list);
}
use of com.sun.enterprise.deployment.annotation.context.RarBundleContext in project Payara by payara.
the class ActivationHandler method processAnnotation.
public HandlerProcessingResult processAnnotation(AnnotationInfo element) throws AnnotationProcessorException {
AnnotatedElementHandler aeHandler = element.getProcessingContext().getHandler();
Activation activation = (Activation) element.getAnnotation();
if (aeHandler instanceof RarBundleContext) {
RarBundleContext rarContext = (RarBundleContext) aeHandler;
ConnectorDescriptor desc = rarContext.getDescriptor();
// process annotation only if message-listeners are provided
if (activation.messageListeners().length > 0) {
// initialize inbound if it was not done already
if (!desc.getInBoundDefined()) {
desc.setInboundResourceAdapter(new InboundResourceAdapter());
}
InboundResourceAdapter ira = desc.getInboundResourceAdapter();
// get the activation-spec implementation class-name
Class c = (Class) element.getAnnotatedElement();
String activationSpecClass = c.getName();
// process all message-listeners, ensure that no duplicate message-listener-types are found
for (Class mlClass : activation.messageListeners()) {
MessageListener ml = new MessageListener();
ml.setActivationSpecClass(activationSpecClass);
ml.setMessageListenerType(mlClass.getName());
if (!ira.hasMessageListenerType(mlClass.getName())) {
ira.addMessageListener(ml);
}
// else {
// ignore the duplicates
// duplicates can be via :
// (i) message listner defined in DD
// (ii) as part of this particular annotation processing,
// already this message-listener-type is defined
// TODO V3 how to handle (ii)
// }
}
}
} else {
getFailureResult(element, "Not a rar bundle context", true);
}
return getDefaultProcessedResult();
}
use of com.sun.enterprise.deployment.annotation.context.RarBundleContext in project Payara by payara.
the class ConnectionDefinitionsHandler method processAnnotation.
public HandlerProcessingResult processAnnotation(AnnotationInfo element) throws AnnotationProcessorException {
AnnotatedElementHandler aeHandler = element.getProcessingContext().getHandler();
ConnectionDefinitions connDefns = (ConnectionDefinitions) element.getAnnotation();
if (aeHandler instanceof RarBundleContext) {
// TODO V3 what if there is @ConnectionDefiniton as well @ConnectionDefinitions specified on same class ?
// TODO V3 should we detect & avoid duplicates here ?
ConnectionDefinition[] definitions = connDefns.value();
if (definitions != null) {
for (ConnectionDefinition defn : definitions) {
ConnectionDefinitionHandler cdh = new ConnectionDefinitionHandler();
cdh.processAnnotation(element, defn);
}
}
} else {
getFailureResult(element, "not a rar bundle context", true);
}
return getDefaultProcessedResult();
}
use of com.sun.enterprise.deployment.annotation.context.RarBundleContext in project Payara by payara.
the class AdministeredObjectHandler method processAnnotation.
public HandlerProcessingResult processAnnotation(AnnotationInfo element) throws AnnotationProcessorException {
AnnotatedElementHandler aeHandler = element.getProcessingContext().getHandler();
AdministeredObject adminObject = (AdministeredObject) element.getAnnotation();
if (aeHandler instanceof RarBundleContext) {
RarBundleContext rarContext = (RarBundleContext) aeHandler;
ConnectorDescriptor desc = rarContext.getDescriptor();
Class c = (Class) element.getAnnotatedElement();
String adminObjectClassName = c.getName();
Class[] adminObjectInterfaceClasses = adminObject.adminObjectInterfaces();
// When "adminObjectInterfaces()" is specified, add one admin-object entry per interface
if (adminObjectInterfaceClasses != null && adminObjectInterfaceClasses.length > 0) {
for (Class adminObjectInterface : adminObjectInterfaceClasses) {
processAdminObjectInterface(adminObjectClassName, adminObjectInterface.getName(), desc);
}
} else {
List<Class> interfacesList = deriveAdminObjectInterfacesFromHierarchy(c);
if (interfacesList.size() == 1) {
Class intf = interfacesList.get(0);
String intfName = intf.getName();
processAdminObjectInterface(adminObjectClassName, intfName, desc);
} else {
// TODO V3 this case is, multiple interfaces implemented, no "adminObjectInterfaces()" attribute defined,
// should we check the DD whether this Impl class is already specified in any of "admin-object" elements ?
// If present, return. If not present, throw exception ?
}
}
} else {
getFailureResult(element, "not a rar bundle context", true);
}
return getDefaultProcessedResult();
}
use of com.sun.enterprise.deployment.annotation.context.RarBundleContext in project Payara by payara.
the class ConfigPropertyHandler method processAnnotation.
public HandlerProcessingResult processAnnotation(AnnotationInfo element) throws AnnotationProcessorException {
AnnotatedElementHandler aeHandler = element.getProcessingContext().getHandler();
ConfigProperty configProperty = (ConfigProperty) element.getAnnotation();
if (aeHandler instanceof RarBundleContext) {
RarBundleContext rbc = (RarBundleContext) aeHandler;
ConnectorDescriptor desc = rbc.getDescriptor();
handleConfigPropertyAnnotation(configProperty, element, desc);
} else {
return getFailureResult(element, "not a rar bundle context", true);
}
return getDefaultProcessedResult();
}
Aggregations