5 Replies Latest reply on Dec 13, 2007 4:30 AM by Dimitris Andreadis

    Missing feature in EJB2 ContainerConfiguration merge

    Adrian Brock Master

      In the old EJB2 container configuration, you could do something like this
      which is an extension of the container configuration without changing its name

      <container-configurations>
       <container-configuration>
       <container-name>Standard Stateless SessionBean</container-name>
       <depends>test:name=Test</depends>
       </container-configuration>
      </container-configurations>
      


      This is the old code (note the comment).

       Element conf = (Element)iterator.next();
       String confName = getElementContent(getUniqueChild(conf,
       "container-name"));
       String parentConfName = conf.getAttribute("extends");
       if (parentConfName != null && parentConfName.trim().length() == 0)
       {
       parentConfName = null;
       }
      
       // Allow the configuration to inherit from a standard
       // configuration. This is determined by looking for a
       // configuration matching the name given by the extends
       // attribute, or if extends was not specified, an
       // existing configuration with the same.
       ConfigurationMetaData configurationMetaData = null;
       if (parentConfName != null)
       {
       configurationMetaData = getConfigurationMetaDataByName(parentConfName);
       if (configurationMetaData == null)
       {
       throw new DeploymentException("Failed to find " +
       "parent config=" + parentConfName);
       }
      
       // Make a copy of the existing configuration
       configurationMetaData =
       (ConfigurationMetaData)configurationMetaData.clone();
       configurations.put(confName, configurationMetaData);
       }
      
       if (configurationMetaData == null)
       {
       configurationMetaData =
       getConfigurationMetaDataByName(confName);
       }
      
       // Create a new configuration if none was found
       if (configurationMetaData == null)
       {
       configurationMetaData = new ConfigurationMetaData(confName);
       configurations.put(confName, configurationMetaData);
       }
      


      This isn't working in the new metadata because the the wrapper
      only looks at the extends attribute.