Return-Path: Delivered-To: apmail-geronimo-scm-archive@www.apache.org Received: (qmail 86453 invoked from network); 7 Jul 2006 05:18:20 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 7 Jul 2006 05:18:20 -0000 Received: (qmail 86816 invoked by uid 500); 7 Jul 2006 05:18:17 -0000 Delivered-To: apmail-geronimo-scm-archive@geronimo.apache.org Received: (qmail 86514 invoked by uid 500); 7 Jul 2006 05:18:16 -0000 Mailing-List: contact scm-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@geronimo.apache.org List-Id: Delivered-To: mailing list scm@geronimo.apache.org Received: (qmail 86478 invoked by uid 99); 7 Jul 2006 05:18:15 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Jul 2006 22:18:15 -0700 X-ASF-Spam-Status: No, hits=-8.6 required=10.0 tests=ALL_TRUSTED,INFO_TLD,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [140.211.166.113] (HELO eris.apache.org) (140.211.166.113) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Jul 2006 22:18:10 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id E0E6D1A9820; Thu, 6 Jul 2006 22:17:49 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r419805 [3/6] - in /geronimo/trunk: ./ applications/ applications/console/ applications/console/console-core/ applications/console/console-ear/ applications/console/console-framework/ applications/console/console-standard/ applications/demo... Date: Fri, 07 Jul 2006 05:17:30 -0000 To: scm@geronimo.apache.org From: jdillon@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20060707051749.E0E6D1A9820@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Modified: geronimo/trunk/configs/shutdown/pom.xml URL: http://svn.apache.org/viewvc/geronimo/trunk/configs/shutdown/pom.xml?rev=419805&r1=419804&r2=419805&view=diff ============================================================================== --- geronimo/trunk/configs/shutdown/pom.xml (original) +++ geronimo/trunk/configs/shutdown/pom.xml Thu Jul 6 22:17:25 2006 @@ -28,23 +28,22 @@ shutdown + Geronimo Configs :: Shutdown car - Shutdown Configuration - + org.apache.geronimo.plugins geronimo-packaging-plugin - true - ../lib/geronimo-deploy-tool-${geronimoVersion}.jar \ - ../lib/geronimo-common-${geronimoVersion}.jar \ - ../lib/geronimo-kernel-${geronimoVersion}.jar \ - ../lib/geronimo-system-${geronimoVersion}.jar \ - ../lib/geronimo-util-${geronimoVersion}.jar \ + ../lib/geronimo-deploy-tool-${pom.version}.jar \ + ../lib/geronimo-common-${pom.version}.jar \ + ../lib/geronimo-kernel-${pom.version}.jar \ + ../lib/geronimo-system-${pom.version}.jar \ + ../lib/geronimo-util-${pom.version}.jar \ ../lib/cglib-nodep-${cglibVersion}.jar \ ../lib/commons-cli-${commonsCliVersion}.jar \ ../lib/commons-logging-${commonsLoggingVersion}.jar \ Modified: geronimo/trunk/configs/system-database/pom.xml URL: http://svn.apache.org/viewvc/geronimo/trunk/configs/system-database/pom.xml?rev=419805&r1=419804&r2=419805&view=diff ============================================================================== --- geronimo/trunk/configs/system-database/pom.xml (original) +++ geronimo/trunk/configs/system-database/pom.xml Thu Jul 6 22:17:25 2006 @@ -27,57 +27,34 @@ ../pom.xml - org.apache.geronimo.configs system-database + Geronimo Configs :: System Database car - System Database Configuration for the J2EE Server - - - 8080 - 8443 - 4201 - localhost - 127.0.0.1 - 4242 - - - - - - org.apache.geronimo.plugins - geronimo-packaging-plugin - true - - ${j2eeNowebServer} - ${settings.localRepository}/tranql/tranql-connector-derby-embed-xa/${tranqlVendorsVersion}/tranql-connector-derby-embed-xa-${tranqlVendorsVersion}.rar - - - - - - - - - + org.apache.geronimo.configs j2ee-server + ${pom.version} car + org.apache.geronimo.configs axis-deployer + ${pom.version} car provided + org.apache.geronimo.configs client-deployer + ${pom.version} car provided @@ -85,6 +62,7 @@ org.apache.geronimo.configs openejb-deployer + ${pom.version} car provided @@ -92,11 +70,13 @@ org.apache.geronimo.modules geronimo-derby + ${pom.version} org.apache.geronimo.modules geronimo-timer + ${pom.version} @@ -112,8 +92,22 @@ tranql tranql-connector-derby-embed-xa - ${tranqlVendorsVersion} rar + + + + + + org.apache.geronimo.plugins + geronimo-packaging-plugin + + ${j2eeNowebServer} + ${settings.localRepository}/tranql/tranql-connector-derby-embed-xa/${tranqlVendorsVersion}/tranql-connector-derby-embed-xa-${tranqlVendorsVersion}.rar + + + + + Modified: geronimo/trunk/configs/tomcat-deployer/pom.xml URL: http://svn.apache.org/viewvc/geronimo/trunk/configs/tomcat-deployer/pom.xml?rev=419805&r1=419804&r2=419805&view=diff ============================================================================== --- geronimo/trunk/configs/tomcat-deployer/pom.xml (original) +++ geronimo/trunk/configs/tomcat-deployer/pom.xml Thu Jul 6 22:17:25 2006 @@ -28,38 +28,24 @@ tomcat-deployer + Geronimo Configs :: Tomcat Deployer car - Tomcat Deployer Configuration for performing J2EE deployments - - - - - org.apache.geronimo.plugins - geronimo-packaging-plugin - true - - ${gbeanDeployer},${j2eeDeployer} - - - - - - - - - + org.apache.geronimo.configs j2ee-deployer + ${pom.version} car + org.apache.geronimo.configs tomcat + ${pom.version} car compile @@ -67,6 +53,21 @@ org.apache.geronimo.modules geronimo-tomcat-builder + ${pom.version} + + + + + + org.apache.geronimo.plugins + geronimo-packaging-plugin + + ${gbeanDeployer},${j2eeDeployer} + + + + + Modified: geronimo/trunk/configs/tomcat/pom.xml URL: http://svn.apache.org/viewvc/geronimo/trunk/configs/tomcat/pom.xml?rev=419805&r1=419804&r2=419805&view=diff ============================================================================== --- geronimo/trunk/configs/tomcat/pom.xml (original) +++ geronimo/trunk/configs/tomcat/pom.xml Thu Jul 6 22:17:25 2006 @@ -28,48 +28,31 @@ tomcat + Geronimo Configs :: Tomcat car - Tomcat Configuration for the J2EE Server - - 8090 - 8453 - 8019 - localhost - - - - - - - org.apache.geronimo.plugins - geronimo-packaging-plugin - true - - - - - - - - + org.apache.geronimo.configs rmi-naming - ${geronimoVersion} + ${pom.version} car org.apache.geronimo.modules geronimo-tomcat + ${pom.version} + + Modified: geronimo/trunk/configs/unavailable-client-deployer/pom.xml URL: http://svn.apache.org/viewvc/geronimo/trunk/configs/unavailable-client-deployer/pom.xml?rev=419805&r1=419804&r2=419805&view=diff ============================================================================== --- geronimo/trunk/configs/unavailable-client-deployer/pom.xml (original) +++ geronimo/trunk/configs/unavailable-client-deployer/pom.xml Thu Jul 6 22:17:25 2006 @@ -28,33 +28,31 @@ unavailable-client-deployer + Geronimo Configs :: Unavailable Client Deployer car - Configuration for no j2ee app clients + + + + + + org.apache.geronimo.configs + j2ee-deployer + ${pom.version} + car + + + org.apache.geronimo.plugins geronimo-packaging-plugin - true ${gbeanDeployer},${j2eeDeployer} - - - - - - - - - org.apache.geronimo.configs - j2ee-deployer - ${geronimoVersion} - car - - + Modified: geronimo/trunk/configs/unavailable-ejb-deployer/pom.xml URL: http://svn.apache.org/viewvc/geronimo/trunk/configs/unavailable-ejb-deployer/pom.xml?rev=419805&r1=419804&r2=419805&view=diff ============================================================================== --- geronimo/trunk/configs/unavailable-ejb-deployer/pom.xml (original) +++ geronimo/trunk/configs/unavailable-ejb-deployer/pom.xml Thu Jul 6 22:17:25 2006 @@ -28,33 +28,31 @@ unavailable-ejb-deployer + Geronimo Configs :: Unavailable EJB Deployer car - Configuration for no EJBs + + + + + + org.apache.geronimo.configs + j2ee-deployer + ${pom.version} + car + + + org.apache.geronimo.plugins geronimo-packaging-plugin - true ${gbeanDeployer},${j2eeDeployer} - - - - - - - - - org.apache.geronimo.configs - j2ee-deployer - ${geronimoVersion} - car - - + Modified: geronimo/trunk/configs/unavailable-webservices-deployer/pom.xml URL: http://svn.apache.org/viewvc/geronimo/trunk/configs/unavailable-webservices-deployer/pom.xml?rev=419805&r1=419804&r2=419805&view=diff ============================================================================== --- geronimo/trunk/configs/unavailable-webservices-deployer/pom.xml (original) +++ geronimo/trunk/configs/unavailable-webservices-deployer/pom.xml Thu Jul 6 22:17:25 2006 @@ -28,33 +28,31 @@ unavailable-webservices-deployer + Geronimo Configs :: Unavailable Web Services Deployer car - Unavailable Web Services deployer + + + + + + org.apache.geronimo.configs + j2ee-deployer + ${pom.version} + car + + + org.apache.geronimo.plugins geronimo-packaging-plugin - true ${gbeanDeployer},${j2eeDeployer} - - - - - - - - - org.apache.geronimo.configs - j2ee-deployer - ${geronimoVersion} - car - - + Modified: geronimo/trunk/configs/upgrade-cli/pom.xml URL: http://svn.apache.org/viewvc/geronimo/trunk/configs/upgrade-cli/pom.xml?rev=419805&r1=419804&r2=419805&view=diff ============================================================================== --- geronimo/trunk/configs/upgrade-cli/pom.xml (original) +++ geronimo/trunk/configs/upgrade-cli/pom.xml Thu Jul 6 22:17:25 2006 @@ -27,32 +27,17 @@ ../pom.xml - org.apache.geronimo.configs upgrade-cli + Geronimo Configs :: CLI Upgrade car - System Configuration for the command line upgrade - - - - - - org.apache.geronimo.plugins - geronimo-packaging-plugin - true - - - - - - - - + + org.apache.geronimo.configs geronimo-gbean-deployer - ${geronimoVersion} + ${pom.version} car @@ -99,17 +84,18 @@ org.apache.geronimo.specs geronimo-qname_1.1_spec - org.apache.geronimo.modules geronimo-upgrade + ${pom.version} org.apache.geronimo.modules geronimo-service-builder + ${pom.version} @@ -121,5 +107,7 @@ stax stax-api + + Modified: geronimo/trunk/configs/upgrade/pom.xml URL: http://svn.apache.org/viewvc/geronimo/trunk/configs/upgrade/pom.xml?rev=419805&r1=419804&r2=419805&view=diff ============================================================================== --- geronimo/trunk/configs/upgrade/pom.xml (original) +++ geronimo/trunk/configs/upgrade/pom.xml Thu Jul 6 22:17:25 2006 @@ -27,43 +27,30 @@ ../pom.xml - org.apache.geronimo.configs upgrade + Geronimo Configs :: Plan Upgrade car - Geronimo Configuration for upgrading plans - - - - - - org.apache.geronimo.plugins - geronimo-packaging-plugin - true - - - - - - - - + + org.apache.geronimo.configs geronimo-gbean-deployer - ${geronimoVersion} + ${pom.version} car org.apache.geronimo.modules geronimo-upgrade + ${pom.version} org.apache.geronimo.modules geronimo-service-builder + ${pom.version} @@ -75,5 +62,7 @@ stax stax-api + + Modified: geronimo/trunk/configs/welcome-jetty/pom.xml URL: http://svn.apache.org/viewvc/geronimo/trunk/configs/welcome-jetty/pom.xml?rev=419805&r1=419804&r2=419805&view=diff ============================================================================== --- geronimo/trunk/configs/welcome-jetty/pom.xml (original) +++ geronimo/trunk/configs/welcome-jetty/pom.xml Thu Jul 6 22:17:25 2006 @@ -27,35 +27,17 @@ ../pom.xml - org.apache.geronimo.configs welcome-jetty + Geronimo Configs :: Welcome app Jetty car - Welcome app Jetty - - - - - - org.apache.geronimo.plugins - geronimo-packaging-plugin - true - - ${j2eeJettyServer} - ${settings.localRepository}/org/apache/geronimo/applications/geronimo-welcome/${geronimoVersion}/geronimo-welcome-${geronimoVersion}.war - - - - - - - - - + - + + org.apache.geronimo.configs jetty + ${pom.version} car provided @@ -63,8 +45,23 @@ org.apache.geronimo.applications geronimo-welcome - ${geronimoVersion} + ${pom.version} war + + + + + + org.apache.geronimo.plugins + geronimo-packaging-plugin + + ${j2eeJettyServer} + ${settings.localRepository}/org/apache/geronimo/applications/geronimo-welcome/${pom.version}/geronimo-welcome-${pom.version}.war + + + + + Modified: geronimo/trunk/configs/welcome-tomcat/pom.xml URL: http://svn.apache.org/viewvc/geronimo/trunk/configs/welcome-tomcat/pom.xml?rev=419805&r1=419804&r2=419805&view=diff ============================================================================== --- geronimo/trunk/configs/welcome-tomcat/pom.xml (original) +++ geronimo/trunk/configs/welcome-tomcat/pom.xml Thu Jul 6 22:17:25 2006 @@ -27,44 +27,41 @@ ../pom.xml - org.apache.geronimo.configs welcome-tomcat + Geronimo Configs :: Welcome app Tomcat car - Welcome app Tomcat - - - - - - org.apache.geronimo.plugins - geronimo-packaging-plugin - true - - ${j2eeTomcatServer} - ${settings.localRepository}/org/apache/geronimo/applications/geronimo-welcome/${geronimoVersion}/geronimo-welcome-${geronimoVersion}.war - - - - - - - - - + + org.apache.geronimo.configs tomcat-deployer + ${pom.version} car provided - + org.apache.geronimo.applications geronimo-welcome - ${geronimoVersion} + ${pom.version} war + + + + + + org.apache.geronimo.plugins + geronimo-packaging-plugin + + ${j2eeTomcatServer} + ${settings.localRepository}/org/apache/geronimo/applications/geronimo-welcome/${pom.version}/geronimo-welcome-${pom.version}.war + + + + + Modified: 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=419805&r1=419804&r2=419805&view=diff ============================================================================== --- geronimo/trunk/m2-plugins/geronimo-packaging-plugin/pom.xml (original) +++ geronimo/trunk/m2-plugins/geronimo-packaging-plugin/pom.xml Thu Jul 6 22:17:25 2006 @@ -17,7 +17,11 @@ - + + 4.0.0 @@ -28,111 +32,28 @@ geronimo-packaging-plugin + Geronimo Plugins :: Packaging maven-plugin - Geronimo :: Maven2 Packaging Plugin - http://geronimo.apache.org - - - jira - http://issues.apache.org/jira/secure/BrowseProject.jspa?id=10220 - - - - continuum - - - mail - - -
dev@geronimo.org
-
-
-
- - - - Geronimo User List - users-subscribe@geronimo.apache.org - users-unsubscribe@geronimo.apache.org - http://mail-archives.apache.org/mod_mbox/geronimo-user/ - - - - Geronimo Developer List - dev-subscribe@geronimo.apache.org - dev-unsubscribe@geronimo.apache.org - http://mail-archives.apache.org/mod_mbox/geronimo-dev/ - - - - Source Control List - scm-subscribe@geronimo.apache.org - scm-unsubscribe@geronimo.apache.org - http://mail-archives.apache.org/mod_mbox/geronimo-scm/ - - - - - - - - - - - - - - - - The Apache Software License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0 - repo - - - - - scm:svn:https://svn.apache.org/repos/asf/geronimo/ - scm:svn:https://${maven.username}@svn.apache.org/repos/asf/geronimo/ - https://svn.apache.org/repos/asf/geronimo/ - - - - Geronimo - http://geronimo.apache.org/ - - + - - org.apache.maven - maven-plugin-api - 2.0 - - - - org.apache.maven - maven-project - 2.0 - - - - org.apache.maven - maven-artifact - 2.0 - - + org.apache.geronimo.modules geronimo-kernel + ${pom.version} org.apache.geronimo.modules geronimo-service-builder + ${pom.version} org.apache.geronimo.modules geronimo-deploy-tool + ${pom.version} + @@ -145,10 +66,12 @@ - + + xmlbeans @@ -170,49 +93,45 @@ org.apache.geronimo.modules geronimo-system + ${pom.version} commons-cli commons-cli - ${commonsCliVersion} - + + --> org.apache.geronimo.specs geronimo-qname_1.1_spec - ${geronimoSpecQnameVersion} xerces xercesImpl - ${xercesVersion} xerces xmlParserAPIs - ${xmlParserApisVersion} xstream xstream - ${xstreamVersion} xpp3 xpp3 - ${xpp3Version} @@ -228,20 +147,6 @@
- - + Modified: 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=419805&r1=419804&r2=419805&view=diff ============================================================================== --- geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/AbstractDistributor.java (original) +++ geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/AbstractDistributor.java Thu Jul 6 22:17:25 2006 @@ -1,6 +1,5 @@ /** - * - * Copyright 2005 The Apache Software Foundation + * 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. @@ -26,11 +25,16 @@ * * @version $Rev$ $Date$ */ -public abstract class AbstractDistributor { +public abstract class AbstractDistributor +{ private String user; + private String password; + private String url; + private File artifact; + protected ObjectName storeName; public String getUser() { @@ -42,7 +46,7 @@ * * @param user the username */ - public void setUser(String user) { + public void setUser(final String user) { this.user = user; } @@ -55,7 +59,7 @@ * * @param password the password */ - public void setPassword(String password) { + public void setPassword(final String password) { this.password = password; } @@ -68,7 +72,7 @@ * * @param url the URL of the server */ - public void setUrl(String url) { + public void setUrl(final String url) { this.url = url; } @@ -81,7 +85,7 @@ * * @param artifact the artifact to distribute */ - public void setArtifact(File artifact) { + public void setArtifact(final File artifact) { this.artifact = artifact; } @@ -96,10 +100,11 @@ * * @param storeName the name of the ConfigurationStore to distribute to */ - public void setStoreName(String storeName) { + public void setStoreName(final String storeName) { try { this.storeName = new ObjectName(storeName); - } catch (MalformedObjectNameException e) { + } + catch (MalformedObjectNameException e) { throw new IllegalArgumentException("Invalid storeName: " + storeName); } } Modified: 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=419805&r1=419804&r2=419805&view=diff ============================================================================== --- geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/AbstractPackagingMojo.java (original) +++ geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/AbstractPackagingMojo.java Thu Jul 6 22:17:25 2006 @@ -1,36 +1,63 @@ -package org.apache.geronimo.plugin.packaging; +/* + * 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. + */ -import java.io.PrintStream; +package org.apache.geronimo.plugin.packaging; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugin.logging.Log; -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); - } - } - } - +/** + * ??? + * + * @version $Id$ + */ +public abstract class AbstractPackagingMojo + extends AbstractMojo +{ + protected Log log; + + protected void init() { + log = getLog(); + } + + /** + * @throws MojoExecutionException + */ + public void execute() throws MojoExecutionException, MojoFailureException { + init(); + + try { + doExecute(); + } + catch (Exception e) { + if (e instanceof MojoExecutionException) { + throw (MojoExecutionException)e; + } + else if (e instanceof MojoFailureException) { + throw (MojoFailureException)e; + } + else { + throw new MojoExecutionException(e.getMessage(), e); + } + } + } + + protected void doExecute() throws Exception { + // Sub-class should override + } } Modified: 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=419805&r1=419804&r2=419805&view=diff ============================================================================== --- geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/ConfigCopier.java (original) +++ geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/ConfigCopier.java Thu Jul 6 22:17:25 2006 @@ -18,43 +18,46 @@ 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; +// +// TODO: Remove... appears unused +// + /** * Copies all the configurations out of source config store into target config store. * - * @version $Rev:$ $Date:$ + * @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 static final Class[] REPO_ARGS = { File.class }; + private static final Class[] STORE_ARGS = { WritableListableRepository.class }; private String sourceRepositoryClass; + private String targetRepositoryClass; + private String sourceConfigurationStoreClass; + private String targetConfigurationStoreClass; + private File sourceRepositoryLocation; - private File targetRepositoryLocation; + private File targetRepositoryLocation; public String getSourceRepositoryClass() { return sourceRepositoryClass; } - public void setSourceRepositoryClass(String sourceRepositoryClass) { + public void setSourceRepositoryClass(final String sourceRepositoryClass) { this.sourceRepositoryClass = sourceRepositoryClass; } @@ -62,7 +65,7 @@ return targetRepositoryClass; } - public void setTargetRepositoryClass(String targetRepositoryClass) { + public void setTargetRepositoryClass(final String targetRepositoryClass) { this.targetRepositoryClass = targetRepositoryClass; } @@ -70,7 +73,7 @@ return sourceConfigurationStoreClass; } - public void setSourceConfigurationStoreClass(String sourceConfigurationStoreClass) { + public void setSourceConfigurationStoreClass(final String sourceConfigurationStoreClass) { this.sourceConfigurationStoreClass = sourceConfigurationStoreClass; } @@ -78,7 +81,7 @@ return targetConfigurationStoreClass; } - public void setTargetConfigurationStoreClass(String targetConfigurationStoreClass) { + public void setTargetConfigurationStoreClass(final String targetConfigurationStoreClass) { this.targetConfigurationStoreClass = targetConfigurationStoreClass; } @@ -86,7 +89,7 @@ return sourceRepositoryLocation; } - public void setSourceRepositoryLocation(File sourceRepositoryLocation) { + public void setSourceRepositoryLocation(final File sourceRepositoryLocation) { this.sourceRepositoryLocation = sourceRepositoryLocation; } @@ -94,7 +97,7 @@ return targetRepositoryLocation; } - public void setTargetRepositoryLocation(File targetRepositoryLocation) { + public void setTargetRepositoryLocation(final File targetRepositoryLocation) { this.targetRepositoryLocation = targetRepositoryLocation; } @@ -103,14 +106,20 @@ ClassLoader cl = this.getClass().getClassLoader(); Class sourceRepoClass = cl.loadClass(sourceRepositoryClass); - WritableListableRepository sourceRepository = (WritableListableRepository) sourceRepoClass.getDeclaredConstructor(REPO_ARGS).newInstance(new Object[] {sourceRepositoryLocation}); + 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}); + 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}); + 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}); + ConfigurationStore targetConfigStore = (ConfigurationStore) + targetConfigStoreClass.getDeclaredConstructor(STORE_ARGS).newInstance(new Object[]{targetRepository}); List configs = sourceConfigStore.listConfigurations(); for (Iterator iterator = configs.iterator(); iterator.hasNext();) { @@ -122,7 +131,8 @@ } targetConfigStore.install(configData); } - } catch (Exception e) { + } + catch (Exception e) { e.printStackTrace(); throw e; } Modified: 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=419805&r1=419804&r2=419805&view=diff ============================================================================== --- geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/ConfigCopierMojo.java (original) +++ geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/ConfigCopierMojo.java Thu Jul 6 22:17:25 2006 @@ -18,143 +18,99 @@ 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; +import org.apache.maven.plugin.logging.Log; + +// +// TODO: Rename to InstallMojo +// /** * Copies all the configurations out of source config store into target config store. * * @goal install - * @version $Rev:$ $Date:$ + * + * @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}; + private static final Class[] REPO_ARGS = { File.class }; + + private static final Class[] STORE_ARGS = { 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; + protected void doExecute() throws Exception { + // copy artifact(s) to maven repository + + 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 }); -/* 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); + 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 }); + + Iterator iterator = sourceConfigStore.listConfigurations().iterator(); + while (iterator.hasNext()) { + ConfigurationInfo configInfo = (ConfigurationInfo) iterator.next(); + Artifact configId = configInfo.getConfigID(); + ConfigurationData configData = sourceConfigStore.loadConfiguration(configId); + + log.info("Copying artifact: " + configId); + + if (targetConfigStore.containsConfiguration(configId)) { + targetConfigStore.uninstall(configId); } - } catch (Exception e) { - e.printStackTrace(); - throw e; + + targetConfigStore.install(configData); } } } Modified: 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=419805&r1=419804&r2=419805&view=diff ============================================================================== --- geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenAttributeStore.java (original) +++ geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenAttributeStore.java Thu Jul 6 22:17:25 2006 @@ -14,6 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.geronimo.plugin.packaging; import org.apache.geronimo.gbean.GAttributeInfo; @@ -34,7 +35,9 @@ /** * @version $Rev$ $Date$ */ -public class MavenAttributeStore implements ManageableAttributeStore { +public class MavenAttributeStore + implements ManageableAttributeStore +{ public MavenAttributeStore() { } Modified: 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=419805&r1=419804&r2=419805&view=diff ============================================================================== --- geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenConfigStore.java (original) +++ geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenConfigStore.java Thu Jul 6 22:17:25 2006 @@ -14,6 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.geronimo.plugin.packaging; import java.io.File; @@ -38,7 +39,9 @@ * * @version $Rev$ $Date$ */ -public class MavenConfigStore extends RepositoryConfigurationStore { +public class MavenConfigStore + extends RepositoryConfigurationStore +{ public MavenConfigStore(Kernel kernel, String objectName, WritableListableRepository repository) { super(kernel, objectName, repository); } @@ -59,7 +62,8 @@ File metaInf = new File(tmpFile, "META-INF"); metaInf.mkdirs(); return tmpFile; - } catch (IOException e) { + } + catch (IOException e) { // doh why can't I throw this? return null; } Modified: 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=419805&r1=419804&r2=419805&view=diff ============================================================================== --- geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilder.java (original) +++ geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilder.java Thu Jul 6 22:17:25 2006 @@ -14,6 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.geronimo.plugin.packaging; import java.io.File; @@ -51,8 +52,8 @@ * * @version $Rev:385659 $ $Date$ */ -public class PackageBuilder { - +public class PackageBuilder +{ private static Log log = LogFactory.getLog(PackageBuilder.class); private static final String KERNEL_NAME = "geronimo.maven"; @@ -66,19 +67,19 @@ 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(), + 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; @@ -89,7 +90,6 @@ private File repository; private File targetRepository; private Collection deploymentConfigs; -// private Artifact[] deploymentConfig; private AbstractName deployerName; private File planFile; @@ -124,7 +124,6 @@ this.configurationStoreClass = configurationStoreClass; } - public File getRepository() { return repository; } @@ -236,7 +235,7 @@ * * @param mainClass */ - public void setMainClass(String mainClass) { + public void setMainClass(final String mainClass) { this.mainClass = mainClass; } @@ -244,7 +243,7 @@ return mainGBean; } - public void setMainGBean(String mainGBean) { + public void setMainGBean(final String mainGBean) { this.mainGBean = mainGBean; } @@ -252,7 +251,7 @@ return mainMethod; } - public void setMainMethod(String mainMethod) { + public void setMainMethod(final String mainMethod) { this.mainMethod = mainMethod; } @@ -260,7 +259,7 @@ return configurations; } - public void setConfigurations(String configurations) { + public void setConfigurations(final String configurations) { this.configurations = configurations; } @@ -268,7 +267,7 @@ return classPath; } - public void setClassPath(String classPath) { + public void setClassPath(final String classPath) { this.classPath = classPath; } @@ -276,7 +275,7 @@ return endorsedDirs; } - public void setEndorsedDirs(String endorsedDirs) { + public void setEndorsedDirs(final String endorsedDirs) { this.endorsedDirs = endorsedDirs; } @@ -284,7 +283,7 @@ return extensionDirs; } - public void setExtensionDirs(String extensionDirs) { + public void setExtensionDirs(final String extensionDirs) { this.extensionDirs = extensionDirs; } @@ -292,7 +291,7 @@ return explicitResolutionLocation; } - public void setExplicitResolutionLocation(String explicitResolutionLocation) { + public void setExplicitResolutionLocation(final String explicitResolutionLocation) { this.explicitResolutionLocation = explicitResolutionLocation; } @@ -308,9 +307,10 @@ System.out.println(); System.out.println(" Packaging configuration " + planFile); System.out.println(); + try { Kernel kernel = createKernel(); - if(!targetSet) { + if (!targetSet) { setTargetConfigStore(); } @@ -331,8 +331,10 @@ AbstractName deployer = locateDeployer(kernel); invokeDeployer(kernel, deployer, targetConfigStoreAName.toString()); + System.out.println("Generated package " + packageFile); - } catch (Exception e) { + } + catch (Exception e) { log.error(e.getClass().getName() + ": " + e.getMessage(), e); throw e; } @@ -343,11 +345,12 @@ kernel.stopGBean(targetRepositoryAName); kernel.setAttribute(targetRepositoryAName, "root", targetRepository.toURI()); kernel.startGBean(targetRepositoryAName); - if(kernel.getGBeanState(targetConfigStoreAName) != State.RUNNING_INDEX) { + if (kernel.getGBeanState(targetConfigStoreAName) != State.RUNNING_INDEX) { throw new IllegalStateException("After restarted repository then config store is not running"); } targetSet = true; - } catch (Exception e) { + } + catch (Exception e) { e.printStackTrace(); throw e; } @@ -384,6 +387,7 @@ /** * Boot the in-Maven deployment system. + * * This contains Repository and ConfigurationStore GBeans that map to * the local maven installation. */ @@ -445,7 +449,6 @@ configManagerGBean.setReferencePatterns("Repositories", repoPatterns); ConfigurationUtil.loadBootstrapConfiguration(kernel, bootstrap, cl); - } /** @@ -460,16 +463,34 @@ 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}; + + 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); } } Modified: 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=419805&r1=419804&r2=419805&view=diff ============================================================================== --- geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilderShellMojo.java (original) +++ geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilderShellMojo.java Thu Jul 6 22:17:25 2006 @@ -14,247 +14,254 @@ * 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.PluginBootstrap2; 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.plugin.logging.Log; import org.apache.maven.project.MavenProject; +// +// TODO: Rename to PackageMojo +// /** * Build a Geronimo Configuration using the local Maven infrastructure. - * + * * @goal package * @phase package + * * @version $Rev$ $Date$ */ +public class PackageBuilderShellMojo + extends AbstractPackagingMojo +{ + private List artifacts; + + private static ClassLoader classLoader; + + /** + * @parameter expression="${project}" + */ + private MavenProject project; + + /** + * @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; -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 + */ + 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 { - PluginBootstrap2 boot = new PluginBootstrap2(); - 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); } } } - */ + /** + * @parameter + */ + private boolean boot = false; + + protected void doExecute() throws Exception { + targetRepository.mkdir(); + + if (boot) { + executeBootShell(); + } + else { + executePackageBuilderShell(); + } + + // copy configuration from target/repository to maven repo + project.getArtifact().setFile(packageFile); + } + + public void executeBootShell() throws Exception { + if (log.isDebugEnabled()) { + log.debug("Build dir: " + buildDir); + log.debug("Package file: " + packageFile); + log.debug("Repository: " + repository); + log.debug("Plan file: " + planFile); + } + + PluginBootstrap2 boot = new PluginBootstrap2(); + + boot.setBuildDir(buildDir); + boot.setCarFile(packageFile); + boot.setLocalRepo(repository); + boot.setPlan(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]); + } 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(); - } - } + + public void executePackageBuilderShell() throws Exception { + 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(), 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); + + try { + Method m = packageBuilder.getClass().getMethod("execute", new Class[0]); + m.invoke(packageBuilder, new Object[0]); + } + catch (InvocationTargetException e) { + log.debug("Decoding ITE", e); + + Throwable t = e.getTargetException(); + + if (t instanceof Exception) { + throw (Exception)t; + } + if (t instanceof Error) { + throw (Error)t; + } + + throw new Error(t); + } + } + + private void set(String methodName, Object value, Class type, Object packageBuilder) throws Exception { + Log log = getLog(); + + log.debug("Setting (" + methodName + "): " + value); + + try { + Method m = packageBuilder.getClass().getMethod(methodName, new Class[]{type}); + m.invoke(packageBuilder, new Object[]{value}); + } + catch (InvocationTargetException e) { + log.debug("Decoding ITE", e); + + // Decode ITE + Throwable t = e.getTargetException(); + + if (t instanceof Exception) { + throw (Exception)t; + } + if (t instanceof Error) { + throw (Error)t; + } + + throw new Error(t); + } + } + + private Object getPackageBuilder() { + return new PackageBuilder(); + } +} Modified: 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=419805&r1=419804&r2=419805&view=diff ============================================================================== --- geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackagingCommandLine.java (original) +++ geronimo/trunk/m2-plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackagingCommandLine.java Thu Jul 6 22:17:25 2006 @@ -14,6 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.geronimo.plugin.packaging; import java.io.File; @@ -28,7 +29,6 @@ */ public class PackagingCommandLine { - public static void Main(String[] args) throws Exception { File configFile = new File("packaging.properties"); Properties config = new Properties(); @@ -41,20 +41,21 @@ 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, -- 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); } @@ -91,6 +92,4 @@ } return new File(fileName); } - - }