cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From reinh...@apache.org
Subject svn commit: r619826 - in /cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor: TreeProcessor.java sitemap/SitemapLanguage.java
Date Fri, 08 Feb 2008 10:41:13 GMT
Author: reinhard
Date: Fri Feb  8 02:41:12 2008
New Revision: 619826

URL: http://svn.apache.org/viewvc?rev=619826&view=rev
Log:
- improve comments and variable names
- remove commented stuff

Modified:
    cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java
    cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/SitemapLanguage.java

Modified: cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java?rev=619826&r1=619825&r2=619826&view=diff
==============================================================================
--- cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java
(original)
+++ cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java
Fri Feb  8 02:41:12 2008
@@ -87,13 +87,14 @@
     public TreeProcessor() {
         // create sitemap schema
         final SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
-        final StreamSource ss = new StreamSource(this.getClass().getResourceAsStream("/org/apache/cocoon/sitemap/schema/cocoon-sitemap-1.0.xsd"));
+        final StreamSource streamSource = new StreamSource(this.getClass().getResourceAsStream(
+                "/org/apache/cocoon/sitemap/schema/cocoon-sitemap-1.0.xsd"));
         try {
-            this.sitemapSchema = factory.newSchema(ss);
+            this.sitemapSchema = factory.newSchema(streamSource);
         } catch (SAXException se) {
             throw new RuntimeException("Unable to parse sitemap schema.", se);
         }
-        this.sitemapExecutor =  new DefaultExecutor();
+        this.sitemapExecutor = new DefaultExecutor();
     }
 
     /**
@@ -208,8 +209,8 @@
         }
     }
 
-    private Configuration createSitemapProgram(Source sitemapSource)
-    throws ProcessingException, SAXException, IOException {
+    private Configuration createSitemapProgram(Source sitemapSource) throws ProcessingException,
SAXException,
+            IOException {
         // do we validate? Default is false
         final String value = this.settings.getProperty("org.apache.cocoon.sitemap.validating",
"false");
         if ( Boolean.valueOf(value).booleanValue() ) {
@@ -238,25 +239,7 @@
             return;
         }
 
-        long startTime = System.currentTimeMillis();
-        ConcreteTreeProcessor concreteTreeProcessor;
-        ConcreteTreeProcessor oldProcessor = this.concreteProcessor;
-
-        if (oldProcessor != null) {
-            if (getLogger().isDebugEnabled()) {
-                getLogger().debug("found a previous ConcreteTreeProcessor");
-            }
-        } else {
-            if (getLogger().isDebugEnabled()) {
-                getLogger().debug("first version of the ConcreteTreeProcessor");
-            }
-        }
-
-        // Dispose the old processor, if any
-        if (oldProcessor != null) {
-            oldProcessor.markForDisposal();
-        }
-
+        long startTime = System.nanoTime();
 
         // We have to do a call to enterProcessor() here as during building
         // of the tree, components (e.g. actions) are already instantiated
@@ -270,14 +253,14 @@
 
             Configuration sitemapProgram = createSitemapProgram(this.source);
 
-            concreteTreeProcessor = new ConcreteTreeProcessor(this, this.sitemapExecutor);
+            this.concreteProcessor = new ConcreteTreeProcessor(this, this.sitemapExecutor);
 
             // Get the treebuilder that can handle this version of the sitemap.
             TreeBuilder treeBuilder = getTreeBuilder(sitemapProgram);
             try {
-                treeBuilder.setProcessor(concreteTreeProcessor);
+                treeBuilder.setProcessor(this.concreteProcessor);
                 ProcessingNode root = treeBuilder.build(sitemapProgram, this.source.getURI());
-                concreteTreeProcessor.setProcessorData(
+                this.concreteProcessor.setProcessorData(
                         treeBuilder.getWebApplicationContext(),
                         root,
                         treeBuilder.getDisposableNodes());
@@ -290,7 +273,7 @@
                 FlowNode flowNode = (FlowNode)treeBuilder.getRegisteredNode("flow");
                 if ( flowNode != null ) {
                     final Interpreter interpreter = flowNode.getInterpreter();
-                    concreteTreeProcessor.setAttribute(Interpreter.ROLE, interpreter);
+                    this.concreteProcessor.setAttribute(Interpreter.ROLE, interpreter);
                 }
 
             } finally {
@@ -301,17 +284,11 @@
         }
 
         if (getLogger().isDebugEnabled()) {
-            double time = (System.currentTimeMillis() - startTime) / 1000.0;
+            double time = (System.nanoTime() - startTime) / 1000.0 / 1000000;
             getLogger().debug("TreeProcessor built in " + time + " secs from " + source.getURI());
         }
-
-        // Switch to the new processor (ensure it's never temporarily null)
-        this.concreteProcessor = concreteTreeProcessor;
     }
 
-    /**
-     * @see org.apache.avalon.framework.activity.Disposable#dispose()
-     */
     public void destroy() {
         // Dispose the concrete processor. No need to check for existing requests, as there
         // are none when a TreeProcessor is disposed.

Modified: cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/SitemapLanguage.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/SitemapLanguage.java?rev=619826&r1=619825&r2=619826&view=diff
==============================================================================
--- cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/SitemapLanguage.java
(original)
+++ cocoon/whiteboard/micro/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/SitemapLanguage.java
Fri Feb  8 02:41:12 2008
@@ -105,13 +105,6 @@
      * The namespace of configuration for the processor that we are building.
      */
     protected String itsNamespace;
-//
-//    /**
-//     * The service manager for the processor that we are building.
-//     */
-//    private ServiceManager itsManager;
-//
-//    private WebApplicationContext itsContainer;
 
     /**
      * Helper object which sets up components in the context of the processor
@@ -766,7 +759,9 @@
     }
 
     /**
-     * Extract pipeline-hints from the given statement (if any exist)
+     * Extract pipeline-hints from the given statement (if any exist). See
+     * {@link http://marc.info/?l=xml-cocoon-dev&m=103097489015888&w=2} for an
+     * explanation of pipeline-hints.
      *
      * @param role
      *            the component role (e.g. <code>Generator.ROLE</code>)



Mime
View raw message