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 12:02:57 UTC

svn commit: r1195924 - in /cocoon/cocoon3/trunk/cocoon-cli/src/main/java/org/apache/cocoon/cli: PipelineDescriptorModule.java PipelinesRegistry.java

Author: simonetripodi
Date: Tue Nov  1 11:02:55 2011
New Revision: 1195924

URL: http://svn.apache.org/viewvc?rev=1195924&view=rev
Log:
first checkin of PipelinesRegistry class
plugged the rule to create the registry

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

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=1195924&r1=1195923&r2=1195924&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 11:02:55 2011
@@ -32,9 +32,11 @@ final class PipelineDescriptorModule
     @Override
     protected void configure()
     {
-        // TODO prepare the DataStructure
-        forPattern( "pipelines" );
-
+        forPattern( "pipelines" )
+            .createObject().ofType( PipelinesRegistry.class )
+            .then()
+            .setProperties()
+                .addAlias( "default", "defaultId" );
         forPattern( "pipelines/pipeline" ).addRuleCreatedBy( new PipelineCreateRuleProvider() );
         forPattern( "pipelines/pipeline/generator" ).addRuleCreatedBy( new CreateXMLGeneratorRuleProvider() );
     }

Added: cocoon/cocoon3/trunk/cocoon-cli/src/main/java/org/apache/cocoon/cli/PipelinesRegistry.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-cli/src/main/java/org/apache/cocoon/cli/PipelinesRegistry.java?rev=1195924&view=auto
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-cli/src/main/java/org/apache/cocoon/cli/PipelinesRegistry.java (added)
+++ cocoon/cocoon3/trunk/cocoon-cli/src/main/java/org/apache/cocoon/cli/PipelinesRegistry.java Tue Nov  1 11:02:55 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.util.HashMap;
+import java.util.Map;
+
+import org.apache.cocoon.pipeline.Pipeline;
+import org.apache.cocoon.sax.SAXPipelineComponent;
+
+final class PipelinesRegistry
+{
+
+    private final Map<String, Pipeline<SAXPipelineComponent>> registry = new HashMap<String, Pipeline<SAXPipelineComponent>>();
+
+    private String name;
+
+    private String defaultId;
+
+    public String getName()
+    {
+        return name;
+    }
+
+    public void setName( String name )
+    {
+        this.name = name;
+    }
+
+    public String getDefaultId()
+    {
+        return defaultId;
+    }
+
+    public void setDefaultId( String defaultId )
+    {
+        this.defaultId = defaultId;
+    }
+
+    public Pipeline<SAXPipelineComponent> getDefaultPipeline()
+    {
+        return registry.get( defaultId );
+    }
+
+    public Pipeline<SAXPipelineComponent> getPipeline( String id )
+    {
+        return registry.get( id );
+    }
+
+}

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

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

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