Search in sources :

Example 11 with EjbBundleDescriptor

use of com.sun.enterprise.deployment.EjbBundleDescriptor in project Payara by payara.

the class DOLUtils method getModuleName.

public static String getModuleName(JndiNameEnvironment env) {
    String moduleName = null;
    if (env instanceof EjbDescriptor) {
        // EJB component
        EjbDescriptor ejbEnv = (EjbDescriptor) env;
        EjbBundleDescriptor ejbBundle = ejbEnv.getEjbBundleDescriptor();
        moduleName = ejbBundle.getModuleDescriptor().getModuleName();
    } else if (env instanceof EjbBundleDescriptor) {
        EjbBundleDescriptor ejbBundle = (EjbBundleDescriptor) env;
        moduleName = ejbBundle.getModuleDescriptor().getModuleName();
    } else if (env instanceof WebBundleDescriptor) {
        WebBundleDescriptor webEnv = (WebBundleDescriptor) env;
        moduleName = webEnv.getModuleName();
    } else if (env instanceof ApplicationClientDescriptor) {
        ApplicationClientDescriptor appEnv = (ApplicationClientDescriptor) env;
        moduleName = appEnv.getModuleName();
    } else if (env instanceof ManagedBeanDescriptor) {
        ManagedBeanDescriptor mb = (ManagedBeanDescriptor) env;
        moduleName = mb.getBundle().getModuleName();
    } else {
        throw new IllegalArgumentException("IllegalJndiNameEnvironment : env");
    }
    return moduleName;
}
Also used : EjbBundleDescriptor(com.sun.enterprise.deployment.EjbBundleDescriptor) WebBundleDescriptor(com.sun.enterprise.deployment.WebBundleDescriptor) ApplicationClientDescriptor(com.sun.enterprise.deployment.ApplicationClientDescriptor) ManagedBeanDescriptor(com.sun.enterprise.deployment.ManagedBeanDescriptor) EjbDescriptor(com.sun.enterprise.deployment.EjbDescriptor)

Example 12 with EjbBundleDescriptor

use of com.sun.enterprise.deployment.EjbBundleDescriptor in project Payara by payara.

the class DOLUtils method getApplicationFromEnv.

/**
 * @param env
 * @return
 */
public static Application getApplicationFromEnv(JndiNameEnvironment env) {
    Application app = null;
    if (env instanceof EjbDescriptor) {
        // EJB component
        EjbDescriptor ejbEnv = (EjbDescriptor) env;
        app = ejbEnv.getApplication();
    } else if (env instanceof EjbBundleDescriptor) {
        EjbBundleDescriptor ejbBundle = (EjbBundleDescriptor) env;
        app = ejbBundle.getApplication();
    } else if (env instanceof WebBundleDescriptor) {
        WebBundleDescriptor webEnv = (WebBundleDescriptor) env;
        app = webEnv.getApplication();
    } else if (env instanceof ApplicationClientDescriptor) {
        ApplicationClientDescriptor appEnv = (ApplicationClientDescriptor) env;
        app = appEnv.getApplication();
    } else if (env instanceof ManagedBeanDescriptor) {
        ManagedBeanDescriptor mb = (ManagedBeanDescriptor) env;
        app = mb.getBundle().getApplication();
    } else if (env instanceof Application) {
        app = ((Application) env);
    } else {
        throw new IllegalArgumentException("IllegalJndiNameEnvironment : env");
    }
    return app;
}
Also used : EjbBundleDescriptor(com.sun.enterprise.deployment.EjbBundleDescriptor) WebBundleDescriptor(com.sun.enterprise.deployment.WebBundleDescriptor) ApplicationClientDescriptor(com.sun.enterprise.deployment.ApplicationClientDescriptor) ManagedBeanDescriptor(com.sun.enterprise.deployment.ManagedBeanDescriptor) Application(com.sun.enterprise.deployment.Application) EjbDescriptor(com.sun.enterprise.deployment.EjbDescriptor)

Example 13 with EjbBundleDescriptor

use of com.sun.enterprise.deployment.EjbBundleDescriptor in project Payara by payara.

the class Verifier method verifyArchive.

private void verifyArchive() {
    if (!getApplication().isVirtual()) {
        // don't run app tests for standalone module
        runVerifier(new ApplicationVerifier(verifierFrameworkContext));
    }
    for (Iterator itr = getApplication().getBundleDescriptors(EjbBundleDescriptor.class).iterator(); itr.hasNext(); ) {
        EjbBundleDescriptor ejbd = (EjbBundleDescriptor) itr.next();
        runVerifier(new EjbVerifier(verifierFrameworkContext, ejbd));
    }
    for (Iterator itr = getApplication().getBundleDescriptors(WebBundleDescriptor.class).iterator(); itr.hasNext(); ) {
        WebBundleDescriptor webd = (WebBundleDescriptor) itr.next();
        runVerifier(new WebVerifier(verifierFrameworkContext, webd));
    }
    for (Iterator itr = getApplication().getBundleDescriptors(ApplicationClientDescriptor.class).iterator(); itr.hasNext(); ) {
        ApplicationClientDescriptor appClientDescriptor = (ApplicationClientDescriptor) itr.next();
        runVerifier(new AppClientVerifier(verifierFrameworkContext, appClientDescriptor));
    }
    for (Iterator itr = getApplication().getBundleDescriptors(ConnectorDescriptor.class).iterator(); itr.hasNext(); ) {
        ConnectorDescriptor cond = (ConnectorDescriptor) itr.next();
        runVerifier(new ConnectorVerifier(verifierFrameworkContext, cond));
    }
}
Also used : ConnectorDescriptor(com.sun.enterprise.deployment.ConnectorDescriptor) AppClientVerifier(com.sun.enterprise.tools.verifier.appclient.AppClientVerifier) EjbBundleDescriptor(com.sun.enterprise.deployment.EjbBundleDescriptor) WebVerifier(com.sun.enterprise.tools.verifier.web.WebVerifier) ApplicationVerifier(com.sun.enterprise.tools.verifier.app.ApplicationVerifier) Iterator(java.util.Iterator) WebBundleDescriptor(com.sun.enterprise.deployment.WebBundleDescriptor) EjbVerifier(com.sun.enterprise.tools.verifier.ejb.EjbVerifier) ConnectorVerifier(com.sun.enterprise.tools.verifier.connector.ConnectorVerifier) ApplicationClientDescriptor(com.sun.enterprise.deployment.ApplicationClientDescriptor)

Example 14 with EjbBundleDescriptor

use of com.sun.enterprise.deployment.EjbBundleDescriptor in project Payara by payara.

the class InboundRecoveryHandler method getEjbDescriptors.

private Vector getEjbDescriptors(Application application, ApplicationRegistry appsRegistry) {
    Vector ejbDescriptors = new Vector();
    if (ResourcesUtil.createInstance().isEnabled(application)) {
        ApplicationInfo appInfo = appsRegistry.get(application.getName());
        // non java-ee apps do not have ejbs, and they dont't have Application entry, leading to NPE
        if (appInfo != null && appInfo.isJavaEEApp()) {
            com.sun.enterprise.deployment.Application app = appInfo.getMetaData(com.sun.enterprise.deployment.Application.class);
            Set<BundleDescriptor> descriptors = app.getBundleDescriptors();
            for (BundleDescriptor descriptor : descriptors) {
                if (descriptor instanceof EjbBundleDescriptor) {
                    EjbBundleDescriptor ejbBundleDescriptor = (EjbBundleDescriptor) descriptor;
                    Set<? extends EjbDescriptor> ejbDescriptorsSet = ejbBundleDescriptor.getEjbs();
                    for (EjbDescriptor ejbDescriptor : ejbDescriptorsSet) {
                        ejbDescriptors.add(ejbDescriptor);
                    }
                }
            }
        } else {
            // application is enabled, but still not found in app-registry
            _logger.log(Level.WARNING, "application.not.started.skipping.recovery", application.getName());
        }
    }
    return ejbDescriptors;
}
Also used : BundleDescriptor(com.sun.enterprise.deployment.BundleDescriptor) EjbBundleDescriptor(com.sun.enterprise.deployment.EjbBundleDescriptor) EjbBundleDescriptor(com.sun.enterprise.deployment.EjbBundleDescriptor) ApplicationInfo(org.glassfish.internal.data.ApplicationInfo) Vector(java.util.Vector) EjbDescriptor(com.sun.enterprise.deployment.EjbDescriptor)

Example 15 with EjbBundleDescriptor

use of com.sun.enterprise.deployment.EjbBundleDescriptor in project Payara by payara.

the class AbstractResourceHandler method processAnnotation.

/**
 * Process a particular annotation which type is the same as the
 * one returned by @see getAnnotationType(). All information
 * pertinent to the annotation and its context is encapsulated
 * in the passed AnnotationInfo instance.
 *
 * @param ainfo the annotation information
 * @return
 * @throws AnnotationProcessorException
 */
@Override
public HandlerProcessingResult processAnnotation(AnnotationInfo ainfo) throws AnnotationProcessorException {
    AnnotatedElementHandler aeHandler = ainfo.getProcessingContext().getHandler();
    if (aeHandler instanceof EjbBundleContext) {
        EjbBundleContext ejbBundleContext = (EjbBundleContext) aeHandler;
        aeHandler = ejbBundleContext.createContextForEjb();
        if (aeHandler == null) {
            aeHandler = ejbBundleContext.createContextForEjbInterceptor();
        }
        // If it's still null and we're in an ejb-jar, use the EjbBundleContext.
        // This way we process dependencies on any classes (other than ejbs ,
        // interceptors , and their super-classes) that have annotations in case
        // we need the info for managed classes we wouldn't normally know about
        // (e.g. 299 classes).   In a .war, those are already processed during the
        // .war annotation scanning.
        EjbBundleDescriptor bundleDesc = ejbBundleContext.getDescriptor();
        RootDeploymentDescriptor enclosingBundle = bundleDesc.getModuleDescriptor().getDescriptor();
        boolean ejbJar = enclosingBundle instanceof EjbBundleDescriptor;
        if ((aeHandler == null) && ejbJar) {
            aeHandler = ejbBundleContext;
        }
    }
    if (aeHandler == null) {
        // not an ejb, interceptor in ejbBundle
        return getInvalidAnnotatedElementHandlerResult(ainfo.getProcessingContext().getHandler(), ainfo);
    }
    ResourceContainerContext[] rcContexts = null;
    if (aeHandler instanceof EjbsContext) {
        EjbsContext ejbsContext = (EjbsContext) aeHandler;
        rcContexts = (ResourceContainerContext[]) ejbsContext.getEjbContexts();
    } else if (aeHandler instanceof WebComponentsContext) {
        WebComponentsContext webCompsContext = (WebComponentsContext) aeHandler;
        rcContexts = (ResourceContainerContext[]) webCompsContext.getWebComponentContexts();
    } else if (aeHandler instanceof ResourceContainerContext) {
        rcContexts = new ResourceContainerContext[] { (ResourceContainerContext) aeHandler };
    } else {
        return getInvalidAnnotatedElementHandlerResult(aeHandler, ainfo);
    }
    return processAnnotation(ainfo, rcContexts);
}
Also used : EjbBundleContext(com.sun.enterprise.deployment.annotation.context.EjbBundleContext) ResourceContainerContext(com.sun.enterprise.deployment.annotation.context.ResourceContainerContext) WebComponentsContext(com.sun.enterprise.deployment.annotation.context.WebComponentsContext) EjbBundleDescriptor(com.sun.enterprise.deployment.EjbBundleDescriptor) RootDeploymentDescriptor(org.glassfish.deployment.common.RootDeploymentDescriptor) AnnotatedElementHandler(org.glassfish.apf.AnnotatedElementHandler) EjbsContext(com.sun.enterprise.deployment.annotation.context.EjbsContext)

Aggregations

EjbBundleDescriptor (com.sun.enterprise.deployment.EjbBundleDescriptor)28 EjbDescriptor (com.sun.enterprise.deployment.EjbDescriptor)15 WebBundleDescriptor (com.sun.enterprise.deployment.WebBundleDescriptor)14 BundleDescriptor (com.sun.enterprise.deployment.BundleDescriptor)7 Application (com.sun.enterprise.deployment.Application)5 ApplicationClientDescriptor (com.sun.enterprise.deployment.ApplicationClientDescriptor)5 ManagedBeanDescriptor (com.sun.enterprise.deployment.ManagedBeanDescriptor)4 WebServiceEndpoint (com.sun.enterprise.deployment.WebServiceEndpoint)4 WebComponentDescriptor (com.sun.enterprise.deployment.WebComponentDescriptor)3 WebService (com.sun.enterprise.deployment.WebService)3 Iterator (java.util.Iterator)3 ConnectorDescriptor (com.sun.enterprise.deployment.ConnectorDescriptor)2 JMSDestinationDefinitionDescriptor (com.sun.enterprise.deployment.JMSDestinationDefinitionDescriptor)2 JndiNameEnvironment (com.sun.enterprise.deployment.JndiNameEnvironment)2 ServiceReferenceDescriptor (com.sun.enterprise.deployment.ServiceReferenceDescriptor)2 EjbsContext (com.sun.enterprise.deployment.annotation.context.EjbsContext)2 IASSecurityException (com.sun.enterprise.security.util.IASSecurityException)2 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)2 ReadableArchive (org.glassfish.api.deployment.archive.ReadableArchive)2