Search in sources :

Example 11 with EjbDescriptor

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

the class InboundRecoveryHandler method createRAEjbMapping.

private Map<String, List<EjbDescriptor>> createRAEjbMapping(List<EjbDescriptor> ejbDescriptors) {
    Map<String, List<EjbDescriptor>> map = new HashMap<String, List<EjbDescriptor>>();
    for (EjbDescriptor ejbDescriptor : ejbDescriptors) {
        List<EjbDescriptor> ejbmdbd = new ArrayList<EjbDescriptor>();
        String ramid = ((EjbMessageBeanDescriptor) ejbDescriptor).getResourceAdapterMid();
        if ((ramid == null) || (ramid.equalsIgnoreCase(""))) {
            ramid = ConnectorConstants.DEFAULT_JMS_ADAPTER;
        }
        // Otherwise, add the RAMid and the current MDB Descriptor to the hashtable
        if (map.containsKey(ramid)) {
            ejbmdbd = map.get(ramid);
            map.remove(ramid);
        }
        ejbmdbd.add(ejbDescriptor);
        map.put(ramid, ejbmdbd);
    }
    return map;
}
Also used : EjbMessageBeanDescriptor(com.sun.enterprise.deployment.EjbMessageBeanDescriptor) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) EjbDescriptor(com.sun.enterprise.deployment.EjbDescriptor)

Example 12 with EjbDescriptor

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

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

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

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

EjbDescriptor (com.sun.enterprise.deployment.EjbDescriptor)48 EjbBundleDescriptor (com.sun.enterprise.deployment.EjbBundleDescriptor)16 WebBundleDescriptor (com.sun.enterprise.deployment.WebBundleDescriptor)11 BundleDescriptor (com.sun.enterprise.deployment.BundleDescriptor)10 Application (com.sun.enterprise.deployment.Application)6 JndiNameEnvironment (com.sun.enterprise.deployment.JndiNameEnvironment)6 WebServiceEndpoint (com.sun.enterprise.deployment.WebServiceEndpoint)5 ManagedBeanDescriptor (com.sun.enterprise.deployment.ManagedBeanDescriptor)4 EjbContext (com.sun.enterprise.deployment.annotation.context.EjbContext)4 ArrayList (java.util.ArrayList)4 Descriptor (org.glassfish.deployment.common.Descriptor)4 BeanDeploymentArchive (org.jboss.weld.bootstrap.spi.BeanDeploymentArchive)4 ApplicationClientDescriptor (com.sun.enterprise.deployment.ApplicationClientDescriptor)3 EjbInterceptor (com.sun.enterprise.deployment.EjbInterceptor)3 EjbMessageBeanDescriptor (com.sun.enterprise.deployment.EjbMessageBeanDescriptor)3 MethodDescriptor (com.sun.enterprise.deployment.MethodDescriptor)3 RunAsIdentityDescriptor (com.sun.enterprise.deployment.RunAsIdentityDescriptor)3 ServiceReferenceDescriptor (com.sun.enterprise.deployment.ServiceReferenceDescriptor)3 WebComponentDescriptor (com.sun.enterprise.deployment.WebComponentDescriptor)3 Method (java.lang.reflect.Method)3