You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by si...@apache.org on 2011/11/01 10:55:11 UTC

svn commit: r1195902 - /cocoon/cocoon3/trunk/cocoon-cli/src/main/java/org/apache/cocoon/cli/PipelineCreateRule.java

Author: simonetripodi
Date: Tue Nov  1 09:55:11 2011
New Revision: 1195902

URL: http://svn.apache.org/viewvc?rev=1195902&view=rev
Log:
first checkin of PipelineCreateRule class

Added:
    cocoon/cocoon3/trunk/cocoon-cli/src/main/java/org/apache/cocoon/cli/PipelineCreateRule.java   (with props)

Added: cocoon/cocoon3/trunk/cocoon-cli/src/main/java/org/apache/cocoon/cli/PipelineCreateRule.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-cli/src/main/java/org/apache/cocoon/cli/PipelineCreateRule.java?rev=1195902&view=auto
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-cli/src/main/java/org/apache/cocoon/cli/PipelineCreateRule.java (added)
+++ cocoon/cocoon3/trunk/cocoon-cli/src/main/java/org/apache/cocoon/cli/PipelineCreateRule.java Tue Nov  1 09:55:11 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 org.apache.cocoon.pipeline.AsyncCachePipeline;
+import org.apache.cocoon.pipeline.CachingPipeline;
+import org.apache.cocoon.pipeline.NonCachingPipeline;
+import org.apache.cocoon.pipeline.Pipeline;
+import org.apache.cocoon.sax.SAXPipelineComponent;
+import org.apache.commons.digester3.Rule;
+import org.xml.sax.Attributes;
+
+/**
+ * Creates a new {@link Pipeline} depending on the type.
+ */
+final class PipelineCreateRule
+    extends Rule
+{
+
+    private static final String TYPE = "type";
+
+    private static final String ASYNC_CACHE = "async-cache";
+
+    private static final String CACHING = "caching";
+
+    @Override
+    public void begin( String namespace, String name, Attributes attributes )
+        throws Exception
+    {
+        String type = attributes.getValue( TYPE );
+
+        Pipeline<SAXPipelineComponent> pipeline;
+
+        if ( ASYNC_CACHE.equals( type ) )
+        {
+            pipeline = new AsyncCachePipeline<SAXPipelineComponent>();
+        }
+        else if ( CACHING.equals( type ) )
+        {
+            pipeline = new CachingPipeline<SAXPipelineComponent>();
+        }
+        else
+        {
+            pipeline = new NonCachingPipeline<SAXPipelineComponent>();
+        }
+
+        getDigester().push( pipeline );
+    }
+
+}

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

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

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