Search in sources :

Example 1 with ManagedBeanDescriptor

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

the class AppSpecificConnectorClassLoaderUtil method processDescriptorForRAReferences.

private void processDescriptorForRAReferences(Application app, Descriptor descriptor, String moduleName) {
    if (descriptor instanceof JndiNameEnvironment) {
        processDescriptorForRAReferences(app, moduleName, (JndiNameEnvironment) descriptor);
    }
    // ejb descriptors
    if (descriptor instanceof EjbBundleDescriptor) {
        EjbBundleDescriptor ejbDesc = (EjbBundleDescriptor) descriptor;
        Set<? extends EjbDescriptor> ejbDescriptors = ejbDesc.getEjbs();
        for (EjbDescriptor ejbDescriptor : ejbDescriptors) {
            processDescriptorForRAReferences(app, moduleName, ejbDescriptor);
            if (ejbDescriptor instanceof EjbMessageBeanDescriptor) {
                EjbMessageBeanDescriptor messageBeanDesc = (EjbMessageBeanDescriptor) ejbDescriptor;
                String raMid = messageBeanDesc.getResourceAdapterMid();
                // there seem to be applications that do not specify ra-mid
                if (raMid != null) {
                    app.addResourceAdapter(raMid);
                }
            }
        }
        // ejb interceptors
        Set<EjbInterceptor> ejbInterceptors = ejbDesc.getInterceptors();
        for (EjbInterceptor ejbInterceptor : ejbInterceptors) {
            processDescriptorForRAReferences(app, moduleName, ejbInterceptor);
        }
    }
    if (descriptor instanceof BundleDescriptor) {
        // managed bean descriptors
        Set<ManagedBeanDescriptor> managedBeanDescriptors = ((BundleDescriptor) descriptor).getManagedBeans();
        for (ManagedBeanDescriptor mbd : managedBeanDescriptors) {
            processDescriptorForRAReferences(app, moduleName, mbd);
        }
    }
}
Also used : BundleDescriptor(com.sun.enterprise.deployment.BundleDescriptor) EjbBundleDescriptor(com.sun.enterprise.deployment.EjbBundleDescriptor) JndiNameEnvironment(com.sun.enterprise.deployment.JndiNameEnvironment) EjbMessageBeanDescriptor(com.sun.enterprise.deployment.EjbMessageBeanDescriptor) EjbBundleDescriptor(com.sun.enterprise.deployment.EjbBundleDescriptor) EjbInterceptor(com.sun.enterprise.deployment.EjbInterceptor) ManagedBeanDescriptor(com.sun.enterprise.deployment.ManagedBeanDescriptor) EjbDescriptor(com.sun.enterprise.deployment.EjbDescriptor)

Example 2 with ManagedBeanDescriptor

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

the class ComponentValidator method getManagedBeanMap.

/**
 * Get a map of bean class to managed bean descriptor for the managed beans
 * defined within the current module.
 */
private Map<String, ManagedBeanDescriptor> getManagedBeanMap() {
    BundleDescriptor thisBundle = getBundleDescriptor();
    Set<ManagedBeanDescriptor> managedBeans = new HashSet<ManagedBeanDescriptor>();
    // for managed beans
    if (thisBundle != null) {
        Object desc = thisBundle.getModuleDescriptor().getDescriptor();
        if (desc instanceof BundleDescriptor) {
            managedBeans = ((BundleDescriptor) desc).getManagedBeans();
        }
    }
    Map<String, ManagedBeanDescriptor> managedBeanMap = new HashMap<String, ManagedBeanDescriptor>();
    for (ManagedBeanDescriptor managedBean : managedBeans) {
        String beanClassName = managedBean.getBeanClassName();
        managedBeanMap.put(beanClassName, managedBean);
    }
    return managedBeanMap;
}
Also used : BundleDescriptor(com.sun.enterprise.deployment.BundleDescriptor) EjbBundleDescriptor(com.sun.enterprise.deployment.EjbBundleDescriptor) HashMap(java.util.HashMap) ManagedBeanDescriptor(com.sun.enterprise.deployment.ManagedBeanDescriptor) HashSet(java.util.HashSet)

Example 3 with ManagedBeanDescriptor

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

the class DOLUtils method getComponentEnvId.

/**
 * Generate a unique id name for each J2EE component.
 * @param env
 * @return
 */
public static String getComponentEnvId(JndiNameEnvironment env) {
    String id = null;
    if (env instanceof EjbDescriptor) {
        // EJB component
        EjbDescriptor ejbEnv = (EjbDescriptor) env;
        // Make jndi name flat so it won't result in the creation of
        // a bunch of sub-contexts.
        String flattedJndiName = ejbEnv.getJndiName().replace('/', '.');
        EjbBundleDescriptor ejbBundle = ejbEnv.getEjbBundleDescriptor();
        Descriptor d = ejbBundle.getModuleDescriptor().getDescriptor();
        // as the web bundle, because they share the same JNDI namespace
        if (d instanceof WebBundleDescriptor) {
            // copy of code below
            WebBundleDescriptor webEnv = (WebBundleDescriptor) d;
            id = webEnv.getApplication().getName() + ID_SEPARATOR + webEnv.getContextRoot();
            if (deplLogger.isLoggable(Level.FINER)) {
                deplLogger.log(Level.FINER, CONVERT_EJB_TO_WEB_ID, id);
            }
        } else {
            id = ejbEnv.getApplication().getName() + ID_SEPARATOR + ejbBundle.getModuleDescriptor().getArchiveUri() + ID_SEPARATOR + ejbEnv.getName() + ID_SEPARATOR + flattedJndiName + ejbEnv.getUniqueId();
        }
    } else if (env instanceof WebBundleDescriptor) {
        WebBundleDescriptor webEnv = (WebBundleDescriptor) env;
        id = webEnv.getApplication().getName() + ID_SEPARATOR + webEnv.getContextRoot();
    } else if (env instanceof ApplicationClientDescriptor) {
        ApplicationClientDescriptor appEnv = (ApplicationClientDescriptor) env;
        id = "client" + ID_SEPARATOR + appEnv.getName() + ID_SEPARATOR + appEnv.getMainClassName();
    } else if (env instanceof ManagedBeanDescriptor) {
        id = ((ManagedBeanDescriptor) env).getGlobalJndiName();
    } else if (env instanceof EjbBundleDescriptor) {
        EjbBundleDescriptor ejbBundle = (EjbBundleDescriptor) env;
        id = "__ejbBundle__" + ID_SEPARATOR + ejbBundle.getApplication().getName() + ID_SEPARATOR + ejbBundle.getModuleName();
    }
    return id;
}
Also used : EjbBundleDescriptor(com.sun.enterprise.deployment.EjbBundleDescriptor) WebBundleDescriptor(com.sun.enterprise.deployment.WebBundleDescriptor) ModuleDescriptor(org.glassfish.deployment.common.ModuleDescriptor) ActiveDescriptor(org.glassfish.hk2.api.ActiveDescriptor) BundleDescriptor(com.sun.enterprise.deployment.BundleDescriptor) ConnectorDescriptor(com.sun.enterprise.deployment.ConnectorDescriptor) Descriptor(org.glassfish.deployment.common.Descriptor) ManagedBeanDescriptor(com.sun.enterprise.deployment.ManagedBeanDescriptor) EjbDescriptor(com.sun.enterprise.deployment.EjbDescriptor) WebBundleDescriptor(com.sun.enterprise.deployment.WebBundleDescriptor) EjbBundleDescriptor(com.sun.enterprise.deployment.EjbBundleDescriptor) RootDeploymentDescriptor(org.glassfish.deployment.common.RootDeploymentDescriptor) ApplicationClientDescriptor(com.sun.enterprise.deployment.ApplicationClientDescriptor) ApplicationClientDescriptor(com.sun.enterprise.deployment.ApplicationClientDescriptor) ManagedBeanDescriptor(com.sun.enterprise.deployment.ManagedBeanDescriptor) EjbDescriptor(com.sun.enterprise.deployment.EjbDescriptor)

Example 4 with ManagedBeanDescriptor

use of com.sun.enterprise.deployment.ManagedBeanDescriptor 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 5 with ManagedBeanDescriptor

use of com.sun.enterprise.deployment.ManagedBeanDescriptor 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)

Aggregations

ManagedBeanDescriptor (com.sun.enterprise.deployment.ManagedBeanDescriptor)12 EjbBundleDescriptor (com.sun.enterprise.deployment.EjbBundleDescriptor)10 BundleDescriptor (com.sun.enterprise.deployment.BundleDescriptor)8 WebBundleDescriptor (com.sun.enterprise.deployment.WebBundleDescriptor)8 EjbDescriptor (com.sun.enterprise.deployment.EjbDescriptor)4 JCDIService (com.sun.enterprise.container.common.spi.JCDIService)3 ApplicationClientDescriptor (com.sun.enterprise.deployment.ApplicationClientDescriptor)3 InterceptorInvoker (com.sun.enterprise.container.common.spi.InterceptorInvoker)2 JavaEEInterceptorBuilder (com.sun.enterprise.container.common.spi.JavaEEInterceptorBuilder)2 HashMap (java.util.HashMap)2 JavaEEInterceptorBuilderFactory (com.sun.enterprise.container.common.spi.JavaEEInterceptorBuilderFactory)1 ComponentEnvManager (com.sun.enterprise.container.common.spi.util.ComponentEnvManager)1 InterceptorInfo (com.sun.enterprise.container.common.spi.util.InterceptorInfo)1 Application (com.sun.enterprise.deployment.Application)1 ConnectorDescriptor (com.sun.enterprise.deployment.ConnectorDescriptor)1 EjbInterceptor (com.sun.enterprise.deployment.EjbInterceptor)1 EjbMessageBeanDescriptor (com.sun.enterprise.deployment.EjbMessageBeanDescriptor)1 JndiNameEnvironment (com.sun.enterprise.deployment.JndiNameEnvironment)1 Field (java.lang.reflect.Field)1 Method (java.lang.reflect.Method)1