[jboss-cvs] JBossAS SVN: r61653 - in trunk: server/src/main/org/jboss/deployment and 6 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sat Mar 24 10:37:47 EDT 2007


Author: scott.stark at jboss.org
Date: 2007-03-24 10:37:47 -0400 (Sat, 24 Mar 2007)
New Revision: 61653

Modified:
   trunk/server/src/etc/deployers/client-deployer-beans.xml
   trunk/server/src/main/org/jboss/deployment/ClientDeployer.java
   trunk/server/src/main/org/jboss/deployment/security/SecurityDeployer.java
   trunk/server/src/main/org/jboss/ejb/EjbUtil50.java
   trunk/server/src/main/org/jboss/web/deployers/AbstractWarDeployer.java
   trunk/server/src/main/org/jboss/web/deployers/AbstractWarDeployment.java
   trunk/tomcat/src/main/org/jboss/web/tomcat/service/TomcatInjectionContainer.java
   trunk/tomcat/src/main/org/jboss/web/tomcat/service/WarEjbResolver.java
   trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployer.java
   trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployment.java
   trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployment2.java
   trunk/tomcat/src/resources/war-deployers-beans.xml
Log:
+ Correct the handling of local ejb refs
+ Update the handling of cross module refs to use the new MainDeployer

Modified: trunk/server/src/etc/deployers/client-deployer-beans.xml
===================================================================
--- trunk/server/src/etc/deployers/client-deployer-beans.xml	2007-03-24 14:34:56 UTC (rev 61652)
+++ trunk/server/src/etc/deployers/client-deployer-beans.xml	2007-03-24 14:37:47 UTC (rev 61653)
@@ -16,6 +16,6 @@
             <this/>
          </parameter>
       </uninstall>
-      <property name="mbeanServer"><inject bean="JMXKernel" property="mbeanServer"/></property>
+      <property name="mainDeployer"><inject bean="MainDeployer" /></property>
    </bean>
 </deployment>
\ No newline at end of file

Modified: trunk/server/src/main/org/jboss/deployment/ClientDeployer.java
===================================================================
--- trunk/server/src/main/org/jboss/deployment/ClientDeployer.java	2007-03-24 14:34:56 UTC (rev 61652)
+++ trunk/server/src/main/org/jboss/deployment/ClientDeployer.java	2007-03-24 14:37:47 UTC (rev 61653)
@@ -40,6 +40,7 @@
 import org.jboss.deployers.spi.DeploymentException;
 import org.jboss.deployers.spi.classloader.ClassLoaderFactory;
 import org.jboss.deployers.spi.deployer.DeploymentUnit;
+import org.jboss.deployers.spi.deployment.MainDeployer;
 import org.jboss.deployers.spi.structure.DeploymentContext;
 import org.jboss.ejb.EjbUtil50;
 import org.jboss.metadata.ClientMetaData;
@@ -70,16 +71,15 @@
    private static final String APPLICATION_CLIENT_XML = "application-client.xml";
    private static final String JBOSS_CLIENT_XML = "jboss-client.xml";
 
-   private MBeanServer mbeanServer;
+   private MainDeployer mainDeployer;
 
-   public MBeanServer getMbeanServer()
+   public MainDeployer getMainDeployer()
    {
-      return mbeanServer;
+      return mainDeployer;
    }
-
-   public void setMbeanServer(MBeanServer server)
+   public void setMainDeployer(MainDeployer mainDeployer)
    {
-      this.mbeanServer = server;
+      this.mainDeployer = mainDeployer;
    }
 
    /**
@@ -247,7 +247,7 @@
          {
             // Internal link
             String linkName = ref.getLink();
-            String jndiName = EjbUtil50.findEjbLink(mbeanServer, unit, linkName);
+            String jndiName = EjbUtil50.findEjbLink(mainDeployer, unit, linkName);
 
             log.debug("Binding " + ref.getName() + " to ejb-link: " + linkName + " -> " + jndiName);
             if (jndiName == null)

Modified: trunk/server/src/main/org/jboss/deployment/security/SecurityDeployer.java
===================================================================
--- trunk/server/src/main/org/jboss/deployment/security/SecurityDeployer.java	2007-03-24 14:34:56 UTC (rev 61652)
+++ trunk/server/src/main/org/jboss/deployment/security/SecurityDeployer.java	2007-03-24 14:37:47 UTC (rev 61653)
@@ -21,6 +21,7 @@
   */
 package org.jboss.deployment.security;
   
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashSet;
 
@@ -30,6 +31,7 @@
 import org.jboss.deployers.spi.DeploymentException;
 import org.jboss.deployers.spi.deployer.DeploymentUnit;
 import org.jboss.system.metadata.ServiceConstructorMetaData;
+import org.jboss.system.metadata.ServiceDeployment;
 import org.jboss.system.metadata.ServiceMetaData;
 
 //$Id$
@@ -37,6 +39,7 @@
 /**
  *  Security Deployer that does Jacc initialization
  *  @author <a href="mailto:Anil.Saldhana at jboss.org">Anil Saldhana</a>
+ *  @author Scott.Stark at jboss.org
  *  @since  Dec 11, 2006 
  *  @version $Revision$
  */
@@ -80,15 +83,20 @@
       constructor.setSignature(new String[] { String.class.getName(),
             DeploymentUnit.class.getName(), Collection.class.getName()});
       constructor.setParameters(new Object[] {contextId, unit, ignoreSuffixes});
-      jaccPolicy.setConstructor(constructor); 
+      jaccPolicy.setConstructor(constructor);
+      ArrayList<ServiceMetaData> services = new ArrayList<ServiceMetaData>();
+      services.add(jaccPolicy);
       
       //Now add this service bean to the unit
-      unit.addAttachment("jboss.jaccpolicy",jaccPolicy, ServiceMetaData.class);  
+      ServiceDeployment sd = new ServiceDeployment();
+      sd.setServices(services);
+      unit.addAttachment("jboss.jaccpolicy", sd, ServiceDeployment.class);
+      // policyUnit.addAttachment("jboss.jaccpolicy", jaccPolicy, .class);  
    }
 
    @Override
    public void undeploy(DeploymentUnit unit )
    {
-      unit.removeAttachment("jboss.jaccpolicy", ServiceMetaData.class); 
+      unit.removeAttachment("jboss.jaccpolicy", ServiceDeployment.class); 
    }
 }


Property changes on: trunk/server/src/main/org/jboss/deployment/security/SecurityDeployer.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision

Modified: trunk/server/src/main/org/jboss/ejb/EjbUtil50.java
===================================================================
--- trunk/server/src/main/org/jboss/ejb/EjbUtil50.java	2007-03-24 14:34:56 UTC (rev 61652)
+++ trunk/server/src/main/org/jboss/ejb/EjbUtil50.java	2007-03-24 14:37:47 UTC (rev 61653)
@@ -26,10 +26,9 @@
 import java.util.Iterator;
 import java.util.StringTokenizer;
 
-import javax.management.MBeanServer;
-
 import org.jboss.deployers.spi.deployer.DeploymentUnit;
 import org.jboss.deployers.spi.structure.DeploymentContext;
+import org.jboss.deployers.spi.deployment.MainDeployer;
 import org.jboss.deployment.MainDeployerMBean;
 import org.jboss.logging.Logger;
 import org.jboss.metadata.ApplicationMetaData;
@@ -61,7 +60,7 @@
     * @return The JNDI Entry of the target bean; <code>null</code> if
     *         no appropriate target could be found.
     */
-   public static String findEjbLink(MBeanServer server, DeploymentUnit unit, String link)
+   public static String findEjbLink(MainDeployer server, DeploymentUnit unit, String link)
    {
       return resolveLink(server, unit, link, false);
    }
@@ -76,7 +75,7 @@
     * @return The JNDI Entry of the target bean; <code>null</code> if
     *         no appropriate target could be found.
     */
-   public static String findLocalEjbLink(MBeanServer server, DeploymentUnit unit, String link)
+   public static String findLocalEjbLink(MainDeployer server, DeploymentUnit unit, String link)
    {
       return resolveLink(server, unit, link, true);
    }
@@ -91,12 +90,12 @@
     * @return The JNDI Entry of the target; <code>null</code> if
     *         no appropriate target could be found.
     */
-   public static MessageDestinationMetaData findMessageDestination(MBeanServer server, DeploymentUnit di, String link)
+   public static MessageDestinationMetaData findMessageDestination(MainDeployer server, DeploymentUnit di, String link)
    {
       return resolveMessageDestination(server, di, link);
    }
 
-   private static String resolveLink(MBeanServer server, DeploymentUnit di, String link, boolean isLocal)
+   private static String resolveLink(MainDeployer server, DeploymentUnit di, String link, boolean isLocal)
    {
       if (link == null)
       {
@@ -132,7 +131,7 @@
       }
    }
 
-   private static String resolveRelativeLink(MBeanServer server, DeploymentUnit unit, String link, boolean isLocal)
+   private static String resolveRelativeLink(MainDeployer server, DeploymentUnit unit, String link, boolean isLocal)
    {
 
       String path = link.substring(0, link.indexOf('#'));
@@ -179,7 +178,8 @@
       DeploymentUnit targetUnit = null;
       try
       {
-         targetUnit = (DeploymentUnit)server.invoke(MainDeployerMBean.OBJECT_NAME, "getDeployment", new Object[] { target }, new String[] { URL.class.getName() });
+         DeploymentContext ctx = server.getDeploymentContext(target.toString());
+         targetUnit = ctx.getDeploymentUnit();
       }
       catch (Exception e)
       {
@@ -291,7 +291,7 @@
       return jndiName;
    }
 
-   private static MessageDestinationMetaData resolveMessageDestination(MBeanServer server, DeploymentUnit di, String link)
+   private static MessageDestinationMetaData resolveMessageDestination(MainDeployer server, DeploymentUnit di, String link)
    {
       if (link == null)
          return null;
@@ -317,7 +317,7 @@
       }
    }
 
-   private static MessageDestinationMetaData resolveRelativeMessageDestination(MBeanServer server, DeploymentUnit unit, String link)
+   private static MessageDestinationMetaData resolveRelativeMessageDestination(MainDeployer server, DeploymentUnit unit, String link)
    {
       String path = link.substring(0, link.indexOf('#'));
       String destinationName = link.substring(link.indexOf('#') + 1);
@@ -357,7 +357,8 @@
       DeploymentUnit targetUnit = null;
       try
       {
-         targetUnit = (DeploymentUnit)server.invoke(MainDeployerMBean.OBJECT_NAME, "getDeployment", new Object[] { target }, new String[] { URL.class.getName() });
+         DeploymentContext ctx = server.getDeploymentContext(target.toString());
+         targetUnit = ctx.getDeploymentUnit();
       }
       catch (Exception e)
       {

Modified: trunk/server/src/main/org/jboss/web/deployers/AbstractWarDeployer.java
===================================================================
--- trunk/server/src/main/org/jboss/web/deployers/AbstractWarDeployer.java	2007-03-24 14:34:56 UTC (rev 61652)
+++ trunk/server/src/main/org/jboss/web/deployers/AbstractWarDeployer.java	2007-03-24 14:37:47 UTC (rev 61653)
@@ -37,6 +37,7 @@
 import org.jboss.deployers.plugins.deployers.helpers.AbstractSimpleRealDeployer; 
 import org.jboss.deployers.spi.DeploymentException;
 import org.jboss.deployers.spi.deployer.DeploymentUnit;
+import org.jboss.deployers.spi.deployment.MainDeployer;
 import org.jboss.deployers.spi.structure.DeploymentContext; 
 import org.jboss.deployment.security.JaccPolicyUtil;
 import org.jboss.metadata.WebMetaData;
@@ -100,6 +101,7 @@
    private String subjectAttributeName = null;
    /** Legacy support for MBeanServer */
    private MBeanServer server; 
+   private MainDeployer mainDeployer;
 
    /**
     * Set the relative order to COMPONENT_DEPLOYER+1 by default
@@ -395,6 +397,7 @@
          metaData.setContextRoot(webContext);
 
          AbstractWarDeployment deployment = getDeployment(unit, metaData);
+         deployment.setMainDeployer(mainDeployer);
          deployWebModule(unit, metaData, deployment);
       }
       catch (Exception e)
@@ -550,6 +553,16 @@
       return server;
    }
 
+   public MainDeployer getMainDeployer()
+   {
+      return mainDeployer;
+   }
+
+   public void setMainDeployer(MainDeployer mainDeployer)
+   {
+      this.mainDeployer = mainDeployer;
+   }
+
    /**
     * Get the object name of the ServiceMetaData instance associated with
     * the WebMetaData. This uses the pattern:

Modified: trunk/server/src/main/org/jboss/web/deployers/AbstractWarDeployment.java
===================================================================
--- trunk/server/src/main/org/jboss/web/deployers/AbstractWarDeployment.java	2007-03-24 14:34:56 UTC (rev 61652)
+++ trunk/server/src/main/org/jboss/web/deployers/AbstractWarDeployment.java	2007-03-24 14:37:47 UTC (rev 61653)
@@ -42,6 +42,7 @@
 import javax.security.jacc.PolicyConfigurationFactory;
 
 import org.jboss.deployers.spi.deployer.DeploymentUnit;
+import org.jboss.deployers.spi.deployment.MainDeployer;
 import org.jboss.deployment.security.JaccPolicyMBean;
 import org.jboss.ejb.EjbUtil50;
 import org.jboss.logging.Logger;
@@ -97,6 +98,8 @@
    protected Logger log;
 
    protected MBeanServer server;
+   protected MainDeployer mainDeployer;
+
    /**
     * The parent class loader first model flag
     */
@@ -160,6 +163,16 @@
       this.server = server;
    }
 
+   public MainDeployer getMainDeployer()
+   {
+      return mainDeployer;
+   }
+
+   public void setMainDeployer(MainDeployer mainDeployer)
+   {
+      this.mainDeployer = mainDeployer;
+   }
+
    /**
     * Get the flag indicating if the normal Java2 parent first class loading
     * model should be used over the servlet 2.3 web container first model.
@@ -634,7 +647,7 @@
          {
             if (jndiName == null)
             {
-               MessageDestinationMetaData messageDestination = EjbUtil50.findMessageDestination(server, unit, link);
+               MessageDestinationMetaData messageDestination = EjbUtil50.findMessageDestination(mainDeployer, unit, link);
                if (messageDestination == null)
                   throw new NamingException("message-destination-ref '" + refName +
                      "' message-destination-link '" + link + "' not found and no jndi-name in jboss-web.xml");
@@ -671,7 +684,7 @@
          //use ejb-link if it is specified
          if (linkName != null)
          {
-            jndiName = EjbUtil50.findEjbLink(server, unit, linkName);
+            jndiName = EjbUtil50.findEjbLink(mainDeployer, unit, linkName);
              
             //if flag does not allow misconfigured ejb-links, it is an error
             if ((jndiName == null) && !(getLenientEjbLink()))
@@ -705,7 +718,7 @@
          //use the ejb-link field if it is specified
          if (linkName != null)
          {
-            jndiName = EjbUtil50.findLocalEjbLink(server, unit, linkName);
+            jndiName = EjbUtil50.findLocalEjbLink(mainDeployer, unit, linkName);
              
             //if flag does not allow misconfigured ejb-links, it is an error    
             if ((jndiName == null) && !(getLenientEjbLink()))

Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/service/TomcatInjectionContainer.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/TomcatInjectionContainer.java	2007-03-24 14:34:56 UTC (rev 61652)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/TomcatInjectionContainer.java	2007-03-24 14:37:47 UTC (rev 61653)
@@ -43,6 +43,7 @@
 
 import org.apache.AnnotationProcessor;
 import org.jboss.deployers.spi.deployer.DeploymentUnit;
+import org.jboss.deployers.spi.deployment.MainDeployer;
 import org.jboss.ejb3.Container;
 import org.jboss.ejb3.DependencyPolicy;
 import org.jboss.ejb3.DeploymentScope;
@@ -134,14 +135,15 @@
    protected WebApplication appInfo;
    protected WebDD webDD;
 
-   public TomcatInjectionContainer(WebApplication appInfo, DeploymentUnit unit, MBeanServer server)
+   public TomcatInjectionContainer(WebApplication appInfo, DeploymentUnit unit,
+         MainDeployer mainDeployer)
    {
       this.unit = unit;
       DeploymentScope deploymentScope = null;
       this.appInfo = appInfo;
 
       persistenceUnitResolver = new DeploymentPersistenceUnitResolver(persistenceUnitDeployments, deploymentScope, ejbContainers);
-      ejbResolver = new WarEjbResolver(deploymentScope, unit, server);
+      ejbResolver = new WarEjbResolver(deploymentScope, unit, mainDeployer);
    }
 
    public EnvironmentRefGroup getEnvironmentRefGroup()

Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/service/WarEjbResolver.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/WarEjbResolver.java	2007-03-24 14:34:56 UTC (rev 61652)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/WarEjbResolver.java	2007-03-24 14:37:47 UTC (rev 61653)
@@ -21,15 +21,17 @@
 */
 package org.jboss.web.tomcat.service;
 
+import javax.ejb.EJBLocalObject;
+import javax.management.MBeanServer;
+import javax.naming.NameNotFoundException;
+
 import org.jboss.deployers.spi.deployer.DeploymentUnit;
+import org.jboss.deployers.spi.deployment.MainDeployer;
 import org.jboss.ejb.EjbUtil50;
 import org.jboss.ejb3.enc.DeploymentEjbResolver;
 import org.jboss.ejb3.EJBContainer;
 import org.jboss.ejb3.DeploymentScope;
 
-import javax.management.MBeanServer;
-import javax.naming.NameNotFoundException;
-
 /**
  * Comment
  *
@@ -39,13 +41,14 @@
 public class WarEjbResolver extends DeploymentEjbResolver
 {
    private DeploymentUnit unit;
-   private MBeanServer server;
+   private MainDeployer mainDeployer;
 
    public WarEjbResolver(DeploymentScope deploymentScope, DeploymentUnit unit,
-         MBeanServer server)
+         MainDeployer mainDeployer)
    {
       super(deploymentScope, unit.getSimpleName());
       this.unit = unit;
+      this.mainDeployer = mainDeployer;
    }
 
    
@@ -54,7 +57,12 @@
    {
       String name = super.getEjbJndiName(ejbLink, businessIntf);
       if( name == null )
-         name = EjbUtil50.findEjbLink(server, unit, ejbLink);
+      {
+         if( EJBLocalObject.class.isAssignableFrom(businessIntf) )
+            name = EjbUtil50.findLocalEjbLink(mainDeployer, unit, ejbLink);
+         else
+            name = EjbUtil50.findEjbLink(mainDeployer, unit, ejbLink);
+      }
       return name;
    }
 

Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployer.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployer.java	2007-03-24 14:34:56 UTC (rev 61652)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployer.java	2007-03-24 14:37:47 UTC (rev 61653)
@@ -778,6 +778,7 @@
       config.setFilteredPackages(filteredPackages);
       config.setSharedMetaData(sharedMetaData);
       
+      
       //Check if there are any xacml policy files
       VirtualFile vf = unit.getMetaDataFile("jboss-xacml-policy.xml");
       if(vf != null)

Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployment.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployment.java	2007-03-24 14:34:56 UTC (rev 61652)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployment.java	2007-03-24 14:37:47 UTC (rev 61653)
@@ -162,7 +162,7 @@
       ClassLoader loader = Thread.currentThread().getContextClassLoader();
       metaData.setContextLoader(loader);
 
-      injectionContainer = new TomcatInjectionContainer(webApp, webApp.getDeploymentUnit(), server);
+      injectionContainer = new TomcatInjectionContainer(webApp, webApp.getDeploymentUnit(), mainDeployer);
 
       Loader webLoader = webApp.getDeploymentUnit().getAttachment(Loader.class);
       if (webLoader == null)

Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployment2.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployment2.java	2007-03-24 14:34:56 UTC (rev 61652)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployment2.java	2007-03-24 14:37:47 UTC (rev 61653)
@@ -159,7 +159,7 @@
       ClassLoader loader = Thread.currentThread().getContextClassLoader();
       metaData.setContextLoader(loader);
 
-      injectionContainer = new TomcatInjectionContainer(webApp, webApp.getDeploymentUnit(), server);
+      injectionContainer = new TomcatInjectionContainer(webApp, webApp.getDeploymentUnit(), mainDeployer);
 
       Loader webLoader = webApp.getDeploymentUnit().getAttachment(Loader.class);
       if (webLoader == null)

Modified: trunk/tomcat/src/resources/war-deployers-beans.xml
===================================================================
--- trunk/tomcat/src/resources/war-deployers-beans.xml	2007-03-24 14:34:56 UTC (rev 61652)
+++ trunk/tomcat/src/resources/war-deployers-beans.xml	2007-03-24 14:37:47 UTC (rev 61653)
@@ -81,6 +81,7 @@
          <parameter><this/></parameter>
       </uninstall>
 
+      <property name="mainDeployer"><inject bean="MainDeployer" /></property>
       <property name="type">war</property>
       <!-- You can configure a set of authenticators keyed by http-auth method
       used. This will apply the same set of authenticators across all web




More information about the jboss-cvs-commits mailing list