You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jb...@apache.org on 2004/01/22 01:51:09 UTC

cvs commit: incubator-geronimo/modules/jetty/src/test/org/apache/geronimo/jetty/deployment WARConfigurationFactoryTest.java

jboynes     2004/01/21 16:51:09

  Modified:    modules/deployment/src/java/org/apache/geronimo/deployment/plugin
                        DeploymentManagerImpl.java
               modules/deployment/src/java/org/apache/geronimo/deployment/plugin/factories
                        DeploymentFactoryImpl.java
               modules/deployment/src/test/org/apache/geronimo/deployment/plugin
                        Application.java
               modules/jetty project.xml
  Added:       modules/deployment/src/java/org/apache/geronimo/deployment/plugin
                        DeploymentConfigurationSupport.java
               modules/deployment/src/java/org/apache/geronimo/deployment/plugin/application
                        EARConfiguration.java EARConfigurationFactory.java
               modules/deployment/src/java/org/apache/geronimo/deployment/plugin/client
                        ClientConfigurationFactory.java
               modules/deployment/src/java/org/apache/geronimo/deployment/plugin/factories
                        DeploymentConfigurationFactory.java
               modules/jetty/src/java/org/apache/geronimo/jetty/deployment
                        JettyModule.java WARConfiguration.java
                        WARConfigurationFactory.java
               modules/jetty/src/test/org/apache/geronimo/jetty/deployment
                        WARConfigurationFactoryTest.java
  Log:
  Start change of DeploymentFactory to use an kernel and pluggable deployers
  
  Revision  Changes    Path
  1.2       +43 -6     incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/DeploymentManagerImpl.java
  
  Index: DeploymentManagerImpl.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/DeploymentManagerImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DeploymentManagerImpl.java	21 Jan 2004 20:37:29 -0000	1.1
  +++ DeploymentManagerImpl.java	22 Jan 2004 00:51:09 -0000	1.2
  @@ -58,6 +58,9 @@
   import java.io.File;
   import java.io.InputStream;
   import java.util.Locale;
  +import java.util.Map;
  +import java.util.HashMap;
  +import java.util.Arrays;
   import javax.enterprise.deploy.model.DeployableObject;
   import javax.enterprise.deploy.shared.DConfigBeanVersionType;
   import javax.enterprise.deploy.shared.ModuleType;
  @@ -70,20 +73,42 @@
   import javax.enterprise.deploy.spi.exceptions.TargetException;
   import javax.enterprise.deploy.spi.status.ProgressObject;
   
  +import org.apache.geronimo.deployment.plugin.factories.DeploymentConfigurationFactory;
  +import org.apache.geronimo.gbean.GBeanInfo;
  +import org.apache.geronimo.gbean.GBeanInfoFactory;
  +import org.apache.geronimo.gbean.GEndpointInfo;
  +import org.apache.geronimo.gbean.GConstructorInfo;
  +
   /**
  - * 
  - * 
  + *
  + *
    * @version $Revision$ $Date$
    */
   public class DeploymentManagerImpl implements DeploymentManager {
  +    private final Map configurationFactories;
  +
       private boolean connected;
   
  -    public DeploymentManagerImpl() {
  +    public DeploymentManagerImpl(
  +            DeploymentConfigurationFactory earFactory,
  +            DeploymentConfigurationFactory warFactory
  +            ) {
           connected = false;
  +        configurationFactories = new HashMap(5);
  +        configurationFactories.put(ModuleType.EAR, earFactory);
  +        configurationFactories.put(ModuleType.WAR, warFactory);
  +        configurationFactories.put(ModuleType.EJB, null);
  +        configurationFactories.put(ModuleType.RAR, null);
  +        configurationFactories.put(ModuleType.CAR, null);
       }
   
  -    public DeploymentConfiguration createConfiguration(DeployableObject dObj) throws InvalidModuleException {
  -        return new DeploymentConfigurationImpl(dObj);
  +    public DeploymentConfiguration createConfiguration(DeployableObject deployable) throws InvalidModuleException {
  +        ModuleType type = deployable.getType();
  +        DeploymentConfigurationFactory factory = (DeploymentConfigurationFactory) configurationFactories.get(type);
  +        if (factory == null) {
  +            throw new InvalidModuleException("Unable to load DeploymentConfigurationFactory");
  +        }
  +        return factory.createConfiguration(deployable);
       }
   
       public DConfigBeanVersionType getDConfigBeanVersion() {
  @@ -202,5 +227,17 @@
               throw new IllegalStateException("Disconnected");
           }
           throw new UnsupportedOperationException();
  +    }
  +
  +    public static final GBeanInfo GBEAN_INFO;
  +    static {
  +        GBeanInfoFactory infoFactory = new GBeanInfoFactory("JSR88 Deployment Manager", DeploymentManagerImpl.class.getName());
  +        infoFactory.addEndpoint(new GEndpointInfo("EARFactory", DeploymentConfigurationFactory.class.getName()));
  +        infoFactory.addEndpoint(new GEndpointInfo("WARFactory", DeploymentConfigurationFactory.class.getName()));
  +        infoFactory.setConstructor(new GConstructorInfo(
  +                Arrays.asList(new Object[] {"EARFactory", "WARFactory"}),
  +                Arrays.asList(new Object[] {DeploymentConfigurationFactory.class, DeploymentConfigurationFactory.class})
  +        ));
  +        GBEAN_INFO = infoFactory.getBeanInfo();
       }
   }
  
  
  
  1.1                  incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/DeploymentConfigurationSupport.java
  
  Index: DeploymentConfigurationSupport.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Geronimo" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Geronimo", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * ====================================================================
   */
  package org.apache.geronimo.deployment.plugin;
  
  import java.io.OutputStream;
  import java.io.InputStream;
  import javax.enterprise.deploy.spi.DeploymentConfiguration;
  import javax.enterprise.deploy.spi.DConfigBeanRoot;
  import javax.enterprise.deploy.spi.exceptions.ConfigurationException;
  import javax.enterprise.deploy.spi.exceptions.BeanNotFoundException;
  import javax.enterprise.deploy.model.DeployableObject;
  import javax.enterprise.deploy.model.DDBeanRoot;
  
  /**
   *
   *
   * @version $Revision: 1.1 $ $Date: 2004/01/22 00:51:09 $
   */
  public abstract class DeploymentConfigurationSupport implements DeploymentConfiguration {
      private final DeployableObject deployable;
  
      public DeploymentConfigurationSupport(DeployableObject deployable) {
          this.deployable = deployable;
      }
  
      public DeployableObject getDeployableObject() {
          return deployable;
      }
  
      public DConfigBeanRoot getDConfigBeanRoot(DDBeanRoot bean) throws ConfigurationException {
          return null;
      }
  
      public void removeDConfigBean(DConfigBeanRoot bean) throws BeanNotFoundException {
      }
  
      public void save(OutputStream outputArchive) throws ConfigurationException {
      }
  
      public void restore(InputStream inputArchive) throws ConfigurationException {
      }
  
      public void saveDConfigBean(OutputStream outputArchive, DConfigBeanRoot bean) throws ConfigurationException {
      }
  
      public DConfigBeanRoot restoreDConfigBean(InputStream inputArchive, DDBeanRoot bean) throws ConfigurationException {
          return null;
      }
  }
  
  
  
  1.1                  incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/application/EARConfiguration.java
  
  Index: EARConfiguration.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Geronimo" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Geronimo", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * ====================================================================
   */
  package org.apache.geronimo.deployment.plugin.application;
  
  import javax.enterprise.deploy.model.DeployableObject;
  
  import org.apache.geronimo.deployment.plugin.DeploymentConfigurationSupport;
  
  /**
   * 
   * 
   * @version $Revision: 1.1 $ $Date: 2004/01/22 00:51:09 $
   */
  public class EARConfiguration extends DeploymentConfigurationSupport{
      public EARConfiguration(DeployableObject deployable) {
          super(deployable);
      }
  }
  
  
  
  1.1                  incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/application/EARConfigurationFactory.java
  
  Index: EARConfigurationFactory.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Geronimo" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Geronimo", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * ====================================================================
   */
  package org.apache.geronimo.deployment.plugin.application;
  
  import javax.enterprise.deploy.model.DeployableObject;
  import javax.enterprise.deploy.spi.DeploymentConfiguration;
  import javax.enterprise.deploy.spi.exceptions.InvalidModuleException;
  import javax.enterprise.deploy.shared.ModuleType;
  
  import org.apache.geronimo.deployment.plugin.factories.DeploymentConfigurationFactory;
  import org.apache.geronimo.gbean.GBeanInfo;
  import org.apache.geronimo.gbean.GBeanInfoFactory;
  import org.apache.geronimo.gbean.GOperationInfo;
  
  /**
   *
   *
   * @version $Revision: 1.1 $ $Date: 2004/01/22 00:51:09 $
   */
  public class EARConfigurationFactory implements DeploymentConfigurationFactory {
      public DeploymentConfiguration createConfiguration(DeployableObject deployable) throws InvalidModuleException {
          if (!ModuleType.EAR.equals(deployable.getType())) {
              throw new InvalidModuleException("DeployableObject must be an EAR");
          }
          return new EARConfiguration(deployable);
      }
  
      public static final GBeanInfo GBEAN_INFO;
  
      static {
          GBeanInfoFactory infoFactory = new GBeanInfoFactory("Geronimo EAR Configuration Factory", EARConfigurationFactory.class.getName());
          infoFactory.addOperation(new GOperationInfo("createConfiguration", new String[]{DeployableObject.class.getName()}));
          GBEAN_INFO = infoFactory.getBeanInfo();
      }
  
      public static GBeanInfo getGBeanInfo() {
          return GBEAN_INFO;
      }
  }
  
  
  
  1.1                  incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/client/ClientConfigurationFactory.java
  
  Index: ClientConfigurationFactory.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Geronimo" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Geronimo", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * ====================================================================
   */
  package org.apache.geronimo.deployment.plugin.client;
  
  import javax.enterprise.deploy.spi.DeploymentConfiguration;
  import javax.enterprise.deploy.spi.exceptions.InvalidModuleException;
  import javax.enterprise.deploy.model.DeployableObject;
  
  import org.apache.geronimo.deployment.plugin.factories.DeploymentConfigurationFactory;
  
  /**
   * 
   * 
   * @version $Revision: 1.1 $ $Date: 2004/01/22 00:51:09 $
   */
  public class ClientConfigurationFactory implements DeploymentConfigurationFactory {
      public DeploymentConfiguration createConfiguration(DeployableObject deployable) throws InvalidModuleException {
          return null;
      }
  }
  
  
  
  1.2       +43 -4     incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/factories/DeploymentFactoryImpl.java
  
  Index: DeploymentFactoryImpl.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/factories/DeploymentFactoryImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DeploymentFactoryImpl.java	21 Jan 2004 20:37:29 -0000	1.1
  +++ DeploymentFactoryImpl.java	22 Jan 2004 00:51:09 -0000	1.2
  @@ -57,14 +57,23 @@
   
   import java.net.URI;
   import java.net.URISyntaxException;
  -import javax.enterprise.deploy.spi.factories.DeploymentFactory;
  +import java.util.Collections;
   import javax.enterprise.deploy.spi.DeploymentManager;
   import javax.enterprise.deploy.spi.exceptions.DeploymentManagerCreationException;
  +import javax.enterprise.deploy.spi.factories.DeploymentFactory;
  +import javax.management.ObjectName;
   
   import org.apache.geronimo.deployment.plugin.DeploymentManagerImpl;
  +import org.apache.geronimo.deployment.plugin.application.EARConfigurationFactory;
  +import org.apache.geronimo.gbean.jmx.GBeanMBean;
  +import org.apache.geronimo.kernel.Kernel;
   
   /**
  - * 
  + * Implementation of JSR88 DeploymentFactory.
  + *
  + * This will create a DeploymentManager using a local Geronimo kernel
  + * to contain the GBeans that are responsible for deploying each module
  + * type.
    * 
    * @version $Revision$ $Date$
    */
  @@ -95,6 +104,7 @@
               throw (DeploymentManagerCreationException) new DeploymentManagerCreationException("Unable to parse URI "+uri).initCause(e);
           }
           assert "geronimo".equals(configURI.getScheme());
  +
           String subURI = configURI.getSchemeSpecificPart();
           if (subURI.startsWith("//")) {
               throw new AssertionError();
  @@ -102,7 +112,36 @@
               configURI = URI.create(subURI);
           }
   
  -        return new DeploymentManagerImpl();
  +        Kernel kernel = new Kernel("geronimo.deployment");
  +        try {
  +            kernel.boot();
  +        } catch (Exception e) {
  +            throw (DeploymentManagerCreationException) new DeploymentManagerCreationException("Unable to boot embedded kernel").initCause(e);
  +        }
  +
  +        // @todo for now lets hard code the deployers to use - ultimately this should use a predefined Configuration
  +        GBeanMBean manager;
  +        try {
  +            ObjectName managerName = new ObjectName("geronimo.deployment:role=DeploymentManager");
  +            manager = new GBeanMBean(DeploymentManagerImpl.GBEAN_INFO);
  +            loadFactory(kernel, manager, "EARFactory", EARConfigurationFactory.class.getName());
  +
  +            kernel.loadGBean(managerName, manager);
  +            kernel.startGBean(managerName);
  +
  +        } catch (Exception e) {
  +            // this should not happen - we own this kernel!
  +            throw (IllegalStateException) new IllegalStateException("Unable to load DeploymentManager").initCause(e);
  +        }
  +        return (DeploymentManager) manager.getTarget();
  +    }
  +
  +    private void loadFactory(Kernel kernel, GBeanMBean manager, String factory, String className) throws Exception {
  +        ObjectName earFactoryName = new ObjectName("geronimo.deployment:role="+factory);
  +        GBeanMBean earFactory = new GBeanMBean(className);
  +        kernel.loadGBean(earFactoryName, earFactory);
  +        kernel.startGBean(earFactoryName);
  +        manager.setEndpointPatterns(factory, Collections.singleton(earFactoryName));
       }
   
       public DeploymentManager getDeploymentManager(String uri, String username, String password) throws DeploymentManagerCreationException {
  
  
  
  1.1                  incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/factories/DeploymentConfigurationFactory.java
  
  Index: DeploymentConfigurationFactory.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Geronimo" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Geronimo", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * ====================================================================
   */
  package org.apache.geronimo.deployment.plugin.factories;
  
  import javax.enterprise.deploy.model.DeployableObject;
  import javax.enterprise.deploy.spi.DeploymentConfiguration;
  import javax.enterprise.deploy.spi.exceptions.InvalidModuleException;
  
  /**
   * 
   * 
   * @version $Revision: 1.1 $ $Date: 2004/01/22 00:51:09 $
   */
  public interface DeploymentConfigurationFactory {
      public DeploymentConfiguration createConfiguration(DeployableObject deployable) throws InvalidModuleException;
  }
  
  
  
  1.2       +78 -78    incubator-geronimo/modules/deployment/src/test/org/apache/geronimo/deployment/plugin/Application.java
  
  Index: Application.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/deployment/src/test/org/apache/geronimo/deployment/plugin/Application.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Application.java	21 Jan 2004 20:37:28 -0000	1.1
  +++ Application.java	22 Jan 2004 00:51:09 -0000	1.2
  @@ -67,86 +67,86 @@
   import javax.enterprise.deploy.shared.ModuleType;
   
   /**
  - * 
  - * 
  + *
  + *
    * @version $Revision$ $Date$
    */
   public class Application implements J2eeApplicationObject {
       private final DDBeanRoot root;
   
  -        public Application(DDBeanRoot root) {
  -            this.root = root;
  -        }
  -
  -        public void addXpathListener(ModuleType type, String xpath, XpathListener xpl) {
  -            throw new UnsupportedOperationException();
  -        }
  -
  -        public Enumeration entries() {
  -            throw new UnsupportedOperationException();
  -        }
  -
  -        public DDBean[] getChildBean(ModuleType type, String xpath) {
  -            throw new UnsupportedOperationException();
  -        }
  -
  -        public DDBean[] getChildBean(String xpath) {
  -            throw new UnsupportedOperationException();
  -        }
  -
  -        public Class getClassFromScope(String className) {
  -            throw new UnsupportedOperationException();
  -        }
  -
  -        public DDBeanRoot getDDBeanRoot() {
  -            return root;
  -        }
  -
  -        public DDBeanRoot getDDBeanRoot(String filename) throws FileNotFoundException, DDBeanCreateException {
  -            throw new UnsupportedOperationException();
  -        }
  -
  -        public DeployableObject getDeployableObject(String uri) {
  -            throw new UnsupportedOperationException();
  -        }
  -
  -        public DeployableObject[] getDeployableObjects() {
  -            throw new UnsupportedOperationException();
  -        }
  -
  -        public DeployableObject[] getDeployableObjects(ModuleType type) {
  -            throw new UnsupportedOperationException();
  -        }
  -
  -        public InputStream getEntry(String name) {
  -            throw new UnsupportedOperationException();
  -        }
  -
  -        public String getModuleDTDVersion() {
  -            throw new UnsupportedOperationException();
  -        }
  -
  -        public String[] getModuleUris() {
  -            throw new UnsupportedOperationException();
  -        }
  -
  -        public String[] getModuleUris(ModuleType type) {
  -            throw new UnsupportedOperationException();
  -        }
  -
  -        public String[] getText(ModuleType type, String xpath) {
  -            throw new UnsupportedOperationException();
  -        }
  -
  -        public String[] getText(String xpath) {
  -            throw new UnsupportedOperationException();
  -        }
  -
  -        public ModuleType getType() {
  -            throw new UnsupportedOperationException();
  -        }
  -
  -        public void removeXpathListener(ModuleType type, String xpath, XpathListener xpl) {
  -            throw new UnsupportedOperationException();
  -        }
  +    public Application(DDBeanRoot root) {
  +        this.root = root;
  +    }
  +
  +    public void addXpathListener(ModuleType type, String xpath, XpathListener xpl) {
  +        throw new UnsupportedOperationException();
  +    }
  +
  +    public Enumeration entries() {
  +        throw new UnsupportedOperationException();
  +    }
  +
  +    public DDBean[] getChildBean(ModuleType type, String xpath) {
  +        throw new UnsupportedOperationException();
  +    }
  +
  +    public DDBean[] getChildBean(String xpath) {
  +        throw new UnsupportedOperationException();
  +    }
  +
  +    public Class getClassFromScope(String className) {
  +        throw new UnsupportedOperationException();
  +    }
  +
  +    public DDBeanRoot getDDBeanRoot() {
  +        return root;
  +    }
  +
  +    public DDBeanRoot getDDBeanRoot(String filename) throws FileNotFoundException, DDBeanCreateException {
  +        throw new UnsupportedOperationException();
  +    }
  +
  +    public DeployableObject getDeployableObject(String uri) {
  +        throw new UnsupportedOperationException();
  +    }
  +
  +    public DeployableObject[] getDeployableObjects() {
  +        throw new UnsupportedOperationException();
  +    }
  +
  +    public DeployableObject[] getDeployableObjects(ModuleType type) {
  +        throw new UnsupportedOperationException();
  +    }
  +
  +    public InputStream getEntry(String name) {
  +        throw new UnsupportedOperationException();
  +    }
  +
  +    public String getModuleDTDVersion() {
  +        throw new UnsupportedOperationException();
  +    }
  +
  +    public String[] getModuleUris() {
  +        throw new UnsupportedOperationException();
  +    }
  +
  +    public String[] getModuleUris(ModuleType type) {
  +        throw new UnsupportedOperationException();
  +    }
  +
  +    public String[] getText(ModuleType type, String xpath) {
  +        throw new UnsupportedOperationException();
  +    }
  +
  +    public String[] getText(String xpath) {
  +        throw new UnsupportedOperationException();
  +    }
  +
  +    public ModuleType getType() {
  +        return ModuleType.EAR;
  +    }
  +
  +    public void removeXpathListener(ModuleType type, String xpath, XpathListener xpl) {
  +        throw new UnsupportedOperationException();
  +    }
   }
  
  
  
  1.3       +19 -1     incubator-geronimo/modules/jetty/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/jetty/project.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- project.xml	22 Jan 2004 00:24:07 -0000	1.2
  +++ project.xml	22 Jan 2004 00:51:09 -0000	1.3
  @@ -36,6 +36,15 @@
   
           <dependency>
               <groupId>geronimo</groupId>
  +            <artifactId>geronimo-deployment</artifactId>
  +            <version>DEV</version>
  +            <properties>
  +                <module>true</module>
  +            </properties>
  +        </dependency>
  +
  +        <dependency>
  +            <groupId>geronimo</groupId>
               <artifactId>geronimo-core</artifactId>
               <version>DEV</version>
               <properties>
  @@ -64,6 +73,15 @@
           <dependency>
               <groupId>geronimo-spec</groupId>
               <artifactId>geronimo-spec-j2ee-connector</artifactId>
  +            <version>DEV</version>
  +            <properties>
  +                <module>true</module>
  +            </properties>
  +        </dependency>
  +
  +        <dependency>
  +            <groupId>geronimo-spec</groupId>
  +            <artifactId>geronimo-spec-j2ee-deployment</artifactId>
               <version>DEV</version>
               <properties>
                   <module>true</module>
  
  
  
  1.1                  incubator-geronimo/modules/jetty/src/java/org/apache/geronimo/jetty/deployment/JettyModule.java
  
  Index: JettyModule.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Geronimo" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Geronimo", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * ====================================================================
   */
  package org.apache.geronimo.jetty.deployment;
  
  import java.net.URI;
  import java.util.Collections;
  import java.util.Properties;
  
  import javax.management.ObjectName;
  
  import org.apache.geronimo.deployment.ConfigurationCallback;
  import org.apache.geronimo.deployment.DeploymentModule;
  import org.apache.geronimo.gbean.jmx.GBeanMBean;
  import org.apache.geronimo.jetty.JettyWebApplicationContext;
  import org.apache.geronimo.kernel.deployment.DeploymentException;
  
  /**
   * 
   * 
   * @version $Revision: 1.1 $ $Date: 2004/01/22 00:51:09 $
   */
  public class JettyModule implements DeploymentModule {
      private final URI uri;
      private final String contextPath;
  
      public JettyModule(URI uri, String contextPath) {
          this.uri = uri;
          this.contextPath = contextPath;
      }
  
      public void init() throws DeploymentException {
      }
  
      public void generateClassPath(ConfigurationCallback callback) throws DeploymentException {
      }
  
      public void defineGBeans(ConfigurationCallback callback, ClassLoader cl) throws DeploymentException {
          try {
              // @todo tie name to configuration
              Properties nameProps = new Properties();
              nameProps.put("J2EEServer", "null");
              nameProps.put("J2EEApplication", "null");
              nameProps.put("J2EEType", "WebModule");
              nameProps.put("Path", contextPath);
              ObjectName name = new ObjectName("geronimo.jetty", nameProps);
  
              GBeanMBean app = new GBeanMBean(JettyWebApplicationContext.GBEAN_INFO);
              app.setAttribute("URI", uri);
              app.setAttribute("ContextPath", contextPath);
              app.setAttribute("ComponentContext", null);
              app.setAttribute("PolicyContextID", null);
              app.setEndpointPatterns("JettyContainer", Collections.singleton(new ObjectName("geronimo.web:type=WebContainer,container=Jetty"))); // @todo configurable
              app.setEndpointPatterns("TransactionManager", Collections.EMPTY_SET);
              app.setEndpointPatterns("TrackedConnectionAssociator", Collections.EMPTY_SET);
              callback.addGBean(name, app);
          } catch (Exception e) {
              throw new DeploymentException("Unable to build GBean for web application", e);
          }
      }
  
      public void complete() {
      }
  }
  
  
  
  1.1                  incubator-geronimo/modules/jetty/src/java/org/apache/geronimo/jetty/deployment/WARConfiguration.java
  
  Index: WARConfiguration.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Geronimo" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Geronimo", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * ====================================================================
   */
  package org.apache.geronimo.jetty.deployment;
  
  import javax.enterprise.deploy.model.DeployableObject;
  
  import org.apache.geronimo.deployment.plugin.DeploymentConfigurationSupport;
  
  /**
   * 
   * 
   * @version $Revision: 1.1 $ $Date: 2004/01/22 00:51:09 $
   */
  public class WARConfiguration extends DeploymentConfigurationSupport {
      public WARConfiguration(DeployableObject deployable) {
          super(deployable);
      }
  }
  
  
  
  1.1                  incubator-geronimo/modules/jetty/src/java/org/apache/geronimo/jetty/deployment/WARConfigurationFactory.java
  
  Index: WARConfigurationFactory.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Geronimo" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Geronimo", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * ====================================================================
   */
  package org.apache.geronimo.jetty.deployment;
  
  import javax.enterprise.deploy.model.DeployableObject;
  import javax.enterprise.deploy.shared.ModuleType;
  import javax.enterprise.deploy.spi.DeploymentConfiguration;
  import javax.enterprise.deploy.spi.exceptions.InvalidModuleException;
  
  import org.apache.geronimo.deployment.plugin.factories.DeploymentConfigurationFactory;
  import org.apache.geronimo.gbean.GBeanInfo;
  import org.apache.geronimo.gbean.GBeanInfoFactory;
  import org.apache.geronimo.gbean.GOperationInfo;
  
  /**
   * 
   * 
   * @version $Revision: 1.1 $ $Date: 2004/01/22 00:51:09 $
   */
  public class WARConfigurationFactory implements DeploymentConfigurationFactory {
      public DeploymentConfiguration createConfiguration(DeployableObject deployable) throws InvalidModuleException {
          if (!ModuleType.WAR.equals(deployable.getType())) {
              throw new InvalidModuleException("DeployableObject must be a WAR");
          }
          return new WARConfiguration(deployable);
      }
  
      public static final GBeanInfo GBEAN_INFO;
  
      static {
          GBeanInfoFactory infoFactory = new GBeanInfoFactory("Jetty WAR Configuration Factory", WARConfigurationFactory.class.getName());
          infoFactory.addOperation(new GOperationInfo("createConfiguration", new String[]{DeployableObject.class.getName()}));
          GBEAN_INFO = infoFactory.getBeanInfo();
      }
  
      public static GBeanInfo getGBeanInfo() {
          return GBEAN_INFO;
      }
  }
  
  
  
  1.1                  incubator-geronimo/modules/jetty/src/test/org/apache/geronimo/jetty/deployment/WARConfigurationFactoryTest.java
  
  Index: WARConfigurationFactoryTest.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Geronimo" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Geronimo", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * ====================================================================
   */
  package org.apache.geronimo.jetty.deployment;
  
  import java.util.Collections;
  import javax.enterprise.deploy.spi.DeploymentConfiguration;
  import javax.enterprise.deploy.spi.DeploymentManager;
  import javax.management.ObjectName;
  
  import org.apache.geronimo.deployment.plugin.DeploymentManagerImpl;
  import org.apache.geronimo.deployment.tools.loader.WebDeployable;
  import org.apache.geronimo.gbean.jmx.GBeanMBean;
  import org.apache.geronimo.kernel.Kernel;
  import org.apache.geronimo.kernel.management.State;
  import junit.framework.TestCase;
  
  /**
   * 
   * 
   * @version $Revision: 1.1 $ $Date: 2004/01/22 00:51:09 $
   */
  public class WARConfigurationFactoryTest extends TestCase {
      private Kernel kernel;
      private ObjectName managerName;
      private ObjectName warName;
      private GBeanMBean managerGBean;
  
      public void testFactory() throws Exception {
          ClassLoader cl = Thread.currentThread().getContextClassLoader();
          assertEquals(new Integer(State.RUNNING_INDEX), kernel.getMBeanServer().getAttribute(managerName, "state"));
          DeploymentManager manager = (DeploymentManager) managerGBean.getTarget();
          WebDeployable deployable = new WebDeployable(cl.getResource("deployables/war1/"));
          DeploymentConfiguration config = manager.createConfiguration(deployable);
          assertEquals(deployable, config.getDeployableObject());
      }
  
      protected void setUp() throws Exception {
          kernel = new Kernel("test");
          kernel.boot();
  
          warName = new ObjectName("geronimo.deployment:role=WARFactory");
          GBeanMBean warFactory = new GBeanMBean(WARConfigurationFactory.GBEAN_INFO);
          kernel.loadGBean(warName, warFactory);
          kernel.startGBean(warName);
  
          managerName = new ObjectName("geronimo.deployment:role=DeploymentManager");
          managerGBean = new GBeanMBean(DeploymentManagerImpl.GBEAN_INFO);
          managerGBean.setEndpointPatterns("WARFactory", Collections.singleton(warName));
          kernel.loadGBean(managerName, managerGBean);
          kernel.startGBean(managerName);
      }
  
      protected void tearDown() throws Exception {
          kernel.stopGBean(managerName);
          kernel.unloadGBean(managerName);
          kernel.stopGBean(warName);
          kernel.unloadGBean(warName);
          kernel.shutdown();
      }
  }