You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by jw...@apache.org on 2005/05/18 09:59:13 UTC

svn commit: r170718 - in /lenya/trunk/src: java/org/apache/lenya/cms/authoring/ java/org/apache/lenya/cms/publication/ java/org/apache/lenya/cms/site/usecases/ webapp/lenya/pubs/blog/java/src/org/apache/lenya/cms/authoring/ webapp/lenya/pubs/blog/java/src/org/apache/lenya/cms/site/usecases/

Author: jwkaltz
Date: Wed May 18 00:59:12 2005
New Revision: 170718

URL: http://svn.apache.org/viewcvs?rev=170718&view=rev
Log:
removed existing node type concept (distinction branch / leaf), as it was not used

Modified:
    lenya/trunk/src/java/org/apache/lenya/cms/authoring/DefaultBranchCreator.java
    lenya/trunk/src/java/org/apache/lenya/cms/authoring/DefaultCreator.java
    lenya/trunk/src/java/org/apache/lenya/cms/authoring/NodeCreatorInterface.java
    lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentManager.java
    lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentManagerImpl.java
    lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/Create.java
    lenya/trunk/src/webapp/lenya/pubs/blog/java/src/org/apache/lenya/cms/authoring/NewBlogEntryCreator.java
    lenya/trunk/src/webapp/lenya/pubs/blog/java/src/org/apache/lenya/cms/site/usecases/CreateBlogEntry.java

Modified: lenya/trunk/src/java/org/apache/lenya/cms/authoring/DefaultBranchCreator.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/authoring/DefaultBranchCreator.java?rev=170718&r1=170717&r2=170718&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/authoring/DefaultBranchCreator.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/authoring/DefaultBranchCreator.java Wed May 18 00:59:12 2005
@@ -23,15 +23,6 @@
  * Default creator for Documents of type branch (ie, they can have child documents)
  */
 public class DefaultBranchCreator extends DefaultCreator {
-    /**
-     * Return the child type.
-     * @param childType a <code>short</code> value
-     * @return a <code>short</code> value
-     * @exception Exception if an error occurs
-     */
-    public short getChildType(short childType) throws Exception {
-        return BRANCH_NODE;
-    }
 
     /**
      * @see org.apache.lenya.cms.authoring.NodeCreatorInterface#getNewDocumentURI(String, String, String, String)

Modified: lenya/trunk/src/java/org/apache/lenya/cms/authoring/DefaultCreator.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/authoring/DefaultCreator.java?rev=170718&r1=170717&r2=170718&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/authoring/DefaultCreator.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/authoring/DefaultCreator.java Wed May 18 00:59:12 2005
@@ -48,28 +48,6 @@
     }
 
     /**
-     * Generate a tree id by returning the child ID.
-     * @param childId a <code>String</code> value
-     * @param childType a <code>short</code> value
-     * @return a <code>String</code> value
-     * @exception Exception if an error occurs
-     */
-    public String generateTreeId(String childId, short childType)
-        throws Exception {
-        return childId;
-    }
-
-    /**
-     * Return the child type by simply returning the child type.
-     * @param childType a <code>short</code> value
-     * @return a <code>short</code> value
-     * @exception Exception if an error occurs
-     */
-    public short getChildType(short childType) throws Exception {
-        return childType;
-    }
-
-    /**
      * Create Child Name for tree entry
      * @param childname a <code>String</code> value
      * @return a <code>String</code> for Child Name for tree entry
@@ -83,13 +61,12 @@
     }
 
     /**
-     * @see NodeCreatorInterface#create(String, String, String, short, String, Map)
+     * @see NodeCreatorInterface#create(String, String, String, String, Map)
       */
     public void create(
         String initialContentsURI,
         String newURI,
         String childId,
-        short childType,
         String childName,
         Map parameters)
         throws Exception {
@@ -99,14 +76,10 @@
                + "\t initialContentsURI [" + initialContentsURI + "]\n"
                + "\t newURI [" + newURI + "]\n"
                + "\t childId [" + childId + "]\n"
-               + "\t childType [" + childType + "]\n"
                + "\t childName [" + childName + "]\n"
                + "\t non-empty parameters [" + (parameters != null) + "]\n"
                );
 
-        // 
-        String id = generateTreeId(childId, childType);
-
         // Read initial contents as DOM
         if (getLogger().isDebugEnabled())
             getLogger().debug("DefaultCreator::create(), ready to read initial contents from URI [" + initialContentsURI + "]");
@@ -123,7 +96,7 @@
             getLogger().debug("transform sample file: ");
 
         // transform the xml if needed
-        transformXML(doc, id, childType, childName, parameters);
+        transformXML(doc, childId, childName, parameters);
 
         // write the document 
         try {
@@ -135,18 +108,12 @@
     }
 
     /**
-     * Apply some transformation on the newly created child.
-     * @param doc the xml document
-     * @param childId the id of the child
-     * @param childType the type of child
-     * @param childName the name of the child
-     * @param parameters additional parameters that can be used in the transformation
-     * @throws Exception if the transformation fails
+     * Default implementation: do nothing
+     * @see #transformXML(Document, String, String, Map)
      */
-    protected void transformXML(
+    public void transformXML(
         Document doc,
         String childId,
-        short childType,
         String childName,
         Map parameters)
         throws Exception {

Modified: lenya/trunk/src/java/org/apache/lenya/cms/authoring/NodeCreatorInterface.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/authoring/NodeCreatorInterface.java?rev=170718&r1=170717&r2=170718&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/authoring/NodeCreatorInterface.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/authoring/NodeCreatorInterface.java Wed May 18 00:59:12 2005
@@ -22,27 +22,13 @@
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.logger.Logger;
 import org.apache.avalon.framework.service.ServiceManager;
+import org.w3c.dom.Document;
 
 /**
  * Interface for creation of nodes in the document hierarchy
  * @version $Id$
  */
 public interface NodeCreatorInterface {
-    /**
-     * Constant for a branch node. Branch nodes are somewhat related
-     * to the concept of collections in WebDAV. They are not the same
-     * however.
-     *
-     */
-    short BRANCH_NODE = 1;
-
-    /**
-     * Constant for a leaf node. Leaf nodes are somewhat related to
-     * the concept of resources in WebDAV. They are not the same
-     * however.
-     *
-     */
-    short LEAF_NODE = 0;
 
     /**
      * Configures the Creator, based on a configuration file.
@@ -52,19 +38,6 @@
      * @param logger A logger
      */
     void init(Configuration doctypeConf, ServiceManager manager, Logger logger);
-
-    /**
-     * Return the type of node this creator will create. It can be
-     * either <code>BRANCH_NODE</code> or <code>LEAF_NODE</code>. An
-     * implementation can simply return the input parameter (which can
-     * be used to pass in a request parameter) or choose to ignore it.
-     *
-     * @param childType a <code>short</code> value
-     * @return a <code>short</code> value (either <code>BRANCH_NODE</code> or <code>LEAF_NODE</code>)
-     * @exception Exception if an error occurs
-     */
-    short getChildType(short childType) throws Exception;
-
     /**
      * Describe <code>getChildName</code> method here.
      *
@@ -75,22 +48,11 @@
     String getChildName(String childname) throws Exception;
 
     /**
-     * Describe <code>generateTreeId</code> method here.
-     *
-     * @param childId a <code>String</code> value
-     * @param childType a <code>short</code> value
-     * @return a <code>String</code> value
-     * @exception Exception if an error occurs
-     */
-    String generateTreeId(String childId, short childType) throws Exception;
-
-    /**
      * Create a physical representation for a new document.
      *
      * @param initialContentsURI the URI where initial content for this document can be found.
      * @param newURI the URI under which the new node is to be created. Can be retrieved via getNewDocumentURI()
      * @param childId the document id of the new document
-     * @param childType the node type (branch, leaf)
      * @param childName the name of the new document.
      * @param parameters additional parameters that can be used when creating the document
      * 
@@ -101,7 +63,6 @@
         String initialContentsURI,
         String newURI,
         String childId,
-        short childType,
         String childName,
         Map parameters)
         throws Exception;
@@ -119,5 +80,21 @@
         String parentId,
         String newId,
         String language);
+
+    /**
+     * Apply some transformation on the newly created document.
+     * @param doc the xml document
+     * @param childId the id of the child
+     * @param childName the name of the child
+     * @param parameters additional parameters that can be used in the transformation
+     * @throws Exception if the transformation fails
+     */
+    void transformXML(
+        Document doc,
+        String childId,
+        String childName,
+        Map parameters)
+        throws Exception;
+
 
 }

Modified: lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentManager.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentManager.java?rev=170718&r1=170717&r2=170718&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentManager.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentManager.java Wed May 18 00:59:12 2005
@@ -72,7 +72,6 @@
      * new document can be read. Optional parameter; may be set to <code>null</code>, 
      * in which case the default initial sample as configured in 
      * <code>doctypes.xconf</code> will be used.
-     * @param nodeType the node type, as defined by the constants in {@link org.apache.lenya.cms.authoring.NodeCreatorInterface NodeCreatorInterface}
      * @param parameters any parameters the caller needs to pass to the creator
      * @return A document.
      * 
@@ -86,7 +85,6 @@
                  String language, 
                  String navigationTitle,
                  String initialContentsURI,
-                 short nodeType,
                  Map parameters) 
        throws DocumentBuildException, PublicationException;
 

Modified: lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentManagerImpl.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentManagerImpl.java?rev=170718&r1=170717&r2=170718&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentManagerImpl.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/publication/DocumentManagerImpl.java Wed May 18 00:59:12 2005
@@ -56,13 +56,13 @@
      * implementation to be used is specified in doctypes.xconf (and thus depends on the publication
      * and the resource type to be used)
      * 
-     * @see DocumentManager#add(Document,String,String,String,String,String,String,short,Map)
+     * @see DocumentManager#add(Document,String,String,String,String,String,String,Map)
      * @see org.apache.lenya.cms.authoring.NodeCreatorInterface
      * @see org.apache.lenya.cms.publication.DocumentBuilder
      */
     public Document add(Document parentDocument, String newDocumentNodeName, String newDocumentId,
             String documentTypeName, String language, String navigationTitle,
-            String initialContentsURI, short nodeType, Map parameters)
+            String initialContentsURI, Map parameters)
             throws DocumentBuildException, PublicationException {
 
         if (getLogger().isDebugEnabled())
@@ -72,7 +72,7 @@
                     + "\t newDocumentId [" + newDocumentId + "]\n" + "\t documentTypeName ["
                     + documentTypeName + "]\n" + "\t language [" + language + "]\n"
                     + "\t navigationTitle [" + navigationTitle + "]\n" + "\t initialContentsURI ["
-                    + initialContentsURI + "]\n" + "\t nodeType [" + nodeType + "]\n"
+                    + initialContentsURI + "]\n" 
                     + "\t non-empty parameters [" + (parameters != null) + "]\n");
 
         Publication publication = parentDocument.getPublication();
@@ -145,7 +145,6 @@
             creator.create(initialContentsURI,
                     newDocumentURI,
                     newDocumentNodeName,
-                    nodeType,
                     navigationTitle,
                     parameters);
         } catch (Exception e) {

Modified: lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/Create.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/Create.java?rev=170718&r1=170717&r2=170718&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/Create.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/site/usecases/Create.java Wed May 18 00:59:12 2005
@@ -27,7 +27,6 @@
 import org.apache.cocoon.environment.Session;
 import org.apache.lenya.ac.Identity;
 import org.apache.lenya.ac.User;
-import org.apache.lenya.cms.authoring.NodeCreatorInterface;
 import org.apache.lenya.cms.metadata.dublincore.DublinCore;
 import org.apache.lenya.cms.publication.Document;
 import org.apache.lenya.cms.publication.DocumentBuildException;
@@ -116,7 +115,6 @@
                                    getParameterAsString(LANGUAGE),
                                    getParameterAsString(DublinCore.ELEMENT_TITLE),
                                    getInitialContentsURI(),
-                                   NodeCreatorInterface.BRANCH_NODE,
                                    null);
         }
         finally {

Modified: lenya/trunk/src/webapp/lenya/pubs/blog/java/src/org/apache/lenya/cms/authoring/NewBlogEntryCreator.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/pubs/blog/java/src/org/apache/lenya/cms/authoring/NewBlogEntryCreator.java?rev=170718&r1=170717&r2=170718&view=diff
==============================================================================
--- lenya/trunk/src/webapp/lenya/pubs/blog/java/src/org/apache/lenya/cms/authoring/NewBlogEntryCreator.java (original)
+++ lenya/trunk/src/webapp/lenya/pubs/blog/java/src/org/apache/lenya/cms/authoring/NewBlogEntryCreator.java Wed May 18 00:59:12 2005
@@ -110,9 +110,9 @@
     }
 
     /**
-     *
+     * @see #transformXML(Document, String, String, Map)
      */
-    protected void transformXML(Document doc, String childId, short childType, String childName, Map parameters) throws Exception {
+    public void transformXML(Document doc, String childId, String childName, Map parameters) throws Exception {
 
        // sanity check: blog entry creation depends on certain parameters
        if (parameters == null)

Modified: lenya/trunk/src/webapp/lenya/pubs/blog/java/src/org/apache/lenya/cms/site/usecases/CreateBlogEntry.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/pubs/blog/java/src/org/apache/lenya/cms/site/usecases/CreateBlogEntry.java?rev=170718&r1=170717&r2=170718&view=diff
==============================================================================
--- lenya/trunk/src/webapp/lenya/pubs/blog/java/src/org/apache/lenya/cms/site/usecases/CreateBlogEntry.java (original)
+++ lenya/trunk/src/webapp/lenya/pubs/blog/java/src/org/apache/lenya/cms/site/usecases/CreateBlogEntry.java Wed May 18 00:59:12 2005
@@ -26,7 +26,6 @@
 
 import org.apache.lenya.ac.Identity;
 
-import org.apache.lenya.cms.authoring.NodeCreatorInterface;
 import org.apache.lenya.cms.metadata.dublincore.DublinCore;
 import org.apache.lenya.cms.publication.Document;
 import org.apache.lenya.cms.publication.DocumentManager;
@@ -105,7 +104,6 @@
                                     language,
                                     getParameterAsString(DublinCore.ELEMENT_TITLE),
                                     null,
-                                    NodeCreatorInterface.LEAF_NODE,
                                     allParameters);
         }
         finally {



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org