use of com.sun.enterprise.container.common.spi.util.ComponentEnvManager in project Payara by payara.
the class SafeProperties method setupEnvironment.
private void setupEnvironment() throws javax.naming.NamingException {
// call the NamingManager to setup the java:comp/env namespace
// for this EJB.
ComponentEnvManager envManager = ejbContainerUtilImpl.getComponentEnvManager();
componentId = envManager.bindToComponentNamespace(ejbDescriptor);
invFactory = new EjbInvocationFactory(componentId, this);
ejbContainerUtilImpl.registerContainer(this);
// create envProps object to be returned from EJBContext.getEnvironment
Set env = ejbDescriptor.getEnvironmentProperties();
SafeProperties safeProps = new SafeProperties();
safeProps.copy(env);
envProps = safeProps;
}
use of com.sun.enterprise.container.common.spi.util.ComponentEnvManager in project Payara by payara.
the class InternalInterceptorBindingImpl method registerInterceptor.
public void registerInterceptor(Object systemInterceptor) {
InvocationManager invManager = services.getService(InvocationManager.class);
ComponentInvocation currentInv = invManager.getCurrentInvocation();
if (currentInv == null) {
throw new IllegalStateException("no current invocation");
} else if (currentInv.getInvocationType() != ComponentInvocation.ComponentInvocationType.SERVLET_INVOCATION) {
throw new IllegalStateException("Illegal invocation type : " + currentInv.getInvocationType() + ". This operation is only available from a web app context");
}
ComponentEnvManager compEnvManager = services.getService(ComponentEnvManager.class);
JndiNameEnvironment env = compEnvManager.getCurrentJndiNameEnvironment();
BundleDescriptor webBundle = (BundleDescriptor) env;
ModuleDescriptor moduleDesc = webBundle.getModuleDescriptor();
// Register interceptor for EJB components
if (EjbContainerUtilImpl.isInitialized()) {
Collection<EjbBundleDescriptor> ejbBundles = moduleDesc.getDescriptor().getExtensionsDescriptors(EjbBundleDescriptor.class);
if (ejbBundles.size() == 1) {
EjbBundleDescriptor ejbBundle = ejbBundles.iterator().next();
for (EjbDescriptor ejb : ejbBundle.getEjbs()) {
BaseContainer container = EjbContainerUtilImpl.getInstance().getContainer(ejb.getUniqueId());
container.registerSystemInterceptor(systemInterceptor);
}
}
}
// Register interceptor for any managed beans
// TODO Handle 299-enabled case
ManagedBeanManager managedBeanManager = services.getService(ManagedBeanManager.class, "ManagedBeanManagerImpl");
managedBeanManager.registerRuntimeInterceptor(systemInterceptor, webBundle);
}
use of com.sun.enterprise.container.common.spi.util.ComponentEnvManager in project Payara by payara.
the class WebModuleContextConfig method stop.
/**
* Process a "stop" event for this Context.
*/
@Override
protected synchronized void stop() {
super.stop();
ComponentEnvManager namingMgr = services.getService(com.sun.enterprise.container.common.spi.util.ComponentEnvManager.class);
unbindFromComponentNamespace(namingMgr);
}
use of com.sun.enterprise.container.common.spi.util.ComponentEnvManager in project Payara by payara.
the class JavaModuleNamingProxy method getModuleName.
private String getModuleName() throws NamingException {
ComponentEnvManager namingMgr = habitat.getService(ComponentEnvManager.class);
String moduleName = null;
if (namingMgr != null) {
JndiNameEnvironment env = namingMgr.getCurrentJndiNameEnvironment();
BundleDescriptor bd = null;
if (env instanceof EjbDescriptor) {
bd = ((EjbDescriptor) env).getEjbBundleDescriptor();
} else if (env instanceof BundleDescriptor) {
bd = (BundleDescriptor) env;
}
if (bd != null) {
moduleName = bd.getModuleDescriptor().getModuleName();
}
}
if (moduleName == null) {
throw new NamingException("Could not resolve " + JAVA_MODULE_NAME);
}
return moduleName;
}
use of com.sun.enterprise.container.common.spi.util.ComponentEnvManager in project Payara by payara.
the class ManagedBeanManagerImpl method getBundle.
private BundleDescriptor getBundle() {
ComponentEnvManager compEnvManager = habitat.getService(ComponentEnvManager.class);
JndiNameEnvironment env = compEnvManager.getCurrentJndiNameEnvironment();
BundleDescriptor bundle = null;
if (env instanceof BundleDescriptor) {
bundle = (BundleDescriptor) env;
} else if (env instanceof EjbDescriptor) {
bundle = (BundleDescriptor) ((EjbDescriptor) env).getEjbBundleDescriptor().getModuleDescriptor().getDescriptor();
}
if (bundle == null) {
throw new IllegalStateException("Invalid context for managed bean creation");
}
return bundle;
}
Aggregations