geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r439899 - in /geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/main: java/org/apache/geronimo/mavenplugins/geronimo/ resources/
Date Mon, 04 Sep 2006 01:54:21 GMT
Author: jdillon
Date: Sun Sep  3 18:54:20 2006
New Revision: 439899

URL: http://svn.apache.org/viewvc?view=rev&rev=439899
Log:
Adding a maven plugin Log to JCL Log adapter
Hooking it up, forcefully since geronimo-kernel tries to install its own logging bits
This basically allows helper objects (like ServerProxy) to use JCL, but have it really go
to Maven

Added:
    geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/MavenPluginLog.java
  (with props)
    geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/main/resources/
    geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/main/resources/commons-logging.properties
  (with props)
Modified:
    geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/ServerMojoSupport.java
    geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/ServerProxy.java

Added: geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/MavenPluginLog.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/MavenPluginLog.java?view=auto&rev=439899
==============================================================================
--- geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/MavenPluginLog.java
(added)
+++ geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/MavenPluginLog.java
Sun Sep  3 18:54:20 2006
@@ -0,0 +1,135 @@
+/*
+ *  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.mavenplugins.geronimo;
+
+import org.apache.commons.logging.Log;
+
+import java.io.Serializable;
+
+/**
+ * ???
+ *
+ * @version $Rev$ $Date$
+ */
+public class MavenPluginLog
+    implements Log, Serializable
+{
+    private static org.apache.maven.plugin.logging.Log log;
+
+    public static void setLog(final org.apache.maven.plugin.logging.Log log) {
+        assert log != null;
+        
+        MavenPluginLog.log = log;
+    }
+
+    public static org.apache.maven.plugin.logging.Log getLog() {
+        if (log == null) {
+            throw new RuntimeException("Maven plugin log delegate as not been initialized");
+        }
+
+        return log;
+    }
+
+    private String name;
+
+    public MavenPluginLog(final String name) {
+        assert name != null;
+        
+        this.name = name;
+    }
+
+    public boolean isDebugEnabled() {
+        return getLog().isDebugEnabled();
+    }
+
+    public boolean isErrorEnabled() {
+        return getLog().isErrorEnabled();
+    }
+
+    public boolean isFatalEnabled() {
+        return getLog().isErrorEnabled();
+    }
+
+    public boolean isInfoEnabled() {
+        return getLog().isInfoEnabled();
+    }
+
+    public boolean isTraceEnabled() {
+        return getLog().isDebugEnabled();
+    }
+
+    public boolean isWarnEnabled() {
+        return getLog().isWarnEnabled();
+    }
+
+    private String createMessage(final Object object) {
+        if (isDebugEnabled()) {
+            return "(" + name + ") " + object;
+        }
+        else {
+            return String.valueOf(object);
+        }
+    }
+    
+    public void trace(Object object) {
+        debug(object);
+    }
+
+    public void trace(Object object, Throwable throwable) {
+        debug(object, throwable);
+    }
+
+    public void debug(Object object) {
+        getLog().debug(createMessage(object));
+    }
+
+    public void debug(Object object, Throwable throwable) {
+        getLog().debug(createMessage(object), throwable);
+    }
+
+    public void info(Object object) {
+        getLog().info(createMessage(object));
+    }
+
+    public void info(Object object, Throwable throwable) {
+        getLog().info(createMessage(object), throwable);
+    }
+
+    public void warn(Object object) {
+        getLog().warn(createMessage(object));
+    }
+
+    public void warn(Object object, Throwable throwable) {
+        getLog().warn(createMessage(object), throwable);
+    }
+
+    public void error(Object object) {
+        getLog().error(createMessage(object));
+    }
+
+    public void error(Object object, Throwable throwable) {
+        getLog().error(createMessage(object), throwable);
+    }
+
+    public void fatal(Object object) {
+        error(object);
+    }
+
+    public void fatal(Object object, Throwable throwable) {
+        error(object, throwable);
+    }
+}
\ No newline at end of file

Propchange: geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/MavenPluginLog.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/MavenPluginLog.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/MavenPluginLog.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/ServerMojoSupport.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/ServerMojoSupport.java?view=diff&rev=439899&r1=439898&r2=439899
==============================================================================
--- geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/ServerMojoSupport.java
(original)
+++ geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/ServerMojoSupport.java
Sun Sep  3 18:54:20 2006
@@ -16,8 +16,11 @@
 
 package org.apache.geronimo.mavenplugins.geronimo;
 
-import org.apache.geronimo.genesis.AntMojoSupport;
 import org.apache.maven.project.MavenProject;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+
+import org.apache.geronimo.genesis.AntMojoSupport;
 
 /**
  * Support for Geronimo server mojos.
@@ -27,6 +30,17 @@
 public abstract class ServerMojoSupport
     extends AntMojoSupport
 {
+    static {
+        //
+        // HACK: Since this module needs to pick up some classes from geronimo-kernel, and
since
+        //       that module assumes that you want to use its logging, we have to forcefully
+        //       configure JCL to use its defaults, and tell the Geronomo logging not to
bootstrap iniitalize.
+        //
+        
+        System.setProperty("org.apache.commons.logging.LogFactory", "org.apache.commons.logging.impl.LogFactoryImpl");
+        System.setProperty("geronimo.bootstrap.logging.enabled", "false");
+    }
+    
     /**
      * The port number to connect to the server..
      *
@@ -63,5 +77,12 @@
 
     protected MavenProject getProject() {
         return project;
+    }
+
+    protected void init() throws MojoExecutionException, MojoFailureException {
+        super.init();
+
+        // Install the bridge from JCL to this plugins Log
+        MavenPluginLog.setLog(log);
     }
 }

Modified: geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/ServerProxy.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/ServerProxy.java?view=diff&rev=439899&r1=439898&r2=439899
==============================================================================
--- geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/ServerProxy.java
(original)
+++ geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo/ServerProxy.java
Sun Sep  3 18:54:20 2006
@@ -83,12 +83,12 @@
     private void init(final JMXServiceURL url, final Map environment) throws Exception {
         assert url != null;
         assert environment != null;
-
+        
         this.url = url;
         this.environment = new HashMap();
         this.environment.put("jmx.remote.credentials", new String[] {"system", "manager"});
 
-        log.info("Initialized with URL: " + url);
+        log.debug("Initialized with URL: " + url + ", environment: " + environment);
     }
 
     private MBeanServerConnection getConnection() throws IOException {
@@ -137,6 +137,8 @@
     }
 
     public void shutdown() {
+        log.info("Attempting to shutdown the remote server");
+        
         try {
             invoke("shutdown");
         }

Added: geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/main/resources/commons-logging.properties
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/main/resources/commons-logging.properties?view=auto&rev=439899
==============================================================================
--- geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/main/resources/commons-logging.properties
(added)
+++ geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/main/resources/commons-logging.properties
Sun Sep  3 18:54:20 2006
@@ -0,0 +1,5 @@
+##
+## $Rev$ $Date$
+##
+
+org.apache.commons.logging.Log=org.apache.geronimo.mavenplugins.geronimo.MavenPluginLog
\ No newline at end of file

Propchange: geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/main/resources/commons-logging.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/main/resources/commons-logging.properties
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/main/resources/commons-logging.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message