You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jl...@apache.org on 2006/03/10 10:57:48 UTC

svn commit: r384746 [1/2] - in /geronimo/sandbox/geronimo-deployment-plugin: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/geronimo/ src/main/java/org/apache/geronimo/plugins/ src/main/java/org/a...

Author: jlaskowski
Date: Fri Mar 10 01:57:45 2006
New Revision: 384746

URL: http://svn.apache.org/viewcvs?rev=384746&view=rev
Log:
GERONIMO-1650 Initial contribution of Geronimo deployment plugin for Maven2
Submitted by: Prasad Kashyap

Added:
    geronimo/sandbox/geronimo-deployment-plugin/   (with props)
    geronimo/sandbox/geronimo-deployment-plugin/LICENSE.txt   (with props)
    geronimo/sandbox/geronimo-deployment-plugin/NOTICE   (with props)
    geronimo/sandbox/geronimo-deployment-plugin/pom.xml   (with props)
    geronimo/sandbox/geronimo-deployment-plugin/src/
    geronimo/sandbox/geronimo-deployment-plugin/src/main/
    geronimo/sandbox/geronimo-deployment-plugin/src/main/java/
    geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/
    geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/
    geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/
    geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/
    geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/
    geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/AbstractModuleMojo.java   (with props)
    geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/DistributeModuleMojo.java   (with props)
    geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/StartModuleMojo.java   (with props)
    geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/StartRemoteServerMojo.java   (with props)
    geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/StartServerMojo.java   (with props)
    geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/StopModuleMojo.java   (with props)
    geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/StopRemoteServerMojo.java   (with props)
    geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/StopServerMojo.java   (with props)
    geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/UndeployModuleMojo.java   (with props)
    geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/UnpackServerMojo.java   (with props)
    geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/VelocityFilterMojo.java   (with props)
    geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/util/
    geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/util/DeploymentClient.java   (with props)
    geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/util/ServerBehavior.java   (with props)
    geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/util/VelocityFilter.java   (with props)

Propchange: geronimo/sandbox/geronimo-deployment-plugin/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Mar 10 01:57:45 2006
@@ -0,0 +1,6 @@
+*.iml
+.project
+.classpath
+maven.log
+junit*.properties
+target

Added: geronimo/sandbox/geronimo-deployment-plugin/LICENSE.txt
URL: http://svn.apache.org/viewcvs/geronimo/sandbox/geronimo-deployment-plugin/LICENSE.txt?rev=384746&view=auto
==============================================================================
--- geronimo/sandbox/geronimo-deployment-plugin/LICENSE.txt (added)
+++ geronimo/sandbox/geronimo-deployment-plugin/LICENSE.txt Fri Mar 10 01:57:45 2006
@@ -0,0 +1,203 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+

Propchange: geronimo/sandbox/geronimo-deployment-plugin/LICENSE.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/geronimo-deployment-plugin/LICENSE.txt
------------------------------------------------------------------------------
    svn:executable = *

Propchange: geronimo/sandbox/geronimo-deployment-plugin/LICENSE.txt
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: geronimo/sandbox/geronimo-deployment-plugin/LICENSE.txt
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/geronimo-deployment-plugin/NOTICE
URL: http://svn.apache.org/viewcvs/geronimo/sandbox/geronimo-deployment-plugin/NOTICE?rev=384746&view=auto
==============================================================================
--- geronimo/sandbox/geronimo-deployment-plugin/NOTICE (added)
+++ geronimo/sandbox/geronimo-deployment-plugin/NOTICE Fri Mar 10 01:57:45 2006
@@ -0,0 +1,3 @@
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+

Propchange: geronimo/sandbox/geronimo-deployment-plugin/NOTICE
------------------------------------------------------------------------------
    svn:executable = *

Propchange: geronimo/sandbox/geronimo-deployment-plugin/NOTICE
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: geronimo/sandbox/geronimo-deployment-plugin/pom.xml
URL: http://svn.apache.org/viewcvs/geronimo/sandbox/geronimo-deployment-plugin/pom.xml?rev=384746&view=auto
==============================================================================
--- geronimo/sandbox/geronimo-deployment-plugin/pom.xml (added)
+++ geronimo/sandbox/geronimo-deployment-plugin/pom.xml Fri Mar 10 01:57:45 2006
@@ -0,0 +1,157 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Copyright 2006 The Apache Software Foundation
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+
+<!-- $Rev$ $Date$ -->
+
+<project>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.geronimo.plugins</groupId>
+  <artifactId>geronimo-deployment-plugin</artifactId>
+  <packaging>maven-plugin</packaging>
+  <version>1.0-SNAPSHOT</version>
+  <name>Geronimo Deployment Plugin for Maven2</name>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-plugin-api</artifactId>
+      <version>2.0</version>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.1</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.geronimo</groupId>
+      <artifactId>geronimo-common</artifactId>
+      <version>1.2-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.geronimo</groupId>
+      <artifactId>geronimo-kernel</artifactId>
+      <version>1.2-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.geronimo</groupId>
+      <artifactId>geronimo-deployment</artifactId>
+      <version>1.2-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.geronimo</groupId>
+      <artifactId>geronimo-deploy-jsr88</artifactId>
+      <version>1.2-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.geronimo</groupId>
+      <artifactId>geronimo-system</artifactId>
+      <version>1.2-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.geronimo.specs</groupId>
+      <artifactId>geronimo-j2ee-deployment_1.1_spec</artifactId>
+      <version>1.0</version>
+    </dependency>
+    <dependency>
+      <groupId>commons-cli</groupId>
+      <artifactId>commons-cli</artifactId>
+      <version>1.0</version>
+    </dependency>
+    <dependency>
+      <groupId>commons-logging</groupId>
+      <artifactId>commons-logging</artifactId>
+      <version>1.0.4</version>
+    </dependency>
+    <dependency>
+      <groupId>log4j</groupId>
+      <artifactId>log4j</artifactId>
+      <version>1.2.8</version>
+    </dependency>
+    <dependency>
+      <groupId>mx4j</groupId>
+      <artifactId>mx4j</artifactId>
+      <version>3.0.1</version>
+    </dependency>
+    <dependency>
+      <groupId>mx4j</groupId>
+      <artifactId>mx4j-remote</artifactId>
+      <version>3.0.1</version>
+    </dependency>
+    <dependency>
+      <groupId>cglib</groupId>
+      <artifactId>cglib-nodep</artifactId>
+      <version>2.1_2</version>
+    </dependency>
+    <dependency>
+      <groupId>xmlbeans</groupId>
+      <artifactId>xbean</artifactId>
+      <version>2.0.0</version>
+    </dependency>
+    <dependency>
+      <groupId>commons-jelly</groupId>
+      <artifactId>commons-jelly</artifactId>
+      <version>1.0</version>
+    </dependency>
+    <dependency>
+      <groupId>velocity</groupId>
+      <artifactId>velocity</artifactId>
+      <version>1.4</version>
+    </dependency>
+    <dependency>
+      <groupId>velocity</groupId>
+      <artifactId>velocity-dep</artifactId>
+      <version>1.4</version>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-plugin-plugin</artifactId>
+        <configuration>
+          <goalPrefix>deploy</goalPrefix>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+  <reporting>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-project-info-reports-plugin</artifactId>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-plugin-plugin</artifactId>
+      </plugin>
+    </plugins>
+  </reporting>
+
+  <properties>
+    <!-- These are the default properties that all the mojos need.
+      They should eventually be moved to the top level POM for the
+      geronimo project and should be inherited from here 
+    -->
+    <geronimoGroupId>geronimo</geronimoGroupId>
+    <geronimoArtifactId>geronimo-jetty-j2ee</geronimoArtifactId>
+    <geronimoVersion>1.0</geronimoVersion>
+    <localRepository>${settings.localRepository}</localRepository>
+  </properties>
+
+</project>

Propchange: geronimo/sandbox/geronimo-deployment-plugin/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/geronimo-deployment-plugin/pom.xml
------------------------------------------------------------------------------
    svn:executable = *

Propchange: geronimo/sandbox/geronimo-deployment-plugin/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: geronimo/sandbox/geronimo-deployment-plugin/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/AbstractModuleMojo.java
URL: http://svn.apache.org/viewcvs/geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/AbstractModuleMojo.java?rev=384746&view=auto
==============================================================================
--- geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/AbstractModuleMojo.java (added)
+++ geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/AbstractModuleMojo.java Fri Mar 10 01:57:45 2006
@@ -0,0 +1,261 @@
+/**
+ *
+ * Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.plugins.deployment;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.PrintStream;
+
+import javax.enterprise.deploy.shared.factories.DeploymentFactoryManager;
+
+import javax.enterprise.deploy.spi.DeploymentManager;
+import javax.enterprise.deploy.spi.exceptions.DeploymentManagerCreationException;
+
+import org.apache.geronimo.deployment.plugin.factories.DeploymentFactoryImpl;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public abstract class AbstractModuleMojo extends AbstractMojo {
+    
+    /**
+     * The greeting to display.
+     * 
+     * @parameter default-value="jmx:rmi://localhost/jndi/rmi:/JMXConnector"
+     */
+    private String uri;
+
+
+    /**
+     * @parameter
+     */
+    protected String id;
+    
+
+    /**
+     * The greeting to display.
+     * 
+     * @parameter default-value="deployer:geronimo:jmx"
+     */
+    private String distributeURI;
+
+    /**
+     * The greeting to display.
+     * 
+     * @parameter default-value="system"
+     */
+    private String username;
+
+    /**
+     * The greeting to display.
+     * 
+     * @parameter default-value="manager"
+     */
+    private String password;
+
+    /**
+     * The greeting to display.
+     * 
+     * @parameter default-value=0
+     */
+    private long sleepTimer;
+
+    /**
+     * @parameter default-value=100
+     */
+    private int maxTries;
+
+    /**
+     * @parameter default-value=2000
+     */
+    private int retryIntervalMilliseconds;
+
+    /**
+     * @parameter default-value=true
+     */
+    private boolean failOnError;
+
+    /**
+     * @parameter
+     */
+    private File outputDirectory;
+
+    /**
+     * @parameter default-value=null
+     */
+    private File resultsLog;
+
+    
+
+    protected final String lineSep = "===========================================";
+
+    public abstract void execute() throws MojoExecutionException;
+
+    protected DeploymentManager getDeploymentManager() throws IOException, DeploymentManagerCreationException {
+        if (getUsername() == null) {
+            throw new IllegalStateException("No user specified");
+        }
+        if (getPassword() == null) {
+            throw new IllegalStateException("No password specified");
+        }
+        if (getDistributeURI() == null) {
+            throw new IllegalStateException("No uri specified");
+        }
+        new DeploymentFactoryImpl();
+
+        ClassLoader oldcl = Thread.currentThread().getContextClassLoader();
+        try {
+            Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
+            DeploymentFactoryManager factoryManager = DeploymentFactoryManager.getInstance();
+            DeploymentManager manager = factoryManager.getDeploymentManager(getDistributeURI(), getUsername(), getPassword());
+            return manager;
+        }
+        finally {
+            Thread.currentThread().setContextClassLoader(oldcl);
+        }
+    }
+
+    /**
+     * @return Returns the maxTries.
+     */
+    public int getMaxTries() {
+        return maxTries;
+    }
+
+    /**
+     * @return Returns the retryIntervalMilliseconds.
+     */
+    public int getRetryIntervalMilliseconds() {
+        return retryIntervalMilliseconds;
+    }
+
+    /**
+     * @return Returns the sleepTimer.
+     */
+    public long getSleepTimer() {
+        return sleepTimer;
+    }
+
+    public String getUri() {
+        return uri;
+    }
+
+    public String getDistributeURI() {
+        return distributeURI;
+    }
+
+    public String getUsername() {
+        return username;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public boolean isFailOnError() {
+        return failOnError;
+    }
+
+    public File getOutputDirectory() {
+        return outputDirectory;
+    }
+
+    public PrintStream getResultsStream() {
+        PrintStream resultStream = null;
+        if (this.resultsLog != null) {
+            try {
+                resultStream = new PrintStream(new FileOutputStream(this.resultsLog, true), true);
+            }
+            catch (FileNotFoundException e) {
+                //e.printStackTrace();
+                getLog().warn(e.toString());
+                getLog().warn("Results cannot be logged");
+            }
+        }
+        return resultStream;
+    }
+
+    public PrintStream getLogStream(String goalName) {
+        PrintStream stream = System.out;
+    
+        if (this.outputDirectory != null) {
+            if (!this.outputDirectory.exists())
+                this.outputDirectory.mkdirs();
+    
+            String fileName = this.outputDirectory.getAbsolutePath() + File.separator + goalName + ".log";
+    
+            try {
+                stream = new PrintStream(new FileOutputStream(fileName, true), true);
+            }
+            catch (FileNotFoundException e) {
+                //e.printStackTrace();
+                getLog().warn(e.toString());
+                getLog().warn("No logs will be available");
+            }
+        }
+        return stream;
+    }
+
+    public void logResults(PrintStream resultStream, String goalName, String result) {
+        if (resultStream != null)
+            getResultsStream().println(goalName + ":" + result);
+    }
+
+    /**
+     * Method is used to point to the log location for more errors.
+     */
+    protected void seeLog() {
+        if (this.outputDirectory != null)
+            getLog().error("See log at " + getOutputDirectory().getAbsolutePath() + " for more details");
+    }
+
+    public void debug(String debugString) {
+        System.out.println(debugString);
+    }
+
+    /**
+     * @param e
+     * @param logStream
+     * @throws MojoExecutionException
+     * @throws MojoFailureException
+     */
+    protected void handleError(Exception e, PrintStream logStream) throws MojoExecutionException {
+        seeLog();
+        e.printStackTrace(logStream);
+        logStream.println(lineSep);
+        if (isFailOnError()) {            
+            throw (MojoExecutionException) new MojoExecutionException(e.toString(), e);
+        }
+        else {            
+             try {
+                throw (MojoFailureException) new MojoFailureException(e, e.toString(), e.getMessage());
+            }
+            catch (MojoFailureException e1) {
+                e1.printStackTrace(logStream);
+                logStream.println(lineSep);
+            }            
+        }        
+    }
+    
+    
+}

Propchange: geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/AbstractModuleMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/AbstractModuleMojo.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/AbstractModuleMojo.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/DistributeModuleMojo.java
URL: http://svn.apache.org/viewcvs/geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/DistributeModuleMojo.java?rev=384746&view=auto
==============================================================================
--- geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/DistributeModuleMojo.java (added)
+++ geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/DistributeModuleMojo.java Fri Mar 10 01:57:45 2006
@@ -0,0 +1,89 @@
+/**
+ *
+ * Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.plugins.deployment;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.net.MalformedURLException;
+
+import javax.enterprise.deploy.spi.DeploymentManager;
+import javax.enterprise.deploy.spi.Target;
+import javax.enterprise.deploy.spi.status.ProgressObject;
+
+import org.apache.geronimo.plugins.util.DeploymentClient;
+import org.apache.maven.plugin.MojoExecutionException;
+
+/**
+ * @goal distribute
+ * 
+ * @version $Rev$ $Date$
+ */
+public class DistributeModuleMojo extends AbstractModuleMojo {
+
+    /**
+     * @parameter
+     */
+    private String module;
+
+    /**
+     * @parameter
+     */
+    private String plan;
+
+    private PrintStream logStream = System.out;    
+    private PrintStream resultStream;
+    
+    private final String goalName = "Deploy Module";
+
+    public void execute() throws MojoExecutionException {        
+        resultStream = getResultsStream();        
+        logStream = getLogStream(goalName);
+        
+        DeploymentManager manager;
+        try {
+            manager = getDeploymentManager();
+
+            Target[] targets = manager.getTargets();
+            File moduleFile = (this.module == null) ? null : getFile(this.module);
+            File planFile = (this.plan == null) ? null : getFile((this.plan));
+            ProgressObject progress = manager.distribute(targets, moduleFile, planFile);
+            DeploymentClient.waitFor(progress);
+        }
+        catch (Exception e) {
+            logResults(resultStream, goalName, "fail");
+            handleError(e, logStream);
+            return;
+        }
+        logResults(resultStream, goalName, "success");  
+    }
+
+    private File getFile(String location) throws MalformedURLException {
+        try {
+            File f = new File(location).getCanonicalFile();
+            if (!f.exists() || !f.canRead()) {
+                throw new MalformedURLException("Invalid location: " + location);
+            }
+            return f;
+        }
+        catch (IOException e) {
+            throw (MalformedURLException) new MalformedURLException("Invalid location: " + location).initCause(e);
+        }
+
+    }
+
+}

Propchange: geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/DistributeModuleMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/DistributeModuleMojo.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/DistributeModuleMojo.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/StartModuleMojo.java
URL: http://svn.apache.org/viewcvs/geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/StartModuleMojo.java?rev=384746&view=auto
==============================================================================
--- geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/StartModuleMojo.java (added)
+++ geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/StartModuleMojo.java Fri Mar 10 01:57:45 2006
@@ -0,0 +1,78 @@
+/**
+ *
+ * Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.plugins.deployment;
+
+import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.enterprise.deploy.spi.DeploymentManager;
+import javax.enterprise.deploy.spi.Target;
+import javax.enterprise.deploy.spi.TargetModuleID;
+import javax.enterprise.deploy.spi.status.ProgressObject;
+
+import org.apache.geronimo.plugins.util.DeploymentClient;
+import org.apache.maven.plugin.MojoExecutionException;
+
+/**
+ * @goal start
+ * 
+ * @version $Rev$ $Date$
+ */
+public class StartModuleMojo extends AbstractModuleMojo {
+
+    private PrintStream logStream = System.out;
+
+    private PrintStream resultStream;
+
+    private final String goalName = "Start Module";
+
+    public void execute() throws MojoExecutionException {
+        resultStream = getResultsStream();
+        logStream = getLogStream(goalName);
+        DeploymentManager manager;
+        try {
+            manager = getDeploymentManager();
+
+            Target[] targets = manager.getTargets();
+            TargetModuleID moduleIds[] = manager.getNonRunningModules(null, targets);
+            List toStart = new ArrayList(moduleIds.length);
+            for (int i = 0; i < moduleIds.length; i++) {
+                TargetModuleID moduleId = moduleIds[i];
+                if (this.id.equals(moduleId.getModuleID())) {
+                    toStart.add(moduleId);
+                }
+            }
+            if (toStart.size() == 0) {
+                logResults(resultStream, goalName, "fail");
+                handleError(new Exception("Module is already running or may not be deployed: " + this.id), logStream);
+                return;
+            }
+            moduleIds = (TargetModuleID[]) toStart.toArray(new TargetModuleID[toStart.size()]);
+            ProgressObject progress = manager.start(moduleIds);
+            DeploymentClient.waitFor(progress);
+        }
+        catch (Exception e) {
+            logResults(resultStream, goalName, "fail");
+            handleError(e, logStream);
+            return;
+        }
+        logResults(resultStream, goalName, "success");
+    }
+
+}

Propchange: geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/StartModuleMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/StartModuleMojo.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/StartModuleMojo.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/StartRemoteServerMojo.java
URL: http://svn.apache.org/viewcvs/geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/StartRemoteServerMojo.java?rev=384746&view=auto
==============================================================================
--- geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/StartRemoteServerMojo.java (added)
+++ geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/StartRemoteServerMojo.java Fri Mar 10 01:57:45 2006
@@ -0,0 +1,189 @@
+/**
+ *
+ * Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.plugins.deployment;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.StringTokenizer;
+
+import org.apache.geronimo.plugins.util.ServerBehavior;
+import org.apache.maven.plugin.MojoExecutionException;
+
+/**
+ * @goal startRemoteServer
+ * 
+ * @version $Rev$ $Date$
+ */
+public class StartRemoteServerMojo extends AbstractModuleMojo {
+
+    /**
+     * @parameter
+     */
+    private String geronimoTarget;
+
+    /**
+     * @parameter default-value=""
+     */
+    private String vmArgs = "";
+
+    /**
+     * @parameter
+     */
+    private String configs;
+
+    /**
+     * @parameter
+     */
+    private String debugPort;
+    
+    
+
+    private PrintStream logStream = System.out;    
+    private PrintStream resultStream;
+    
+    private final String goalName = "Start Remote Server";
+
+    public void execute() throws MojoExecutionException {        
+        resultStream = getResultsStream();        
+        logStream = getLogStream(goalName);
+        
+        try {
+            startRemoteServer();
+        }
+        catch (Exception e) {
+            logResults(resultStream, goalName, "fail");
+            handleError(e, logStream);
+            return;
+        }
+        logResults(resultStream, goalName, "success");        
+    }    
+    
+    
+
+    /**
+     * @throws MojoExecutionException
+     */
+    private void startRemoteServer() throws Exception {
+        ArrayList cmd = new ArrayList();
+        File root = new File(this.geronimoTarget);
+        File systemFile = new File(root, "bin/server.jar");
+        String s = java.io.File.separator;
+        String java = System.getProperty("java.home") + s + "bin" + s + "java";
+
+        cmd.add(java);
+
+        if (debugPort != null) {
+            cmd.add("-Xdebug");
+            cmd.add("-Xnoagent");
+            cmd.add("-Djava.compiler=NONE");
+            cmd.add("-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=" + debugPort);
+        }
+
+        for (StringTokenizer st = new StringTokenizer(this.vmArgs); st.hasMoreTokens();) {
+            cmd.add(st.nextToken());
+        }
+
+        cmd.add("-ea");
+        cmd.add("-jar");
+
+        if (systemFile.exists()) {
+            try {
+                cmd.add(systemFile.getCanonicalPath());
+            }
+            catch (IOException e) {
+            }
+        }
+        else {
+            throw new Exception(systemFile.getAbsolutePath() + " does not exist");                                 
+        }
+
+        cmd.add("--quiet");
+
+        if (this.configs != null && (this.configs).trim().length() > 0) {
+            cmd.add("--override");
+            for (StringTokenizer st = new StringTokenizer(this.configs); st.hasMoreTokens();) {
+                cmd.add(st.nextToken());
+            }
+        }
+        String[] command = (String[]) cmd.toArray(new String[0]);
+
+        Runtime runtime = Runtime.getRuntime();
+        Process server;
+        try {
+            server = runtime.exec(command);
+
+            // Pipe the processes STDOUT to ours
+            InputStream outStream = server.getInputStream();
+            Thread serverOut = new Thread(new Pipe(outStream, logStream));
+            serverOut.setDaemon(true);
+            serverOut.start();
+
+            // Pipe the processes STDERR to ours
+            InputStream errStream = server.getErrorStream();
+            Thread serverErr = new Thread(new Pipe(errStream, logStream));
+            serverErr.setDaemon(true);
+            serverErr.start();
+
+            ServerBehavior sb = new ServerBehavior(getUri(), getMaxTries(), getRetryIntervalMilliseconds());
+            sb.setLogStream(logStream);
+            if (!sb.isFullyStarted()) {
+                server.destroy();                                
+                throw new Exception("Server did not start");                
+            }
+        }
+        catch (Exception e1) {
+            throw new Exception(e1);            
+        }        
+    }
+
+
+
+    public void destroy() {
+        logStream.close();
+    }
+
+    private final class Pipe implements Runnable {
+
+        private final InputStream in;
+
+        private final OutputStream out;
+
+        public Pipe(InputStream in, OutputStream out) {
+            this.in = in;
+            this.out = out;
+        }
+
+        public void run() {
+            int i;
+            try {
+                do {
+                    i = in.read();
+                    out.write(i);
+                }
+                while (i != -1);
+            }
+            catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+    }
+}

Propchange: geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/StartRemoteServerMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/StartRemoteServerMojo.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/StartRemoteServerMojo.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/StartServerMojo.java
URL: http://svn.apache.org/viewcvs/geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/StartServerMojo.java?rev=384746&view=auto
==============================================================================
--- geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/StartServerMojo.java (added)
+++ geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/StartServerMojo.java Fri Mar 10 01:57:45 2006
@@ -0,0 +1,185 @@
+/**
+ *
+ * Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.plugins.deployment;
+
+import java.io.File;
+import java.io.ObjectInputStream;
+import java.io.PrintStream;
+import java.net.URI;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import javax.management.ObjectName;
+
+import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.KernelFactory;
+import org.apache.geronimo.kernel.config.Configuration;
+import org.apache.geronimo.kernel.config.ConfigurationManager;
+import org.apache.geronimo.kernel.config.ConfigurationUtil;
+import org.apache.geronimo.kernel.config.ManageableAttributeStore;
+import org.apache.geronimo.kernel.log.GeronimoLogging;
+import org.apache.maven.plugin.MojoExecutionException;
+
+/**
+ * @goal startServer
+ * 
+ * @version $Rev$ $Date$
+ */
+public class StartServerMojo extends AbstractModuleMojo {
+
+    static {
+        // This MUST be done before the first log is acquired
+        GeronimoLogging.initialize(GeronimoLogging.INFO);
+    }
+
+    /**
+     * @parameter
+     */
+    private String geronimoHome;
+
+    /**
+     * @parameter
+     */
+    private String kernelName;
+
+    /**
+     * @parameter
+     */
+    private String domainName;
+
+    /**
+     * @parameter
+     */
+    private String configs;
+
+    private PrintStream logStream = System.out;
+
+    private PrintStream resultStream;
+
+    private final String goalName = "Start Server";
+
+    public void execute() throws MojoExecutionException {
+        resultStream = getResultsStream();
+        logStream = getLogStream(goalName);
+
+        try {
+            startServer();
+        }
+        catch (Exception e) {
+            logResults(resultStream, goalName, "fail");
+            handleError(e, logStream);
+            return;
+        }
+        logResults(resultStream, goalName, "success");
+    }
+
+    /**
+     * @throws MojoExecutionException
+     */
+    private void startServer() throws Exception {
+        System.setProperty("org.apache.geronimo.base.dir", this.geronimoHome);
+        List configList = new ArrayList();
+        for (StringTokenizer st = new StringTokenizer(configs); st.hasMoreTokens();) {
+            try {
+                configList.add(new URI(st.nextToken()));
+            }
+            catch (Exception e) {
+                throw e;
+            }
+        }
+        File root = new File(this.geronimoHome);
+        if (!root.exists())
+            throw new Exception(root.getAbsolutePath() + " does not exist"); 
+        
+        URL systemURL = null;
+        URL configURL = null;
+        try {
+            systemURL = new File(root, "bin/server.jar").toURL();
+            configURL = new URL("jar:" + systemURL.toString() + "!/META-INF/config.ser");
+        }
+        catch (Exception e) {
+            throw e;
+        }
+        GBeanData configuration = new GBeanData();
+        ObjectInputStream ois = null;
+        try {
+            ois = new ObjectInputStream(configURL.openStream());
+            configuration.readExternal(ois);
+        }
+        catch (Exception e) {
+            throw e;
+        }
+        finally {
+            try {
+                ois.close();
+            }
+            catch (Exception e1) {
+                throw e1;
+            }
+        }
+        URI configurationId = (URI) configuration.getAttribute("id");
+        ObjectName configName = null;
+        try {
+            configName = Configuration.getConfigurationObjectName(configurationId);
+        }
+        catch (Exception e) {
+            throw e;
+        }
+        configuration.setName(configName);
+        configuration.setAttribute("baseURL", systemURL);
+
+        // build a basic kernel without a configuration-store, our configuration
+        // store is
+        Kernel kernel = KernelFactory.newInstance().createKernel(this.kernelName);
+        try {
+            kernel.boot();
+            kernel.loadGBean(configuration, this.getClass().getClassLoader());
+            kernel.startGBean(configName);
+            kernel.invoke(configName, "loadGBeans", new Object[] { null }, new String[] { ManageableAttributeStore.class.getName() });
+            kernel.invoke(configName, "startRecursiveGBeans");
+        }
+        catch (Exception e) {
+            throw e;
+        }
+        
+        // load the rest of the configuration listed on the command line
+        ConfigurationManager configurationManager = ConfigurationUtil.getConfigurationManager(kernel);
+        try {
+            for (Iterator i = configList.iterator(); i.hasNext();) {
+                URI configID = (URI) i.next();
+                List list = configurationManager.loadRecursive(configID);
+                for (Iterator iterator = list.iterator(); iterator.hasNext();) {
+                    URI name = (URI) iterator.next();
+                    configurationManager.loadGBeans(name);
+                    configurationManager.start(name);
+                    logStream.println("started gbean: " + name);
+                }
+            }
+        }
+        catch (Exception e) {
+            throw e;
+        }
+        finally {
+            ConfigurationUtil.releaseConfigurationManager(kernel, configurationManager);
+        }
+    }
+}

Propchange: geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/StartServerMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/StartServerMojo.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/StartServerMojo.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/StopModuleMojo.java
URL: http://svn.apache.org/viewcvs/geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/StopModuleMojo.java?rev=384746&view=auto
==============================================================================
--- geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/StopModuleMojo.java (added)
+++ geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/StopModuleMojo.java Fri Mar 10 01:57:45 2006
@@ -0,0 +1,77 @@
+/**
+ *
+ * Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.plugins.deployment;
+
+import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.enterprise.deploy.spi.DeploymentManager;
+import javax.enterprise.deploy.spi.Target;
+import javax.enterprise.deploy.spi.TargetModuleID;
+import javax.enterprise.deploy.spi.status.ProgressObject;
+
+import org.apache.geronimo.plugins.util.DeploymentClient;
+import org.apache.maven.plugin.MojoExecutionException;
+
+/**
+ * @goal stop
+ * 
+ * @version $Rev$ $Date$
+ */
+public class StopModuleMojo extends AbstractModuleMojo {
+
+    private PrintStream logStream = System.out;
+
+    private PrintStream resultStream;
+
+    private final String goalName = "Stop Module";
+
+    public void execute() throws MojoExecutionException {
+        resultStream = getResultsStream();
+        logStream = getLogStream(goalName);
+        DeploymentManager manager;
+        try {
+            manager = getDeploymentManager();
+        
+        Target[] targets = manager.getTargets();
+        TargetModuleID moduleIds[] = manager.getRunningModules(null, targets);
+        List toStop = new ArrayList(moduleIds.length);
+        for (int i = 0; i < moduleIds.length; i++) {
+            TargetModuleID moduleId = moduleIds[i];
+            if (this.id.equals(moduleId.getModuleID())) {
+                toStop.add(moduleId);
+            }
+        }
+        if (toStop.size() == 0) {            
+            logResults(resultStream, goalName, "fail");
+            handleError(new Exception("Module is not deployed: " + this.id), logStream);            
+            return;
+        }
+        moduleIds = (TargetModuleID[]) toStop.toArray(new TargetModuleID[toStop.size()]);
+        ProgressObject progress = manager.stop(moduleIds);
+        DeploymentClient.waitFor(progress);
+        }
+        catch (Exception e) {
+            logResults(resultStream, goalName, "fail");
+            handleError(e, logStream);
+            return;
+        }
+        logResults(resultStream, goalName, "success");
+    }
+
+}

Propchange: geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/StopModuleMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/StopModuleMojo.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/StopModuleMojo.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/StopRemoteServerMojo.java
URL: http://svn.apache.org/viewcvs/geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/StopRemoteServerMojo.java?rev=384746&view=auto
==============================================================================
--- geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/StopRemoteServerMojo.java (added)
+++ geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/StopRemoteServerMojo.java Fri Mar 10 01:57:45 2006
@@ -0,0 +1,101 @@
+/**
+ *
+ * Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.plugins.deployment;
+
+import java.io.PrintStream;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.management.MBeanServerConnection;
+import javax.management.remote.JMXConnector;
+import javax.management.remote.JMXConnectorFactory;
+import javax.management.remote.JMXServiceURL;
+
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.jmx.KernelDelegate;
+import org.apache.maven.plugin.MojoExecutionException;
+
+/**
+ * @goal stopRemoteServer
+ *
+ * @version $Rev$ $Date$
+ */
+public class StopRemoteServerMojo extends AbstractModuleMojo {
+
+    
+    private MBeanServerConnection mbServerConnection;
+    private Kernel kernel;
+
+    private PrintStream logStream = System.out;
+    
+    private PrintStream resultStream;
+    
+    private final String goalName = "Stop Remote Server";
+
+    public void execute() throws MojoExecutionException {        
+        resultStream = getResultsStream();        
+        logStream = getLogStream(goalName);
+        
+        try {
+            stopRemoteServer();
+        }
+        catch (Exception e) {
+            logResults(resultStream, goalName, "fail");
+            handleError(e, logStream);
+            return;
+        }
+        logResults(resultStream, goalName, "success"); 
+    }
+
+    /**
+     * 
+     */
+    private void stopRemoteServer() throws Exception {
+        String uri = getUri();        
+        if (!uri.startsWith("jmx")) {            
+                throw new Exception("Bad JMX URI ("+uri+")");            
+        }
+
+        Map environment = new HashMap();
+        String[] credentials = new String[]{getUsername(), getPassword()};
+        environment.put(JMXConnector.CREDENTIALS, credentials);
+
+        JMXServiceURL address = null;
+        JMXConnector jmxConnector;
+        try {
+            address = new JMXServiceURL("service:" + uri);
+        }
+        catch (Exception e) {
+            throw e;            
+        }
+        ClassLoader oldcl = Thread.currentThread().getContextClassLoader();
+        try {
+            Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
+            jmxConnector = JMXConnectorFactory.connect(address, environment);
+            mbServerConnection = jmxConnector.getMBeanServerConnection();
+            kernel = new KernelDelegate(mbServerConnection);
+            kernel.shutdown();
+        }
+        catch (Exception e) {
+            throw e;            
+        } 
+        finally {
+            Thread.currentThread().setContextClassLoader(oldcl);
+        }
+    }
+
+}

Propchange: geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/StopRemoteServerMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/StopRemoteServerMojo.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/StopRemoteServerMojo.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/StopServerMojo.java
URL: http://svn.apache.org/viewcvs/geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/StopServerMojo.java?rev=384746&view=auto
==============================================================================
--- geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/StopServerMojo.java (added)
+++ geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/StopServerMojo.java Fri Mar 10 01:57:45 2006
@@ -0,0 +1,38 @@
+/**
+ *
+ * Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.plugins.deployment;
+
+import org.apache.geronimo.kernel.KernelRegistry;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+
+/**
+ * @goal stopServer
+ *
+ * @version $Rev$ $Date$
+ */
+public class StopServerMojo extends AbstractMojo {
+
+    private String kernelName;
+
+    public void execute() throws MojoExecutionException {
+        Kernel kernel = KernelRegistry.getKernel(this.kernelName);
+        kernel.shutdown();
+    }
+}

Propchange: geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/StopServerMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/StopServerMojo.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/StopServerMojo.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/UndeployModuleMojo.java
URL: http://svn.apache.org/viewcvs/geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/UndeployModuleMojo.java?rev=384746&view=auto
==============================================================================
--- geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/UndeployModuleMojo.java (added)
+++ geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/UndeployModuleMojo.java Fri Mar 10 01:57:45 2006
@@ -0,0 +1,78 @@
+/**
+ *
+ * Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.plugins.deployment;
+
+import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.enterprise.deploy.spi.DeploymentManager;
+import javax.enterprise.deploy.spi.Target;
+import javax.enterprise.deploy.spi.TargetModuleID;
+import javax.enterprise.deploy.spi.status.ProgressObject;
+
+import org.apache.geronimo.plugins.util.DeploymentClient;
+import org.apache.maven.plugin.MojoExecutionException;
+
+/**
+ * @goal undeploy
+ *
+ * @version $Rev$ $Date$
+ */
+public class UndeployModuleMojo extends AbstractModuleMojo {
+
+    private PrintStream logStream = System.out;
+
+    private PrintStream resultStream;
+
+    private final String goalName = "Undeploy Module";
+
+    public void execute() throws MojoExecutionException {
+        resultStream = getResultsStream();
+        logStream = getLogStream(goalName);
+
+        DeploymentManager manager;
+        try {
+            manager = getDeploymentManager();
+
+            Target[] targets = manager.getTargets();
+            TargetModuleID moduleIds[] = manager.getNonRunningModules(null, targets);
+            List toUndeploy = new ArrayList(moduleIds.length);
+            for (int i = 0; i < moduleIds.length; i++) {
+                TargetModuleID moduleId = moduleIds[i];
+                if (this.id.equals(moduleId.getModuleID())) {
+                    toUndeploy.add(moduleId);
+                }
+            }
+            if (toUndeploy.size() == 0) {   
+                logResults(resultStream, goalName, "fail");
+                handleError(new Exception("Module is running or not deployed: " + this.id), logStream);
+                return;
+            }
+            moduleIds = (TargetModuleID[]) toUndeploy.toArray(new TargetModuleID[toUndeploy.size()]);
+            ProgressObject progress = manager.undeploy(moduleIds);
+            DeploymentClient.waitFor(progress);
+        }
+        catch (Exception e) {
+            logResults(resultStream, goalName, "fail");
+            handleError(e, logStream);
+            return;
+        }
+        logResults(resultStream, goalName, "success");
+    }
+
+}

Propchange: geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/UndeployModuleMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/UndeployModuleMojo.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/UndeployModuleMojo.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/UnpackServerMojo.java
URL: http://svn.apache.org/viewcvs/geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/UnpackServerMojo.java?rev=384746&view=auto
==============================================================================
--- geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/UnpackServerMojo.java (added)
+++ geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/UnpackServerMojo.java Fri Mar 10 01:57:45 2006
@@ -0,0 +1,95 @@
+/**
+ *
+ * Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.plugins.deployment;
+
+import org.apache.geronimo.kernel.log.GeronimoLogging;
+import org.apache.geronimo.plugins.util.VelocityFilter;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+
+/**
+ * @goal unpackServer
+ *
+ * @version $Rev$ $Date$
+ */
+public class UnpackServerMojo extends AbstractMojo {
+
+    static {
+        // This MUST be done before the first log is acquired
+        GeronimoLogging.initialize(GeronimoLogging.INFO);
+    }
+
+    /**
+     * @parameter
+     *
+     */
+    private String geronimoVersion;
+    
+    /**
+     * @parameter expression=${geronimoGroupId} default-value="geronimo"
+     */
+    private String geronimoGroupId;
+    
+    /**
+     * @parameter expression=${geronimoArtifactId} default-value="geronimo"
+     */
+    private String geronimoArtifactId;
+    
+    /**
+     * @parameter expression="${project.build.directory}/${geronimoGroupId}-${geronimoVersion}"
+     */
+    private String targetDir;
+    
+    /**
+     * @parameter expression="${geronimo.deploy.var.source}" default-value=null
+     */
+    private String varDir;
+
+    /**
+     * @parameter context
+     */
+    private String context;
+    
+    /**
+     * @parameter expression="${geronimoVersion}"
+     */
+    private String junk;
+
+    
+    public void execute() throws MojoExecutionException {
+        
+        System.out.println("targetDir is " + targetDir);
+        System.out.println("local repo is " + junk);
+        
+        if (varDir != null) {
+            //TODO: prepend $baseDir to $varDir
+            //TODO: copy all files from $varDir to $targetDir
+                        
+            try {
+                VelocityFilter velocityFilter = new VelocityFilter(varDir, targetDir, context, true);
+                velocityFilter.execute();
+                }
+                catch (Exception e) {
+//                  e.printStackTrace();
+                    throw (MojoExecutionException) new MojoExecutionException(e.toString(), e);  
+                }
+        }                       
+    }
+    
+    
+}

Propchange: geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/UnpackServerMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/UnpackServerMojo.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/UnpackServerMojo.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/VelocityFilterMojo.java
URL: http://svn.apache.org/viewcvs/geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/VelocityFilterMojo.java?rev=384746&view=auto
==============================================================================
--- geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/VelocityFilterMojo.java (added)
+++ geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/VelocityFilterMojo.java Fri Mar 10 01:57:45 2006
@@ -0,0 +1,67 @@
+/**
+ *
+ * Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.plugins.deployment;
+
+import org.apache.geronimo.plugins.util.VelocityFilter;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+
+
+/**
+ * @goal velocityFilter
+ * 
+ * @version $Revision$ $Date$
+ */
+public class VelocityFilterMojo extends AbstractMojo {
+    /**
+     * @parameter
+     * @required
+     */
+    private String sourceDir;
+    
+    /**
+     * @parameter
+     * @required
+     */
+    private String targetDir;
+  
+    /**
+     * @parameter
+     * @required
+     */
+    private String context;
+    
+    /**
+     * @parameter
+     */
+    private boolean force;
+    
+    
+    public void execute() throws MojoExecutionException {
+        try {
+        VelocityFilter velocityFilter = new VelocityFilter(sourceDir, targetDir, context, force);
+        velocityFilter.execute();
+        }
+        catch (Exception e) {
+//          e.printStackTrace();
+            throw (MojoExecutionException) new MojoExecutionException(e.toString(), e);  
+        }
+    }
+
+ 
+}

Propchange: geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/VelocityFilterMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/VelocityFilterMojo.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/deployment/VelocityFilterMojo.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/util/DeploymentClient.java
URL: http://svn.apache.org/viewcvs/geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/util/DeploymentClient.java?rev=384746&view=auto
==============================================================================
--- geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/util/DeploymentClient.java (added)
+++ geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/util/DeploymentClient.java Fri Mar 10 01:57:45 2006
@@ -0,0 +1,103 @@
+/**
+ *
+ * Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.plugins.util;
+
+import java.io.IOException;
+import java.net.JarURLConnection;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.StringTokenizer;
+import java.util.jar.Attributes;
+import javax.enterprise.deploy.shared.factories.DeploymentFactoryManager;
+import javax.enterprise.deploy.spi.factories.DeploymentFactory;
+import javax.enterprise.deploy.spi.status.ProgressObject;
+import javax.enterprise.deploy.spi.status.ProgressListener;
+import javax.enterprise.deploy.spi.status.ProgressEvent;
+import javax.enterprise.deploy.spi.status.DeploymentStatus;
+
+/*
+ * @version $Rev$ $Date$
+ */
+public class DeploymentClient {
+    private static final DeploymentFactoryManager FACTORY_MANAGER = DeploymentFactoryManager.getInstance();
+
+    private URL provider;
+
+    public URL getProvider() {
+        return provider;
+    }
+
+    public void setProvider(URL provider) {
+        this.provider = provider;
+    }
+
+    public void doIt() throws IOException {
+        registerProvider(provider, null);
+    }
+
+    public static void registerProvider(URL provider, ClassLoader parent) throws IOException {
+        if (parent == null) {
+            parent = Thread.currentThread().getContextClassLoader();
+        }
+        if (parent == null) {
+            parent = DeploymentClient.class.getClassLoader();
+        }
+
+        // read manifest entry from provider
+        URL url = new URL("jar:" + provider.toString() + "!/");
+        JarURLConnection jarConnection = (JarURLConnection) url.openConnection();
+        Attributes attrs = jarConnection.getMainAttributes();
+        String factoryNames = attrs.getValue("J2EE-DeploymentFactory-Implementation-Class");
+        if (factoryNames == null) {
+            throw new IOException("No DeploymentFactory found in jar");
+        }
+
+        // register listed DeploymentFactories
+        ClassLoader cl = new URLClassLoader(new URL[]{provider}, parent);
+        for (StringTokenizer tokenizer = new StringTokenizer(factoryNames); tokenizer.hasMoreTokens();) {
+            String className = tokenizer.nextToken();
+            try {
+                DeploymentFactory factory = (DeploymentFactory) cl.loadClass(className).newInstance();
+                FACTORY_MANAGER.registerDeploymentFactory(factory);
+            } catch (Exception e) {
+                throw (IOException) new IOException("Unable to instantiate DeploymentFactory: " + className).initCause(e);
+            }
+        }
+    }
+
+    public static void waitFor(final ProgressObject progress) throws InterruptedException {
+        ProgressListener listener = new ProgressListener() {
+            public void handleProgressEvent(ProgressEvent event) {
+                DeploymentStatus status = event.getDeploymentStatus();
+                if (status.getMessage() != null) {
+                    System.out.println(status.getMessage());
+                }
+                if (!status.isRunning()) {
+                    synchronized (progress) {
+                        progress.notify();
+                    }
+                }
+            }
+        };
+        progress.addProgressListener(listener);
+        synchronized (progress) {
+            while (progress.getDeploymentStatus().isRunning()) {
+                progress.wait();
+            }
+        }
+    }
+}

Propchange: geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/util/DeploymentClient.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/util/DeploymentClient.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/util/DeploymentClient.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/util/ServerBehavior.java
URL: http://svn.apache.org/viewcvs/geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/util/ServerBehavior.java?rev=384746&view=auto
==============================================================================
--- geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/util/ServerBehavior.java (added)
+++ geronimo/sandbox/geronimo-deployment-plugin/src/main/java/org/apache/geronimo/plugins/util/ServerBehavior.java Fri Mar 10 01:57:45 2006
@@ -0,0 +1,183 @@
+/**
+ *
+ * Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.plugins.util;
+
+import java.io.PrintStream;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+import javax.management.remote.JMXConnector;
+import javax.management.remote.JMXConnectorFactory;
+import javax.management.remote.JMXServiceURL;
+
+import org.apache.geronimo.gbean.GBeanQuery;
+import org.apache.geronimo.kernel.GBeanNotFoundException;
+import org.apache.geronimo.kernel.InternalKernelException;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.NoSuchAttributeException;
+import org.apache.geronimo.kernel.config.PersistentConfigurationList;
+import org.apache.geronimo.kernel.jmx.KernelDelegate;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ServerBehavior {
+
+    private int maxTries = 100;
+
+    private int retryIntervalMilliseconds = 1000;
+
+    private String uri = "jmx:rmi://localhost/jndi/rmi:/JMXConnector";
+
+    private String username = "system";
+
+    private String password = "manager";
+
+    private PrintStream logStream = System.out;
+
+    protected final String lineSep = "===========================================";
+
+    /**
+     * @param id
+     *            specify null for default
+     * @param maxTries
+     *            specify -1 for default. default-value=40
+     * @param retryIntervalMilliseconds
+     *            specify -1 for default. default-value=1000
+     */
+    public ServerBehavior(String uri, int maxTries, int retryIntervalMilliseconds) {
+        if (uri != null)
+            this.uri = uri;
+        if (maxTries > -1)
+            this.maxTries = maxTries;
+        if (retryIntervalMilliseconds > -1)
+            this.retryIntervalMilliseconds = retryIntervalMilliseconds;
+    }
+
+    /**
+     *  
+     */
+    public ServerBehavior(String uri) {
+        this(uri, -1, -1);
+    }
+
+    /**
+     *  
+     */
+    public ServerBehavior() {
+        this(null, -1, -1);
+    }
+
+    public boolean isFullyStarted() {
+        Kernel kernel = null;
+
+        if (!uri.startsWith("jmx")) {
+            logStream.println("Bad JMX URI (" + uri + ")");
+            logStream.println(lineSep);
+            return false;
+        }
+
+        // Get the kernel first
+        Map environment = new HashMap();
+        String[] credentials = new String[] { username, password };
+        environment.put(JMXConnector.CREDENTIALS, credentials);
+        ClassLoader oldcl = Thread.currentThread().getContextClassLoader();
+        try {
+            JMXServiceURL address = new JMXServiceURL("service:" + uri);
+            Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
+            for (int tries = maxTries; true; tries--) {
+                try {
+                    JMXConnector jmxConnector = JMXConnectorFactory.connect(address, environment);
+                    MBeanServerConnection mbServerConnection = jmxConnector.getMBeanServerConnection();
+                    kernel = new KernelDelegate(mbServerConnection);
+                    break;
+                }
+                catch (Exception e) {
+                    if (tries == 0) {
+                        e.printStackTrace(logStream);
+                        logStream.println("Could not connect");
+                        logStream.println(lineSep);
+                        return false;
+                    }
+                    Thread.sleep(retryIntervalMilliseconds);
+                }
+            }
+        }
+        catch (Exception e1) {
+            e1.printStackTrace(logStream);
+            logStream.println(lineSep);
+            return false;
+        }
+        finally {
+            Thread.currentThread().setContextClassLoader(oldcl);
+        }
+
+        // Now check to see if all configurations have started
+        Set configLists = kernel.listGBeans(new GBeanQuery(null, PersistentConfigurationList.class.getName()));
+        ObjectName on = null;
+        if (!configLists.isEmpty())
+            on = (ObjectName) configLists.toArray()[0];
+
+        for (int tries = maxTries; tries > 0; tries--) {
+            try {
+                Thread.sleep(retryIntervalMilliseconds);
+                Boolean b = (Boolean) kernel.getAttribute(on, "kernelFullyStarted");
+                //System.out.println("attempt.. " + (maxTries - tries));
+                if (b.booleanValue())
+                    return true;
+            }
+            catch (InternalKernelException e) {
+                //hasn't been loaded yet, keep trying
+            }
+            catch (GBeanNotFoundException e) {
+                //hasn't been loaded yet, keep trying
+            }
+            catch (InterruptedException e) {
+                e.printStackTrace(logStream);
+                logStream.println(lineSep);
+                return false;
+            }
+            catch (NoSuchAttributeException e) {
+                e.printStackTrace(logStream);
+                logStream.println(lineSep);
+                return false;
+            }
+            catch (Exception e) {
+                e.printStackTrace(logStream);
+                logStream.println(lineSep);
+                return false;
+            }
+        }
+        return false;
+    }  
+    
+
+    /**
+     * @param logStream
+     */
+    public void setLogStream(PrintStream logStream) {
+        if (logStream != null)
+            this.logStream = logStream;
+    }
+    
+    public void destroy() {
+        logStream.close();
+    }
+}