geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r607674 - /geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/
Date Mon, 31 Dec 2007 05:16:27 GMT
Author: djencks
Date: Sun Dec 30 21:16:26 2007
New Revision: 607674

URL: http://svn.apache.org/viewvc?rev=607674&view=rev
Log:
GERONIMO-3723 provide a recording LifecycleMonitor so we can find out what went wrong

Added:
    geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/RecordingLifecycleMonitor.java
  (with props)
Modified:
    geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/DebugLoggingLifecycleMonitor.java
    geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/LifecycleMonitor.java
    geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/NullLifecycleMonitor.java
    geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java

Modified: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/DebugLoggingLifecycleMonitor.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/DebugLoggingLifecycleMonitor.java?rev=607674&r1=607673&r2=607674&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/DebugLoggingLifecycleMonitor.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/DebugLoggingLifecycleMonitor.java
Sun Dec 30 21:16:26 2007
@@ -38,6 +38,10 @@
         log.debug("added module: " + configurationId);
     }
 
+    public void resolving(Artifact configurationId) {
+        log.debug("resolving dependencies for module: " + configurationId);
+    }
+
     public void reading(Artifact configurationId) {
         log.debug("reading module: " + configurationId);
     }

Modified: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/LifecycleMonitor.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/LifecycleMonitor.java?rev=607674&r1=607673&r2=607674&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/LifecycleMonitor.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/LifecycleMonitor.java
Sun Dec 30 21:16:26 2007
@@ -55,6 +55,12 @@
     void addConfiguration(Artifact configurationId);
 
     /**
+     * The configuration manager has started resolving the dependencies of the specified
configuration.
+     * @param configurationId the configuration identifier
+     */
+    void resolving(Artifact configurationId);
+
+    /**
      * The configuration manager has started reading the specified configuration.
      * @param configurationId the configuration identifier
      */

Modified: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/NullLifecycleMonitor.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/NullLifecycleMonitor.java?rev=607674&r1=607673&r2=607674&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/NullLifecycleMonitor.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/NullLifecycleMonitor.java
Sun Dec 30 21:16:26 2007
@@ -27,6 +27,9 @@
     public void addConfiguration(Artifact configurationId) {
     }
 
+    public void resolving(Artifact configurationId) {
+    }
+
     public void reading(Artifact configurationId) {
     }
 

Added: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/RecordingLifecycleMonitor.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/RecordingLifecycleMonitor.java?rev=607674&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/RecordingLifecycleMonitor.java
(added)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/RecordingLifecycleMonitor.java
Sun Dec 30 21:16:26 2007
@@ -0,0 +1,145 @@
+/*
+ * 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.kernel.config;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.geronimo.kernel.repository.Artifact;
+
+/**
+ * @version $Rev:$ $Date:$
+ */
+public class RecordingLifecycleMonitor implements LifecycleMonitor{
+    private final List<Event> events = new ArrayList<Event>();
+
+    public void addConfiguration(Artifact configurationId) {
+        events.add(new Event(Action.ADD, configurationId));
+    }
+
+    public void resolving(Artifact configurationId) {
+        events.add(new Event(Action.RESOLVING, configurationId));
+    }
+
+    public void reading(Artifact configurationId) {
+        events.add(new Event(Action.READING, configurationId));
+    }
+
+    public void loading(Artifact configurationId) {
+        events.add(new Event(Action.LOADING, configurationId));
+    }
+
+    public void starting(Artifact configurationId) {
+        events.add(new Event(Action.STARTING, configurationId));
+    }
+
+    public void stopping(Artifact configurationId) {
+        events.add(new Event(Action.STOPPING, configurationId));
+    }
+
+    public void unloading(Artifact configurationId) {
+        events.add(new Event(Action.UNLOADING, configurationId));
+    }
+
+    public void succeeded(Artifact configurationId) {
+        events.add(new Event(Action.SUCCEEDED, configurationId));
+    }
+
+    public void failed(Artifact configurationId, Throwable cause) {
+        events.add(new FailedEvent(configurationId, cause));
+    }
+
+    public void finished() {
+        events.add(new Event(Action.FINISHED, null));
+    }
+
+    public List<Event> getEvents() {
+        return Collections.unmodifiableList(events);
+    }
+
+    @Override
+    public String toString() {
+        StringBuffer buf = new StringBuffer();
+        for (Event event: events) {
+            buf.append(event.toString()).append("\n");
+        }
+        return buf.toString();
+    }
+
+    private static enum Action {
+
+        ADD,
+        RESOLVING,
+        READING,
+        LOADING,
+        STARTING,
+        STOPPING,
+        UNLOADING,
+        SUCCEEDED,
+        FAILED,
+        FINISHED
+    }
+
+    private static class Event {
+        private final Action action;
+        private final Artifact artifact;
+
+        private Event(Action action, Artifact artifact) {
+            this.action = action;
+            this.artifact = artifact;
+        }
+
+        public Action getAction() {
+            return action;
+        }
+
+        public Artifact getArtifact() {
+            return artifact;
+        }
+
+        @Override
+        public String toString() {
+            if (artifact == null) {
+                return action.toString();
+            }
+            return artifact.toString() + ": " + action.toString();
+        }
+    }
+
+    private static class FailedEvent extends Event {
+        private final Throwable cause;
+
+        private FailedEvent(Artifact artifact, Throwable cause) {
+            super(Action.FAILED, artifact);
+            this.cause = cause;
+        }
+
+        public Throwable getCause() {
+            return cause;
+        }
+
+        @Override
+        public String toString() {
+            return super.toString() + ": " + cause.getMessage();
+        }
+    }
+}

Propchange: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/RecordingLifecycleMonitor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/RecordingLifecycleMonitor.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/RecordingLifecycleMonitor.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java?rev=607674&r1=607673&r2=607674&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java
Sun Dec 30 21:16:26 2007
@@ -427,8 +427,10 @@
         // if this parent hasn't already been processed, iterate into the parent
         Artifact configurationId = configurationData.getId();
         if (!configurationsToLoad.containsKey(configurationId)) {
+            monitor.resolving(configurationId);
             LinkedHashSet resolvedParentIds = resolveParentIds(configurationData);
-
+            monitor.succeeded(configurationId);
+            
             for (Iterator iterator = resolvedParentIds.iterator(); iterator.hasNext();) {
                 Artifact parentId = (Artifact) iterator.next();
                 // if this parent id hasn't already been loaded and is actually a configuration



Mime
View raw message