FileDocCategorySizeDatePackage
WarConfiguration.javaAPI DocJBoss 4.2.14847Fri Jul 13 20:52:34 BST 2007org.jboss.deployment.spi.configurations

WarConfiguration

public class WarConfiguration extends Object implements javax.enterprise.deploy.spi.DeploymentConfiguration
The war configuration container.
author
Rob Stryker
version
$Revision: 57190 $

Fields Summary
private javax.enterprise.deploy.model.DeployableObject
deployable
private HashMap
configBeans
Constructors Summary
public WarConfiguration(javax.enterprise.deploy.model.DeployableObject deployable)

      this.deployable = deployable;
      configBeans = new HashMap(); // maps filename to dconfigbean

   
Methods Summary
public javax.enterprise.deploy.spi.DConfigBeanRootgetDConfigBeanRoot(javax.enterprise.deploy.model.DDBeanRoot dd)

      // If they give us web.xml, return our jboss-web.xml config bean
      if (configBeans.containsKey(dd.getFilename()))
      {
         return (DConfigBeanRoot)configBeans.get(dd.getFilename());
      }

      // Not found, so create it. (lazy initializing)
      if (dd.getFilename().equals("WEB-INF/web.xml"))
      {
         DConfigBeanRoot retval = new WarConfigBeanRoot(dd, deployable);
         configBeans.put(dd.getFilename(), retval);
         return retval;
      }

      // if they give us some other standard bean, return the jboss specific
      // None implemented as of now
      return null;
   
public javax.enterprise.deploy.model.DeployableObjectgetDeployableObject()

      return this.deployable;
   
public voidremoveDConfigBean(javax.enterprise.deploy.spi.DConfigBeanRoot bean)

      String key = bean.getDDBean().getRoot().getFilename();
      if (configBeans.containsKey(key))
      {
         System.out.println("its here... not anymore");
         configBeans.remove(key);
      }
      else
      {
         throw new BeanNotFoundException("BNF");
      }
   
public voidrestore(java.io.InputStream arg0)

   
public javax.enterprise.deploy.spi.DConfigBeanRootrestoreDConfigBean(java.io.InputStream arg0, javax.enterprise.deploy.model.DDBeanRoot arg1)

      return null;
   
public voidsave(java.io.OutputStream stream)

      JarOutputStream jos = null;

      // Setup deployment plan meta data with propriatary descriptor (jboss-web.xml)
      DeploymentMetaData metaData = new DeploymentMetaData("WRONG.war");

      try
      {
         jos = new JarOutputStream(stream);
      }
      catch (Exception e)
      {
         return;
      }
      if (jos == null)
         return;

      Iterator setIterator = configBeans.keySet().iterator();
      while (setIterator.hasNext())
      {
         String key = (String)setIterator.next();
         JBossConfigBeanProxy val = (JBossConfigBeanProxy)configBeans.get(key);
         val.save(jos, metaData);
      }
      try
      {
         String metaStr = metaData.toXMLString();
         JarUtils.addJarEntry(jos, DeploymentMetaData.ENTRY_NAME, new ByteArrayInputStream(metaStr.getBytes()));
         jos.flush();
         jos.close();
      }
      catch (Exception e)
      {
         System.out.println("config IO exception error: " + e.getMessage());
      }
   
public voidsaveDConfigBean(java.io.OutputStream arg0, javax.enterprise.deploy.spi.DConfigBeanRoot arg1)