cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1195919 - in /cocoon/cocoon3/trunk/cocoon-cli/src/main/java/org/apache/cocoon/cli: CreateXMLGeneratorRule.java PipelineDescriptorModule.java
Date Tue, 01 Nov 2011 10:32:03 GMT
Author: simonetripodi
Date: Tue Nov  1 10:32:02 2011
New Revision: 1195919

URL: http://svn.apache.org/viewvc?rev=1195919&view=rev
Log:
first checkin of CreateXMLGeneratorRule, plugged the generator rule

Added:
    cocoon/cocoon3/trunk/cocoon-cli/src/main/java/org/apache/cocoon/cli/CreateXMLGeneratorRule.java
  (with props)
Modified:
    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/CreateXMLGeneratorRule.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-cli/src/main/java/org/apache/cocoon/cli/CreateXMLGeneratorRule.java?rev=1195919&view=auto
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-cli/src/main/java/org/apache/cocoon/cli/CreateXMLGeneratorRule.java
(added)
+++ cocoon/cocoon3/trunk/cocoon-cli/src/main/java/org/apache/cocoon/cli/CreateXMLGeneratorRule.java
Tue Nov  1 10:32:02 2011
@@ -0,0 +1,66 @@
+/*
+ * 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 java.io.File;
+import java.net.URL;
+
+import org.apache.cocoon.sax.component.XMLGenerator;
+import org.apache.commons.digester3.Rule;
+import org.apache.commons.digester3.binder.RuleProvider;
+import org.xml.sax.Attributes;
+
+final class CreateXMLGeneratorRule
+    extends Rule
+{
+
+    private final static String SRC = "src";
+
+    @Override
+    public void begin( String namespace, String name, Attributes attributes )
+        throws Exception
+    {
+        String source = attributes.getValue( SRC );
+
+        XMLGenerator generator;
+
+        try
+        {
+            generator = new XMLGenerator( new URL( source ) );
+        }
+        catch ( Exception e )
+        {
+            generator = new XMLGenerator( new File( source ) );
+        }
+
+        getDigester().push( generator );
+    }
+
+    public static class CreateXMLGeneratorRuleProvider
+        implements RuleProvider<CreateXMLGeneratorRule>
+    {
+
+        public CreateXMLGeneratorRule get()
+        {
+            return new CreateXMLGeneratorRule();
+        }
+
+    }
+
+}

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

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

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

Modified: 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=1195919&r1=1195918&r2=1195919&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-cli/src/main/java/org/apache/cocoon/cli/PipelineDescriptorModule.java
(original)
+++ cocoon/cocoon3/trunk/cocoon-cli/src/main/java/org/apache/cocoon/cli/PipelineDescriptorModule.java
Tue Nov  1 10:32:02 2011
@@ -18,6 +18,7 @@
  */
 package org.apache.cocoon.cli;
 
+import org.apache.cocoon.cli.CreateXMLGeneratorRule.CreateXMLGeneratorRuleProvider;
 import org.apache.cocoon.cli.PipelineCreateRule.PipelineCreateRuleProvider;
 import org.apache.commons.digester3.binder.AbstractRulesModule;
 
@@ -35,6 +36,7 @@ final class PipelineDescriptorModule
         forPattern( "pipelines" );
 
         forPattern( "pipelines/pipeline" ).addRuleCreatedBy( new PipelineCreateRuleProvider()
);
+        forPattern( "pipelines/pipeline/generator" ).addRuleCreatedBy( new CreateXMLGeneratorRuleProvider()
);
     }
 
 }



Mime
View raw message