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);
}
}
}
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;
}
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;
}
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;
}
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;
}
Aggregations