[jboss-cvs] JBossAS SVN: r59914 - branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Jan 22 08:42:19 EST 2007


Author: wolfc
Date: 2007-01-22 08:42:19 -0500 (Mon, 22 Jan 2007)
New Revision: 59914

Modified:
   branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/Ejb3Deployment.java
Log:
+ EJBTHREE-840: fixed reference from Ejb3Registry

Modified: branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/Ejb3Deployment.java
===================================================================
--- branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/Ejb3Deployment.java	2007-01-22 10:24:32 UTC (rev 59913)
+++ branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/Ejb3Deployment.java	2007-01-22 13:42:19 UTC (rev 59914)
@@ -62,9 +62,9 @@
    public static final String ACTUAL_ENTITY_MANAGER_FACTORY_CONTEXT = "java:/ActualEntityManagerFactories";
    public static final String MANAGED_ENTITY_FACTORY_CONTEXT = "java:/managedEntityFactories";
 
-   protected DeploymentUnit di;
+   protected DeploymentUnit unit;
 
-   protected LinkedHashMap ejbContainers = new LinkedHashMap();
+   protected LinkedHashMap<ObjectName, Container> ejbContainers = new LinkedHashMap<ObjectName, Container>();
 
    protected boolean hasEntities;
    protected List<String> explicitEntityClasses = new ArrayList<String>();
@@ -91,19 +91,19 @@
    //The JACC PolicyConfiguration
    PolicyConfiguration pc;
 
-   public Ejb3Deployment(DeploymentUnit di, EAR ear)
+   public Ejb3Deployment(DeploymentUnit unit, EAR ear)
    {
-      this.di = di;
+      this.unit = unit;
       this.ear = ear;
       try
       {
-         initialContext = EJB3Util.getInitialContext(di.getJndiProperties());
+         initialContext = EJB3Util.getInitialContext(unit.getJndiProperties());
       }
       catch (NamingException e)
       {
          throw new RuntimeException(e);
       }
-      ejbRefResolver = new EjbModuleEjbResolver(ear, di.getShortName(), ejbContainers, this);
+      ejbRefResolver = new EjbModuleEjbResolver(ear, unit.getShortName(), ejbContainers, this);
       persistenceUnitResolver = new EjbModulePersistenceUnitResolver(persistenceUnitDeployments, ear, ejbContainers);
    }
 
@@ -129,7 +129,7 @@
 
    public DeploymentUnit getDeploymentUnit()
    {
-      return di;
+      return unit;
    }
 
    public String getDefaultSLSBDomain()
@@ -148,7 +148,7 @@
    {
       String scopedKernelName = "";
       if (ear != null) scopedKernelName += ",ear=" + ear.getShortName();
-      scopedKernelName += ",jar=" + di.getShortName();
+      scopedKernelName += ",jar=" + unit.getShortName();
       return scopedKernelName;
    }
 
@@ -214,7 +214,7 @@
 
    protected String getJaccContextId()
    {
-      return di.getShortName();
+      return unit.getShortName();
    }
 
    public Container getContainer(ObjectName name)
@@ -328,7 +328,7 @@
             registerEJBContainer(con);
          }
 
-         putJaccInService(pc, di);
+         putJaccInService(pc, unit);
       }
       catch (Exception ex)
       {
@@ -347,11 +347,11 @@
    protected void deploy() throws Exception
    {
       Ejb3HandlerFactory factory = Ejb3HandlerFactory.getInstance(this);
-      if (di.getUrl() != null) deployUrl(factory);
+      if (unit.getUrl() != null) deployUrl(factory);
 
-      if (di.getClasses() != null)
+      if (unit.getClasses() != null)
       {
-         for (Class explicit : di.getClasses())
+         for (Class explicit : unit.getClasses())
          {
             if (explicit.isAnnotationPresent(Entity.class))
             {
@@ -367,7 +367,7 @@
    protected void deployUrl(Ejb3HandlerFactory factory)
            throws Exception
    {
-      Iterator it = ArchiveBrowser.getBrowser(di.getUrl(), new ClassFileFilter());
+      Iterator it = ArchiveBrowser.getBrowser(unit.getUrl(), new ClassFileFilter());
 
       InitialContext ctx = initialContext;
       // need to look into every entry in the archive to see if anybody has tags
@@ -402,7 +402,7 @@
            throws Exception
    {
       Ejb3Handler handler = factory.createHandler(cf);
-      handler.setCtxProperties(di.getJndiProperties());
+      handler.setCtxProperties(unit.getJndiProperties());
 
       if (handler.isEjb() || handler.isJBossBeanType())
       {
@@ -423,15 +423,15 @@
            throws Exception
    {
       URL persistenceXmlUrl = null;
-      persistenceXmlUrl = di.getPersistenceXml();
+      persistenceXmlUrl = unit.getPersistenceXml();
  
       hasEntities = persistenceXmlUrl != null;
 
       if (!hasEntities) return;
 
-      if (di.getClasses() != null)
+      if (unit.getClasses() != null)
       {
-         for (Class explicit : di.getClasses())
+         for (Class explicit : unit.getClasses())
          {
             if (explicit.isAnnotationPresent(Entity.class))
             {
@@ -446,7 +446,7 @@
       {
          String earShortName = ear == null ? null : ear.getShortName();
          boolean isScoped = ejbContainers.size() > 0;
-         PersistenceUnitDeployment deployment = new PersistenceUnitDeployment(initialContext, this, explicitEntityClasses, persistenceXmlUrl, metadata, earShortName, di.getShortName(), isScoped);
+         PersistenceUnitDeployment deployment = new PersistenceUnitDeployment(initialContext, this, explicitEntityClasses, persistenceXmlUrl, metadata, earShortName, unit.getShortName(), isScoped);
          PersistenceUnitRegistry.register(deployment);
          persistenceUnitDeployments.add(deployment);
       }
@@ -499,9 +499,6 @@
          {
             ObjectName on = (ObjectName) o;
             kernelAbstraction.uninstall(on.getCanonicalName());
-            Container container = (Container) ejbContainers.get(on);
-            Ejb3Registry.unregister(container);
-            container.stop();
          }
          catch (Exception e)
          {
@@ -513,8 +510,18 @@
 
    public void destroy() throws Exception
    {
+      undeploy();
+      
       PolicyConfigurationFactory pcFactory = PolicyConfigurationFactory.getPolicyConfigurationFactory();
       PolicyConfiguration pc = pcFactory.getPolicyConfiguration(getJaccContextId(), true);
       pc.delete();
    }
+   
+   private void undeploy()
+   {
+      for(Container container : ejbContainers.values())
+      {
+         Ejb3Registry.unregister(container);
+      }
+   }
 }




More information about the jboss-cvs-commits mailing list