geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dblev...@apache.org
Subject svn commit: r355898 - in /geronimo/branches/1.0/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging: PackageBuilder.java PackageBuilderShell.java PlanProcessor.java
Date Sun, 11 Dec 2005 04:20:58 GMT
Author: dblevins
Date: Sat Dec 10 20:20:55 2005
New Revision: 355898

URL: http://svn.apache.org/viewcvs?rev=355898&view=rev
Log:
Crude logging that removes the need to do -X

Modified:
    geronimo/branches/1.0/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilder.java
    geronimo/branches/1.0/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilderShell.java
    geronimo/branches/1.0/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PlanProcessor.java

Modified: geronimo/branches/1.0/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.0/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilder.java?rev=355898&r1=355897&r2=355898&view=diff
==============================================================================
--- geronimo/branches/1.0/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilder.java
(original)
+++ geronimo/branches/1.0/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilder.java
Sat Dec 10 20:20:55 2005
@@ -34,14 +34,19 @@
 import org.apache.geronimo.kernel.config.ConfigurationManagerImpl;
 import org.apache.geronimo.kernel.config.ConfigurationUtil;
 import org.apache.log4j.BasicConfigurator;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 /**
  * JellyBean that builds a Geronimo Configuration using the local Mavem
  * infrastructure.
  *
- * @version $Rev$ $Date$
+ * @version $Rev: 355876 $ $Date$
  */
 public class PackageBuilder {
+
+    private static Log log = LogFactory.getLog(PackageBuilder.class);
+
     private static final String KERNEL_NAME = "geronimo.maven";
     /**
      * The name of the GBean that will load dependencies from the Maven repository.
@@ -250,33 +255,38 @@
     }
 
     public void execute() throws Exception {
-        Kernel kernel = createKernel(repository, repositoryClass, configurationStoreClass);
-
-        // start the Configuration we're going to use for this deployment
-        ConfigurationManager configurationManager = ConfigurationUtil.getConfigurationManager(kernel);
         try {
-            for (int i = 0; i < deploymentConfig.length; i++) {
-                URI configName = deploymentConfig[i];
-                if (!configurationManager.isLoaded(configName)) {
-                    List configs = configurationManager.loadRecursive(configName);
-                    for (Iterator iterator = configs.iterator(); iterator.hasNext(); ) {
-                        URI ancestorConfigName = (URI) iterator.next();
-                        try {
-                            configurationManager.loadGBeans(ancestorConfigName);
-                        } catch (Throwable e) {
-                            throw new RuntimeException("Could not start configuration: "
+ configName, e);
+            Kernel kernel = createKernel(repository, repositoryClass, configurationStoreClass);
+
+            // start the Configuration we're going to use for this deployment
+            ConfigurationManager configurationManager = ConfigurationUtil.getConfigurationManager(kernel);
+            try {
+                for (int i = 0; i < deploymentConfig.length; i++) {
+                    URI configName = deploymentConfig[i];
+                    if (!configurationManager.isLoaded(configName)) {
+                        List configs = configurationManager.loadRecursive(configName);
+                        for (Iterator iterator = configs.iterator(); iterator.hasNext();
) {
+                            URI ancestorConfigName = (URI) iterator.next();
+                            try {
+                                configurationManager.loadGBeans(ancestorConfigName);
+                            } catch (Throwable e) {
+                                throw new RuntimeException("Could not start configuration:
" + configName, e);
+                            }
                         }
+                        configurationManager.start(configName);
                     }
-                    configurationManager.start(configName);
                 }
+            } finally {
+                ConfigurationUtil.releaseConfigurationManager(kernel, configurationManager);
             }
-        } finally {
-            ConfigurationUtil.releaseConfigurationManager(kernel, configurationManager);
-        }
 
-        ObjectName deployer = locateDeployer(kernel);
-        invokeDeployer(kernel, deployer);
-        System.out.println("Generated package " + packageFile);
+            ObjectName deployer = locateDeployer(kernel);
+            invokeDeployer(kernel, deployer);
+            System.out.println("Generated package " + packageFile);
+        } catch (Exception e) {
+            log.error(e.getClass().getName()+": "+e.getMessage(), e);
+            throw e;
+        }
     }
 
     /**

Modified: geronimo/branches/1.0/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilderShell.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.0/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilderShell.java?rev=355898&r1=355897&r2=355898&view=diff
==============================================================================
--- geronimo/branches/1.0/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilderShell.java
(original)
+++ geronimo/branches/1.0/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilderShell.java
Sat Dec 10 20:20:55 2005
@@ -29,6 +29,8 @@
 import javax.management.ObjectName;
 
 import org.apache.commons.jelly.JellyContext;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.maven.jelly.MavenJellyContext;
 import org.apache.maven.project.Dependency;
 import org.apache.maven.repository.Artifact;
@@ -40,6 +42,7 @@
  * @version $Rev$ $Date$
  */
 public class PackageBuilderShell {
+    private static Log log = LogFactory.getLog(PlanProcessor.class);
 
     private List artifacts;
     private List pluginArtifacts;
@@ -200,22 +203,27 @@
     }
 
     public void execute() throws Exception {
-        Object packageBuilder = getPackageBuilder();
-        set("setClassPath", classPath, String.class, packageBuilder);
-        set("setDeployerName", deployerName, String.class, packageBuilder);
-        set("setDeploymentConfig", deploymentConfigString, String.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", MavenRepository.class.getName(), String.class, packageBuilder);
-        set("setConfigurationStoreClass", MavenConfigStore.class.getName(), String.class,
packageBuilder);
-
-        Method m = packageBuilder.getClass().getMethod("execute", new Class[]{});
-        m.invoke(packageBuilder, new Object[]{});
+        try {
+            Object packageBuilder = getPackageBuilder();
+            set("setClassPath", classPath, String.class, packageBuilder);
+            set("setDeployerName", deployerName, String.class, packageBuilder);
+            set("setDeploymentConfig", deploymentConfigString, String.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", MavenRepository.class.getName(), String.class, packageBuilder);
+            set("setConfigurationStoreClass", MavenConfigStore.class.getName(), 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 {

Modified: geronimo/branches/1.0/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PlanProcessor.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.0/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PlanProcessor.java?rev=355898&r1=355897&r2=355898&view=diff
==============================================================================
--- geronimo/branches/1.0/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PlanProcessor.java
(original)
+++ geronimo/branches/1.0/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PlanProcessor.java
Sat Dec 10 20:20:55 2005
@@ -24,6 +24,8 @@
 
 import org.apache.commons.jelly.tags.velocity.JellyContextAdapter;
 import org.apache.commons.jelly.JellyContext;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.maven.project.Dependency;
 import org.apache.maven.repository.Artifact;
 import org.apache.velocity.Template;
@@ -38,6 +40,8 @@
  * @version $Rev$ $Date$
  */
 public class PlanProcessor {
+    private static Log log = LogFactory.getLog(PlanProcessor.class);
+
     private static final String IMPORT_PROPERTY = "geronimo.import";
     private static final QName IMPORT_QNAME = new QName("http://geronimo.apache.org/xml/ns/deployment-1.0",
"import");
     private static final String INCLUDE_PROPERTY = "geronimo.include";
@@ -97,55 +101,60 @@
     }
 
     public void execute() throws Exception, XmlException {
-        if (artifacts == null) {
-            throw new RuntimeException("Artifacts not supplied");
-        }
-        if (targetDir == null) {
-            throw new RuntimeException("No target directory supplied");
-        }
-        if (planFile == null) {
-            throw new RuntimeException("No source plan supplied");
-        }
-        if (targetFile == null) {
-            throw new RuntimeException("No target plan supplied");
-        }
-
-        File sourceD = new File(sourceDir);
-        VelocityEngine velocity = new VelocityEngine();
-        velocity.setProperty(VelocityEngine.FILE_RESOURCE_LOADER_PATH, sourceD.getAbsolutePath());
-        velocity.init();
-        Template template = velocity.getTemplate(planFile);
-        StringWriter writer = new StringWriter();
-        template.merge(context, writer);
-
-        String plan = writer.toString();
-
-        XmlObject doc = XmlObject.Factory.parse(plan);
-        XmlCursor xmlCursor = doc.newCursor();
         try {
+            if (artifacts == null) {
+                throw new RuntimeException("Artifacts not supplied");
+            }
+            if (targetDir == null) {
+                throw new RuntimeException("No target directory supplied");
+            }
+            if (planFile == null) {
+                throw new RuntimeException("No source plan supplied");
+            }
+            if (targetFile == null) {
+                throw new RuntimeException("No target plan supplied");
+            }
 
-            xmlCursor.toFirstContentToken();
-            xmlCursor.toFirstChild();
-
-
-            insertPlanElements(xmlCursor, IMPORT_PROPERTY, IMPORT_QNAME);
-            insertPlanElements(xmlCursor, INCLUDE_PROPERTY, INCLUDE_QNAME);
-            insertPlanElements(xmlCursor, DEPENDENCY_PROPERTY, DEPENDENCY_QNAME);
-
-            File targetDir = new File(this.targetDir);
-            if (targetDir.exists()) {
-                if (!targetDir.isDirectory()) {
-                    throw new RuntimeException("TargetDir: " + this.targetDir + " exists
and is not a directory");
+            File sourceD = new File(sourceDir);
+            VelocityEngine velocity = new VelocityEngine();
+            velocity.setProperty(VelocityEngine.FILE_RESOURCE_LOADER_PATH, sourceD.getAbsolutePath());
+            velocity.init();
+            Template template = velocity.getTemplate(planFile);
+            StringWriter writer = new StringWriter();
+            template.merge(context, writer);
+
+            String plan = writer.toString();
+
+            XmlObject doc = XmlObject.Factory.parse(plan);
+            XmlCursor xmlCursor = doc.newCursor();
+            try {
+
+                xmlCursor.toFirstContentToken();
+                xmlCursor.toFirstChild();
+
+
+                insertPlanElements(xmlCursor, IMPORT_PROPERTY, IMPORT_QNAME);
+                insertPlanElements(xmlCursor, INCLUDE_PROPERTY, INCLUDE_QNAME);
+                insertPlanElements(xmlCursor, DEPENDENCY_PROPERTY, DEPENDENCY_QNAME);
+
+                File targetDir = new File(this.targetDir);
+                if (targetDir.exists()) {
+                    if (!targetDir.isDirectory()) {
+                        throw new RuntimeException("TargetDir: " + this.targetDir + " exists
and is not a directory");
+                    }
+                } else {
+                    targetDir.mkdirs();
                 }
-            } else {
-                targetDir.mkdirs();
+                File output = new File(targetFile);
+                XmlOptions xmlOptions = new XmlOptions();
+                xmlOptions.setSavePrettyPrint();
+                doc.save(output, xmlOptions);
+            } finally {
+                xmlCursor.dispose();
             }
-            File output = new File(targetFile);
-            XmlOptions xmlOptions = new XmlOptions();
-            xmlOptions.setSavePrettyPrint();
-            doc.save(output, xmlOptions);
-        } finally {
-            xmlCursor.dispose();
+        } catch (Exception e) {
+            log.error(e.getClass().getName()+": "+e.getMessage(), e);
+            throw e;
         }
     }
 



Mime
View raw message