cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1195989 - in /cocoon/cocoon3/trunk/cocoon-cli/src: main/java/org/apache/cocoon/cli/ test/java/org/apache/cocoon/cli/
Date Tue, 01 Nov 2011 13:28:01 GMT
Author: simonetripodi
Date: Tue Nov  1 13:28:01 2011
New Revision: 1195989

URL: http://svn.apache.org/viewvc?rev=1195989&view=rev
Log:
restored parser rules modules; depending on the printer helper is enabled or not, different
rules will be load and unused rules discarded

Added:
    cocoon/cocoon3/trunk/cocoon-cli/src/main/java/org/apache/cocoon/cli/PipelineDescriptorModule.java
  (with props)
    cocoon/cocoon3/trunk/cocoon-cli/src/main/java/org/apache/cocoon/cli/PipelineHelpModule.java
  (with props)
Modified:
    cocoon/cocoon3/trunk/cocoon-cli/src/main/java/org/apache/cocoon/cli/PipelineDescriptorParser.java
    cocoon/cocoon3/trunk/cocoon-cli/src/test/java/org/apache/cocoon/cli/PipelineDescriptorParserTestCase.java

Added: cocoon/cocoon3/trunk/cocoon-cli/src/main/java/org/apache/cocoon/cli/PipelineDescriptorModule.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-cli/src/main/java/org/apache/cocoon/cli/PipelineDescriptorModule.java?rev=1195989&view=auto
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-cli/src/main/java/org/apache/cocoon/cli/PipelineDescriptorModule.java
(added)
+++ cocoon/cocoon3/trunk/cocoon-cli/src/main/java/org/apache/cocoon/cli/PipelineDescriptorModule.java
Tue Nov  1 13:28:01 2011
@@ -0,0 +1,49 @@
+/*
+ * 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.cocoon.cli;
+
+import org.apache.cocoon.cli.CreateXMLGeneratorRule.CreateXMLGeneratorRuleProvider;
+import org.apache.cocoon.cli.PipelineCreateRule.PipelineCreateRuleProvider;
+import org.apache.cocoon.sax.component.XMLSerializer;
+import org.apache.commons.digester3.binder.AbstractRulesModule;
+
+/**
+ * Digester rules for parsing the pipeline CLI descriptor.
+ */
+final class PipelineDescriptorModule
+    extends AbstractRulesModule
+{
+
+    @Override
+    protected void configure()
+    {
+        forPattern( "pipelines" )
+            .createObject().ofType( PipelinesRegistry.class )
+            .then()
+            .setProperties()
+                .addAlias( "default", "defaultId" );
+        forPattern( "pipelines/pipeline" ).addRuleCreatedBy( new PipelineCreateRuleProvider()
);
+        forPattern( "pipelines/pipeline/generator" ).addRuleCreatedBy( new CreateXMLGeneratorRuleProvider()
);
+        forPattern( "pipelines/pipeline/serializer" )
+            .createObject().ofType( XMLSerializer.class )
+            .then()
+            .setProperties();
+    }
+
+}

Propchange: cocoon/cocoon3/trunk/cocoon-cli/src/main/java/org/apache/cocoon/cli/PipelineDescriptorModule.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/cocoon3/trunk/cocoon-cli/src/main/java/org/apache/cocoon/cli/PipelineDescriptorModule.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: cocoon/cocoon3/trunk/cocoon-cli/src/main/java/org/apache/cocoon/cli/PipelineDescriptorModule.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: cocoon/cocoon3/trunk/cocoon-cli/src/main/java/org/apache/cocoon/cli/PipelineDescriptorParser.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-cli/src/main/java/org/apache/cocoon/cli/PipelineDescriptorParser.java?rev=1195989&r1=1195988&r2=1195989&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-cli/src/main/java/org/apache/cocoon/cli/PipelineDescriptorParser.java
(original)
+++ cocoon/cocoon3/trunk/cocoon-cli/src/main/java/org/apache/cocoon/cli/PipelineDescriptorParser.java
Tue Nov  1 13:28:01 2011
@@ -27,10 +27,6 @@ import java.io.IOException;
 
 import javax.xml.validation.Schema;
 
-import org.apache.cocoon.cli.CreateXMLGeneratorRule.CreateXMLGeneratorRuleProvider;
-import org.apache.cocoon.cli.PipelineCreateRule.PipelineCreateRuleProvider;
-import org.apache.cocoon.sax.component.XMLSerializer;
-import org.apache.commons.digester3.binder.AbstractRulesModule;
 import org.apache.commons.digester3.binder.DigesterLoader;
 import org.xml.sax.SAXException;
 
@@ -39,7 +35,7 @@ final class PipelineDescriptorParser
 
     private final DigesterLoader digesterLoader;
 
-    public PipelineDescriptorParser()
+    public PipelineDescriptorParser( boolean printHelp )
     {
         Schema schema;
         try
@@ -52,26 +48,16 @@ final class PipelineDescriptorParser
             schema = null;
         }
 
-        digesterLoader = newLoader( new AbstractRulesModule()
+        if ( printHelp )
         {
+            digesterLoader = newLoader( new PipelineHelpModule() );
+        }
+        else
+        {
+            digesterLoader = newLoader( new PipelineDescriptorModule() );
+        }
 
-            @Override
-            protected void configure()
-            {
-                forPattern( "pipelines" )
-                    .createObject().ofType( PipelinesRegistry.class )
-                    .then()
-                    .setProperties()
-                        .addAlias( "default", "defaultId" );
-                forPattern( "pipelines/pipeline" ).addRuleCreatedBy( new PipelineCreateRuleProvider()
);
-                forPattern( "pipelines/pipeline/generator" ).addRuleCreatedBy( new CreateXMLGeneratorRuleProvider()
);
-                forPattern( "pipelines/pipeline/serializer" )
-                    .createObject().ofType( XMLSerializer.class )
-                    .then()
-                    .setProperties();
-            }
-
-        }).setSchema( schema );
+        digesterLoader.setSchema( schema );
     }
 
     public PipelinesRegistry parse( File pipelineDescriptorFile )

Added: cocoon/cocoon3/trunk/cocoon-cli/src/main/java/org/apache/cocoon/cli/PipelineHelpModule.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-cli/src/main/java/org/apache/cocoon/cli/PipelineHelpModule.java?rev=1195989&view=auto
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-cli/src/main/java/org/apache/cocoon/cli/PipelineHelpModule.java
(added)
+++ cocoon/cocoon3/trunk/cocoon-cli/src/main/java/org/apache/cocoon/cli/PipelineHelpModule.java
Tue Nov  1 13:28:01 2011
@@ -0,0 +1,37 @@
+/*
+ * 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.cocoon.cli;
+
+import org.apache.cocoon.cli.PipelineHelpRule.PipelineHelpRuleProvider;
+import org.apache.commons.digester3.binder.AbstractRulesModule;
+
+/**
+ * Digester rules for parsing the pipeline CLI descriptor.
+ */
+final class PipelineHelpModule
+    extends AbstractRulesModule
+{
+
+    @Override
+    protected void configure()
+    {
+        forPattern( "pipelines/pipeline" ).addRuleCreatedBy( new PipelineHelpRuleProvider()
);
+    }
+
+}

Propchange: cocoon/cocoon3/trunk/cocoon-cli/src/main/java/org/apache/cocoon/cli/PipelineHelpModule.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/cocoon3/trunk/cocoon-cli/src/main/java/org/apache/cocoon/cli/PipelineHelpModule.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: cocoon/cocoon3/trunk/cocoon-cli/src/main/java/org/apache/cocoon/cli/PipelineHelpModule.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: cocoon/cocoon3/trunk/cocoon-cli/src/test/java/org/apache/cocoon/cli/PipelineDescriptorParserTestCase.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-cli/src/test/java/org/apache/cocoon/cli/PipelineDescriptorParserTestCase.java?rev=1195989&r1=1195988&r2=1195989&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-cli/src/test/java/org/apache/cocoon/cli/PipelineDescriptorParserTestCase.java
(original)
+++ cocoon/cocoon3/trunk/cocoon-cli/src/test/java/org/apache/cocoon/cli/PipelineDescriptorParserTestCase.java
Tue Nov  1 13:28:01 2011
@@ -27,7 +27,7 @@ import org.xml.sax.SAXException;
 public final class PipelineDescriptorParserTestCase
 {
 
-    private PipelineDescriptorParser parser = new PipelineDescriptorParser();
+    private PipelineDescriptorParser parser = new PipelineDescriptorParser( false );
 
     private File testDir = new File( System.getProperty( "user.dir" ), "src/test/resources"
);
 



Mime
View raw message