protected InjectionManager getInjectionManager(Container container) { // This is a bit brittle since we are relying on the internal knowledge of // what org.jboss.ejb3.deployers.EJBsDeployer uses as a name to attach the EJB metadata // component to the deployment unit. However, we don't have an alternate way to get hold // of the name. So for now, let's just use this String ejbComponentName = JBossEnterpriseBeanMetaData.class.getName() + "." + container.getEjbName(); // get the component DU for the EJB of this container from the parent (non-component) DU org.jboss.deployers.structure.spi.DeploymentUnit componentDU = this.jbossUnit.getComponent(ejbComponentName); if (componentDU == null) { // without the component DU, there's no way we can get hold of the correct InjectionManager. // That effectively makes the container unusable. Hence throw this exception throw new RuntimeException("Component Deployment Unit for bean: " + container.getEjbName() + " not found in unit: " + this.jbossUnit); } // get the InjectionManager return componentDU.getAttachment(InjectionManager.class); }
protected void registerEJBContainer(Container container) throws Exception { ObjectName on = container.getObjectName(); String name = on.getCanonicalName(); DependencyPolicy dependsPolicy = container.getDependencyPolicy(); dependsPolicy.addDependency("jboss.ejb:service=EJBTimerService"); kernelAbstraction.install(name, dependsPolicy, unit, container); mbeanServer.registerMBean(container.getMBean(), on); log.debug("Bound ejb3 container " + name); }
private BeanContext createBeanContext() { return container.createBeanContext(); }
protected void processEJBContainerMetadata(Container container) throws Exception { log.trace("Process EJB container metadata " + container); ObjectName on = container.getObjectName(); ejbContainers.put(on, container); container.processMetadata(); }
public static final String clusterUid(Container container) { if (container.isClustered()) return container.getObjectName().getCanonicalName() + ",Partition=" + ((EJBContainer)container).getPartitionName(); return container.getObjectName().getCanonicalName(); }
localContainers.put(container.getEjbName(), container); this.ejbContainers.put(con.getObjectName(), con); Ejb3Registry.register(con); "Error creating ejb container " + con.getEjbName() + ": " + t.getMessage(), t);
RemoteHome remoteHomeAnnotation = ((EJBContainer) container).getAnnotation(RemoteHome.class); Set<Class<?>> remoteAndRemoteBusinessInterfaces = new HashSet<Class<?>>(); Class<?> beanClass = container.getBeanClass(); boolean isStateless = (container instanceof StatelessContainer) ? true : false; throw new RuntimeException("Use of empty @Remote on bean " + container.getEjbName() + " and there are no valid business interfaces"); throw new RuntimeException("Use of empty @Remote on bean " + container.getEjbName() + " with more than one default interface " + businessInterfaces);
MCDependencyPolicy dependsPolicy = (MCDependencyPolicy) container.getDependencyPolicy(); EJBContainer ejbContainer = (EJBContainer) container; JBossEnterpriseBeanMetaData beanMD = ejbContainer.getXml(); if(endpoints != null) String ejbKey = "ejb/" + jbossUnit.getRelativePath() + "#" + container.getEjbName(); cdmd = endpoints.get(ejbKey); throw new RuntimeException("No SwitchBoard Barrier found for bean: " + container.getEjbName() + " in unit: " + this.jbossUnit + " (or its component deployment unit)"); throw new RuntimeException("No InjectionManager found for bean: " + container.getEjbName() + " in unit: " + this.jbossUnit + " (or its component deployment unit)");
private static final String oid(Container container) { return container.getObjectName().getCanonicalName(); }
return getContainer().getEnc().lookup(newName); return getContainer().getInitialContext().lookup(name);
public void discard(BeanContext ctx) { if (log.isTraceEnabled()) { String msg = "Discard instance:" + this + "#" + ctx + "#" + container.getBeanClass(); log.trace(msg); } // If we block when maxSize instances are in use, invoke release on strictMaxSize strictMaxSize.release(); --inUse; // Let the super do any other remove stuff super.doRemove(ctx); }
protected void deployElement(Ejb3HandlerFactory factory, ClassFile cf, InitialContext ctx) throws Exception { Ejb3Handler handler = factory.createHandler(cf); handler.setCtxProperties(unit.getJndiProperties()); if (handler.isEjb() || handler.isJBossBeanType()) { List<Container> containers = handler.getContainers(cf, this); for (Container con : containers) { // EJBContainer has finished with all metadata initialization from XML files and such. // this is really a hook to do some processing after XML has been set up and before // and processing of dependencies and such. try { ((EJBContainer) con).instantiated(); this.ejbContainers.put(con.getObjectName(), con); Ejb3Registry.register(con); } catch (Throwable t) { throw new DeploymentException( "Error creating ejb container " + con.getEjbName() + ": " + t.getMessage(), t); } } } }
Class<?> beanClass = container.getBeanClass(); throw new RuntimeException("Use of empty @Local on bean " + container.getEjbName() + " and there are no valid business interfaces"); throw new RuntimeException("Use of empty @Local on bean " + container.getEjbName() + " with more than one default interface " + businessInterfacesImplementedByBeanClass); + remoteInterface.toString() + "\" for EJB \"" + container.getEjbName() + "\" per EJB3 Spec 4.6.6, Bullet 5.4 [" + ErrorCodes.ERROR_CODE_EJBTHREE751 + "]");
public static final String guid(Container container, VMID vmid) { return container.getObjectName().getCanonicalName() + ",VMID=" + vmid; }
@Override public void remove(BeanContext ctx) { if (log.isTraceEnabled()) { String msg = "Removing instance:" + this + "#" + ctx + "#" + container.getBeanClass(); log.trace(msg); } strictMaxSize.release(); --inUse; // let the super do the other remove stuff super.doRemove(ctx); } }
public UserTransactionPropertyInjector(BeanProperty property, InjectionContainer container) { super(property); if (container instanceof EJBContainer) { TransactionManagementType type = TxUtil.getTransactionManagementType(((EJBContainer) container).getAdvisor()); if (type != TransactionManagementType.BEAN) throw new IllegalStateException("Container " + ((Container) container).getEjbName() + ": it is illegal to inject UserTransaction into a CMT bean"); } }
private void generateContainerName(Container container, JBossEnterpriseBeanMetaData beanMD) { ObjectName on = container.getObjectName(); assert on!=null : "ObjectName was null"; // Heiko: This should actually generate the name and assign it to ejb3 meta data // Currently we stick to copying the values around until an EJB3 team member figures out a proper way beanMD.setGeneratedContainerName(on.getCanonicalName()); }
+ "#" + container.getBeanClass(); log.trace(msg);
return container.getEjbName(); return beanContext.getContainer().getEjbName();
log.trace("Get instance " + this + "#" + pool.size() + "#" + container.getBeanClass());