[jboss-cvs] JBossAS SVN: r61900 - in trunk/server/src/main/org/jboss: ejb and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Mar 30 13:35:44 EDT 2007


Author: anil.saldhana at jboss.com
Date: 2007-03-30 13:35:44 -0400 (Fri, 30 Mar 2007)
New Revision: 61900

Modified:
   trunk/server/src/main/org/jboss/deployment/security/JaccPolicy.java
   trunk/server/src/main/org/jboss/ejb/EjbModule.java
   trunk/server/src/main/org/jboss/ejb/deployers/EjbDeployer.java
   trunk/server/src/main/org/jboss/web/deployers/AbstractWarDeployer.java
Log:
Handle ejb jars and wars that may be the top level deployments

Modified: trunk/server/src/main/org/jboss/deployment/security/JaccPolicy.java
===================================================================
--- trunk/server/src/main/org/jboss/deployment/security/JaccPolicy.java	2007-03-30 17:33:54 UTC (rev 61899)
+++ trunk/server/src/main/org/jboss/deployment/security/JaccPolicy.java	2007-03-30 17:35:44 UTC (rev 61900)
@@ -53,10 +53,14 @@
    private PolicyConfiguration parentPC = null;
    private String contextID = null;
    
+   /** List of contextIds for all sub deployments that are jacc capable **/
    private List<String> subDeployments = new ArrayList<String>();
    
    public static String BASE_OBJECT_NAME = "jboss:service=jacc,id=";
    
+   /** Original list of jacc sub deployments **/
+   private int jaccDeploymentsCount = 0; 
+   
    /**
     * Ctr
     * @param id Jacc Context Id for the top level deployment
@@ -68,6 +72,7 @@
          throw new IllegalArgumentException("Jacc Context Id passed is null");
       this.contextID = id; 
       subDeployments.addAll(JaccPolicyUtil.getJaccDeployments(unit, ignoreSuffix));
+      jaccDeploymentsCount = subDeployments.size();
    }
    
    /**
@@ -97,7 +102,7 @@
     * @see JaccPolicyMBean#start()
     */
    public void start()
-   {  
+   { 
       /**
        * We cannot start the policy configuration until all the subdeployments
        * have linked
@@ -144,12 +149,17 @@
     */
    public void link(PolicyConfiguration pc) throws PolicyContextException
    { 
+      if(jaccDeploymentsCount == 0)
+         return; //There is just one deployment and the component deployment will commit
+      
       if(trace)
          log.trace("Linking " + pc + " to parent pc=" +  parentPC);
       parentPC.linkConfiguration(pc);
       this.subDeployments.remove(pc.getContextID());
       if(this.subDeployments.size() == 0)
-         parentPC.commit(); //Ready to be inService
+      {
+         parentPC.commit(); //Ready to be inService 
+      }
    }
    
    /**

Modified: trunk/server/src/main/org/jboss/ejb/EjbModule.java
===================================================================
--- trunk/server/src/main/org/jboss/ejb/EjbModule.java	2007-03-30 17:33:54 UTC (rev 61899)
+++ trunk/server/src/main/org/jboss/ejb/EjbModule.java	2007-03-30 17:35:44 UTC (rev 61900)
@@ -384,7 +384,7 @@
          
          if(pc != null && jaccPolicy != null)
          {
-            jaccPolicy.link(pc);
+            jaccPolicy.link(pc); 
             pc.commit();
          }
            

Modified: trunk/server/src/main/org/jboss/ejb/deployers/EjbDeployer.java
===================================================================
--- trunk/server/src/main/org/jboss/ejb/deployers/EjbDeployer.java	2007-03-30 17:33:54 UTC (rev 61899)
+++ trunk/server/src/main/org/jboss/ejb/deployers/EjbDeployer.java	2007-03-30 17:35:44 UTC (rev 61900)
@@ -171,12 +171,10 @@
       wsDepends.setDependency(getWebServiceName());
       ws.setValue(wsDepends);
       attrs.add(ws);
-       
-      //Add a dependence on the jacc policy only if we are not the top-level deployment
-      if(unit.getParent() != null)
-      { 
-         attrs.add(JaccPolicyUtil.getServiceAttributeMetaData(unit));
-      }
+      
+      //Add a dependence on the jacc policy 
+      //TODO: Do it only if the deployment is security enabled
+      attrs.add(JaccPolicyUtil.getServiceAttributeMetaData(unit)); 
       ejbModule.setAttributes(attrs);
 
       List<ServiceDependencyMetaData> dependencies = new ArrayList<ServiceDependencyMetaData>();
@@ -218,9 +216,7 @@
 
    @Override
    public void undeploy(DeploymentUnit unit, ApplicationMetaData deployment)
-   {
-      // TODO Auto-generated method stub
-      
+   { 
    }
 
    /**

Modified: trunk/server/src/main/org/jboss/web/deployers/AbstractWarDeployer.java
===================================================================
--- trunk/server/src/main/org/jboss/web/deployers/AbstractWarDeployer.java	2007-03-30 17:33:54 UTC (rev 61899)
+++ trunk/server/src/main/org/jboss/web/deployers/AbstractWarDeployer.java	2007-03-30 17:35:44 UTC (rev 61900)
@@ -617,16 +617,13 @@
             ServiceDependencyMetaData sdmd = new ServiceDependencyMetaData();
             sdmd.setIDependOn(iDependOn);
          }
-         webModule.setDependencies(dependencies);
+         webModule.setDependencies(dependencies); 
          
-         //Add a dependence on the jacc policy only if we are not the top-level deployment 
-         if(unit.getParent() != null)
-         {
-            //set attributes 
-            List<ServiceAttributeMetaData> attrs = new ArrayList<ServiceAttributeMetaData>(); 
-            attrs.add(JaccPolicyUtil.getServiceAttributeMetaData(unit));
-            webModule.setAttributes(attrs);
-         } 
+         //Add a dependence on the JaccPolicy
+         //TODO: Do it only if the war is security enabled 
+         List<ServiceAttributeMetaData> attrs = new ArrayList<ServiceAttributeMetaData>(); 
+         attrs.add(JaccPolicyUtil.getServiceAttributeMetaData(unit));
+         webModule.setAttributes(attrs); 
 
          // TODO could create multiple components for the deployment
          // The ServiceConstructorMetaData is not serializable due to its args




More information about the jboss-cvs-commits mailing list