cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From reinh...@apache.org
Subject svn commit: r663900 - in /cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node: AbstractSitemapNode.java PipelineNode.java Sitemap.java
Date Fri, 06 Jun 2008 11:29:18 GMT
Author: reinhard
Date: Fri Jun  6 04:29:18 2008
New Revision: 663900

URL: http://svn.apache.org/viewvc?rev=663900&view=rev
Log:
. improve logging

Modified:
    cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/AbstractSitemapNode.java
    cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/PipelineNode.java
    cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/Sitemap.java

Modified: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/AbstractSitemapNode.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/AbstractSitemapNode.java?rev=663900&r1=663899&r2=663900&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/AbstractSitemapNode.java
(original)
+++ cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/AbstractSitemapNode.java
Fri Jun  6 04:29:18 2008
@@ -30,9 +30,13 @@
 import org.apache.cocoon.corona.sitemap.Invocation;
 import org.apache.cocoon.corona.sitemap.node.annotations.NodeChild;
 import org.apache.cocoon.corona.sitemap.node.annotations.Parameter;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 public abstract class AbstractSitemapNode implements SitemapNode {
 
+    private final Log logger = LogFactory.getLog(this.getClass());
+
     private final List<SitemapNode> children = new LinkedList<SitemapNode>();
 
     private final Map<String, String> parameters = new HashMap<String, String>();
@@ -41,7 +45,9 @@
 
     public void addChild(SitemapNode child) {
         if (child == null) {
-            throw new IllegalArgumentException("Node of class " + this.getClass().getName()
+ " received null child");
+            String msg = "Node of class " + this.getClass().getName() + " received null child.";
+            this.logger.error(msg);
+            throw new IllegalArgumentException(msg);
         }
 
         if (child instanceof ParameterNode) {
@@ -56,11 +62,9 @@
                 try {
                     childField.set(this, child);
                 } catch (IllegalArgumentException e) {
-                    System.out.println("Failed to set child field for child class '" + child.getClass().getName()
-                            + "': " + e);
+                    this.logger.error("Failed to set child field for child class '" + child.getClass().getName(),
e);
                 } catch (IllegalAccessException e) {
-                    System.out.println("Failed to set child field for child class '" + child.getClass().getName()
-                            + "': " + e);
+                    this.logger.error("Failed to set child field for child class '" + child.getClass().getName(),
e);
                 }
             } else {
                 this.children.add(child);
@@ -82,7 +86,9 @@
         InvocationResult result = InvocationResult.NONE;
 
         for (SitemapNode child : this.children) {
-//            System.out.println(child + ".invoke(" + invocation.getRequestURI() + ")");
+            if (this.logger.isDebugEnabled()) {
+                this.logger.debug(child + ".invoke(" + invocation.getRequestURI() + ")");
+            }
 
             // aggregate the results of child invocations, the overall result is
             // the maximum of all individual results
@@ -119,9 +125,9 @@
                 try {
                     parameterField.set(this, value);
                 } catch (IllegalArgumentException e) {
-                    System.out.println("Failed to set parameter field " + key + ": " + e);
+                    this.logger.error("Failed to set parameter field " + key, e);
                 } catch (IllegalAccessException e) {
-                    System.out.println("Failed to set parameter field " + key + ": " + e);
+                    this.logger.error("Failed to set parameter field " + key, e);
                 }
                 continue;
             }

Modified: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/PipelineNode.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/PipelineNode.java?rev=663900&r1=663899&r2=663900&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/PipelineNode.java
(original)
+++ cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/PipelineNode.java
Fri Jun  6 04:29:18 2008
@@ -36,7 +36,7 @@
     private String id;
 
     @Parameter
-    private String type = "caching"; // "caching" is the default type
+    private final String type = "caching"; // "caching" is the default type
 
     /**
      * {@inheritDoc}
@@ -72,7 +72,7 @@
      */
     @Override
     public String toString() {
-        return "PipelineNode(" + this.id + ")";
+        return "PipelineNode(" + this.type + ")";
     }
 
     private InvocationResult handleException(Invocation invocation, Exception ex) {

Modified: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/Sitemap.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/Sitemap.java?rev=663900&r1=663899&r2=663900&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/Sitemap.java
(original)
+++ cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/Sitemap.java
Fri Jun  6 04:29:18 2008
@@ -25,20 +25,11 @@
 
     /**
      * {@inheritDoc}
-     *
+     * 
      * @see org.apache.cocoon.corona.sitemap.node.AbstractSitemapNode#invoke(org.apache.cocoon.corona.sitemap.Invocation)
      */
     @Override
     public InvocationResult invoke(Invocation invocation) {
-        // System.out.println("========================================");
-        System.out.println("Sitemap.invoke(" + invocation.getRequestURI() + ")");
-        long start = System.nanoTime();
-        try {
-            return super.invoke(invocation);
-        } finally {
-            long duration = System.nanoTime() - start;
-            // System.out.println("Finished in " + duration / 1000000d + " ms");
-            // System.out.println("========================================");
-        }
+        return super.invoke(invocation);
     }
 }



Mime
View raw message