geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r411333 [1/5] - in /geronimo/trunk: ./ m2-plugins/ m2-plugins/geronimo-packaging-plugin/ m2-plugins/geronimo-packaging-plugin/src/ m2-plugins/geronimo-packaging-plugin/src/java/ m2-plugins/geronimo-packaging-plugin/src/java/org/ m2-plugins/...
Date Fri, 02 Jun 2006 23:36:00 GMT
Author: djencks
Date: Fri Jun  2 16:35:57 2006
New Revision: 411333

URL: http://svn.apache.org/viewvc?rev=411333&view=rev
Log:
GERONIMO-2071  m2 build for modules and m2 packaging plugin.  Tomcat tests fail.  This is from geronimo.patch dated 1/jun, bug does not include configs poms

Added:
    geronimo/trunk/m2-plugins/
    geronimo/trunk/m2-plugins/geronimo-packaging-plugin/
    geronimo/trunk/m2-plugins/geronimo-packaging-plugin/pom.xml   (with props)
    geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/
    geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/
    geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/
    geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/
    geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/
    geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/
    geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/
    geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/AbstractDistributor.java   (with props)
    geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/AbstractPackagingMojo.java   (with props)
    geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/ConfigCopier.java   (with props)
    geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/ConfigCopierMojo.java   (with props)
    geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenAttributeStore.java   (with props)
    geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenConfigStore.java   (with props)
    geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilder.java   (with props)
    geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilderShellMojo.jav
    geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilderShellMojo.java   (with props)
    geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackagingCommandLine.java   (with props)
    geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PlanProcessorMojo.java   (with props)
    geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/resources/
    geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/resources/META-INF/
    geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/resources/META-INF/plexus/
    geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/resources/META-INF/plexus/components.xml   (with props)
    geronimo/trunk/m2-plugins/pom.xml   (with props)
    geronimo/trunk/modules/axis-builder/pom.xml   (with props)
    geronimo/trunk/modules/axis/pom.xml   (with props)
    geronimo/trunk/modules/client-builder/pom.xml   (with props)
    geronimo/trunk/modules/client/pom.xml   (with props)
    geronimo/trunk/modules/common/pom.xml   (with props)
    geronimo/trunk/modules/connector-builder/pom.xml   (with props)
    geronimo/trunk/modules/connector-builder/src/test/test-setup.xml   (with props)
    geronimo/trunk/modules/connector/pom.xml   (with props)
    geronimo/trunk/modules/converter/pom.xml   (with props)
    geronimo/trunk/modules/core/pom.xml   (with props)
    geronimo/trunk/modules/deploy-config/pom.xml   (with props)
    geronimo/trunk/modules/deploy-jsr88/pom.xml   (with props)
    geronimo/trunk/modules/deploy-tool/pom.xml   (with props)
    geronimo/trunk/modules/deployment/pom.xml   (with props)
    geronimo/trunk/modules/derby/pom.xml   (with props)
    geronimo/trunk/modules/directory/pom.xml   (with props)
    geronimo/trunk/modules/hot-deploy/pom.xml   (with props)
    geronimo/trunk/modules/installer-processing/pom.xml   (with props)
    geronimo/trunk/modules/installer-support/pom.xml   (with props)
    geronimo/trunk/modules/j2ee-builder/pom.xml   (with props)
    geronimo/trunk/modules/j2ee-builder/src/test/test-setup.xml   (with props)
    geronimo/trunk/modules/j2ee-schema/pom.xml   (with props)
    geronimo/trunk/modules/j2ee/pom.xml   (with props)
    geronimo/trunk/modules/javamail-transport/pom.xml   (with props)
    geronimo/trunk/modules/jetty-builder/pom.xml   (with props)
    geronimo/trunk/modules/jetty/pom.xml   (with props)
    geronimo/trunk/modules/jmx-remoting/pom.xml   (with props)
    geronimo/trunk/modules/kernel/pom.xml   (with props)
    geronimo/trunk/modules/mail/pom.xml   (with props)
    geronimo/trunk/modules/management/pom.xml   (with props)
    geronimo/trunk/modules/naming-builder/pom.xml   (with props)
    geronimo/trunk/modules/naming/pom.xml   (with props)
    geronimo/trunk/modules/pom.xml   (with props)
    geronimo/trunk/modules/scripts/pom.xml   (with props)
    geronimo/trunk/modules/security-builder/pom.xml   (with props)
    geronimo/trunk/modules/security/pom.xml   (with props)
    geronimo/trunk/modules/service-builder/pom.xml   (with props)
    geronimo/trunk/modules/system/pom.xml   (with props)
    geronimo/trunk/modules/test-ddbean/pom.xml   (with props)
    geronimo/trunk/modules/timer/pom.xml   (with props)
    geronimo/trunk/modules/tomcat-builder/pom.xml   (with props)
    geronimo/trunk/modules/tomcat/pom.xml   (with props)
    geronimo/trunk/modules/tomcat/src/resources/META-INF/geronimo-dependency.xml   (with props)
    geronimo/trunk/modules/transaction/pom.xml   (with props)
    geronimo/trunk/modules/upgrade/pom.xml   (with props)
    geronimo/trunk/modules/util/pom.xml   (with props)
    geronimo/trunk/modules/web-builder/pom.xml   (with props)
    geronimo/trunk/modules/webservices/pom.xml   (with props)
Modified:
    geronimo/trunk/modules/activation/pom.xml
    geronimo/trunk/modules/activemq-embedded-rar/pom.xml
    geronimo/trunk/pom.xml

Added: geronimo/trunk/m2-plugins/geronimo-packaging-plugin/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/trunk/m2-plugins/geronimo-packaging-plugin/pom.xml?rev=411333&view=auto
==============================================================================
--- geronimo/trunk/m2-plugins/geronimo-packaging-plugin/pom.xml (added)
+++ geronimo/trunk/m2-plugins/geronimo-packaging-plugin/pom.xml Fri Jun  2 16:35:57 2006
@@ -0,0 +1,228 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.geronimo.plugins</groupId>
+        <artifactId>plugins-parent</artifactId>
+        <version>1.2-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>geronimo-packaging-plugin</artifactId>
+    <packaging>maven-plugin</packaging>
+    <version>${geronimoPackagingPluginVersion}</version>
+    <name>Geronimo :: Maven2 Packaging Plugin</name>
+    <url>http://geronimo.apache.org</url>
+
+    <issueManagement>
+        <system>jira</system>
+        <url>http://issues.apache.org/jira/secure/BrowseProject.jspa?id=10220</url>
+    </issueManagement>
+
+    <ciManagement>
+        <system>continuum</system>
+        <notifiers>
+            <notifier>
+                <type>mail</type>
+                <sendOnError />
+                <sendOnFailure />
+                <address>dev@geronimo.org</address>
+            </notifier>
+        </notifiers>
+    </ciManagement>
+
+    <mailingLists>
+        <mailingList>
+            <name>Geronimo User List</name>
+            <subscribe>users-subscribe@geronimo.apache.org</subscribe>
+            <unsubscribe>users-unsubscribe@geronimo.apache.org</unsubscribe>
+            <archive>http://mail-archives.apache.org/mod_mbox/geronimo-user/</archive>
+        </mailingList>
+
+        <mailingList>
+            <name>Geronimo Developer List</name>
+            <subscribe>dev-subscribe@geronimo.apache.org</subscribe>
+            <unsubscribe>dev-unsubscribe@geronimo.apache.org</unsubscribe>
+            <archive>http://mail-archives.apache.org/mod_mbox/geronimo-dev/</archive>
+        </mailingList>
+
+        <mailingList>
+            <name>Source Control List</name>
+            <subscribe>scm-subscribe@geronimo.apache.org</subscribe>
+            <unsubscribe>scm-unsubscribe@geronimo.apache.org</unsubscribe>
+            <archive>http://mail-archives.apache.org/mod_mbox/geronimo-scm/</archive>
+        </mailingList>
+    </mailingLists>
+
+    <developers>
+        <developer>
+        </developer>
+    </developers>
+
+    <contributors>
+        <contributor>
+        </contributor>
+    </contributors>
+
+    <licenses>
+        <license>
+            <name>The Apache Software License, Version 2.0</name>
+            <url>http://www.apache.org/licenses/LICENSE-2.0</url>
+            <distribution>repo</distribution>
+        </license>
+    </licenses>
+
+    <scm>
+        <connection>scm:svn:https://svn.apache.org/repos/asf/geronimo/</connection>
+        <developerConnection>scm:svn:https://${maven.username}@svn.apache.org/repos/asf/geronimo/</developerConnection>
+        <url>https://svn.apache.org/repos/asf/geronimo/</url>
+    </scm>
+
+    <organization>
+        <name>Geronimo</name>
+        <url>http://geronimo.apache.org/</url>
+    </organization>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.maven</groupId>
+            <artifactId>maven-plugin-api</artifactId>
+            <version>2.0</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.maven</groupId>
+            <artifactId>maven-project</artifactId>
+            <version>2.0</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.maven</groupId>
+            <artifactId>maven-artifact</artifactId>
+            <version>2.0</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.geronimo.modules</groupId>
+            <artifactId>geronimo-kernel</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.geronimo.modules</groupId>
+            <artifactId>geronimo-service-builder</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.geronimo.modules</groupId>
+            <artifactId>geronimo-deploy-tool</artifactId>
+            <!-- exclude transitive deps -->
+            <exclusions>
+                <exclusion>
+                    <groupId>org.apache.geronimo.modules</groupId>
+                    <artifactId>geronimo-util</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.apache.geronimo.modules</groupId>
+                    <artifactId>geronimo-deploy-jsr88</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+<!--    <dependency>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+        </dependency> -->
+        <!-- for processing velocity -->
+        <dependency>
+            <groupId>xmlbeans</groupId>
+            <artifactId>xbean</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>stax</groupId>
+            <artifactId>stax-api</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>velocity</groupId>
+            <artifactId>velocity</artifactId>
+            <version>1.4</version>
+        </dependency>
+
+        <!-- These are needed for constructing the classpath for PackageBuilder -->
+        <dependency>
+            <groupId>org.apache.geronimo.modules</groupId>
+            <artifactId>geronimo-system</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>commons-cli</groupId>
+            <artifactId>commons-cli</artifactId>
+            <version>${commonsCliVersion}</version>
+        </dependency>
+<!--
+        <dependency>
+            <groupId>mx4j</groupId>
+            <artifactId>mx4j-remote</artifactId>
+            <version>${mx4jVersion}</version>
+        </dependency> -->
+
+        <!-- test -->
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-qname_1.1_spec</artifactId>
+            <version>${geronimoSpecQnameVersion}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>xerces</groupId>
+            <artifactId>xercesImpl</artifactId>
+            <version>${xercesVersion}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>xerces</groupId>
+            <artifactId>xmlParserAPIs</artifactId>
+            <version>${xmlParserApisVersion}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>xstream</groupId>
+            <artifactId>xstream</artifactId>
+            <version>${xstreamVersion}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>xpp3</groupId>
+            <artifactId>xpp3</artifactId>
+            <version>${xpp3Version}</version>
+        </dependency> 
+    </dependencies>
+
+    <!-- bind jmxDistribute to deploy -->
+    <build>
+        <plugins>
+            <plugin>
+                <artifactId>maven-plugin-plugin</artifactId>
+
+                <configuration>
+                    <goalPrefix>car</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> -->
+</project>
+

Propchange: geronimo/trunk/m2-plugins/geronimo-packaging-plugin/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/trunk/m2-plugins/geronimo-packaging-plugin/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/trunk/m2-plugins/geronimo-packaging-plugin/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/AbstractDistributor.java
URL: http://svn.apache.org/viewvc/geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/AbstractDistributor.java?rev=411333&view=auto
==============================================================================
--- geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/AbstractDistributor.java (added)
+++ geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/AbstractDistributor.java Fri Jun  2 16:35:57 2006
@@ -0,0 +1,108 @@
+/**
+ *
+ * Copyright 2005 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.plugin.packaging;
+
+import java.io.File;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+
+/**
+ * Base class for Distributors defining common attributes.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class AbstractDistributor {
+    private String user;
+    private String password;
+    private String url;
+    private File artifact;
+    protected ObjectName storeName;
+
+    public String getUser() {
+        return user;
+    }
+
+    /**
+     * Set the username used to connect to the server.
+     *
+     * @param user the username
+     */
+    public void setUser(String user) {
+        this.user = user;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    /**
+     * Set the password used to connect to the server.
+     *
+     * @param password the password
+     */
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    public String getUrl() {
+        return url;
+    }
+
+    /**
+     * Set the URL of the server.
+     *
+     * @param url the URL of the server
+     */
+    public void setUrl(String url) {
+        this.url = url;
+    }
+
+    public File getArtifact() {
+        return artifact;
+    }
+
+    /**
+     * Set the artifact to distribute.
+     *
+     * @param artifact the artifact to distribute
+     */
+    public void setArtifact(File artifact) {
+        this.artifact = artifact;
+    }
+
+    public String getStoreName() {
+        return storeName.getCanonicalName();
+    }
+
+    /**
+     * Set the name of the ConfigurationStore in the server that the artifact
+     * should be installed in. This allows for server's that have multiple
+     * stores, although typical installation may only have one.
+     *
+     * @param storeName the name of the ConfigurationStore to distribute to
+     */
+    public void setStoreName(String storeName) {
+        try {
+            this.storeName = new ObjectName(storeName);
+        } catch (MalformedObjectNameException e) {
+            throw new IllegalArgumentException("Invalid storeName: " + storeName);
+        }
+    }
+
+    public abstract void execute() throws Exception;
+}

Propchange: geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/AbstractDistributor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/AbstractDistributor.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/AbstractDistributor.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/AbstractPackagingMojo.java
URL: http://svn.apache.org/viewvc/geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/AbstractPackagingMojo.java?rev=411333&view=auto
==============================================================================
--- geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/AbstractPackagingMojo.java (added)
+++ geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/AbstractPackagingMojo.java Fri Jun  2 16:35:57 2006
@@ -0,0 +1,36 @@
+package org.apache.geronimo.plugin.packaging;
+
+import java.io.PrintStream;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+
+public abstract class AbstractPackagingMojo extends AbstractMojo {
+	protected final String lineSep = "===========================================";
+
+	private PrintStream logStream = System.out;
+
+	private boolean failOnError = true;
+
+	public abstract void execute() throws MojoExecutionException;
+
+	protected void handleError(Exception e) throws MojoExecutionException {
+		// seeLog();
+		e.printStackTrace(logStream);
+		logStream.println(lineSep);
+		if (failOnError) {
+			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/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/AbstractPackagingMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/AbstractPackagingMojo.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/AbstractPackagingMojo.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/ConfigCopier.java
URL: http://svn.apache.org/viewvc/geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/ConfigCopier.java?rev=411333&view=auto
==============================================================================
--- geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/ConfigCopier.java (added)
+++ geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/ConfigCopier.java Fri Jun  2 16:35:57 2006
@@ -0,0 +1,130 @@
+/**
+ *
+ * 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.plugin.packaging;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.geronimo.kernel.config.ConfigurationData;
+import org.apache.geronimo.kernel.config.ConfigurationStore;
+import org.apache.geronimo.kernel.config.InvalidConfigException;
+import org.apache.geronimo.kernel.config.NoSuchConfigException;
+import org.apache.geronimo.kernel.config.ConfigurationInfo;
+import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.kernel.repository.WritableListableRepository;
+
+/**
+ * Copies all the configurations out of source config store into target config store.
+ *
+ * @version $Rev:$ $Date:$
+ */
+public class ConfigCopier {
+
+    private static final Class[] REPO_ARGS = new Class[] {File.class};
+    private static final Class[] STORE_ARGS = new Class[] {WritableListableRepository.class};
+
+
+    private String sourceRepositoryClass;
+    private String targetRepositoryClass;
+    private String sourceConfigurationStoreClass;
+    private String targetConfigurationStoreClass;
+    private File sourceRepositoryLocation;
+    private File targetRepositoryLocation;
+
+
+    public String getSourceRepositoryClass() {
+        return sourceRepositoryClass;
+    }
+
+    public void setSourceRepositoryClass(String sourceRepositoryClass) {
+        this.sourceRepositoryClass = sourceRepositoryClass;
+    }
+
+    public String getTargetRepositoryClass() {
+        return targetRepositoryClass;
+    }
+
+    public void setTargetRepositoryClass(String targetRepositoryClass) {
+        this.targetRepositoryClass = targetRepositoryClass;
+    }
+
+    public String getSourceConfigurationStoreClass() {
+        return sourceConfigurationStoreClass;
+    }
+
+    public void setSourceConfigurationStoreClass(String sourceConfigurationStoreClass) {
+        this.sourceConfigurationStoreClass = sourceConfigurationStoreClass;
+    }
+
+    public String getTargetConfigurationStoreClass() {
+        return targetConfigurationStoreClass;
+    }
+
+    public void setTargetConfigurationStoreClass(String targetConfigurationStoreClass) {
+        this.targetConfigurationStoreClass = targetConfigurationStoreClass;
+    }
+
+    public File getSourceRepositoryLocation() {
+        return sourceRepositoryLocation;
+    }
+
+    public void setSourceRepositoryLocation(File sourceRepositoryLocation) {
+        this.sourceRepositoryLocation = sourceRepositoryLocation;
+    }
+
+    public File getTargetRepositoryLocation() {
+        return targetRepositoryLocation;
+    }
+
+    public void setTargetRepositoryLocation(File targetRepositoryLocation) {
+        this.targetRepositoryLocation = targetRepositoryLocation;
+    }
+
+    public void execute() throws Exception {
+        try {
+            ClassLoader cl = this.getClass().getClassLoader();
+
+            Class sourceRepoClass = cl.loadClass(sourceRepositoryClass);
+            WritableListableRepository sourceRepository = (WritableListableRepository) sourceRepoClass.getDeclaredConstructor(REPO_ARGS).newInstance(new Object[] {sourceRepositoryLocation});
+            Class sourceConfigStoreClass = cl.loadClass(sourceConfigurationStoreClass);
+            ConfigurationStore sourceConfigStore = (ConfigurationStore) sourceConfigStoreClass.getDeclaredConstructor(STORE_ARGS).newInstance(new Object[] {sourceRepository});
+
+            Class targetRepoClass = cl.loadClass(targetRepositoryClass);
+            WritableListableRepository targetRepository = (WritableListableRepository) targetRepoClass.getDeclaredConstructor(REPO_ARGS).newInstance(new Object[] {targetRepositoryLocation});
+            Class targetConfigStoreClass = cl.loadClass(targetConfigurationStoreClass);
+            ConfigurationStore targetConfigStore = (ConfigurationStore) targetConfigStoreClass.getDeclaredConstructor(STORE_ARGS).newInstance(new Object[] {targetRepository});
+
+            List configs = sourceConfigStore.listConfigurations();
+            for (Iterator iterator = configs.iterator(); iterator.hasNext();) {
+                ConfigurationInfo configInfo = (ConfigurationInfo) iterator.next();
+                Artifact configId = configInfo.getConfigID();
+                ConfigurationData configData = sourceConfigStore.loadConfiguration(configId);
+                if (targetConfigStore.containsConfiguration(configId)) {
+                    targetConfigStore.uninstall(configId);
+                }
+                targetConfigStore.install(configData);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw e;
+        }
+    }
+}

Propchange: geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/ConfigCopier.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/ConfigCopier.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/ConfigCopier.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/ConfigCopierMojo.java
URL: http://svn.apache.org/viewvc/geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/ConfigCopierMojo.java?rev=411333&view=auto
==============================================================================
--- geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/ConfigCopierMojo.java (added)
+++ geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/ConfigCopierMojo.java Fri Jun  2 16:35:57 2006
@@ -0,0 +1,160 @@
+/**
+ *
+ * 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.plugin.packaging;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.geronimo.kernel.config.ConfigurationData;
+import org.apache.geronimo.kernel.config.ConfigurationStore;
+import org.apache.geronimo.kernel.config.InvalidConfigException;
+import org.apache.geronimo.kernel.config.NoSuchConfigException;
+import org.apache.geronimo.kernel.config.ConfigurationInfo;
+import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.kernel.repository.WritableListableRepository;
+import org.apache.maven.plugin.MojoExecutionException;
+
+/**
+ * Copies all the configurations out of source config store into target config store.
+ *
+ * @goal install
+ * @version $Rev:$ $Date:$
+ */
+public class ConfigCopierMojo extends AbstractPackagingMojo {
+
+    private static final Class[] REPO_ARGS = new Class[] {File.class};
+    private static final Class[] STORE_ARGS = new Class[] {WritableListableRepository.class};
+
+    /**
+     * @parameter expression="org.apache.geronimo.system.repository.Maven2Repository"
+     */
+    private String sourceRepositoryClass;
+    /**
+     * @parameter expression="org.apache.geronimo.system.repository.Maven2Repository"
+     */
+    private String targetRepositoryClass;
+    /**
+     * @parameter expression="org.apache.geronimo.system.configuration.RepositoryConfigurationStore"
+     */    
+    private String sourceConfigurationStoreClass;
+    /**
+     * @parameter expression="org.apache.geronimo.plugin.packaging.MavenConfigStore"
+     */    
+    private String targetConfigurationStoreClass;
+    /**
+     * @parameter expression="${project.build.directory}/repository"
+     */    
+    private File sourceRepositoryLocation;
+    /**
+     * @parameter expression="${settings.LocalRepository}"
+     */    
+    private File targetRepositoryLocation;
+
+
+/*    public String getSourceRepositoryClass() {
+        return sourceRepositoryClass;
+    }
+
+    public void setSourceRepositoryClass(String sourceRepositoryClass) {
+        this.sourceRepositoryClass = sourceRepositoryClass;
+    }
+
+    public String getTargetRepositoryClass() {
+        return targetRepositoryClass;
+    }
+
+    public void setTargetRepositoryClass(String targetRepositoryClass) {
+        this.targetRepositoryClass = targetRepositoryClass;
+    }
+
+    public String getSourceConfigurationStoreClass() {
+        return sourceConfigurationStoreClass;
+    }
+
+    public void setSourceConfigurationStoreClass(String sourceConfigurationStoreClass) {
+        this.sourceConfigurationStoreClass = sourceConfigurationStoreClass;
+    }
+
+    public String getTargetConfigurationStoreClass() {
+        return targetConfigurationStoreClass;
+    }
+
+    public void setTargetConfigurationStoreClass(String targetConfigurationStoreClass) {
+        this.targetConfigurationStoreClass = targetConfigurationStoreClass;
+    }
+
+    public File getSourceRepositoryLocation() {
+        return sourceRepositoryLocation;
+    }
+
+    public void setSourceRepositoryLocation(File sourceRepositoryLocation) {
+        this.sourceRepositoryLocation = sourceRepositoryLocation;
+    }
+
+    public File getTargetRepositoryLocation() {
+        return targetRepositoryLocation;
+    }
+
+    public void setTargetRepositoryLocation(File targetRepositoryLocation) {
+        this.targetRepositoryLocation = targetRepositoryLocation;
+    }*/
+    public void execute() throws MojoExecutionException {
+        try {
+            // copy artifact(s) to maven repository
+                System.out.println("----Begin installing config to local repository");
+                executeCopyConfig();
+                System.out.println("----Begin installing config to local repository");
+        } catch (Exception e) {
+            handleError(e);
+        }
+    }
+
+    private void executeCopyConfig() throws Exception {
+        try {
+            ClassLoader cl = this.getClass().getClassLoader();
+
+            Class sourceRepoClass = cl.loadClass(sourceRepositoryClass);
+            WritableListableRepository sourceRepository = (WritableListableRepository) sourceRepoClass.getDeclaredConstructor(REPO_ARGS).newInstance(new Object[] {sourceRepositoryLocation});
+            Class sourceConfigStoreClass = cl.loadClass(sourceConfigurationStoreClass);
+            ConfigurationStore sourceConfigStore = (ConfigurationStore) sourceConfigStoreClass.getDeclaredConstructor(STORE_ARGS).newInstance(new Object[] {sourceRepository});
+
+            Class targetRepoClass = cl.loadClass(targetRepositoryClass);
+            WritableListableRepository targetRepository = (WritableListableRepository) targetRepoClass.getDeclaredConstructor(REPO_ARGS).newInstance(new Object[] {targetRepositoryLocation});
+            Class targetConfigStoreClass = cl.loadClass(targetConfigurationStoreClass);
+            ConfigurationStore targetConfigStore = (ConfigurationStore) targetConfigStoreClass.getDeclaredConstructor(STORE_ARGS).newInstance(new Object[] {targetRepository});
+
+            List configs = sourceConfigStore.listConfigurations();
+            for (Iterator iterator = configs.iterator(); iterator.hasNext();) {
+                ConfigurationInfo configInfo = (ConfigurationInfo) iterator.next();
+                Artifact configId = configInfo.getConfigID();
+                System.out.println("*****[ConfigCopy] copying Artifact " + configId);
+                ConfigurationData configData = sourceConfigStore.loadConfiguration(configId);
+                if (targetConfigStore.containsConfiguration(configId)) {
+                    targetConfigStore.uninstall(configId);
+                }
+                targetConfigStore.install(configData);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw e;
+        }
+    }
+}

Propchange: geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/ConfigCopierMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/ConfigCopierMojo.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/ConfigCopierMojo.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenAttributeStore.java
URL: http://svn.apache.org/viewvc/geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenAttributeStore.java?rev=411333&view=auto
==============================================================================
--- geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenAttributeStore.java (added)
+++ geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenAttributeStore.java Fri Jun  2 16:35:57 2006
@@ -0,0 +1,69 @@
+/**
+ *
+ * Copyright 2005 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.plugin.packaging;
+
+import java.io.IOException;
+import java.util.Collection;
+
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.GAttributeInfo;
+import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.GReferenceInfo;
+import org.apache.geronimo.gbean.ReferencePatterns;
+import org.apache.geronimo.kernel.config.ManageableAttributeStore;
+import org.apache.geronimo.kernel.repository.Artifact;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class MavenAttributeStore implements ManageableAttributeStore {
+    public MavenAttributeStore() {
+    }
+
+    public Collection applyOverrides(Artifact configurationName, Collection datas, ClassLoader classLoader) {
+        return datas;
+    }
+
+    public void setValue(Artifact configurationName, AbstractName gbean, GAttributeInfo attribute, Object value) {
+    }
+
+    public void setReferencePatterns(Artifact configurationName, AbstractName gbean, GReferenceInfo reference, ReferencePatterns patterns) {
+    }
+
+    public void setShouldLoad(Artifact configurationName, AbstractName gbean, boolean load) {
+    }
+
+    public void addGBean(Artifact configurationName, GBeanData gbeanData) {
+    }
+
+    public void save() throws IOException {
+    }
+
+    public static final GBeanInfo GBEAN_INFO;
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+
+    static {
+        GBeanInfoBuilder builder = GBeanInfoBuilder.createStatic(MavenAttributeStore.class);
+        builder.addInterface(ManageableAttributeStore.class);
+        GBEAN_INFO = builder.getBeanInfo();
+    }
+}

Propchange: geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenAttributeStore.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenAttributeStore.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenAttributeStore.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenConfigStore.java
URL: http://svn.apache.org/viewvc/geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenConfigStore.java?rev=411333&view=auto
==============================================================================
--- geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenConfigStore.java (added)
+++ geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenConfigStore.java Fri Jun  2 16:35:57 2006
@@ -0,0 +1,103 @@
+/**
+ *
+ * Copyright 2005 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.plugin.packaging;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.kernel.config.ConfigurationData;
+import org.apache.geronimo.kernel.config.InvalidConfigException;
+import org.apache.geronimo.kernel.config.NoSuchConfigException;
+import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.kernel.repository.WritableListableRepository;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.system.configuration.ExecutableConfigurationUtil;
+import org.apache.geronimo.system.configuration.RepositoryConfigurationStore;
+
+/**
+ * Implementation of ConfigurationStore that loads Configurations from a repository.
+ * This implementation is read-only on the assumption that a separate maven task will
+ * handle installation of a built package into the repository.
+ *
+ * @version $Rev$ $Date$
+ */
+public class MavenConfigStore extends RepositoryConfigurationStore {
+    public MavenConfigStore(Kernel kernel, String objectName, WritableListableRepository repository) {
+        super(kernel, objectName, repository);
+    }
+
+    public MavenConfigStore(WritableListableRepository repository) {
+        super(repository);
+    }
+
+    public File createNewConfigurationDir(Artifact configId) {
+        try {
+            File tmpFile = File.createTempFile("package", ".tmpdir");
+            tmpFile.delete();
+            tmpFile.mkdir();
+            if (!tmpFile.isDirectory()) {
+                return null;
+            }
+            // create the meta-inf dir
+            File metaInf = new File(tmpFile, "META-INF");
+            System.out.println("********** creating file " + tmpFile);
+            metaInf.mkdirs();
+            return tmpFile;
+        } catch (IOException e) {
+            // doh why can't I throw this?
+            return null;
+        }
+    }
+
+    public void install(ConfigurationData configurationData) throws IOException, InvalidConfigException {
+        File source = configurationData.getConfigurationDir();
+        if (!source.isDirectory()) {
+            throw new InvalidConfigException("Source must be a directory: source=" + source);
+        }
+        Artifact configId = configurationData.getId();
+        File targetFile = repository.getLocation(configId);
+        System.out.println("*************** creating from " + source + " to " + targetFile);
+        ExecutableConfigurationUtil.createExecutableConfiguration(configurationData, null, targetFile);
+    }
+
+    public void uninstall(Artifact configID) throws NoSuchConfigException, IOException {
+        File targetFile = repository.getLocation(configID);
+        targetFile.delete();
+    }
+
+    public List listConfigurations() {
+        throw new UnsupportedOperationException();
+    }
+
+    public static final GBeanInfo GBEAN_INFO;
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+
+    static {
+        GBeanInfoBuilder builder = GBeanInfoBuilder.createStatic(MavenConfigStore.class, "ConfigurationStore");
+        builder.addAttribute("kernel", Kernel.class, false);
+        builder.addAttribute("objectName", String.class, false);
+        builder.addReference("Repository", WritableListableRepository.class, "Repository");
+        builder.setConstructor(new String[]{"kernel", "objectName", "Repository"});
+        GBEAN_INFO = builder.getBeanInfo();
+    }
+}

Propchange: geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenConfigStore.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenConfigStore.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenConfigStore.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilder.java?rev=411333&view=auto
==============================================================================
--- geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilder.java (added)
+++ geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilder.java Fri Jun  2 16:35:57 2006
@@ -0,0 +1,474 @@
+/**
+ *
+ * Copyright 2005 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.plugin.packaging;
+
+import java.io.File;
+import java.net.URI;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.AbstractNameQuery;
+import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.ReferencePatterns;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.KernelFactory;
+import org.apache.geronimo.kernel.KernelRegistry;
+import org.apache.geronimo.kernel.Naming;
+import org.apache.geronimo.kernel.config.ConfigurationData;
+import org.apache.geronimo.kernel.config.ConfigurationManager;
+import org.apache.geronimo.kernel.config.ConfigurationUtil;
+import org.apache.geronimo.kernel.config.KernelConfigurationManager;
+import org.apache.geronimo.kernel.log.GeronimoLogging;
+import org.apache.geronimo.kernel.management.State;
+import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.kernel.repository.DefaultArtifactManager;
+import org.apache.geronimo.system.resolver.ExplicitDefaultArtifactResolver;
+
+/**
+ * JellyBean that builds a Geronimo Configuration using the local Mavem
+ * infrastructure.
+ *
+ * @version $Rev:385659 $ $Date$
+ */
+public class PackageBuilder {
+
+    private static Log log = LogFactory.getLog(PackageBuilder.class);
+
+    private static final String KERNEL_NAME = "geronimo.maven";
+
+    /**
+     * Reference to the kernel that will last the lifetime of this classloader.
+     * The KernelRegistry keeps soft references that may be garbage collected.
+     */
+    private static Kernel kernel;
+    private static AbstractName targetConfigStoreAName;
+    private static AbstractName targetRepositoryAName;
+
+    private static final String[] ARG_TYPES = {
+            boolean.class.getName(),
+            File.class.getName(),
+            File.class.getName(),
+            File.class.getName(),
+            Boolean.TYPE.getName(),
+            String.class.getName(),
+            String.class.getName(),
+            String.class.getName(),
+            String.class.getName(),
+            String.class.getName(),
+            String.class.getName(),
+            String.class.getName(),
+            String.class.getName(),
+    };
+
+    private String repositoryClass;
+    private String configurationStoreClass;
+    private String targetRepositoryClass;
+    private String targetConfigurationStoreClass;
+
+    private File repository;
+    private File targetRepository;
+    private Collection deploymentConfigs;
+//    private Artifact[] deploymentConfig;
+    private AbstractName deployerName;
+
+    private File planFile;
+    private File moduleFile;
+    private File packageFile;
+    private String mainClass;
+    private String mainGBean;
+    private String mainMethod;
+    private String configurations;
+    private String classPath;
+    private String endorsedDirs;
+    private String extensionDirs;
+    private String explicitResolutionLocation;
+    private String logLevel;
+
+    private boolean targetSet;
+    private boolean singleArtifact = true;
+
+    public String getRepositoryClass() {
+        return repositoryClass;
+    }
+
+    public void setRepositoryClass(String repositoryClass) {
+        this.repositoryClass = repositoryClass;
+    }
+
+    public String getConfigurationStoreClass() {
+        return configurationStoreClass;
+    }
+
+    public void setConfigurationStoreClass(String configurationStoreClass) {
+        this.configurationStoreClass = configurationStoreClass;
+    }
+
+
+    public File getRepository() {
+        return repository;
+    }
+
+    /**
+     * Set the location of the Maven repository; typically ${maven.repo.local}
+     *
+     * @param repository the location of the Maven repository
+     */
+    public void setRepository(File repository) {
+        this.repository = repository;
+    }
+
+    public String getTargetRepositoryClass() {
+        return targetRepositoryClass;
+    }
+
+    public void setTargetRepositoryClass(String targetRepositoryClass) {
+        this.targetRepositoryClass = targetRepositoryClass;
+    }
+
+    public String getTargetConfigurationStoreClass() {
+        return targetConfigurationStoreClass;
+    }
+
+    public void setTargetConfigurationStoreClass(String targetConfigurationStoreClass) {
+        this.targetConfigurationStoreClass = targetConfigurationStoreClass;
+    }
+
+    public File getTargetRepository() {
+        return targetRepository;
+    }
+
+    public void setTargetRepository(File targetRepository) {
+        this.targetRepository = targetRepository;
+    }
+
+    public Collection getDeploymentConfig() {
+        return deploymentConfigs;
+    }
+
+    /**
+     * Set the id of the Configuration to use to perform the packaging.
+     *
+     * @param deploymentConfigString comma-separated list of the ids of the Configurations performing the deployment
+     */
+    public void setDeploymentConfig(Collection deploymentConfigString) {
+        this.deploymentConfigs = deploymentConfigString;
+    }
+
+    public String getDeployerName() {
+        return deployerName.toString();
+    }
+
+    /**
+     * Set the name of the GBean that is the Deployer.
+     *
+     * @param deployerName the name of the Deployer GBean
+     */
+    public void setDeployerName(String deployerName) {
+        this.deployerName = new AbstractName(URI.create(deployerName));
+    }
+
+    public File getPlanFile() {
+        return planFile;
+    }
+
+    /**
+     * Set the File that is the deployment plan.
+     *
+     * @param planFile the deployment plan
+     */
+    public void setPlanFile(File planFile) {
+        this.planFile = planFile;
+    }
+
+    public File getModuleFile() {
+        return moduleFile;
+    }
+
+    /**
+     * Set the File that is the module being deployed.
+     *
+     * @param moduleFile the module to deploy
+     */
+    public void setModuleFile(File moduleFile) {
+        this.moduleFile = moduleFile;
+    }
+
+    public File getPackageFile() {
+        return packageFile;
+    }
+
+    /**
+     * Set the File where the Configuration will be stored; normally the artifact being produced.
+     *
+     * @param packageFile the package file to produce
+     */
+    public void setPackageFile(File packageFile) {
+        this.packageFile = packageFile;
+    }
+
+    public String getMainClass() {
+        return mainClass;
+    }
+
+    /**
+     * Set the name of the class containing the main method for a executable configuration.
+     *
+     * @param mainClass
+     */
+    public void setMainClass(String mainClass) {
+        this.mainClass = mainClass;
+    }
+
+    public String getMainGBean() {
+        return mainGBean;
+    }
+
+    public void setMainGBean(String mainGBean) {
+        this.mainGBean = mainGBean;
+    }
+
+    public String getMainMethod() {
+        return mainMethod;
+    }
+
+    public void setMainMethod(String mainMethod) {
+        this.mainMethod = mainMethod;
+    }
+
+    public String getConfigurations() {
+        return configurations;
+    }
+
+    public void setConfigurations(String configurations) {
+        this.configurations = configurations;
+    }
+
+    public String getClassPath() {
+        return classPath;
+    }
+
+    public void setClassPath(String classPath) {
+        this.classPath = classPath;
+    }
+
+    public String getEndorsedDirs() {
+        return endorsedDirs;
+    }
+
+    public void setEndorsedDirs(String endorsedDirs) {
+        this.endorsedDirs = endorsedDirs;
+    }
+
+    public String getExtensionDirs() {
+        return extensionDirs;
+    }
+
+    public void setExtensionDirs(String extensionDirs) {
+        this.extensionDirs = extensionDirs;
+    }
+
+    public String getExplicitResolutionLocation() {
+        return explicitResolutionLocation;
+    }
+
+    public void setExplicitResolutionLocation(String explicitResolutionLocation) {
+        this.explicitResolutionLocation = explicitResolutionLocation;
+    }
+
+    public String getLogLevel() {
+        return logLevel;
+    }
+
+    public void setLogLevel(String logLevel) {
+        this.logLevel = logLevel;
+    }
+
+    public void execute() throws Exception {
+        System.out.println();
+        System.out.println("    Packaging configuration " + planFile);
+        System.out.println();
+        try {
+            Kernel kernel = createKernel();
+            if(!targetSet) {
+                setTargetConfigStore();
+            }
+
+            // start the Configuration we're going to use for this deployment
+            ConfigurationManager configurationManager = ConfigurationUtil.getConfigurationManager(kernel);
+            try {
+                for (Iterator iterator = deploymentConfigs.iterator(); iterator.hasNext();) {
+                    String artifactName = (String) iterator.next();
+                    Artifact configName = Artifact.create(artifactName);
+                    if (!configurationManager.isLoaded(configName)) {
+                        configurationManager.loadConfiguration(configName);
+                        configurationManager.startConfiguration(configName);
+                    }
+                }
+            } finally {
+                ConfigurationUtil.releaseConfigurationManager(kernel, configurationManager);
+            }
+
+            AbstractName deployer = locateDeployer(kernel);
+            invokeDeployer(kernel, deployer, targetConfigStoreAName.toString());
+            System.out.println("Generated package " + packageFile);
+        } catch (Exception e) {
+            log.error(e.getClass().getName() + ": " + e.getMessage(), e);
+            throw e;
+        }
+    }
+
+    private void setTargetConfigStore() throws Exception {
+        try {
+            kernel.stopGBean(targetRepositoryAName);
+            kernel.setAttribute(targetRepositoryAName, "root", targetRepository.toURI());
+            kernel.startGBean(targetRepositoryAName);
+            if(kernel.getGBeanState(targetConfigStoreAName) != State.RUNNING_INDEX) {
+                throw new IllegalStateException("After restarted repository then config store is not running");
+            }
+            targetSet = true;
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw e;
+        }
+    }
+
+    /**
+     * Create a Geronimo Kernel to contain the deployment configurations.
+     */
+    private synchronized Kernel createKernel() throws Exception {
+        // first return our cached version
+        if (kernel != null) {
+            return kernel;
+        }
+
+        // check the registry in case someone else created one
+        kernel = KernelRegistry.getKernel(KERNEL_NAME);
+        if (kernel != null) {
+            return kernel;
+        }
+
+        GeronimoLogging geronimoLogging = GeronimoLogging.getGeronimoLogging(logLevel);
+        if (geronimoLogging == null) {
+            geronimoLogging = GeronimoLogging.DEBUG;
+        }
+        GeronimoLogging.initialize(geronimoLogging);
+        // boot one ourselves
+        kernel = KernelFactory.newInstance().createKernel(KERNEL_NAME);
+        kernel.boot();
+
+        bootDeployerSystem();
+
+        return kernel;
+    }
+
+    /**
+     * Boot the in-Maven deployment system.
+     * This contains Repository and ConfigurationStore GBeans that map to
+     * the local maven installation.
+     */
+    private void bootDeployerSystem() throws Exception {
+        Artifact baseId = new Artifact("geronimo", "packaging", "fixed", "car");
+        Naming naming = kernel.getNaming();
+        ConfigurationData bootstrap = new ConfigurationData(baseId, naming);
+        ClassLoader cl = PackageBuilder.class.getClassLoader();
+        Set repoNames = new HashSet();
+
+        //Source repo
+        GBeanData repoGBean = bootstrap.addGBean("SourceRepository", GBeanInfo.getGBeanInfo(repositoryClass, cl));
+        URI repositoryURI = repository.toURI();
+        repoGBean.setAttribute("root", repositoryURI);
+        repoNames.add(repoGBean.getAbstractName());
+
+        //Target repo
+        GBeanData targetRepoGBean = bootstrap.addGBean("TargetRepository", GBeanInfo.getGBeanInfo(targetRepositoryClass, cl));
+        URI targetRepositoryURI = targetRepository.toURI();
+        targetRepoGBean.setAttribute("root", targetRepositoryURI);
+        repoNames.add(targetRepoGBean.getAbstractName());
+        targetRepositoryAName = targetRepoGBean.getAbstractName();
+
+        GBeanData artifactManagerGBean = bootstrap.addGBean("ArtifactManager", DefaultArtifactManager.GBEAN_INFO);
+
+        GBeanData artifactResolverGBean = bootstrap.addGBean("ArtifactResolver", ExplicitDefaultArtifactResolver.GBEAN_INFO);
+        artifactResolverGBean.setAttribute("versionMapLocation", explicitResolutionLocation);
+        ReferencePatterns repoPatterns = new ReferencePatterns(repoNames);
+        artifactResolverGBean.setReferencePatterns("Repositories", repoPatterns);
+        artifactResolverGBean.setReferencePattern("ArtifactManager", artifactManagerGBean.getAbstractName());
+
+        Set storeNames = new HashSet();
+        //source config store
+        GBeanInfo configStoreInfo = GBeanInfo.getGBeanInfo(configurationStoreClass, cl);
+        GBeanData storeGBean = bootstrap.addGBean("ConfigStore", configStoreInfo);
+        if (configStoreInfo.getReference("Repository") != null) {
+            storeGBean.setReferencePattern("Repository", repoGBean.getAbstractName());
+        }
+        storeNames.add(storeGBean.getAbstractName());
+
+        //target config store
+        GBeanInfo targetConfigStoreInfo = GBeanInfo.getGBeanInfo(targetConfigurationStoreClass, cl);
+        GBeanData targetStoreGBean = bootstrap.addGBean("TargetConfigStore", targetConfigStoreInfo);
+        if (targetConfigStoreInfo.getReference("Repository") != null) {
+            targetStoreGBean.setReferencePattern("Repository", targetRepoGBean.getAbstractName());
+        }
+        storeNames.add(targetStoreGBean.getAbstractName());
+
+        targetConfigStoreAName = targetStoreGBean.getAbstractName();
+        targetSet = true;
+
+        GBeanData attrManagerGBean = bootstrap.addGBean("AttributeStore", MavenAttributeStore.GBEAN_INFO);
+
+        GBeanData configManagerGBean = bootstrap.addGBean("ConfigManager", KernelConfigurationManager.GBEAN_INFO);
+        configManagerGBean.setReferencePatterns("Stores", new ReferencePatterns(storeNames));
+        configManagerGBean.setReferencePattern("AttributeStore", attrManagerGBean.getAbstractName());
+        configManagerGBean.setReferencePattern("ArtifactManager", artifactManagerGBean.getAbstractName());
+        configManagerGBean.setReferencePattern("ArtifactResolver", artifactResolverGBean.getAbstractName());
+        configManagerGBean.setReferencePatterns("Repositories", repoPatterns);
+        ConfigurationUtil.loadBootstrapConfiguration(kernel, bootstrap, cl);
+
+    }
+
+    /**
+     * Locate a Deployer GBean matching the deployerName pattern.
+     *
+     * @param kernel the kernel to search.
+     * @return the ObjectName of the Deployer GBean
+     * @throws IllegalStateException if there is not exactly one GBean matching the deployerName pattern
+     */
+    private AbstractName locateDeployer(Kernel kernel) {
+        Iterator i = kernel.listGBeans(new AbstractNameQuery(deployerName)).iterator();
+        if (!i.hasNext()) {
+            throw new IllegalStateException("No deployer found matching deployerName: " + deployerName);
+        }
+        AbstractName deployer = (AbstractName) i.next();
+        if (i.hasNext()) {
+            throw new IllegalStateException("Multiple deployers found matching deployerName: " + deployerName);
+        }
+        return deployer;
+    }
+
+    private List invokeDeployer(Kernel kernel, AbstractName deployer, String targetConfigStore) throws Exception {
+        boolean isExecutable = mainClass != null;
+        Object[] args = {Boolean.FALSE, planFile, moduleFile, singleArtifact ? packageFile : null, Boolean.valueOf(!isExecutable), mainClass, mainGBean, mainMethod, configurations, classPath, endorsedDirs, extensionDirs, targetConfigStore};
+        return (List) kernel.invoke(deployer, "deploy", args, ARG_TYPES);
+    }
+}

Propchange: geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilder.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilder.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilderShellMojo.jav
URL: http://svn.apache.org/viewvc/geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilderShellMojo.jav?rev=411333&view=auto
==============================================================================
--- geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilderShellMojo.jav (added)
+++ geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilderShellMojo.jav Fri Jun  2 16:35:57 2006
@@ -0,0 +1,300 @@
+/**
+ *
+ * Copyright 2005 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.plugin.packaging;
+
+import java.io.File;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.deployment.PluginBootstrap;
+import org.apache.geronimo.system.configuration.RepositoryConfigurationStore;
+import org.apache.geronimo.system.repository.Maven2Repository;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
+
+
+/**
+ * Build a Geronimo Configuration using the local Maven infrastructure.
+ * 
+ * @goal package
+ * @phase package
+ * @version $Rev$ $Date$
+ */
+
+public class PackageBuilderShellMojo extends AbstractPackagingMojo {
+	private static Log log = LogFactory.getLog(PlanProcessorMojo.class);
+	private List artifacts;
+
+	private static ClassLoader classLoader;
+
+	/**
+	 * @parameter expression="${project}"
+	 */
+	private MavenProject project;
+
+	/**
+	 * @parameter expression="${plugin.artifacts}"
+	 */
+	private List pluginArtifacts;
+
+	/**
+	 * @parameter expression="${settings.localRepository}"
+	 */
+	private File repository;
+	/**
+	 * @parameter expression="${project.build.directory}/repository"
+	 */
+	private File targetRepository;
+
+	/**
+	 * @parameter expression="org.apache.geronimo.configs/geronimo-gbean-deployer/${geronimoVersion}/car"
+	 */
+	private String deploymentConfig;
+	private Collection deploymentConfigList;
+
+	/**
+	 * @parameter expression="org.apache.geronimo.configs/geronimo-gbean-deployer/${geronimoVersion}/car?j2eeType=Deployer,name=Deployer"
+	 */
+	private String deployerName;
+
+	/**
+	 * @parameter expression="${project.build.directory}/plan/plan.xml"
+	 */
+	private File planFile;
+
+	/**
+	 * @parameter
+	 */
+	private File moduleFile;
+
+	/**
+	 * @parameter expression="${project.build.directory}/${project.artifactId}-${project.version}.car"
+	 */
+	private File packageFile;
+	/**
+	 * @parameter expression="${project.build.directory}"
+	 */
+	private File buildDir;
+	/**
+	 * @parameter
+	 */
+	private String mainClass;
+
+	/**
+	 * @parameter
+	 */
+	private String classPath;
+
+	/**
+	 * @parameter expression="lib/endorsed"
+	 */
+	private String endorsedDirs;
+
+	/**
+	 * @parameter expression="lib/ext"
+	 */
+	private String extensionDirs;
+    /**
+     * @parameter expression="${basedir}/../../etc/explicit_versions.properties"
+     */ 
+    private String explicitResolutionLocation;
+    /**
+     * @parameter expression="WARN"
+     */
+    private String logLevel;
+
+	//private static final String PACKAGING_CLASSPATH_PROPERTY = "packaging.classpath";
+	
+	/**
+	 * @parameter
+	 */
+	private boolean boot = false;
+	
+
+	public void execute() throws MojoExecutionException {
+		try {
+			// create target/repository, delete old contents 
+            targetRepository.delete();
+			targetRepository.mkdir();
+			if (boot)
+				executeBootShell();
+			else
+				executePackageBuilderShell();
+		} catch (Exception e) {
+			handleError(e);
+		}
+		// copy configuration from target/repository to maven repo
+		project.getArtifact().setFile(packageFile);
+	}
+
+	public void executeBootShell() throws Exception {
+		PluginBootstrap boot = new PluginBootstrap();
+		boot.setBuildDir(buildDir);
+		boot.setCarFile(packageFile);
+		boot.setLocalRepo(repository);
+		boot.setPlan(planFile);
+		System.out.println("******build dir = " + buildDir);
+		System.out.println("******car file = " + packageFile);
+		System.out.println("******repo = " + repository);
+		System.out.println("******plan file = " + planFile);
+		boot.bootstrap();
+	}
+	public void setDeploymentConfigList(String deploymentConfigs) {
+		Collection values = new ArrayList();
+		String[] configList = deploymentConfigs.split(",");
+		for (int i = 0; i < configList.length; i++) {
+			values.add(configList[i]);
+		}
+/*
+	      this.artifacts = artifacts; for (Iterator iterator = artifacts.iterator();
+		  iterator.hasNext();) { Artifact artifact = (Artifact) iterator.next();
+		  //Dependency dependency = artifact.getDependency(); //if
+		  (dependency.getProperty(PACKAGING_CONFIG_PROPERTY) != null) { if
+		  ("car".equals(artifact.getType()) && "provided".equals(artifact.getScope())) {
+		  //String orderString = dependency.getProperty(PACKAGING_CONFIG_PROPERTY);
+		  String orderString = getOrderString(artifact); try { Integer order =
+		  Integer.decode(orderString); String artifactString = artifact.getGroupId() +
+		  "/" + artifact.getArtifactId() + "/" + dependency.getVersion() + "/" +
+		  dependency.getType(); tree.put(order, artifactString); }
+		  catch(NumberFormatException e) { System.out.println("Could not interpret
+		  order for " + dependency); } } }
+ */
+
+        deploymentConfigList = values;
+    }
+	
+	public void executePackageBuilderShell() throws Exception {
+		try {
+			setDeploymentConfigList(deploymentConfig);			
+			Object packageBuilder = getPackageBuilder();
+			//set("setClassPath", classPath, String.class, packageBuilder);
+			set("setDeployerName", deployerName, String.class, packageBuilder);
+			set("setDeploymentConfig", deploymentConfigList, Collection.class,
+					packageBuilder);
+			set("setEndorsedDirs", endorsedDirs, String.class, packageBuilder);
+			set("setExtensionDirs", extensionDirs, String.class, packageBuilder);
+			set("setMainClass", mainClass, String.class, packageBuilder);
+			set("setModuleFile", moduleFile, File.class, packageBuilder);
+			set("setPackageFile", packageFile, File.class, packageBuilder);
+			set("setPlanFile", planFile, File.class, packageBuilder);
+			set("setRepository", repository, File.class, packageBuilder);
+			set("setRepositoryClass", Maven2Repository.class.getName(), //was maven1
+					String.class, packageBuilder);
+			set("setConfigurationStoreClass", MavenConfigStore.class.getName(),
+					String.class, packageBuilder);
+			set("setTargetRepository", targetRepository, File.class,
+					packageBuilder);
+			set("setTargetRepositoryClass", Maven2Repository.class.getName(),
+					String.class, packageBuilder);
+			set("setTargetConfigurationStoreClass",
+					RepositoryConfigurationStore.class.getName(), String.class,
+					packageBuilder);
+			set("setExplicitResolutionLocation", explicitResolutionLocation,
+					String.class, packageBuilder);
+            set("setLogLevel", logLevel, String.class, packageBuilder);
+
+			Method m = packageBuilder.getClass().getMethod("execute",
+					new Class[] {});
+			m.invoke(packageBuilder, new Object[] {});
+		} catch (Exception e) {
+			log.error(e.getClass().getName() + ": " + e.getMessage(), e);
+			throw e;
+		}
+	}
+
+	private void set(String methodName, Object value, Class type,
+			Object packageBuilder) throws NoSuchMethodException,
+			IllegalAccessException, InvocationTargetException {
+		Method m = packageBuilder.getClass().getMethod(methodName,
+				new Class[] { type });
+		System.out.println("-----------" + value);
+		m.invoke(packageBuilder, new Object[] { value });
+	}
+
+	private Object getPackageBuilder() throws ClassNotFoundException,
+			IllegalAccessException, InstantiationException,
+			MalformedURLException {
+		System.out.println("plugin artifacts = " + pluginArtifacts);
+/*		if (classLoader == null) {
+			List urls = new ArrayList();
+			for (Iterator iterator = pluginArtifacts.iterator(); iterator
+					.hasNext();) {
+				Artifact artifact = (Artifact) iterator.next();
+				String groupId = artifact.getGroupId();
+				// Figure out a better way to do this
+				if ("junit".equals(groupId) || "velocity".equals(groupId) ||
+						"xmlbeans".equals(groupId) || "stax".equals(groupId) ||
+						"org.apache.maven".equals(groupId)) continue;
+				String artifactId = artifact.getArtifactId(); 
+				if ("org.apache.geronimo.modules".equals(groupId) && 
+						("geronimo-common".equals(artifactId) || 
+								"geronimo-service-builder".equals(artifactId))) continue;
+				urls.add(getUrl(artifact));					
+				}
+			boolean found = false;
+			Set pluginArtifacts = project.getPluginArtifacts();
+			for (Iterator iterator = pluginArtifacts.iterator(); iterator
+					.hasNext();) {
+				Artifact artifact = (Artifact) iterator.next();
+				if ("org.apache.geronimo.plugins".equals(artifact.getGroupId())
+						&& "geronimo-packaging-plugin".equals(artifact
+								.getArtifactId())) {
+					urls.add(getUrl(artifact));
+					found = true;
+				}
+			}
+			if (!found) {
+				System.err
+						.println("You must include the geronimo packaging plugin as a dependency in your project.xml");
+				throw new RuntimeException(
+						"You must include the geronimo packaging plugin as a dependency in your project.xml");
+			}
+			System.out.println("------urls----" + urls);
+			URL[] builderClassPath = (URL[]) urls.toArray(new URL[urls.size()]);
+			classLoader = new URLClassLoader(builderClassPath, ClassLoader
+					.getSystemClassLoader());
+		}
+		return classLoader.loadClass(PackageBuilder.class.getName())
+				.newInstance(); */
+		return new PackageBuilder();
+		}
+
+	private URL getUrl(Artifact artifact) {
+		String path = "/" + artifact.getGroupId().replace('.', '/') + "/"
+				+ artifact.getArtifactId() + "/" + artifact.getVersion() + "/"
+				+ artifact.getArtifactId() + "-" + artifact.getVersion() + ".jar";
+		URL url = null;
+		try {
+		url = new File(repository + path).toURL();
+		} catch (Exception e) {
+			//
+		}
+		System.out.println("**** adding = " + url);
+		return url;
+	}	
+	}

Added: geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilderShellMojo.java
URL: http://svn.apache.org/viewvc/geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilderShellMojo.java?rev=411333&view=auto
==============================================================================
--- geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilderShellMojo.java (added)
+++ geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilderShellMojo.java Fri Jun  2 16:35:57 2006
@@ -0,0 +1,260 @@
+/**
+ *
+ * Copyright 2005 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.plugin.packaging;
+
+import java.io.File;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.deployment.PluginBootstrap;
+import org.apache.geronimo.system.configuration.RepositoryConfigurationStore;
+import org.apache.geronimo.system.repository.Maven2Repository;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
+
+
+/**
+ * Build a Geronimo Configuration using the local Maven infrastructure.
+ * 
+ * @goal package
+ * @phase package
+ * @version $Rev$ $Date$
+ */
+
+public class PackageBuilderShellMojo extends AbstractPackagingMojo {
+	private static Log log = LogFactory.getLog(PlanProcessorMojo.class);
+	private List artifacts;
+
+	private static ClassLoader classLoader;
+
+	/**
+	 * @parameter expression="${project}"
+	 */
+	private MavenProject project;
+
+	/**
+	 * @parameter expression="${plugin.artifacts}"
+	 */
+	private List pluginArtifacts;
+
+	/**
+	 * @parameter expression="${settings.localRepository}"
+	 */
+	private File repository;
+	/**
+	 * @parameter expression="${project.build.directory}/repository"
+	 */
+	private File targetRepository;
+
+	/**
+	 * @parameter expression="org.apache.geronimo.configs/geronimo-gbean-deployer/${geronimoVersion}/car"
+	 */
+	private String deploymentConfig;
+	private Collection deploymentConfigList;
+
+	/**
+	 * @parameter expression="org.apache.geronimo.configs/geronimo-gbean-deployer/${geronimoVersion}/car?j2eeType=Deployer,name=Deployer"
+	 */
+	private String deployerName;
+
+	/**
+	 * @parameter expression="${project.build.directory}/plan/plan.xml"
+	 */
+	private File planFile;
+
+	/**
+	 * @parameter
+	 */
+	private File moduleFile;
+
+	/**
+	 * @parameter expression="${project.build.directory}/${project.artifactId}-${project.version}.car"
+	 */
+	private File packageFile;
+	/**
+	 * @parameter expression="${project.build.directory}"
+	 */
+	private File buildDir;
+	/**
+	 * @parameter
+	 */
+	private String mainClass;
+    /**
+     * @parameter
+     */
+    private String mainMethod;
+    /**
+     * @parameter
+     */
+    private String mainGBean;
+    /**
+     * @parameter
+     */
+    private String configurations;
+
+	/**
+	 * @parameter
+	 */
+	private String classPath;
+
+	/**
+	 * @parameter expression="lib/endorsed"
+	 */
+	private String endorsedDirs;
+
+	/**
+	 * @parameter expression="lib/ext"
+	 */
+	private String extensionDirs;
+    /**
+     * @parameter expression="${basedir}/../../etc/explicit_versions.properties"
+     */ 
+    private String explicitResolutionLocation;
+    /**
+     * @parameter expression="WARN"
+     */
+    private String logLevel;
+
+	//private static final String PACKAGING_CLASSPATH_PROPERTY = "packaging.classpath";
+	
+	/**
+	 * @parameter
+	 */
+	private boolean boot = false;
+	
+
+	public void execute() throws MojoExecutionException {
+		try {
+			// create target/repository, delete old contents 
+            //targetRepository.delete();
+			targetRepository.mkdir();
+			if (boot)
+				executeBootShell();
+			else
+				executePackageBuilderShell();
+		} catch (Exception e) {
+			handleError(e);
+		}
+		// copy configuration from target/repository to maven repo
+		project.getArtifact().setFile(packageFile);
+	}
+
+	public void executeBootShell() throws Exception {
+		PluginBootstrap boot = new PluginBootstrap();
+		boot.setBuildDir(buildDir);
+		boot.setCarFile(packageFile);
+		boot.setLocalRepo(repository);
+		boot.setPlan(planFile);
+		System.out.println("******build dir = " + buildDir);
+		System.out.println("******car file = " + packageFile);
+		System.out.println("******repo = " + repository);
+		System.out.println("******plan file = " + planFile);
+		boot.bootstrap();
+	}
+	public void setDeploymentConfigList(String deploymentConfigs) {
+		Collection values = new ArrayList();
+		String[] configList = deploymentConfigs.split(",");
+		for (int i = 0; i < configList.length; i++) {
+			values.add(configList[i]);
+		}
+/*
+	      this.artifacts = artifacts; for (Iterator iterator = artifacts.iterator();
+		  iterator.hasNext();) { Artifact artifact = (Artifact) iterator.next();
+		  //Dependency dependency = artifact.getDependency(); //if
+		  (dependency.getProperty(PACKAGING_CONFIG_PROPERTY) != null) { if
+		  ("car".equals(artifact.getType()) && "provided".equals(artifact.getScope())) {
+		  //String orderString = dependency.getProperty(PACKAGING_CONFIG_PROPERTY);
+		  String orderString = getOrderString(artifact); try { Integer order =
+		  Integer.decode(orderString); String artifactString = artifact.getGroupId() +
+		  "/" + artifact.getArtifactId() + "/" + dependency.getVersion() + "/" +
+		  dependency.getType(); tree.put(order, artifactString); }
+		  catch(NumberFormatException e) { System.out.println("Could not interpret
+		  order for " + dependency); } } }
+ */
+
+        deploymentConfigList = values;
+    }
+	
+	public void executePackageBuilderShell() throws Exception {
+		try {
+			setDeploymentConfigList(deploymentConfig);			
+			Object packageBuilder = getPackageBuilder();
+			set("setClassPath", classPath, String.class, packageBuilder);
+			set("setDeployerName", deployerName, String.class, packageBuilder);
+			set("setDeploymentConfig", deploymentConfigList, Collection.class,
+					packageBuilder);
+			set("setEndorsedDirs", endorsedDirs, String.class, packageBuilder);
+			set("setExtensionDirs", extensionDirs, String.class, packageBuilder);
+			set("setMainClass", mainClass, String.class, packageBuilder);
+            set("setMainMethod", mainMethod, String.class, packageBuilder);
+            set("setMainGBean", mainGBean, String.class, packageBuilder);
+            set("setConfigurations", configurations, String.class, packageBuilder);
+			set("setModuleFile", moduleFile, File.class, packageBuilder);
+			set("setPackageFile", packageFile, File.class, packageBuilder);
+			set("setPlanFile", planFile, File.class, packageBuilder);
+			set("setRepository", repository, File.class, packageBuilder);
+			set("setRepositoryClass", Maven2Repository.class.getName(), //was maven1
+					String.class, packageBuilder);
+			set("setConfigurationStoreClass", MavenConfigStore.class.getName(),
+					String.class, packageBuilder);
+			set("setTargetRepository", targetRepository, File.class,
+					packageBuilder);
+			set("setTargetRepositoryClass", Maven2Repository.class.getName(),
+					String.class, packageBuilder);
+			set("setTargetConfigurationStoreClass",
+					RepositoryConfigurationStore.class.getName(), String.class,
+					packageBuilder);
+			set("setExplicitResolutionLocation", explicitResolutionLocation,
+					String.class, packageBuilder);
+            set("setLogLevel", logLevel, String.class, packageBuilder);
+
+			Method m = packageBuilder.getClass().getMethod("execute",
+					new Class[] {});
+			m.invoke(packageBuilder, new Object[] {});
+		} catch (Exception e) {
+			log.error(e.getClass().getName() + ": " + e.getMessage(), e);
+			throw e;
+		}
+	}
+
+	private void set(String methodName, Object value, Class type,
+			Object packageBuilder) throws NoSuchMethodException,
+			IllegalAccessException, InvocationTargetException {
+		Method m = packageBuilder.getClass().getMethod(methodName,
+				new Class[] { type });
+		System.out.println("-----------" + value);
+		m.invoke(packageBuilder, new Object[] { value });
+	}
+
+	private Object getPackageBuilder() throws ClassNotFoundException,
+			IllegalAccessException, InstantiationException,
+			MalformedURLException {
+		//System.out.println("plugin artifacts = " + pluginArtifacts);
+		return new PackageBuilder();
+		}
+	}

Propchange: geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilderShellMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilderShellMojo.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilderShellMojo.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackagingCommandLine.java
URL: http://svn.apache.org/viewvc/geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackagingCommandLine.java?rev=411333&view=auto
==============================================================================
--- geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackagingCommandLine.java (added)
+++ geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackagingCommandLine.java Fri Jun  2 16:35:57 2006
@@ -0,0 +1,96 @@
+/**
+ *
+ * Copyright 2005 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.plugin.packaging;
+
+import java.io.File;
+import java.io.InputStream;
+import java.io.FileInputStream;
+import java.util.Properties;
+import java.util.Collection;
+import java.util.Arrays;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class PackagingCommandLine {
+
+
+    public static void Main(String[] args) throws Exception {
+        File configFile = new File("packaging.properties");
+        Properties config = new Properties();
+        InputStream in = new FileInputStream(configFile);
+        try {
+            config.load(in);
+        } finally {
+            in.close();
+        }
+        mergeArgs(config, args);
+
+        new PackagingCommandLine(config).execute();
+
+    }
+
+
+    private static void mergeArgs(Properties config, String[] args) throws Exception {
+        if (args.length % 2 != 0) {
+            throw new Exception("There must be an even number of args, --<name> followed by value");
+        }
+        for (int i = 0; i < args.length; i++) {
+            String key = args[i++];
+            String value = args[i];
+            if (!key.startsWith("--")) {
+                throw new Exception("Keys must be preceded by '--'");
+            }
+            key = key.substring(2);
+            config.put(key, value);
+        }
+    }
+
+    private final Properties config;
+
+    public PackagingCommandLine(Properties config) {
+        this.config = config;
+    }
+
+    public void execute() throws Exception {
+        PackageBuilder builder = new PackageBuilder();
+        builder.setClassPath(config.getProperty("classPath"));
+        builder.setConfigurationStoreClass(config.getProperty("configurationStoreClass"));
+        builder.setDeployerName(config.getProperty("deployerName"));
+        String[] artifactNames = config.getProperty("deploymentConfig").split("/");
+        Collection configs = Arrays.asList(artifactNames);
+        builder.setDeploymentConfig(configs);
+        builder.setEndorsedDirs(config.getProperty("endorsedDirs"));
+        builder.setExtensionDirs(config.getProperty("extensionDirs"));
+        builder.setMainClass(config.getProperty("mainClass"));
+        builder.setModuleFile(getFile(config.getProperty("moduleFile")));
+        builder.setPackageFile(getFile(config.getProperty("packageFile")));
+        builder.setPlanFile(getFile(config.getProperty("planFile")));
+        builder.setRepository(getFile(config.getProperty("repository")));
+        builder.setRepositoryClass(config.getProperty("repositoryClass"));
+        builder.execute();
+    }
+
+    private File getFile(String fileName) {
+        if (fileName == null) {
+            return null;
+        }
+        return new File(fileName);
+    }
+
+
+}



Mime
View raw message