[jboss-cvs] JBossAS SVN: r61472 - in trunk: server/src/main/org/jboss/metadata/web and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Mar 19 18:53:39 EDT 2007


Author: thomas.diesler at jboss.com
Date: 2007-03-19 18:53:39 -0400 (Mon, 19 Mar 2007)
New Revision: 61472

Modified:
   trunk/server/src/main/org/jboss/deployment/JBossWebAppParsingDeployer.java
   trunk/server/src/main/org/jboss/metadata/web/JBossWebMetaDataObjectFactory.java
   trunk/system-jmx/src/main/org/jboss/system/deployers/ServiceClassLoaderDeployer.java
Log:
Fix WAR scoping with <loader-repository>

Modified: trunk/server/src/main/org/jboss/deployment/JBossWebAppParsingDeployer.java
===================================================================
--- trunk/server/src/main/org/jboss/deployment/JBossWebAppParsingDeployer.java	2007-03-19 22:39:43 UTC (rev 61471)
+++ trunk/server/src/main/org/jboss/deployment/JBossWebAppParsingDeployer.java	2007-03-19 22:53:39 UTC (rev 61472)
@@ -27,6 +27,7 @@
 import org.jboss.deployers.spi.deployer.DeploymentUnit;
 import org.jboss.metadata.WebMetaData;
 import org.jboss.metadata.web.JBossWebMetaDataObjectFactory;
+import org.jboss.mx.loading.LoaderRepositoryFactory.LoaderRepositoryConfig;
 import org.jboss.xb.binding.ObjectModelFactory;
 
 /**
@@ -102,6 +103,13 @@
       if( metaData == null )
          return;
 
+      // Add the loader repository config
+      LoaderRepositoryConfig loaderConfig = metaData.getLoaderConfig();
+      if (loaderConfig != null)
+      {
+         unit.addAttachment(LoaderRepositoryConfig.class, loaderConfig);
+      }
+      
       // Merge any settings from the ear level
       J2eeApplicationMetaData earMetaData = AttachmentLocator.search(unit, J2eeApplicationMetaData.class);
       if( earMetaData != null )

Modified: trunk/server/src/main/org/jboss/metadata/web/JBossWebMetaDataObjectFactory.java
===================================================================
--- trunk/server/src/main/org/jboss/metadata/web/JBossWebMetaDataObjectFactory.java	2007-03-19 22:39:43 UTC (rev 61471)
+++ trunk/server/src/main/org/jboss/metadata/web/JBossWebMetaDataObjectFactory.java	2007-03-19 22:53:39 UTC (rev 61472)
@@ -36,6 +36,8 @@
 import org.jboss.metadata.ResourceRefMetaData;
 import org.jboss.metadata.SecurityRoleMetaData;
 import org.jboss.metadata.WebMetaData;
+import org.jboss.mx.loading.LoaderRepositoryFactory;
+import org.jboss.mx.util.ObjectNameFactory;
 import org.jboss.util.xml.JBossEntityResolver;
 import org.jboss.ws.integration.ServiceRefMetaData;
 import org.jboss.xb.binding.JBossXBException;
@@ -52,10 +54,10 @@
    private static final ThreadLocal<WebMetaData> activeMetaData = new ThreadLocal<WebMetaData>();
    private WebMetaData metaData;
 
-   public static WebMetaData parse(URL ddResource, WebMetaData dd)
-           throws JBossXBException, IOException
+   public static WebMetaData parse(URL ddResource, WebMetaData dd) throws JBossXBException, IOException
    {
-      if (ddResource == null) return null;
+      if (ddResource == null)
+         return null;
       log.debug("found jboss-web.xml " + ddResource);
 
       InputStream is = ddResource.openStream();
@@ -63,8 +65,7 @@
       return parse(dd, is);
    }
 
-   public static WebMetaData parse(WebMetaData metaData, InputStream is)
-           throws JBossXBException
+   public static WebMetaData parse(WebMetaData metaData, InputStream is) throws JBossXBException
    {
       ObjectModelFactory factory = null;
       Unmarshaller unmarshaller = null;
@@ -80,7 +81,7 @@
       JBossEntityResolver entityResolver = new JBossEntityResolver();
       unmarshaller.setEntityResolver(entityResolver);
 
-      metaData = (WebMetaData) unmarshaller.unmarshal(is, factory, null);
+      metaData = (WebMetaData)unmarshaller.unmarshal(is, factory, null);
       return metaData;
    }
 
@@ -93,18 +94,16 @@
    /**
     * Return the root.
     */
-   public Object newRoot(Object root, UnmarshallingContext navigator,
-                         String namespaceURI, String localName, Attributes attrs)
+   public Object newRoot(Object root, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
    {
       // If both the root and metaData are null the deployer is likely in the wrong order
-      if( root == null && metaData == null )
+      if (root == null && metaData == null)
          throw new IllegalStateException("No existing WebMetaData, check the JBossWebAppParsingDeployer order");
 
       return root == null ? metaData : root;
    }
 
-   public Object completeRoot(Object root, UnmarshallingContext ctx,
-                              String uri, String name)
+   public Object completeRoot(Object root, UnmarshallingContext ctx, String uri, String name)
    {
       return root;
    }
@@ -114,15 +113,16 @@
    /**
     * Called when parsing of a new element started.
     */
-   public Object newChild(WebMetaData dd, UnmarshallingContext navigator,
-                          String namespaceURI, String localName, Attributes attrs)
+   public Object newChild(WebMetaData dd, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
    {
       Object child = null;
-      log.debug("newChild, "+localName);
+      log.debug("newChild, " + localName);
       if ((child = newEnvRefGroupChild(localName)) != null)
          return child;
       else if (localName.equals("security-role"))
          child = new SecurityRoleMetaData();
+      else if (localName.equals("class-loading"))
+         child = new LoaderRepositoryFactory.LoaderRepositoryConfig();
       else if (localName.equals("servlet"))
          child = new Servlet();
       else if (localName.equals("replication-config"))
@@ -135,81 +135,77 @@
       }
       return child;
    }
-   
-   public void addChild(WebMetaData parent, ReplicationConfig config,
-                        UnmarshallingContext navigator, String namespaceURI, String localName)
+
+   public void addChild(WebMetaData parent, ReplicationConfig config, UnmarshallingContext navigator, String namespaceURI, String localName)
    {
       parent.setReplicationConfig(config);
    }
 
-   public void addChild(WebMetaData parent, PassivationConfig config,
-                        UnmarshallingContext navigator, String namespaceURI, String localName)
+   public void addChild(WebMetaData parent, PassivationConfig config, UnmarshallingContext navigator, String namespaceURI, String localName)
    {
       parent.setPassivationConfig(config);
    }
 
-   public void addChild(WebMetaData parent, EjbLocalRefMetaData ref,
-                        UnmarshallingContext navigator, String namespaceURI, String localName)
+   public void addChild(WebMetaData parent, EjbLocalRefMetaData ref, UnmarshallingContext navigator, String namespaceURI, String localName)
    {
       parent.addEjbLocalRef(ref);
    }
 
-   public void addChild(WebMetaData parent, EjbRefMetaData ref,
-                        UnmarshallingContext navigator, String namespaceURI, String localName)
+   public void addChild(WebMetaData parent, EjbRefMetaData ref, UnmarshallingContext navigator, String namespaceURI, String localName)
    {
       parent.addEjbRef(ref);
    }
 
-   public void addChild(WebMetaData parent, EnvEntryMetaData ref,
-                        UnmarshallingContext navigator, String namespaceURI, String localName)
+   public void addChild(WebMetaData parent, EnvEntryMetaData ref, UnmarshallingContext navigator, String namespaceURI, String localName)
    {
       parent.addEnvEntry(ref);
    }
 
-   public void addChild(WebMetaData parent, MessageDestinationMetaData destination,
-         UnmarshallingContext navigator, String namespaceURI, String localName)
+   public void addChild(WebMetaData parent, MessageDestinationMetaData destination, UnmarshallingContext navigator, String namespaceURI, String localName)
    {
-      log.debug("addMessageDestinationMetaData, "+destination);
+      log.debug("addMessageDestinationMetaData, " + destination);
       parent.addMessageDestination(destination);
       // See if this message-destination resolves to an existing ref link
       String link = destination.getJNDIName();
-      if( link != null )
+      if (link != null)
       {
          MessageDestinationMetaData ref = parent.getMessageDestination(link);
-         if( ref != null )
+         if (ref != null)
          {
-            log.debug("ressolved "+ref+" to link JndiName: "+destination.getJNDIName());
+            log.debug("ressolved " + ref + " to link JndiName: " + destination.getJNDIName());
             ref.setJNDIName(destination.getJNDIName());
          }
       }
    }
-   public void addChild(WebMetaData parent, MessageDestinationRefMetaData ref,
-                        UnmarshallingContext navigator, String namespaceURI, String localName)
+
+   public void addChild(WebMetaData parent, MessageDestinationRefMetaData ref, UnmarshallingContext navigator, String namespaceURI, String localName)
    {
-      log.debug("addMessageDestinationMetaDataRef, "+ref);
+      log.debug("addMessageDestinationMetaDataRef, " + ref);
       parent.addMessageDestinationRef(ref);
    }
 
-   public void addChild(WebMetaData parent, ResourceEnvRefMetaData ref,
-                        UnmarshallingContext navigator, String namespaceURI, String localName)
+   public void addChild(WebMetaData parent, ResourceEnvRefMetaData ref, UnmarshallingContext navigator, String namespaceURI, String localName)
    {
       // Need to merge this with any existing version
       parent.updateResourceEnvRef(ref);
    }
 
-   public void addChild(WebMetaData parent, ResourceRefMetaData ref,
-                        UnmarshallingContext navigator, String namespaceURI, String localName)
+   public void addChild(WebMetaData parent, ResourceRefMetaData ref, UnmarshallingContext navigator, String namespaceURI, String localName)
    {
       // Need to merge this with any existing version
       parent.updateResourceRef(ref);
    }
 
-   public void addChild(WebMetaData parent, SecurityRoleMetaData role,
-                        UnmarshallingContext navigator, String namespaceURI, String localName)
+   public void addChild(WebMetaData parent, SecurityRoleMetaData role, UnmarshallingContext navigator, String namespaceURI, String localName)
    {
       parent.addSecurityRole(role);
    }
 
+   public void addChild(WebMetaData parent, LoaderRepositoryFactory.LoaderRepositoryConfig cfg, UnmarshallingContext navigator, String namespaceURI, String localName)
+   {
+      parent.setLoaderConfig(cfg);
+   }
+
    public void addChild(WebMetaData parent, ServiceRefMetaData sref, UnmarshallingContext navigator, String namespaceURI, String localName)
    {
       String refName = sref.getServiceRefName();
@@ -228,15 +224,12 @@
       }
    }
 
-   public void addChild(WebMetaData parent, Servlet servlet,
-                        UnmarshallingContext navigator, String namespaceURI, String localName)
+   public void addChild(WebMetaData parent, Servlet servlet, UnmarshallingContext navigator, String namespaceURI, String localName)
    {
       parent.updateServlet(servlet);
    }
 
-   public void setValue(WebMetaData dd,
-                        UnmarshallingContext navigator, String namespaceURI, String localName,
-                        String value)
+   public void setValue(WebMetaData dd, UnmarshallingContext navigator, String namespaceURI, String localName, String value)
    {
       if (localName.equals("depends"))
       {
@@ -252,9 +245,7 @@
       }
    }
 
-   public void setValue(ReplicationConfig config,
-                        UnmarshallingContext navigator, String namespaceURI, String localName,
-                        String value)
+   public void setValue(ReplicationConfig config, UnmarshallingContext navigator, String namespaceURI, String localName, String value)
    {
       if (localName.equals("replication-trigger"))
       {
@@ -269,10 +260,8 @@
          config.setFieldBatchMode(value);
       }
    }
-   
-   public void setValue(PassivationConfig config,
-                        UnmarshallingContext navigator, String namespaceURI, String localName,
-                        String value)
+
+   public void setValue(PassivationConfig config, UnmarshallingContext navigator, String namespaceURI, String localName, String value)
    {
       if (localName.equals("use-session-passivation"))
       {
@@ -288,9 +277,7 @@
       }
    }
 
-   public void setValue(Servlet servlet,
-                        UnmarshallingContext navigator, String namespaceURI, String localName,
-                        String value)
+   public void setValue(Servlet servlet, UnmarshallingContext navigator, String namespaceURI, String localName, String value)
    {
       if (localName.equals("servlet-name"))
       {
@@ -302,9 +289,7 @@
       }
    }
 
-   public void setValue(ServletMapping mapping,
-                        UnmarshallingContext navigator, String namespaceURI, String localName,
-                        String value)
+   public void setValue(ServletMapping mapping, UnmarshallingContext navigator, String namespaceURI, String localName, String value)
    {
       if (localName.equals("servlet-name"))
       {
@@ -316,16 +301,24 @@
       }
    }
 
-   public void setValue(SecurityRoleMetaData role,
-                        UnmarshallingContext navigator, String namespaceURI, String localName,
-                        String value)
+   public void setValue(SecurityRoleMetaData role, UnmarshallingContext navigator, String namespaceURI, String localName, String value)
    {
       if (localName.equals("principal-name"))
       {
          role.setRoleName(value);
       }
-      else
-         super.setValue(role, navigator, namespaceURI, localName, value);
+      else super.setValue(role, navigator, namespaceURI, localName, value);
    }
 
+   public void setValue(LoaderRepositoryFactory.LoaderRepositoryConfig cfg, UnmarshallingContext navigator, String namespaceURI, String localName, String value)
+   {
+      if (localName.equals("loader-repository"))
+      {
+         cfg.repositoryName = ObjectNameFactory.create(value);
+      }
+      else if (localName.equals("loader-repository-config"))
+      {
+         cfg.repositoryConfig = value;
+      }
+   }
 }

Modified: trunk/system-jmx/src/main/org/jboss/system/deployers/ServiceClassLoaderDeployer.java
===================================================================
--- trunk/system-jmx/src/main/org/jboss/system/deployers/ServiceClassLoaderDeployer.java	2007-03-19 22:39:43 UTC (rev 61471)
+++ trunk/system-jmx/src/main/org/jboss/system/deployers/ServiceClassLoaderDeployer.java	2007-03-19 22:53:39 UTC (rev 61472)
@@ -86,17 +86,9 @@
       }
 
       // Check the loader repository config
-      LoaderRepositoryConfig parentConfig = unit.getParent() != null ? unit.getParent().getAttachment(LoaderRepositoryConfig.class) : null;
       LoaderRepositoryConfig loaderConfig = unit.getAttachment(LoaderRepositoryConfig.class);
-      if (parentConfig != null && parentConfig != loaderConfig)
-      {
-         log.info("Using parent loader repository config: " + parentConfig.repositoryName);
-         loaderConfig = parentConfig;
-      }
-      else if (loaderConfig != null)
-      {
+      if (loaderConfig != null)
          log.debug("Using loader repository config: " + loaderConfig.repositoryName);
-      }
       
       // Create default loader repository config
       if (loaderConfig == null)




More information about the jboss-cvs-commits mailing list