Search in sources :

Example 1 with RarBundleContext

use of com.sun.enterprise.deployment.annotation.context.RarBundleContext in project Payara by payara.

the class AuthenticationMechanismHandler method processAnnotation.

public HandlerProcessingResult processAnnotation(AnnotationInfo element) throws AnnotationProcessorException {
    AnnotatedElementHandler aeHandler = element.getProcessingContext().getHandler();
    AuthenticationMechanism authMechanism = (AuthenticationMechanism) element.getAnnotation();
    if (aeHandler instanceof RarBundleContext) {
        boolean isConnectionDefinition = hasConnectorAnnotation(element);
        if (isConnectionDefinition) {
            RarBundleContext rarContext = (RarBundleContext) aeHandler;
            ConnectorDescriptor desc = rarContext.getDescriptor();
            if (!desc.getOutBoundDefined()) {
                OutboundResourceAdapter ora = new OutboundResourceAdapter();
                desc.setOutboundResourceAdapter(ora);
            }
            OutboundResourceAdapter ora = desc.getOutboundResourceAdapter();
            String[] description = authMechanism.description();
            int authMechanismValue = getAuthMechVal(authMechanism.authMechanism());
            AuthenticationMechanism.CredentialInterface ci = authMechanism.credentialInterface();
            String credentialInterface = ora.getCredentialInterfaceName(ci);
            // XXX: Siva: For now use the first description
            String firstDesc = "";
            if (description.length > 0) {
                firstDesc = description[0];
            }
            AuthMechanism auth = new AuthMechanism(firstDesc, authMechanismValue, credentialInterface);
            ora.addAuthMechanism(auth);
        } else {
            getFailureResult(element, "Not a @Connector annotation : @AuthenticationMechanism must " + "be specified along with @Connector annotation", true);
        }
    } else {
        getFailureResult(element, "Not a rar bundle context", true);
    }
    return getDefaultProcessedResult();
}
Also used : ConnectorDescriptor(com.sun.enterprise.deployment.ConnectorDescriptor) AuthMechanism(com.sun.enterprise.deployment.AuthMechanism) AuthenticationMechanism(javax.resource.spi.AuthenticationMechanism) RarBundleContext(com.sun.enterprise.deployment.annotation.context.RarBundleContext) OutboundResourceAdapter(com.sun.enterprise.deployment.OutboundResourceAdapter)

Example 2 with RarBundleContext

use of com.sun.enterprise.deployment.annotation.context.RarBundleContext in project Payara by payara.

the class SecurityPermissionHandler method processAnnotation.

public HandlerProcessingResult processAnnotation(AnnotationInfo element) throws AnnotationProcessorException {
    AnnotatedElementHandler aeHandler = element.getProcessingContext().getHandler();
    SecurityPermission securityPermission = (SecurityPermission) element.getAnnotation();
    if (aeHandler instanceof RarBundleContext) {
        boolean isConnectionDefinition = hasConnectorAnnotation(element);
        if (isConnectionDefinition) {
            RarBundleContext rarContext = (RarBundleContext) aeHandler;
            ConnectorDescriptor desc = rarContext.getDescriptor();
            // XXX: Siva : For now use the first provided description
            String firstDesc = "";
            if (securityPermission.description().length > 0) {
                firstDesc = securityPermission.description()[0];
            }
            com.sun.enterprise.deployment.SecurityPermission permission = new com.sun.enterprise.deployment.SecurityPermission(firstDesc, securityPermission.permissionSpec());
            desc.addSecurityPermission(permission);
        } else {
            getFailureResult(element, "Not a @Connector annotation : @SecurityPermission must " + "be specified along with @Connector annotation", true);
        }
    } else {
        getFailureResult(element, "Not a rar bundle context", true);
    }
    return getDefaultProcessedResult();
}
Also used : ConnectorDescriptor(com.sun.enterprise.deployment.ConnectorDescriptor) RarBundleContext(com.sun.enterprise.deployment.annotation.context.RarBundleContext) SecurityPermission(javax.resource.spi.SecurityPermission)

Example 3 with RarBundleContext

use of com.sun.enterprise.deployment.annotation.context.RarBundleContext in project Payara by payara.

the class AnnotatedElementHandlerFactory method createAnnotatedElementHandler.

public static AnnotatedElementHandler createAnnotatedElementHandler(RootDeploymentDescriptor bundleDesc) {
    AnnotatedElementHandler aeHandler = null;
    if (bundleDesc instanceof EjbBundleDescriptor) {
        EjbBundleDescriptor ejbBundleDesc = (EjbBundleDescriptor) bundleDesc;
        aeHandler = new EjbBundleContext(ejbBundleDesc);
    } else if (bundleDesc instanceof ApplicationClientDescriptor) {
        ApplicationClientDescriptor appClientDesc = (ApplicationClientDescriptor) bundleDesc;
        aeHandler = new AppClientContext(appClientDesc);
    } else if (bundleDesc instanceof WebBundleDescriptor) {
        WebBundleDescriptor webBundleDesc = (WebBundleDescriptor) bundleDesc;
        aeHandler = new WebBundleContext(webBundleDesc);
    } else if (bundleDesc instanceof ConnectorDescriptor) {
        ConnectorDescriptor connectorDesc = (ConnectorDescriptor) bundleDesc;
        aeHandler = new RarBundleContext(connectorDesc);
    }
    return aeHandler;
}
Also used : AppClientContext(com.sun.enterprise.deployment.annotation.context.AppClientContext) EjbBundleContext(com.sun.enterprise.deployment.annotation.context.EjbBundleContext) WebBundleContext(com.sun.enterprise.deployment.annotation.context.WebBundleContext) RarBundleContext(com.sun.enterprise.deployment.annotation.context.RarBundleContext) AnnotatedElementHandler(org.glassfish.apf.AnnotatedElementHandler)

Example 4 with RarBundleContext

use of com.sun.enterprise.deployment.annotation.context.RarBundleContext in project Payara by payara.

the class SecurityPermissionHandler method processAnnotation.

public HandlerProcessingResult processAnnotation(AnnotationInfo element) throws AnnotationProcessorException {
    AnnotatedElementHandler aeHandler = element.getProcessingContext().getHandler();
    SecurityPermission securityPermission = (SecurityPermission) element.getAnnotation();
    if (aeHandler instanceof RarBundleContext) {
        boolean isConnectionDefinition = hasConnectorAnnotation(element);
        if (isConnectionDefinition) {
            RarBundleContext rarContext = (RarBundleContext) aeHandler;
            ConnectorDescriptor desc = rarContext.getDescriptor();
            // XXX: Siva : For now use the first provided description
            String firstDesc = "";
            if (securityPermission.description().length > 0) {
                firstDesc = securityPermission.description()[0];
            }
            com.sun.enterprise.deployment.SecurityPermission permission = new com.sun.enterprise.deployment.SecurityPermission(firstDesc, securityPermission.permissionSpec());
            desc.addSecurityPermission(permission);
        } else {
            getFailureResult(element, "Not a @Connector annotation : @SecurityPermission must " + "be specified along with @Connector annotation", true);
        }
    } else {
        getFailureResult(element, "Not a rar bundle context", true);
    }
    return getDefaultProcessedResult();
}
Also used : ConnectorDescriptor(com.sun.enterprise.deployment.ConnectorDescriptor) RarBundleContext(com.sun.enterprise.deployment.annotation.context.RarBundleContext) SecurityPermission(javax.resource.spi.SecurityPermission)

Example 5 with RarBundleContext

use of com.sun.enterprise.deployment.annotation.context.RarBundleContext in project Payara by payara.

the class ConnectionDefinitionHandler method processAnnotation.

public HandlerProcessingResult processAnnotation(AnnotationInfo element) throws AnnotationProcessorException {
    AnnotatedElementHandler aeHandler = element.getProcessingContext().getHandler();
    ConnectionDefinition connDefn = (ConnectionDefinition) element.getAnnotation();
    if (aeHandler instanceof RarBundleContext) {
        handleAnnotation(aeHandler, connDefn, element);
    } else {
        getFailureResult(element, "not a rar bundle context", true);
    }
    return getDefaultProcessedResult();
}
Also used : ConnectionDefinition(javax.resource.spi.ConnectionDefinition) RarBundleContext(com.sun.enterprise.deployment.annotation.context.RarBundleContext)

Aggregations

RarBundleContext (com.sun.enterprise.deployment.annotation.context.RarBundleContext)12 ConnectorDescriptor (com.sun.enterprise.deployment.ConnectorDescriptor)8 OutboundResourceAdapter (com.sun.enterprise.deployment.OutboundResourceAdapter)3 AuthMechanism (com.sun.enterprise.deployment.AuthMechanism)2 AuthenticationMechanism (javax.resource.spi.AuthenticationMechanism)2 ConnectionDefinition (javax.resource.spi.ConnectionDefinition)2 SecurityPermission (javax.resource.spi.SecurityPermission)2 ConnectionDefDescriptor (com.sun.enterprise.deployment.ConnectionDefDescriptor)1 InboundResourceAdapter (com.sun.enterprise.deployment.InboundResourceAdapter)1 MessageListener (com.sun.enterprise.deployment.MessageListener)1 AppClientContext (com.sun.enterprise.deployment.annotation.context.AppClientContext)1 EjbBundleContext (com.sun.enterprise.deployment.annotation.context.EjbBundleContext)1 WebBundleContext (com.sun.enterprise.deployment.annotation.context.WebBundleContext)1 Annotation (java.lang.annotation.Annotation)1 ArrayList (java.util.ArrayList)1 Activation (javax.resource.spi.Activation)1 AdministeredObject (javax.resource.spi.AdministeredObject)1 ConnectionDefinitions (javax.resource.spi.ConnectionDefinitions)1 Connector (javax.resource.spi.Connector)1 AnnotatedElementHandler (org.glassfish.apf.AnnotatedElementHandler)1