geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jboy...@apache.org
Subject cvs commit: incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel Kernel.java
Date Sat, 24 Jan 2004 21:07:45 GMT
jboynes     2004/01/24 13:07:45

  Modified:    modules/connector/src/java/org/apache/geronimo/connector/deployment
                        ConnectorModule.java
               modules/deployment/src/java/org/apache/geronimo/deployment
                        DeploymentModule.java
               modules/deployment/src/java/org/apache/geronimo/deployment/plugin
                        DeploymentManagerImpl.java
               modules/deployment/src/java/org/apache/geronimo/deployment/plugin/application
                        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/deployment/src/java/org/apache/geronimo/deployment/plugin/local
                        CommandSupport.java DistributeCommand.java
                        LocalServer.java
               modules/deployment/src/java/org/apache/geronimo/deployment/service
                        ServiceModule.java
               modules/jetty/src/java/org/apache/geronimo/jetty/deployment
                        JettyModule.java WARConfigurationFactory.java
               modules/jetty/src/test-resources/services local.xml
               modules/jetty/src/test/org/apache/geronimo/jetty/deployment
                        DeploymentTest.java
               modules/kernel/src/java/org/apache/geronimo/kernel
                        Kernel.java
  Added:       modules/deployment/src/java/org/apache/geronimo/deployment/plugin
                        FailedProgressObject.java
               modules/deployment/src/java/org/apache/geronimo/deployment/plugin/local
                        StartCommand.java StopCommand.java
               modules/jetty/src/java/org/apache/geronimo/jetty/deployment
                        AbstractModule.java UnpackedModule.java
               modules/jetty/src/test-resources/deployables/war1/WEB-INF
                        geronimo-web.xml
  Log:
  Support for unpacked WAR deployment on embedded local server
  
  Revision  Changes    Path
  1.3       +1 -6      incubator-geronimo/modules/connector/src/java/org/apache/geronimo/connector/deployment/ConnectorModule.java
  
  Index: ConnectorModule.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/connector/src/java/org/apache/geronimo/connector/deployment/ConnectorModule.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ConnectorModule.java	23 Jan 2004 19:58:16 -0000	1.2
  +++ ConnectorModule.java	24 Jan 2004 21:07:44 -0000	1.3
  @@ -65,7 +65,6 @@
   import javax.management.MalformedObjectNameException;
   import javax.management.ObjectName;
   import javax.management.ReflectionException;
  -import javax.enterprise.deploy.spi.TargetModuleID;
   
   import org.apache.geronimo.common.propertyeditor.PropertyEditors;
   import org.apache.geronimo.connector.ResourceAdapterWrapper;
  @@ -107,10 +106,6 @@
           this.moduleID = moduleID;
           this.geronimoConnectorDocument = geronimoConnectorDocument;
           this.connectorDeployer = connectorDeployer;
  -    }
  -
  -    public TargetModuleID getModuleID() {
  -        throw new UnsupportedOperationException();
       }
   
       public void init() throws DeploymentException {
  
  
  
  1.4       +20 -11    incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentModule.java
  
  Index: DeploymentModule.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentModule.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DeploymentModule.java	23 Jan 2004 19:58:16 -0000	1.3
  +++ DeploymentModule.java	24 Jan 2004 21:07:44 -0000	1.4
  @@ -66,10 +66,25 @@
   /**
    * A module representing a resource being deployed. The deployer will call each
    * method once in the sequence:
  - * <li>init</li>
  - * <li>generateClassPath</li>
  - * <li>defineGBeans</li>
  - * <li>complete</li>
  + * <code>
  + * try {
  + *   foreach module {
  + *       module.init();
  + *   }
  + *   foreach module {
  + *       module.generateClassPath(this);
  + *   }
  + *   ClassLoader parent = ... ; // get classloader from parent config
  + *   ClassLoader cl = new ClassLoader(classPathURLs, parent);
  + *   foreach module {
  + *       module.defineGBeans(this, cl);
  + *   }
  + * } finally {
  + *   foreach module {
  + *       module.complete();
  + *   }
  + * }
  + * </code>
    *
    * Once deployment starts, complete() method must always be called even if
    * problems in the deployment process prevent the other methods being called.
  @@ -78,12 +93,6 @@
    * @version $Revision$ $Date$
    */
   public interface DeploymentModule {
  -    /**
  -     * Get the JSR88 TargetModuleID for this module
  -     * @return the moduleID
  -     */
  -    TargetModuleID getModuleID();
  -
       /**
        * Indication to this module that the deployment process is starting.
        */
  
  
  
  1.5       +24 -11    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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DeploymentManagerImpl.java	23 Jan 2004 19:58:16 -0000	1.4
  +++ DeploymentManagerImpl.java	24 Jan 2004 21:07:44 -0000	1.5
  @@ -65,6 +65,7 @@
   import java.util.Locale;
   import java.util.Map;
   import javax.enterprise.deploy.model.DeployableObject;
  +import javax.enterprise.deploy.shared.CommandType;
   import javax.enterprise.deploy.shared.DConfigBeanVersionType;
   import javax.enterprise.deploy.shared.ModuleType;
   import javax.enterprise.deploy.spi.DeploymentConfiguration;
  @@ -81,6 +82,7 @@
   import org.apache.geronimo.deployment.DeploymentException;
   import org.apache.geronimo.deployment.DeploymentModule;
   import org.apache.geronimo.deployment.plugin.factories.DeploymentConfigurationFactory;
  +import org.apache.geronimo.deployment.plugin.local.CommandSupport;
   import org.apache.geronimo.gbean.GBeanInfo;
   import org.apache.geronimo.gbean.GBeanInfoFactory;
   import org.apache.geronimo.gbean.GConstructorInfo;
  @@ -179,12 +181,26 @@
       }
   
       public ProgressObject distribute(Target[] targetList, File moduleArchive, File deploymentPlan) throws IllegalStateException {
  +        Document doc;
           try {
  -            return distribute(targetList, new FileInputStream(moduleArchive), new FileInputStream(deploymentPlan));
  -        } catch (FileNotFoundException e) {
  -            // @todo should this return a "failed" progress object?
  -            throw new IllegalStateException();
  +            DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
  +            doc = parser.parse(deploymentPlan);
  +        } catch (Exception e) {
  +            return new FailedProgressObject(CommandType.DISTRIBUTE, e.getMessage());
  +        }
  +        DeploymentModule module = null;
  +        for (Iterator i = configurationFactories.values().iterator(); i.hasNext();) {
  +            DeploymentConfigurationFactory factory = (DeploymentConfigurationFactory) i.next();
  +            try {
  +                module = factory.createModule(moduleArchive, doc);
  +            } catch (DeploymentException e) {
  +                return new FailedProgressObject(CommandType.DISTRIBUTE, e.getMessage());
  +            }
  +        }
  +        if (module == null) {
  +            return new FailedProgressObject(CommandType.DISTRIBUTE, "No deployer found for supplied plan");
           }
  +        return server.distribute(targetList, module);
       }
   
       public ProgressObject distribute(Target[] targetList, InputStream moduleArchive, InputStream deploymentPlan) throws IllegalStateException {
  @@ -193,8 +209,7 @@
               DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
               doc = parser.parse(deploymentPlan);
           } catch (Exception e) {
  -            // @todo failed ProgressObject?
  -            throw new IllegalStateException();
  +            return new FailedProgressObject(CommandType.DISTRIBUTE, e.getMessage());
           }
           DeploymentModule module = null;
           for (Iterator i = configurationFactories.values().iterator(); i.hasNext();) {
  @@ -202,13 +217,11 @@
               try {
                   module = factory.createModule(moduleArchive, doc);
               } catch (DeploymentException e) {
  -                // @todo failed ProgressObject?
  -                throw new IllegalStateException();
  +                return new FailedProgressObject(CommandType.DISTRIBUTE, e.getMessage());
               }
           }
           if (module == null) {
  -            // @todo failed ProgressObject?
  -            throw new IllegalStateException();
  +            return new FailedProgressObject(CommandType.DISTRIBUTE, "No deployer found for supplied plan");
           }
           return server.distribute(targetList, module);
       }
  
  
  
  1.1                  incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/FailedProgressObject.java
  
  Index: FailedProgressObject.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 javax.enterprise.deploy.shared.CommandType;
  
  import org.apache.geronimo.deployment.plugin.local.CommandSupport;
  
  /**
   *
   *
   * @version $Revision: 1.1 $ $Date: 2004/01/24 21:07:44 $
   */
  public class FailedProgressObject extends CommandSupport {
      public FailedProgressObject(CommandType command, String message) {
          super(command);
          fail(message);
      }
  
      public void run() {
      }
  }
  
  
  
  1.3       +6 -1      incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/application/EARConfigurationFactory.java
  
  Index: EARConfigurationFactory.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/application/EARConfigurationFactory.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- EARConfigurationFactory.java	23 Jan 2004 19:58:16 -0000	1.2
  +++ EARConfigurationFactory.java	24 Jan 2004 21:07:44 -0000	1.3
  @@ -56,6 +56,7 @@
   package org.apache.geronimo.deployment.plugin.application;
   
   import java.io.InputStream;
  +import java.io.File;
   import javax.enterprise.deploy.model.DeployableObject;
   import javax.enterprise.deploy.spi.DeploymentConfiguration;
   import javax.enterprise.deploy.spi.exceptions.InvalidModuleException;
  @@ -83,6 +84,10 @@
       }
   
       public DeploymentModule createModule(InputStream moduleArchive, Document deploymentPlan) throws DeploymentException {
  +        throw new UnsupportedOperationException();
  +    }
  +
  +    public DeploymentModule createModule(File moduleArchive, Document deploymentPlan) throws DeploymentException {
           throw new UnsupportedOperationException();
       }
   
  
  
  
  1.3       +6 -1      incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/client/ClientConfigurationFactory.java
  
  Index: ClientConfigurationFactory.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/client/ClientConfigurationFactory.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ClientConfigurationFactory.java	23 Jan 2004 19:58:16 -0000	1.2
  +++ ClientConfigurationFactory.java	24 Jan 2004 21:07:44 -0000	1.3
  @@ -56,6 +56,7 @@
   package org.apache.geronimo.deployment.plugin.client;
   
   import java.io.InputStream;
  +import java.io.File;
   import javax.enterprise.deploy.spi.DeploymentConfiguration;
   import javax.enterprise.deploy.spi.exceptions.InvalidModuleException;
   import javax.enterprise.deploy.model.DeployableObject;
  @@ -76,6 +77,10 @@
       }
   
       public DeploymentModule createModule(InputStream moduleArchive, Document deploymentPlan) throws DeploymentException {
  +        throw new UnsupportedOperationException();
  +    }
  +
  +    public DeploymentModule createModule(File moduleArchive, Document deploymentPlan) throws DeploymentException {
           throw new UnsupportedOperationException();
       }
   
  
  
  
  1.3       +7 -3      incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/factories/DeploymentConfigurationFactory.java
  
  Index: DeploymentConfigurationFactory.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/factories/DeploymentConfigurationFactory.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DeploymentConfigurationFactory.java	23 Jan 2004 19:58:16 -0000	1.2
  +++ DeploymentConfigurationFactory.java	24 Jan 2004 21:07:44 -0000	1.3
  @@ -56,8 +56,10 @@
   package org.apache.geronimo.deployment.plugin.factories;
   
   import java.io.InputStream;
  +import java.io.File;
   import javax.enterprise.deploy.model.DeployableObject;
   import javax.enterprise.deploy.spi.DeploymentConfiguration;
  +import javax.enterprise.deploy.spi.Target;
   import javax.enterprise.deploy.spi.exceptions.InvalidModuleException;
   
   import org.apache.geronimo.deployment.DeploymentModule;
  @@ -65,12 +67,14 @@
   import org.w3c.dom.Document;
   
   /**
  - * 
  - * 
  + *
  + *
    * @version $Revision$ $Date$
    */
   public interface DeploymentConfigurationFactory {
       public DeploymentConfiguration createConfiguration(DeployableObject deployable) throws InvalidModuleException;
   
       public DeploymentModule createModule(InputStream moduleArchive, Document deploymentPlan) throws DeploymentException;
  +
  +    public DeploymentModule createModule(File moduleArchive, Document deploymentPlan) throws DeploymentException;
   }
  
  
  
  1.2       +88 -23    incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/local/CommandSupport.java
  
  Index: CommandSupport.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/local/CommandSupport.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CommandSupport.java	23 Jan 2004 19:58:16 -0000	1.1
  +++ CommandSupport.java	24 Jan 2004 21:07:44 -0000	1.2
  @@ -55,6 +55,11 @@
    */
   package org.apache.geronimo.deployment.plugin.local;
   
  +import java.util.ArrayList;
  +import java.util.HashSet;
  +import java.util.Iterator;
  +import java.util.List;
  +import java.util.Set;
   import javax.enterprise.deploy.shared.ActionType;
   import javax.enterprise.deploy.shared.CommandType;
   import javax.enterprise.deploy.shared.StateType;
  @@ -62,6 +67,7 @@
   import javax.enterprise.deploy.spi.exceptions.OperationUnsupportedException;
   import javax.enterprise.deploy.spi.status.ClientConfiguration;
   import javax.enterprise.deploy.spi.status.DeploymentStatus;
  +import javax.enterprise.deploy.spi.status.ProgressEvent;
   import javax.enterprise.deploy.spi.status.ProgressListener;
   import javax.enterprise.deploy.spi.status.ProgressObject;
   
  @@ -72,19 +78,29 @@
    */
   public abstract class CommandSupport implements ProgressObject, Runnable {
       private final CommandType command;
  -    private final Status status;
  +    private ActionType action;
  +    private StateType state;
  +    private String message;
  +    private final Set listeners = new HashSet();
  +    private final List moduleIDs = new ArrayList();
   
       protected CommandSupport(CommandType command) {
           this.command = command;
  -        this.status = new Status();
  +        this.action = ActionType.EXECUTE;
  +        this.state = StateType.RUNNING;
  +        this.message = null;
       }
   
  -    public TargetModuleID[] getResultTargetModuleIDs() {
  -        return new TargetModuleID[0];
  +    protected synchronized void addModule(TargetModuleID moduleID) {
  +        moduleIDs.add(moduleID);
  +    }
  +
  +    public synchronized TargetModuleID[] getResultTargetModuleIDs() {
  +        return (TargetModuleID[]) moduleIDs.toArray(new TargetModuleID[moduleIDs.size()]);
       }
   
       public DeploymentStatus getDeploymentStatus() {
  -        return status;
  +        return new Status(command, action, state, message);
       }
   
       public ClientConfiguration getClientConfiguration(TargetModuleID id) {
  @@ -107,33 +123,70 @@
           throw new OperationUnsupportedException("stop not supported");
       }
   
  -    public void addProgressListener(ProgressListener pol) {
  +    public synchronized void addProgressListener(ProgressListener pol) {
  +        listeners.add(pol);
       }
   
  -    public void removeProgressListener(ProgressListener pol) {
  +    public synchronized void removeProgressListener(ProgressListener pol) {
  +        listeners.remove(pol);
       }
   
       protected void setState(StateType state) {
  -        status.state = state;
  +        Set toNotify;
  +        DeploymentStatus newStatus;
  +        synchronized (this) {
  +            this.state = state;
  +            newStatus = getDeploymentStatus();
  +            toNotify = listeners;
  +        }
  +        sendEvent(toNotify, newStatus);
       }
   
       protected void fail(String message) {
  -        status.message = message;
  -        status.state = StateType.FAILED;
  -    }
  -
  -    protected void complete() {
  -        status.state = StateType.COMPLETED;
  -    }
  -
  -    protected void setMessage(String message) {
  -        status.message = message;
  +        Set toNotify;
  +        DeploymentStatus newStatus;
  +        synchronized (this) {
  +            this.message = message;
  +            this.state = StateType.FAILED;
  +            newStatus = getDeploymentStatus();
  +            toNotify = listeners;
  +        }
  +        sendEvent(toNotify, newStatus);
  +    }
  +
  +    protected synchronized void complete(String message) {
  +        Set toNotify;
  +        DeploymentStatus newStatus;
  +        synchronized (this) {
  +            this.message = message;
  +            this.state = StateType.COMPLETED;
  +            newStatus = getDeploymentStatus();
  +            toNotify = listeners;
  +        }
  +        sendEvent(toNotify, newStatus);
  +    }
  +
  +    private void sendEvent(Set toNotify, DeploymentStatus newStatus) {
  +        assert !Thread.holdsLock(this) : "Trying to send event whilst holding lock";
  +        ProgressEvent event = new ProgressEvent(this, null, newStatus);
  +        for (Iterator i = toNotify.iterator(); i.hasNext();) {
  +            ProgressListener listener = (ProgressListener) i.next();
  +            listener.handleProgressEvent(event);
  +        }
       }
   
  -    private class Status implements DeploymentStatus {
  -        private volatile ActionType action = ActionType.EXECUTE;
  -        private volatile StateType state = StateType.RUNNING;
  -        private volatile String message;
  +    private static class Status implements DeploymentStatus {
  +        private final CommandType command;
  +        private final ActionType action;
  +        private final StateType state;
  +        private final String message;
  +
  +        public Status(CommandType command, ActionType action, StateType state, String message) {
  +            this.command = command;
  +            this.action = action;
  +            this.state = state;
  +            this.message = message;
  +        }
   
           public CommandType getCommand() {
               return command;
  @@ -161,6 +214,18 @@
   
           public boolean isFailed() {
               return StateType.FAILED.equals(state);
  +        }
  +
  +        public String toString() {
  +            StringBuffer buf = new StringBuffer();
  +            buf.append("DeploymentStatus[").append(command).append(',');
  +            buf.append(action).append(',');
  +            buf.append(state);
  +            if (message != null) {
  +                buf.append(',').append(message);
  +            }
  +            buf.append(']');
  +            return buf.toString();
           }
       }
   }
  
  
  
  1.2       +10 -8     incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/local/DistributeCommand.java
  
  Index: DistributeCommand.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/local/DistributeCommand.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DistributeCommand.java	23 Jan 2004 19:58:16 -0000	1.1
  +++ DistributeCommand.java	24 Jan 2004 21:07:44 -0000	1.2
  @@ -62,9 +62,11 @@
   import java.util.jar.JarOutputStream;
   import javax.enterprise.deploy.shared.CommandType;
   import javax.enterprise.deploy.spi.TargetModuleID;
  +import javax.enterprise.deploy.spi.Target;
   
   import org.apache.geronimo.deployment.DeploymentModule;
   import org.apache.geronimo.deployment.ModuleDeployer;
  +import org.apache.geronimo.deployment.plugin.TargetModuleIDImpl;
   import org.apache.geronimo.deployment.util.FileUtil;
   import org.apache.geronimo.kernel.Kernel;
   import org.apache.geronimo.kernel.config.ConfigurationParent;
  @@ -75,12 +77,14 @@
    * @version $Revision$ $Date$
    */
   public class DistributeCommand extends CommandSupport {
  +    private final Target target;
       private final ConfigurationParent parent;
       private final Kernel kernel;
       private final DeploymentModule module;
   
  -    public DistributeCommand(ConfigurationParent parent, Kernel kernel, DeploymentModule module) {
  +    public DistributeCommand(Target target, ConfigurationParent parent, Kernel kernel, DeploymentModule module) {
           super(CommandType.DISTRIBUTE);
  +        this.target = target;
           this.parent = parent;
           this.kernel = kernel;
           this.module = module;
  @@ -98,7 +102,7 @@
               workDir.mkdir();
   
               // convert the module to a Configuration
  -            TargetModuleID targetID = module.getModuleID();
  +            TargetModuleID targetID = new TargetModuleIDImpl(target, "test");
               URI moduleID = URI.create(targetID.getModuleID());
               ModuleDeployer deployer = new ModuleDeployer(parent, moduleID, workDir);
               deployer.addModule(module);
  @@ -109,17 +113,15 @@
               try {
                   JarOutputStream jos = new JarOutputStream(new BufferedOutputStream(os));
                   deployer.saveConfiguration(jos);
  +                jos.flush();
               } finally {
                   os.close();
               }
   
               // install in our local server
               kernel.install(configFile.toURL());
  -
  -            // load configuration
  -            kernel.load(moduleID);
  -
  -            complete();
  +            addModule(targetID);
  +            complete("Completed");
           } catch (Exception e) {
               fail(e.getMessage());
           } finally {
  
  
  
  1.2       +15 -8     incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/local/LocalServer.java
  
  Index: LocalServer.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/local/LocalServer.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- LocalServer.java	23 Jan 2004 19:58:16 -0000	1.1
  +++ LocalServer.java	24 Jan 2004 21:07:44 -0000	1.2
  @@ -58,6 +58,7 @@
   import java.io.File;
   import java.io.InputStream;
   import java.net.URI;
  +import javax.enterprise.deploy.shared.CommandType;
   import javax.enterprise.deploy.shared.ModuleType;
   import javax.enterprise.deploy.spi.Target;
   import javax.enterprise.deploy.spi.TargetModuleID;
  @@ -67,6 +68,7 @@
   
   import org.apache.geronimo.deployment.DeploymentModule;
   import org.apache.geronimo.deployment.plugin.DeploymentServer;
  +import org.apache.geronimo.deployment.plugin.FailedProgressObject;
   import org.apache.geronimo.deployment.plugin.TargetImpl;
   import org.apache.geronimo.gbean.GAttributeInfo;
   import org.apache.geronimo.gbean.GBean;
  @@ -81,8 +83,8 @@
   import org.apache.geronimo.kernel.jmx.MBeanProxyFactory;
   
   /**
  - * 
  - * 
  + *
  + *
    * @version $Revision$ $Date$
    */
   public class LocalServer implements DeploymentServer,GBean {
  @@ -129,20 +131,23 @@
   
       public ProgressObject distribute(Target[] targetList, DeploymentModule module) throws IllegalStateException {
           if (targetList.length != 1 || !target.equals(targetList[0])) {
  -            // @todo progress object ?
  -            throw new IllegalStateException();
  +            return new FailedProgressObject(CommandType.DISTRIBUTE, "Invalid Target");
           }
  -        DistributeCommand command = new DistributeCommand(parent, kernel, module);
  +        DistributeCommand command = new DistributeCommand(target, parent, kernel, module);
           new Thread(command).start();
           return command;
       }
   
       public ProgressObject start(TargetModuleID[] moduleIDList) throws IllegalStateException {
  -        throw new UnsupportedOperationException();
  +        StartCommand command = new StartCommand(kernel, moduleIDList);
  +        new Thread(command).start();
  +        return command;
       }
   
       public ProgressObject stop(TargetModuleID[] moduleIDList) throws IllegalStateException {
  -        throw new UnsupportedOperationException();
  +        StopCommand command = new StopCommand(kernel, moduleIDList);
  +        new Thread(command).start();
  +        return command;
       }
   
       public boolean isRedeploySupported() {
  @@ -166,11 +171,13 @@
       public void doStart() throws WaitingException, Exception {
           kernel.boot();
           configName = kernel.load(rootConfigID);
  +        kernel.getMBeanServer().invoke(configName, "startRecursive", null, null);
           parent = (ConfigurationParent) MBeanProxyFactory.getProxy(ConfigurationParent.class, kernel.getMBeanServer(), configName);
       }
   
       public void doStop() throws WaitingException, Exception {
           parent = null;
  +        kernel.getMBeanServer().invoke(configName, "stop", null, null);
           kernel.unload(configName);
           kernel.shutdown();
       }
  
  
  
  1.1                  incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/local/StartCommand.java
  
  Index: StartCommand.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.local;
  
  import java.net.URI;
  import javax.enterprise.deploy.shared.CommandType;
  import javax.enterprise.deploy.spi.TargetModuleID;
  import javax.management.ObjectName;
  
  import org.apache.geronimo.kernel.Kernel;
  
  /**
   *
   *
   * @version $Revision: 1.1 $ $Date: 2004/01/24 21:07:44 $
   */
  public class StartCommand extends CommandSupport {
      private final Kernel kernel;
      private final TargetModuleID[] modules;
  
      public StartCommand(Kernel kernel, TargetModuleID modules[]) {
          super(CommandType.START);
          this.kernel = kernel;
          this.modules = modules;
      }
  
      public void run() {
          try {
              for (int i = 0; i < modules.length; i++) {
                  TargetModuleID module = modules[i];
  
                  URI moduleID = URI.create(module.getModuleID());
                  ObjectName name = kernel.load(moduleID);
  
                  kernel.getMBeanServer().invoke(name, "startRecursive", null, null);
                  addModule(module);
              }
              complete("Completed");
          } catch (Exception e) {
              fail(e.getMessage());
          }
      }
  }
  
  
  
  1.1                  incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/local/StopCommand.java
  
  Index: StopCommand.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.local;
  
  import java.net.URI;
  import javax.enterprise.deploy.shared.CommandType;
  import javax.enterprise.deploy.spi.TargetModuleID;
  import javax.management.ObjectName;
  
  import org.apache.geronimo.kernel.Kernel;
  
  /**
   *
   *
   * @version $Revision: 1.1 $ $Date: 2004/01/24 21:07:44 $
   */
  public class StopCommand extends CommandSupport {
      private final Kernel kernel;
      private final TargetModuleID[] modules;
  
      public StopCommand(Kernel kernel, TargetModuleID modules[]) {
          super(CommandType.START);
          this.kernel = kernel;
          this.modules = modules;
      }
  
      public void run() {
          try {
              for (int i = 0; i < modules.length; i++) {
                  TargetModuleID module = modules[i];
  
                  URI moduleID = URI.create(module.getModuleID());
                  ObjectName name = kernel.getConfigObjectName(moduleID);
                  kernel.getMBeanServer().invoke(name, "stop", null, null);
                  addModule(module);
              }
              complete("Completed");
          } catch (Exception e) {
              fail(e.getMessage());
          }
      }
  }
  
  
  
  1.6       +4 -9      incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/service/ServiceModule.java
  
  Index: ServiceModule.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/service/ServiceModule.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ServiceModule.java	23 Jan 2004 19:58:17 -0000	1.5
  +++ ServiceModule.java	24 Jan 2004 21:07:44 -0000	1.6
  @@ -69,19 +69,17 @@
   import java.util.Set;
   import java.util.zip.ZipEntry;
   import java.util.zip.ZipInputStream;
  -
   import javax.management.MalformedObjectNameException;
   import javax.management.ObjectName;
  -import javax.enterprise.deploy.spi.TargetModuleID;
   
   import org.apache.geronimo.deployment.ConfigurationCallback;
  +import org.apache.geronimo.deployment.DeploymentException;
   import org.apache.geronimo.deployment.DeploymentModule;
  +import org.apache.geronimo.deployment.util.URLInfo;
  +import org.apache.geronimo.deployment.util.URLType;
   import org.apache.geronimo.gbean.GBeanInfo;
   import org.apache.geronimo.gbean.InvalidConfigurationException;
   import org.apache.geronimo.gbean.jmx.GBeanMBean;
  -import org.apache.geronimo.deployment.DeploymentException;
  -import org.apache.geronimo.deployment.util.URLInfo;
  -import org.apache.geronimo.deployment.util.URLType;
   
   /**
    *
  @@ -101,9 +99,6 @@
           this.gbeanDefaults = gbeanDefaults;
       }
   
  -    public TargetModuleID getModuleID() {
  -        throw new UnsupportedOperationException();
  -    }
       public void init() throws DeploymentException {
       }
   
  
  
  
  1.4       +6 -50     incubator-geronimo/modules/jetty/src/java/org/apache/geronimo/jetty/deployment/JettyModule.java
  
  Index: JettyModule.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/jetty/src/java/org/apache/geronimo/jetty/deployment/JettyModule.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JettyModule.java	23 Jan 2004 19:58:17 -0000	1.3
  +++ JettyModule.java	24 Jan 2004 21:07:44 -0000	1.4
  @@ -55,21 +55,12 @@
    */
   package org.apache.geronimo.jetty.deployment;
   
  -import java.net.URI;
  -import java.util.Collections;
  -import java.util.Properties;
  -import java.util.zip.ZipInputStream;
  -import java.util.zip.ZipEntry;
  -import java.io.InputStream;
   import java.io.IOException;
  -
  -import javax.management.ObjectName;
  -import javax.enterprise.deploy.spi.TargetModuleID;
  +import java.io.InputStream;
  +import java.util.zip.ZipEntry;
  +import java.util.zip.ZipInputStream;
   
   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.deployment.DeploymentException;
   import org.w3c.dom.Document;
   
  @@ -78,58 +69,23 @@
    *
    * @version $Revision$ $Date$
    */
  -public class JettyModule implements DeploymentModule {
  +public class JettyModule extends AbstractModule {
       private final InputStream moduleArchive;
  -    private URI uri;
  -    private String contextPath;
   
       public JettyModule(InputStream moduleArchive, Document deploymentPlan) {
           this.moduleArchive = moduleArchive;
       }
   
  -    public TargetModuleID getModuleID() {
  -        throw new UnsupportedOperationException();
  -    }
  -
  -    public void init() throws DeploymentException {
  -    }
  -
       public void generateClassPath(ConfigurationCallback callback) throws DeploymentException {
           ZipInputStream zis = new ZipInputStream(moduleArchive);
           try {
               ZipEntry entry;
               while ((entry = zis.getNextEntry()) != null) {
  -                            
  +
               }
           } catch (IOException e) {
               throw new DeploymentException("Unable to download WAR content", e);
           }
       }
   
  -    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.3       +12 -2     incubator-geronimo/modules/jetty/src/java/org/apache/geronimo/jetty/deployment/WARConfigurationFactory.java
  
  Index: WARConfigurationFactory.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/jetty/src/java/org/apache/geronimo/jetty/deployment/WARConfigurationFactory.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- WARConfigurationFactory.java	23 Jan 2004 19:58:17 -0000	1.2
  +++ WARConfigurationFactory.java	24 Jan 2004 21:07:44 -0000	1.3
  @@ -55,15 +55,16 @@
    */
   package org.apache.geronimo.jetty.deployment;
   
  +import java.io.File;
   import java.io.InputStream;
   import javax.enterprise.deploy.model.DeployableObject;
   import javax.enterprise.deploy.shared.ModuleType;
   import javax.enterprise.deploy.spi.DeploymentConfiguration;
  +import javax.enterprise.deploy.spi.Target;
   import javax.enterprise.deploy.spi.exceptions.InvalidModuleException;
   
   import org.apache.geronimo.deployment.DeploymentException;
   import org.apache.geronimo.deployment.DeploymentModule;
  -import org.apache.geronimo.deployment.util.XMLUtil;
   import org.apache.geronimo.deployment.plugin.factories.DeploymentConfigurationFactory;
   import org.apache.geronimo.gbean.GBeanInfo;
   import org.apache.geronimo.gbean.GBeanInfoFactory;
  @@ -90,6 +91,15 @@
           }
   
           return new JettyModule(moduleArchive, deploymentPlan);
  +    }
  +
  +    public DeploymentModule createModule(File moduleArchive, Document deploymentPlan) throws DeploymentException {
  +        Element root = deploymentPlan.getDocumentElement();
  +        if (!"web-app".equals(root.getNodeName())) {
  +            return null;
  +        }
  +
  +       return new UnpackedModule(moduleArchive, deploymentPlan);
       }
   
       public static final GBeanInfo GBEAN_INFO;
  
  
  
  1.1                  incubator-geronimo/modules/jetty/src/java/org/apache/geronimo/jetty/deployment/AbstractModule.java
  
  Index: AbstractModule.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.Properties;
  import java.util.Collections;
  import java.net.URI;
  import javax.enterprise.deploy.spi.TargetModuleID;
  import javax.management.ObjectName;
  
  import org.apache.geronimo.deployment.DeploymentModule;
  import org.apache.geronimo.deployment.DeploymentException;
  import org.apache.geronimo.deployment.ConfigurationCallback;
  import org.apache.geronimo.gbean.jmx.GBeanMBean;
  import org.apache.geronimo.jetty.JettyWebApplicationContext;
  
  /**
   * 
   * 
   * @version $Revision: 1.1 $ $Date: 2004/01/24 21:07:44 $
   */
  public class AbstractModule implements DeploymentModule {
      protected URI uri;
      protected String 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/UnpackedModule.java
  
  Index: UnpackedModule.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.io.File;
  
  import org.apache.geronimo.deployment.util.XMLUtil;
  import org.w3c.dom.Document;
  import org.w3c.dom.Element;
  
  /**
   * 
   * 
   * @version $Revision: 1.1 $ $Date: 2004/01/24 21:07:44 $
   */
  public class UnpackedModule extends AbstractModule {
      public UnpackedModule(File archive, Document doc) {
          this.uri = archive.toURI();
          Element contextElement = XMLUtil.getChild(doc.getDocumentElement(), "context-root");
          if (contextElement == null) {
              contextPath = archive.getName();
              if (contextPath.endsWith(".war")) {
                  contextPath = contextPath.substring(0, contextPath.length()-4);
              }
          } else {
              contextPath = (String) XMLUtil.getContent(contextElement);
          }
      }
  
  }
  
  
  
  1.1                  incubator-geronimo/modules/jetty/src/test-resources/deployables/war1/WEB-INF/geronimo-web.xml
  
  Index: geronimo-web.xml
  ===================================================================
  <web-app>
      <context-root>/test</context-root>
  </web-app>
  
  
  1.2       +1 -1      incubator-geronimo/modules/jetty/src/test-resources/services/local.xml
  
  Index: local.xml
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/jetty/src/test-resources/services/local.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- local.xml	23 Jan 2004 19:58:17 -0000	1.1
  +++ local.xml	24 Jan 2004 21:07:45 -0000	1.2
  @@ -3,7 +3,7 @@
       </gbean>
   
       <gbean class="org.apache.geronimo.jetty.connector.HTTPConnector" objectName="geronimo.web:type=WebConnector,container=Jetty,port=8080">
  -        <default attribute="Port" type="int">8080</default>
  +        <default attribute="Port" type="int">5678</default>
           <endpoint name="JettyContainer">
               <pattern>geronimo.web:type=WebContainer,container=Jetty</pattern>
           </endpoint>
  
  
  
  1.2       +79 -29    incubator-geronimo/modules/jetty/src/test/org/apache/geronimo/jetty/deployment/DeploymentTest.java
  
  Index: DeploymentTest.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/jetty/src/test/org/apache/geronimo/jetty/deployment/DeploymentTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DeploymentTest.java	23 Jan 2004 19:58:17 -0000	1.1
  +++ DeploymentTest.java	24 Jan 2004 21:07:45 -0000	1.2
  @@ -55,42 +55,91 @@
    */
   package org.apache.geronimo.jetty.deployment;
   
  -import java.net.URL;
  -import java.net.URI;
  -import java.io.ByteArrayOutputStream;
  -import java.io.ByteArrayInputStream;
  -import java.io.File;
   import java.io.BufferedOutputStream;
  +import java.io.File;
   import java.io.FileOutputStream;
  +import java.io.BufferedReader;
  +import java.io.InputStreamReader;
  +import java.io.IOException;
  +import java.net.URI;
  +import java.net.URL;
  +import java.net.HttpURLConnection;
   import java.util.Collections;
   import java.util.jar.JarOutputStream;
  -import javax.enterprise.deploy.spi.DeploymentConfiguration;
  -import javax.enterprise.deploy.spi.DConfigBeanRoot;
   import javax.enterprise.deploy.spi.Target;
  +import javax.enterprise.deploy.spi.TargetModuleID;
  +import javax.enterprise.deploy.spi.status.ProgressEvent;
  +import javax.enterprise.deploy.spi.status.ProgressListener;
  +import javax.enterprise.deploy.spi.status.ProgressObject;
  +import javax.enterprise.deploy.shared.StateType;
   
  -import org.apache.geronimo.deployment.tools.loader.WebDeployable;
  -import org.apache.geronimo.deployment.plugin.local.LocalServer;
  -import org.apache.geronimo.deployment.util.FileUtil;
  -import org.apache.geronimo.deployment.util.URLInfo;
   import org.apache.geronimo.deployment.URLDeployer;
  +import org.apache.geronimo.deployment.plugin.local.LocalServer;
   import org.apache.geronimo.deployment.service.ServiceDeployer;
  +import org.apache.geronimo.deployment.util.URLInfo;
   import org.apache.geronimo.gbean.jmx.GBeanMBean;
   
   /**
  - * 
  - * 
  + *
  + *
    * @version $Revision$ $Date$
    */
   public class DeploymentTest extends DeployerTestCase {
  -    private URL war;
  -    private byte[] plan;
  +//    private byte[] plan;
       private File configFile;
  +    private Target[] targets;
   
  -    public void testDistribute() throws Exception {
  -//        Target[] targets = manager.getTargets();
  -//        manager.distribute(targets, war.openStream(), new ByteArrayInputStream(plan));
  +    public void testUnpacked() throws Exception {
  +        URL url = classLoader.getResource("deployables/war1/");
  +        File war = new File(URI.create(url.toString()));
  +
  +        ProgressObject result = manager.distribute(targets, war, new File(war, "WEB-INF/geronimo-web.xml"));
  +        waitFor(result);
  +        TargetModuleID[] ids = result.getResultTargetModuleIDs();
  +        assertEquals(1, ids.length);
  +
  +        result = manager.start(ids);
  +        waitFor(result);
  +
  +        HttpURLConnection connection = (HttpURLConnection) new URL("http://localhost:5678/test/hello.txt").openConnection();
  +        BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
  +        assertEquals(HttpURLConnection.HTTP_OK, connection.getResponseCode());
  +        assertEquals("Hello World", reader.readLine());
  +        connection.disconnect();
  +
  +        result = manager.stop(ids);
  +        waitFor(result);
  +
  +        connection = (HttpURLConnection) new URL("http://localhost:5678/test/hello.txt").openConnection();
  +        try {
  +            reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
  +            fail();
  +        } catch (IOException e) {
  +            assertEquals(HttpURLConnection.HTTP_NOT_FOUND, connection.getResponseCode());
  +        }
  +        connection.disconnect();
  +    }
  +
  +    private void waitFor(ProgressObject result) throws InterruptedException {
  +        result.addProgressListener(new ProgressListener() {
  +            public void handleProgressEvent(ProgressEvent event) {
  +                synchronized (DeploymentTest.this) {
  +                    DeploymentTest.this.notify();
  +                }
  +            }
  +        });
  +        synchronized (this) {
  +            while (result.getDeploymentStatus().isRunning()) {
  +                wait();
  +            }
  +        }
  +        assertEquals(StateType.COMPLETED, result.getDeploymentStatus().getState());
       }
   
  +//    public void testPacked() throws Exception {
  +//        manager.distribute(targets, war.openStream(), new ByteArrayInputStream(plan));
  +//    }
  +
       protected void setUp() throws Exception {
           super.setUp();
   
  @@ -112,16 +161,17 @@
           kernel.loadGBean(serverName, serverGBean);
           kernel.startGBean(serverName);
   
  -        war = classLoader.getResource("deployables/war2.war");
  -        WebDeployable deployable = new WebDeployable(war);
  -        DeploymentConfiguration config = manager.createConfiguration(deployable);
  -        DConfigBeanRoot configRoot = config.getDConfigBeanRoot(deployable.getDDBeanRoot());
  -        WebAppDConfigBean contextBean = (WebAppDConfigBean) configRoot.getDConfigBean(deployable.getChildBean("/web-app")[0]);
  -        contextBean.setContextRoot("/war2");
  -
  -        ByteArrayOutputStream baos = new ByteArrayOutputStream();
  -        config.save(baos);
  -        plan = baos.toByteArray();
  +//        WebDeployable deployable = new WebDeployable(war);
  +//        DeploymentConfiguration config = manager.createConfiguration(deployable);
  +//        DConfigBeanRoot configRoot = config.getDConfigBeanRoot(deployable.getDDBeanRoot());
  +//        WebAppDConfigBean contextBean = (WebAppDConfigBean) configRoot.getDConfigBean(deployable.getChildBean("/web-app")[0]);
  +//        contextBean.setContextRoot("/war2");
  +//
  +//        ByteArrayOutputStream baos = new ByteArrayOutputStream();
  +//        config.save(baos);
  +//        plan = baos.toByteArray();
  +
  +        targets = manager.getTargets();
       }
   
       protected void tearDown() throws Exception {
  
  
  
  1.10      +6 -2      incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/Kernel.java
  
  Index: Kernel.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/Kernel.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Kernel.java	23 Jan 2004 16:45:48 -0000	1.9
  +++ Kernel.java	24 Jan 2004 21:07:45 -0000	1.10
  @@ -216,12 +216,16 @@
           }
           ObjectName configName;
           try {
  -            configName = new ObjectName("geronimo.config:name=" + ObjectName.quote(configID.toString()));
  +            configName = getConfigObjectName(configID);
           } catch (MalformedObjectNameException e) {
               throw new InvalidConfigException("Cannot convert ID to ObjectName: ", e);
           }
           load(config, rootURL, configName);
           return configName;
  +    }
  +
  +    public ObjectName getConfigObjectName(URI configID) throws MalformedObjectNameException {
  +        return new ObjectName("geronimo.config:name=" + ObjectName.quote(configID.toString()));
       }
   
       /**
  
  
  

Mime
View raw message