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

svn commit: r468818 - in /geronimo/gbuild/trunk: ./ gbuild-agent-assembly/ gbuild-agent-assembly/src/main/config/manager/ gbuild-agent-assembly/src/main/config/slave/ gbuild-agent/ gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/logging/ gb...

Author: jdillon
Date: Sat Oct 28 19:04:52 2006
New Revision: 468818

URL: http://svn.apache.org/viewvc?view=rev&rev=468818
Log:
Using ${version} instead of ${pom.version}
Adding custom plexus log4j log manager impls, looks like the version that is deployed has some problems with latest log4j jars
Drop the distributed build config

Added:
    geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/logging/
    geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/logging/Log4jLogger.java   (with props)
    geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/logging/Log4jLoggerManager.java   (with props)
Modified:
    geronimo/gbuild/trunk/gbuild-agent-assembly/pom.xml
    geronimo/gbuild/trunk/gbuild-agent-assembly/src/main/config/manager/application.xml
    geronimo/gbuild/trunk/gbuild-agent-assembly/src/main/config/slave/application.xml
    geronimo/gbuild/trunk/gbuild-agent/pom.xml
    geronimo/gbuild/trunk/gbuild-agent/src/main/resources/META-INF/plexus/components.xml
    geronimo/gbuild/trunk/gbuild-extensions/gbuild-requeue-extensions/pom.xml
    geronimo/gbuild/trunk/gbuild-extensions/gbuild-standard-extensions/pom.xml
    geronimo/gbuild/trunk/gbuild-extensions/pom.xml
    geronimo/gbuild/trunk/pom.xml

Modified: geronimo/gbuild/trunk/gbuild-agent-assembly/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gbuild/trunk/gbuild-agent-assembly/pom.xml?view=diff&rev=468818&r1=468817&r2=468818
==============================================================================
--- geronimo/gbuild/trunk/gbuild-agent-assembly/pom.xml (original)
+++ geronimo/gbuild/trunk/gbuild-agent-assembly/pom.xml Sat Oct 28 19:04:52 2006
@@ -39,31 +39,31 @@
         <dependency>
             <groupId>org.apache.geronimo.gbuild</groupId>
             <artifactId>gbuild-agent</artifactId>
-            <version>${pom.version}</version>
+            <version>${version}</version>
         </dependency>
 
         <dependency>
             <groupId>org.apache.geronimo.gbuild.extension</groupId>
             <artifactId>gbuild-standard-extensions</artifactId>
-            <version>${pom.version}</version>
+            <version>${version}</version>
         </dependency>
 
         <dependency>
             <groupId>org.apache.geronimo.gbuild.extension</groupId>
             <artifactId>gbuild-activity-extensions</artifactId>
-            <version>${pom.version}</version>
+            <version>${version}</version>
         </dependency>
 
         <dependency>
             <groupId>org.apache.geronimo.gbuild.extension</groupId>
             <artifactId>gbuild-requeue-extensions</artifactId>
-            <version>${pom.version}</version>
+            <version>${version}</version>
         </dependency>
         
         <dependency>
             <groupId>org.apache.geronimo.gbuild</groupId>
             <artifactId>gbuild-commands</artifactId>
-            <version>${pom.version}</version>
+            <version>${version}</version>
         </dependency>
 
         <!-- GShell Support -->
@@ -96,15 +96,6 @@
             <groupId>log4j</groupId>
             <artifactId>log4j</artifactId>
         </dependency>
-        
-        <!-- Plexus Components -->
-        
-        <dependency>
-            <groupId>org.codehaus.plexus</groupId>
-            <artifactId>plexus-log4j-logging</artifactId>
-            <version>1.1-alpha-2</version>
-        </dependency>
-        
         
         <!-- ActiveMQ Support -->
 

Modified: geronimo/gbuild/trunk/gbuild-agent-assembly/src/main/config/manager/application.xml
URL: http://svn.apache.org/viewvc/geronimo/gbuild/trunk/gbuild-agent-assembly/src/main/config/manager/application.xml?view=diff&rev=468818&r1=468817&r2=468818
==============================================================================
--- geronimo/gbuild/trunk/gbuild-agent-assembly/src/main/config/manager/application.xml (original)
+++ geronimo/gbuild/trunk/gbuild-agent-assembly/src/main/config/manager/application.xml Sat Oct 28 19:04:52 2006
@@ -57,7 +57,7 @@
         
         <component>
             <role>org.codehaus.plexus.logging.LoggerManager</role>
-            <implementation>org.codehaus.plexus.logging.log4j.ExternalLog4JLoggerManager</implementation>
+            <implementation>org.apache.geronimo.gbuild.agent.logging.Log4jLoggerManager</implementation>
         </component>
         
         <component>

Modified: geronimo/gbuild/trunk/gbuild-agent-assembly/src/main/config/slave/application.xml
URL: http://svn.apache.org/viewvc/geronimo/gbuild/trunk/gbuild-agent-assembly/src/main/config/slave/application.xml?view=diff&rev=468818&r1=468817&r2=468818
==============================================================================
--- geronimo/gbuild/trunk/gbuild-agent-assembly/src/main/config/slave/application.xml (original)
+++ geronimo/gbuild/trunk/gbuild-agent-assembly/src/main/config/slave/application.xml Sat Oct 28 19:04:52 2006
@@ -37,7 +37,7 @@
         
         <component>
             <role>org.codehaus.plexus.logging.LoggerManager</role>
-            <implementation>org.codehaus.plexus.logging.log4j.ExternalLog4JLoggerManager</implementation>
+            <implementation>org.apache.geronimo.gbuild.agent.logging.Log4jLoggerManager</implementation>
         </component>
         
         <component>

Modified: geronimo/gbuild/trunk/gbuild-agent/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gbuild/trunk/gbuild-agent/pom.xml?view=diff&rev=468818&r1=468817&r2=468818
==============================================================================
--- geronimo/gbuild/trunk/gbuild-agent/pom.xml (original)
+++ geronimo/gbuild/trunk/gbuild-agent/pom.xml Sat Oct 28 19:04:52 2006
@@ -71,6 +71,11 @@
             <groupId>org.codehaus.swizzle</groupId>
             <artifactId>swizzle-stream</artifactId>
         </dependency>
+        
+        <dependency>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+        </dependency>
     </dependencies>
 
 </project>

Added: geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/logging/Log4jLogger.java
URL: http://svn.apache.org/viewvc/geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/logging/Log4jLogger.java?view=auto&rev=468818
==============================================================================
--- geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/logging/Log4jLogger.java (added)
+++ geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/logging/Log4jLogger.java Sat Oct 28 19:04:52 2006
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.gbuild.agent.logging;
+
+import org.codehaus.plexus.logging.AbstractLogger;
+
+import org.apache.log4j.Logger;
+
+//
+// NOTE: Duplicated from plexus-logging/plexus-log4j-logging to avoid certain MNFE errors
+//       due to the plexus version be compiled against an incompatible Log4j.
+//
+
+/**
+ * Logger which delgates to logger from Log4j framwork.
+ *
+ * @version $Rev$ $Date$
+ */
+public class Log4jLogger
+    extends AbstractLogger
+{
+    private Logger logger;
+
+    public Log4jLogger(int threshold, Logger logger) {
+        super(threshold, getLoggerName(logger));
+
+        if (null == logger) {
+            throw new IllegalArgumentException("Logger cannot be null");
+        }
+
+        this.logger = logger;
+    }
+
+    public void debug(String message) {
+        logger.debug(message);
+    }
+
+    public void debug(String message, Throwable throwable) {
+        logger.debug(message, throwable);
+    }
+
+    public void info(String message) {
+        logger.info(message);
+    }
+
+    public void info(String message, Throwable throwable) {
+        logger.info(message, throwable);
+    }
+
+    public void warn(String message) {
+        logger.warn(message);
+    }
+
+    public void warn(String message, Throwable throwable) {
+        logger.warn(message, throwable);
+    }
+
+    public void error(String message) {
+        logger.error(message);
+    }
+
+    public void error(String message, Throwable throwable) {
+        logger.error(message, throwable);
+    }
+
+    public void fatalError(String message) {
+        logger.fatal(message);
+    }
+
+    public void fatalError(String message, Throwable throwable) {
+        logger.fatal(message, throwable);
+    }
+
+    public String getName() {
+        return logger.getName();
+    }
+
+    public org.codehaus.plexus.logging.Logger getChildLogger(String name) {
+        return new Log4jLogger(getThreshold(), Logger.getLogger(logger.getName() + "." + name));
+    }
+
+    private static String getLoggerName(Logger logger) {
+        if (logger == null) {
+            return "";
+        }
+
+        return logger.getName();
+    }
+}
\ No newline at end of file

Propchange: geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/logging/Log4jLogger.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/logging/Log4jLogger.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/logging/Log4jLogger.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/logging/Log4jLoggerManager.java
URL: http://svn.apache.org/viewvc/geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/logging/Log4jLoggerManager.java?view=auto&rev=468818
==============================================================================
--- geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/logging/Log4jLoggerManager.java (added)
+++ geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/logging/Log4jLoggerManager.java Sat Oct 28 19:04:52 2006
@@ -0,0 +1,178 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.gbuild.agent.logging;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.codehaus.plexus.logging.AbstractLogger;
+import org.codehaus.plexus.logging.AbstractLoggerManager;
+import org.codehaus.plexus.logging.Logger;
+import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
+
+//
+// NOTE: Duplicated from plexus-logging/plexus-log4j-logging to avoid certain MNFE errors
+//       due to the plexus version be compiled against an incompatible Log4j.
+//
+
+/**
+ * Base class for all LoggerManagers which use cache of Loggers.
+ *
+ * @version $Rev$ $Date$
+ */
+public class Log4jLoggerManager
+    extends AbstractLoggerManager
+    implements Initializable
+{
+    private Map loggerCache = new HashMap();
+
+    private String threshold = "info";
+
+    private int currentThreshold;
+
+    public void initialize() {
+        currentThreshold = parseThreshold(threshold);
+
+        if (currentThreshold == -1) {
+            currentThreshold = Logger.LEVEL_DEBUG;
+        }
+    }
+
+    protected int parseThreshold(String text) {
+        text = text.trim().toLowerCase();
+
+        if (text.equals("debug")) {
+            return Logger.LEVEL_DEBUG;
+        }
+        else if (text.equals("info")) {
+            return Logger.LEVEL_INFO;
+        }
+        else if (text.equals("warn")) {
+            return Logger.LEVEL_WARN;
+        }
+        else if (text.equals("error")) {
+            return Logger.LEVEL_ERROR;
+        }
+        else if (text.equals("fatal")) {
+            return Logger.LEVEL_FATAL;
+        }
+
+        return -1;
+    }
+
+    /**
+     * Sets the threshold for all new loggers. It will NOT affect the existing loggers.
+     * <p/>
+     * This is usually only set once while the logger manager is configured.
+     *
+     * @param currentThreshold The new threshold.
+     */
+    public void setThreshold(int currentThreshold) {
+        this.currentThreshold = currentThreshold;
+    }
+
+    /**
+     * Returns the current threshold for all new loggers.
+     *
+     * @return Returns the current threshold for all new loggers.
+     */
+    public int getThreshold() {
+        return currentThreshold;
+    }
+
+    public void setThreshold(String role, String roleHint, int threshold) {
+        AbstractLogger logger;
+
+        String key = toMapKey(role, roleHint);
+
+        logger = (AbstractLogger) loggerCache.get(key);
+
+        if (logger == null) {
+            return; // nothing to do
+        }
+
+        logger.setThreshold(threshold);
+    }
+
+    public int getThreshold(String role, String roleHint) {
+        AbstractLogger logger;
+
+        String key = toMapKey(role, roleHint);
+
+        logger = (AbstractLogger) loggerCache.get(key);
+
+        if (logger == null) {
+            return Logger.LEVEL_DEBUG; // does not return null because that could create a NPE
+        }
+
+        return logger.getThreshold();
+    }
+
+    public Logger getLoggerForComponent(String role, String roleHint) {
+        Logger logger;
+
+        String key = toMapKey(role, roleHint);
+
+        logger = (Logger) loggerCache.get(key);
+
+        if (logger != null) {
+            return logger;
+        }
+
+        logger = createLogger(key);
+
+        loggerCache.put(key, logger);
+
+        return logger;
+    }
+
+    public void returnComponentLogger(String role, String roleHint) {
+        Object obj;
+
+        String key = toMapKey(role, roleHint);
+
+        obj = loggerCache.remove(key);
+
+        if (obj == null) {
+            // TODO: use a logger!
+            System.err.println("There was no such logger '" + key + "' " + hashCode() + ".");
+        }
+    }
+
+    public int getActiveLoggerCount() {
+        return loggerCache.size();
+    }
+
+    public Logger createLogger(String key) {
+        Logger logger = new Log4jLogger(getThreshold(), org.apache.log4j.Logger.getLogger(key));
+
+        return logger;
+    }
+    
+    public String getThresholdAsString() {
+        String retValue = threshold;
+
+        if (retValue != null) {
+            retValue = retValue.toUpperCase();
+        }
+
+        return retValue;
+    }
+}
\ No newline at end of file

Propchange: geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/logging/Log4jLoggerManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/logging/Log4jLoggerManager.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/logging/Log4jLoggerManager.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/gbuild/trunk/gbuild-agent/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewvc/geronimo/gbuild/trunk/gbuild-agent/src/main/resources/META-INF/plexus/components.xml?view=diff&rev=468818&r1=468817&r2=468818
==============================================================================
--- geronimo/gbuild/trunk/gbuild-agent/src/main/resources/META-INF/plexus/components.xml (original)
+++ geronimo/gbuild/trunk/gbuild-agent/src/main/resources/META-INF/plexus/components.xml Sat Oct 28 19:04:52 2006
@@ -61,27 +61,7 @@
                 <build-output-directory>agent/output</build-output-directory>
             </configuration>
         </component>
-
-        <component>
-            <role>org.codehaus.plexus.action.Action</role>
-            <role-hint>execute-builder</role-hint>
-            <implementation>org.apache.geronimo.gbuild.agent.continuum.ExecuteDistributedBuilderContinuumAction</implementation>
-            <requirements>
-                <requirement>
-                    <role>org.apache.maven.continuum.configuration.ConfigurationService</role>
-                </requirement>
-                <requirement>
-                    <role>org.apache.maven.continuum.execution.manager.BuildExecutorManager</role>
-                </requirement>
-                <requirement>
-                    <role>org.apache.maven.continuum.notification.ContinuumNotificationDispatcher</role>
-                </requirement>
-                <requirement>
-                    <role>org.apache.maven.continuum.store.ContinuumStore</role>
-                </requirement>
-            </requirements>
-        </component>
-
+        
         <component>
             <role>org.codehaus.plexus.component.factory.ComponentFactory</role>
             <implementation>org.apache.geronimo.gbuild.agent.continuum.ThreadContextContinuumStoreFactory</implementation>

Modified: geronimo/gbuild/trunk/gbuild-extensions/gbuild-requeue-extensions/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gbuild/trunk/gbuild-extensions/gbuild-requeue-extensions/pom.xml?view=diff&rev=468818&r1=468817&r2=468818
==============================================================================
--- geronimo/gbuild/trunk/gbuild-extensions/gbuild-requeue-extensions/pom.xml (original)
+++ geronimo/gbuild/trunk/gbuild-extensions/gbuild-requeue-extensions/pom.xml Sat Oct 28 19:04:52 2006
@@ -35,7 +35,7 @@
         <dependency>
             <groupId>org.apache.geronimo.gbuild.extension</groupId>
             <artifactId>gbuild-activity-extensions</artifactId>
-            <version>${pom.version}</version>
+            <version>${version}</version>
         </dependency>
     </dependencies>
 

Modified: geronimo/gbuild/trunk/gbuild-extensions/gbuild-standard-extensions/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gbuild/trunk/gbuild-extensions/gbuild-standard-extensions/pom.xml?view=diff&rev=468818&r1=468817&r2=468818
==============================================================================
--- geronimo/gbuild/trunk/gbuild-extensions/gbuild-standard-extensions/pom.xml (original)
+++ geronimo/gbuild/trunk/gbuild-extensions/gbuild-standard-extensions/pom.xml Sat Oct 28 19:04:52 2006
@@ -40,7 +40,7 @@
         <dependency>
             <groupId>org.apache.geronimo.gbuild.extension</groupId>
             <artifactId>gbuild-activity-extensions</artifactId>
-            <version>${pom.version}</version>
+            <version>${version}</version>
         </dependency>
     </dependencies>
 

Modified: geronimo/gbuild/trunk/gbuild-extensions/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gbuild/trunk/gbuild-extensions/pom.xml?view=diff&rev=468818&r1=468817&r2=468818
==============================================================================
--- geronimo/gbuild/trunk/gbuild-extensions/pom.xml (original)
+++ geronimo/gbuild/trunk/gbuild-extensions/pom.xml Sat Oct 28 19:04:52 2006
@@ -40,7 +40,7 @@
         <dependency>
             <groupId>org.apache.geronimo.gbuild</groupId>
             <artifactId>gbuild-agent</artifactId>
-            <version>${pom.version}</version>
+            <version>${version}</version>
         </dependency>
     </dependencies>
     

Modified: geronimo/gbuild/trunk/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gbuild/trunk/pom.xml?view=diff&rev=468818&r1=468817&r2=468818
==============================================================================
--- geronimo/gbuild/trunk/pom.xml (original)
+++ geronimo/gbuild/trunk/pom.xml Sat Oct 28 19:04:52 2006
@@ -53,7 +53,19 @@
     </issueManagement>
 
     <inceptionYear>2005</inceptionYear>
-
+    
+    <properties>
+        <!--
+        NOTE: Project version, to be used instead of ${pom.version} since that
+              value magically changes when using SNAPSHOT versions.
+              
+              This value *must* be kept in sync with the value of the <version>
+              element, and it will need to be changed manually before a release,
+              as the maven-release-plugin will not update this value.
+        -->
+        <version>1.0-SNAPSHOT</version>
+    </properties>
+    
     <developers>
         <developer>
             <id>dblevins</id>