Package org.jboss.ejb3

Examples of org.jboss.ejb3.EJBContainer


   @Override
   public void start() throws Exception
   {
      super.start();
      EJBContainer statelessContainer = (EJBContainer) getContainer();
      LocalHome localHome = (LocalHome) statelessContainer.resolveAnnotation(LocalHome.class);
      if (localHome != null && !bindHomeAndBusinessTogether(statelessContainer))
      {
         Class<?>[] interfaces = {localHome.value()};
         Object homeProxy = java.lang.reflect.Proxy.newProxyInstance(getContainer().getBeanClass().getClassLoader(),
                                                                     interfaces, new StatelessLocalProxy(getContainer()));
View Full Code Here


   @Override
   public void stop() throws Exception
   {
      super.stop();
      EJBContainer statelessContainer = (EJBContainer) getContainer();
      LocalHome localHome = (LocalHome) statelessContainer.resolveAnnotation(LocalHome.class);
      if (localHome != null && !bindHomeAndBusinessTogether(statelessContainer))
      {
         Util.unbind(getContainer().getInitialContext(), ProxyFactoryHelper.getLocalHomeJndiName(getContainer()));
      }
   }
View Full Code Here

   {
      Advisor advisor = (Advisor) container;
      this.pool = container.getPool();
      cacheMap = new CacheMap();
      PersistenceManager pmConfig = (PersistenceManager) advisor.resolveAnnotation(PersistenceManager.class);
      EJBContainer ejbContainer = (EJBContainer)container;
      this.pm = ejbContainer.getDeployment().getPersistenceManagerFactoryRegistry().getPersistenceManagerFactory(
            pmConfig.value()).createPersistenceManager();
      pm.initialize(container);
      CacheConfig config = (CacheConfig) advisor.resolveAnnotation(CacheConfig.class);
      maxSize = config.maxSize();
      sessionTimeout = config.idleTimeoutSeconds();
View Full Code Here

         }
         String ejbName = ejbLink.substring(hashIndex + 1);
         return dep.getEjbContainer(ejbName, businessIntf);
      }
      // look internally
      EJBContainer ejb = searchDeploymentInternally(ejbLink, businessIntf);
      if (ejb != null) return ejb;
      for (Object obj : Ejb3Registry.getContainers())
      {
         EJBContainer container = (EJBContainer) obj;
         if (container.getEjbName().equals(ejbLink))
         {
            return container;
         }
      }
      return null;
View Full Code Here

      return null;
   }

   public String getEjbJndiName(String ejbLink, Class businessIntf)
   {
      EJBContainer container = getEjbContainer(ejbLink, businessIntf);
      if (container == null)
      {
         return null;
      }
      return ProxyFactoryHelper.getJndiName(container, businessIntf);
View Full Code Here

      return ProxyFactoryHelper.getJndiName(container, businessIntf);
   }

   public EJBContainer getEjbContainer(Ejb3Deployment deployment, Class businessIntf) throws NameNotFoundException
   {
      EJBContainer container = null;
      // search in myself
      for (Object obj : deployment.getEjbContainers().values())
      {
         EJBContainer newContainer = (EJBContainer) obj;
         if (container == newContainer) continue;
         if (ProxyFactoryHelper.publishesInterface(newContainer, businessIntf))
         {
            if (container != null) throw new NameNotFoundException("duplicated in " + errorName);
            container = newContainer;
View Full Code Here

      return container;
   }

   public EJBContainer getEjbContainer(Class businessIntf) throws NameNotFoundException
   {
      EJBContainer rtnContainer = null;
      // search in deployment first
      rtnContainer = searchForEjbContainerInternally(businessIntf);
      if (rtnContainer != null) return rtnContainer;
      // search in EAR
      String jarName = null;
      if (deploymentScope != null)
      {
         for (Ejb3Deployment deployment : deploymentScope.getEjbDeployments())
         {
            EJBContainer newContainer = getEjbContainer(deployment, businessIntf);
            if (rtnContainer == newContainer) continue; // don't check self
            if (rtnContainer != null && newContainer != null)
            {
               throw new NameNotFoundException("duplicated in .ear within " + jarName +
                       " and " + deployment.getDeploymentUnit().getShortName());
            }
            if (newContainer != null)
            {
               rtnContainer = newContainer;
               jarName = deployment.getDeploymentUnit().getShortName();
            }
         }
      }
      if (rtnContainer != null)
      {
         return rtnContainer;
      }
      // search everywhere
      Iterator containers = Ejb3Registry.getContainers().iterator();
      while (containers.hasNext())
      {
         Container container = (Container)containers.next();
         EJBContainer ejbContainer = (EJBContainer) container;
         if (ejbContainer == rtnContainer) continue;
         if (ProxyFactoryHelper.publishesInterface(container, businessIntf))
         {
            if (rtnContainer != null)
            {
               throw new NameNotFoundException("duplicated in " + ejbContainer.getDeployment().getDeploymentUnit().getShortName()
                       + " and " + jarName);
            }
            rtnContainer = ejbContainer;
            jarName = ejbContainer.getDeployment().getDeploymentUnit().getShortName();
         }
      }
      if (rtnContainer != null) return rtnContainer;
      throw new NameNotFoundException("not used by any EJBs");
   }
View Full Code Here

   protected abstract EJBContainer searchForEjbContainerInternally(Class businessIntf) throws NameNotFoundException;

   public String getEjbJndiName(Class businessIntf) throws NameNotFoundException
   {
      EJBContainer container = getEjbContainer(businessIntf);
      String jndiName = ProxyFactoryHelper.getJndiName(container, businessIntf);
      if (jndiName == null) throw new NameNotFoundException("not used by any EJBs");
      return jndiName;
   }
View Full Code Here

   }


   public Object createPerClass(Advisor advisor)
   {
      EJBContainer container = (EJBContainer)advisor;
      RunAsIdentity runAsIdentity = getRunAsIdentity(container);
      /*if (runAsIdentity == null)
      {
         return new NullInterceptor();
      }*/

      Object domain = null;
      try
      {
         InitialContext ctx = container.getInitialContext();
         SecurityDomain securityDomain = (SecurityDomain) advisor.resolveAnnotation(SecurityDomain.class);
         if (securityDomain != null)
         {
            String domainName = securityDomain.value();
            domain = SecurityDomainManager.getSecurityManager(domainName, ctx);
View Full Code Here

    * @see org.jboss.aop.advice.AspectFactory#createPerClass(org.jboss.aop.Advisor)
    */
   public Object createPerClass(final Advisor advisor)
   {
      // Get the container
      final EJBContainer container = EJBContainer.getEJBContainer(advisor);

      // Get the metadata
      final JBossEnterpriseBeanMetaData md = container.getXml();

      // Create the interceptor instance
      AsyncMethodsMetaData asyncMethods = this.getAsyncMethods(md);
      if (asyncMethods == null)
      {
View Full Code Here

TOP

Related Classes of org.jboss.ejb3.EJBContainer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.