protected boolean isContainerManagedTx() { BeanMetaData md = con.getBeanMetaData(); return md.isContainerManagedTx(); }
/** * Stores the container reference and the application and bean JNDI * names. * * @param container set by the container initialization code */ public void setContainer(Container container) { super.setContainer(container); if (container != null) { applicationName = container.getEjbModule().getName(); beanName = container.getBeanMetaData().getJndiName(); } }
/** * Stops all the containers of this application. */ @Override protected void stopService() throws Exception { ListIterator iter = containerOrdering.listIterator(containerOrdering.size()); while (iter.hasPrevious()) { Container con = (Container) iter.previous(); try { ObjectName jmxName = con.getJmxName(); // The container may already be destroyed so validate metaData BeanMetaData metaData = con.getBeanMetaData(); String ejbName = metaData != null ? metaData.getEjbName() : "Unknown"; log.debug("stopService, stopping container: " + ejbName); serviceController.stop(jmxName); } catch (Exception e) { log.error("unexpected exception stopping Container: " + con.getJmxName(), e); } // end of try-catch } }
/** * Restore any timers previously persisted for this container */ protected void restoreTimers() { try { // TODO: this name needs to be externalized // pass to the ejb timer service the container ObjectName timerService.restoreTimers(getServiceName(), getClassLoader()); } catch (Exception e) { log.warn("Could not restore ejb timers", e); } }
/** * Add a container to this deployment unit. * * @param con */ private void addContainer(Container con) throws DeploymentException { String ejbName = con.getBeanMetaData().getEjbName(); if (containers.containsKey(ejbName)) throw new DeploymentException("Duplicate ejb-name. Container for " + ejbName + " already exists."); containers.put(ejbName, con); containerOrdering.add(con); con.setEjbModule(this); }
ObjectName jmxName = con.getJmxName(); int conState = con.getState(); boolean destroyContainer = true; log.debug("Looking to destroy container: " + jmxName + ", state: " + con.getStateString() + ", destroy: " + destroyContainer); ClassLoader wcl = con.getWebClassLoader(); if (wcl != null) log.info("Undeployed " + con.getBeanMetaData().getEjbName()); if (server.isRegistered(jmxName)) server.unregisterMBean(jmxName); if (con.getBeanMetaData() != null && con.getBeanMetaData().getInvokerBindings() != null) Iterator<String> invokerBindings = con.getBeanMetaData().getInvokerBindings(); while (invokerBindings.hasNext()) EJBProxyFactory ci = con.lookupProxyFactory(invoker); if (ci != null) con.setBeanMetaData(null); con.setWebClassLoader(null); con.setClassLoader(null); con.setEjbModule(null); con.setTransactionManager(null); con.setSecurityManager(null); con.setRealmMapping(null); con.setSecurityProxy(null);
container.setEjbModule(this); container.setBeanMetaData(bean); wcl = WebClassLoaderFactory.createWebClassLoader(clazz, container.getJmxName(), (RealClassLoader) unitCl); container.setWebClassLoader(wcl); container.setClassLoader(new DelegatingClassLoader(wcl)); container.setTransactionManager(tmFactory.getTransactionManager()); container.setTimerService(timerService); container.setSecurityManager(ejbS); container.setRealmMapping(rM); container.setSecurityManagement(securityManagement); container.setPolicyRegistration(policyRegistration); container.setDefaultSecurityDomain((String) unit.getAttachment("EJB.defaultSecurityDomain")); container.setSecurityContextClassName((String) unit.getAttachment("EJB.securityContextClassName")); container.setSecurityProxy(proxy); log.debug("setSecurityProxy, " + proxy);
public void create() throws Exception jmxName = container.getJmxName(); jmxNameHash = jmxName.hashCode(); jmxNameHashInteger = new Integer(jmxNameHash); BeanMetaData bmd = container.getBeanMetaData(); boolean isSession = !(bmd instanceof EntityMetaData); boolean isStatelessSession = false; pkClass = container.getClassLoader().loadClass(pkClassName); = container.getClassLoader() .loadClass(metaData.getEjbClass()) .getField(metaData.getPrimKeyField())
if (con.getBeanMetaData().isEntity()) SecurityActions.setContextClassLoader(con.getClassLoader()); con.pushENC(); try con.popENC(); log.debug("startService, starting container: " + con.getBeanMetaData().getEjbName()); serviceController.start(con.getJmxName());
public EJBObject getEJBObject() { AllowedOperationsAssociation.assertAllowedIn("getEJBObject", IN_EJB_CREATE | IN_EJB_REMOVE | IN_BUSINESS_METHOD | IN_EJB_TIMEOUT | IN_SERVICE_ENDPOINT_METHOD); if (((StatelessSessionContainer)con).getProxyFactory()==null) throw new IllegalStateException( "No remote interface defined." ); if (ejbObject == null) { EJBProxyFactory proxyFactory = con.getProxyFactory(); if(proxyFactory == null) { String defaultInvokerName = con.getBeanMetaData(). getContainerConfiguration().getDefaultInvokerName(); proxyFactory = con.lookupProxyFactory(defaultInvokerName); } ejbObject = (EJBObject) proxyFactory.getStatelessSessionEJBObject(); } return ejbObject; }
String contextID = getJaccContextID(); try pushENC(); BeanMetaDataPolicyContextHandler.setMetaData(this.getBeanMetaData()); Object obj = internalInvoke(mi); return obj; Object obj = internalInvokeHome(mi); return obj; popENC();
if (container != null) BeanMetaData beanMetaData = container.getBeanMetaData(); ApplicationMetaData applicationMetaData = beanMetaData.getApplicationMetaData(); AssemblyDescriptorMetaData assemblyDescriptor = applicationMetaData.getAssemblyDescriptor(); this.isUseCallerIdentity = true; securityManager = container.getSecurityManager(); realmMapping = container.getRealmMapping(); ejbCS = container.getBeanClass().getProtectionDomain().getCodeSource(); securityManagement = (ISecurityManagement) container.getSecurityManagement();
SecurityActions.setContextClassLoader(container.getClassLoader()); container.pushENC(); try inv.setType(InvocationType.LOCAL); BeanMetaData bmd = container.getBeanMetaData(); SecurityIdentityMetaData ejbTimeoutIdentity = bmd.isEntity() ? null : bmd.getEjbTimeoutIdentity(); if( ejbTimeoutIdentity != null && ejbTimeoutIdentity.getUseCallerIdentity() == false ) pushedRunAs = true; container.invoke(inv); container.popENC(); if(pushedRunAs) SecurityActions.popRunAsIdentity();
addContainer(con); con.setJaccContextID(contextID); ObjectName jmxName = con.getJmxName(); BeanMetaData metaData = con.getBeanMetaData(); Collection<ObjectName> depends = new ArrayList<ObjectName>(); for (String dependsName : metaData.getDepends())
public void waitForNoMoreInvocations () { this.log.debug ("Waiting that the container " + container.getJmxName () + " finishes its running invocations. " + this.runningHomeInvocations + " current home invocations and " + this.runningInvocations + " current remote invocations."); purgeRunningInvocations (); if (isDebugEnabled) log.debug ("... Done: no more remote invocations currently running in this container."); }
public void setRollbackOnly() { // EJB1.1 11.6.1: Must throw IllegalStateException if BMT if (con.getBeanMetaData().isBeanManagedTx()) throw new IllegalStateException("setRollbackOnly() not allowed for BMT beans."); try { TransactionManager tm = con.getTransactionManager(); // The getRollbackOnly and setRollBackOnly method of the SessionContext interface should be used // only in the session bean methods that execute in the context of a transaction. if (tm.getTransaction() == null) throw new IllegalStateException("setRollbackOnly() not allowed without a transaction."); tm.setRollbackOnly(); } catch (SystemException e) { log.warn("failed to set rollback only; ignoring", e); } }
public void create() throws Exception { super.create (); this.allowInvocations = false; this.allowRemoteInvocations = false; this.isDebugEnabled = log.isDebugEnabled (); ejbModuleName = ejbModule.getServiceName().toString(); // we register our inner-class to retrieve STATE notifications from our container // AttributeChangeNotificationFilter filter = new AttributeChangeNotificationFilter (); filter.enableAttribute ("State"); this.container.getServer (). addNotificationListener (this.container.getEjbModule ().getServiceName (), new CleanShutdownInterceptor.StateChangeListener (), filter, null); // we need a way to find all CleanShutDownInterceptor of an EjbModule // ejbModule.putModuleData ("CleanShutDownInterceptor-" + this.container.getServiceName ().toString (), this); }
container.getBeanMetaData().getApplicationMetaData(), container.getClassLoader() ); URL stdJDBCUrl = container.getClassLoader().getResource("standardjbosscmp-jdbc.xml"); if(stdJDBCUrl == null) { throw new DeploymentException("No standardjbosscmp-jdbc.xml found"); VirtualFile dd = container.getDeploymentUnit().getMetaDataFile("jbosscmp-jdbc.xml"); if(dd != null)
RealmMapping rm = con.getRealmMapping(); SecurityContext sc = SecurityActions.getSecurityContext(); Principal caller = null; log.error("Error getting callerPrincipal for " + con.getBeanClass(),e); ApplicationMetaData appMetaData = con.getBeanMetaData().getApplicationMetaData(); String name = appMetaData.getUnauthenticatedPrincipal(); if (name != null)
Object proxyFactory = container.lookupProxyFactory(invokerBinding); if (proxyFactory == null) log.error("jmx name: " + container.getJmxName().toString()); log.error("invokerBinding: " + invokerBinding); log.error("Stack trace", new Throwable()); throw new EJBException("Couldn't find proxy factory"); container.setProxyFactory(proxyFactory);