Search in sources :

Example 1 with AdministeredObject

use of javax.resource.spi.AdministeredObject 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();
}
Also used : AdministeredObject(javax.resource.spi.AdministeredObject) ConnectorDescriptor(com.sun.enterprise.deployment.ConnectorDescriptor) RarBundleContext(com.sun.enterprise.deployment.annotation.context.RarBundleContext)

Aggregations

ConnectorDescriptor (com.sun.enterprise.deployment.ConnectorDescriptor)1 RarBundleContext (com.sun.enterprise.deployment.annotation.context.RarBundleContext)1 AdministeredObject (javax.resource.spi.AdministeredObject)1