You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by vg...@apache.org on 2005/09/29 00:03:51 UTC

svn commit: r292327 - in /cocoon/trunk: ./ src/java/org/apache/cocoon/components/source/impl/ src/webapp/WEB-INF/xconf/

Author: vgritsenko
Date: Wed Sep 28 15:03:40 2005
New Revision: 292327

URL: http://svn.apache.org/viewcvs?rev=292327&view=rev
Log:
rename create-document: to empty:

Added:
    cocoon/trunk/src/java/org/apache/cocoon/components/source/impl/EmptySource.java
      - copied, changed from r292307, cocoon/trunk/src/java/org/apache/cocoon/components/source/impl/CreateDocumentSource.java
    cocoon/trunk/src/java/org/apache/cocoon/components/source/impl/EmptySourceFactory.java
      - copied, changed from r292307, cocoon/trunk/src/java/org/apache/cocoon/components/source/impl/CreateDocumentSourceFactory.java
Removed:
    cocoon/trunk/src/java/org/apache/cocoon/components/source/impl/CreateDocumentSource.java
    cocoon/trunk/src/java/org/apache/cocoon/components/source/impl/CreateDocumentSourceFactory.java
Modified:
    cocoon/trunk/src/webapp/WEB-INF/xconf/cocoon-core.xconf
    cocoon/trunk/status.xml

Copied: cocoon/trunk/src/java/org/apache/cocoon/components/source/impl/EmptySource.java (from r292307, cocoon/trunk/src/java/org/apache/cocoon/components/source/impl/CreateDocumentSource.java)
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/components/source/impl/EmptySource.java?p2=cocoon/trunk/src/java/org/apache/cocoon/components/source/impl/EmptySource.java&p1=cocoon/trunk/src/java/org/apache/cocoon/components/source/impl/CreateDocumentSource.java&r1=292307&r2=292327&rev=292327&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/components/source/impl/CreateDocumentSource.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/components/source/impl/EmptySource.java Wed Sep 28 15:03:40 2005
@@ -30,27 +30,31 @@
 import org.xml.sax.SAXException;
 
 /**
- * A <code>Source</code> that generates an empty XML document or an
- * XML document just containing a root node.
- * The URI syntax is "create-document:" or "create-document:ROOT_ELEMENT_NAME".
+ * A <code>Source</code> that generates completely empty XML document or an
+ * XML document that contains just a root node.
  *
- * @version $Id:$
+ * <p>
+ * The URI syntax is <code>empty:</code> for completely empty XML document
+ * or <code>create-document:root-element</code> for document with root element,
+ * where <code>root-element</code> is the name of the root element to create.
+ *
+ * @version $Id$
  * @since 2.1.8
  */
-public class CreateDocumentSource
-    implements XMLizable, Source {
+public class EmptySource implements XMLizable, Source {
 
     protected String rootElementName;
     protected String scheme;
     protected String uri;
     protected String xmlDocument;
 
-    public CreateDocumentSource(String location) {
+    public EmptySource(String location) {
         this.uri = location;
         final int pos = location.indexOf(':');
         this.scheme = location.substring(0, pos);
-        final String rootName = location.substring(pos+1);
-        if (rootName != null && rootName.trim().length() > 0 ) {
+
+        final String rootName = location.substring(pos + 1);
+        if (rootName != null && rootName.trim().length() > 0) {
             this.rootElementName = rootName.trim();
             this.xmlDocument = '<' + this.rootElementName + "/>";
         } else {
@@ -63,7 +67,7 @@
      */
     public void toSAX(ContentHandler handler) throws SAXException {
         handler.startDocument();
-        if ( rootElementName != null ) {
+        if (rootElementName != null) {
             XMLUtils.createElement(handler, this.rootElementName);
         }
         handler.endDocument();
@@ -132,5 +136,4 @@
     public void refresh() {
         // nothing to do here
     }
-
 }

Copied: cocoon/trunk/src/java/org/apache/cocoon/components/source/impl/EmptySourceFactory.java (from r292307, cocoon/trunk/src/java/org/apache/cocoon/components/source/impl/CreateDocumentSourceFactory.java)
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/components/source/impl/EmptySourceFactory.java?p2=cocoon/trunk/src/java/org/apache/cocoon/components/source/impl/EmptySourceFactory.java&p1=cocoon/trunk/src/java/org/apache/cocoon/components/source/impl/CreateDocumentSourceFactory.java&r1=292307&r2=292327&rev=292327&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/components/source/impl/CreateDocumentSourceFactory.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/components/source/impl/EmptySourceFactory.java Wed Sep 28 15:03:40 2005
@@ -25,33 +25,31 @@
 import org.apache.excalibur.source.SourceFactory;
 
 /**
- * A factory for 'create-document:' sources (see {@link CreateDocumentSource}).
- * 
- * @version $Id:$
+ * A factory for 'empty:' sources (see {@link EmptySource}).
+ *
+ * @version $Id$
  * @since 2.1.8
  */
-public class CreateDocumentSourceFactory 
-    extends AbstractLogEnabled
-    implements SourceFactory, ThreadSafe {
-    
+public class EmptySourceFactory extends AbstractLogEnabled
+                                implements SourceFactory, ThreadSafe {
+
     /**
-     * Get a {@link CreateDocumentSource} object.
-     * 
+     * Get an {@link EmptySource} object.
+     *
      * @param location   The URI to resolve - this URI includes the scheme.
      * @param parameters this is optional and not used here
      *
      * @see org.apache.excalibur.source.SourceFactory#getSource(java.lang.String, java.util.Map)
      */
-    public Source getSource( String location, Map parameters )
+    public Source getSource(String location, Map parameters)
     throws IOException, MalformedURLException {
-        return new CreateDocumentSource(location);
+        return new EmptySource(location);
     }
-    
+
     /**
      * @see org.apache.excalibur.source.SourceFactory#release(org.apache.excalibur.source.Source)
      */
-    public void release( Source source ) {
+    public void release(Source source) {
         // Do nothing here
     }
-
 }

Modified: cocoon/trunk/src/webapp/WEB-INF/xconf/cocoon-core.xconf
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/webapp/WEB-INF/xconf/cocoon-core.xconf?rev=292327&r1=292326&r2=292327&view=diff
==============================================================================
--- cocoon/trunk/src/webapp/WEB-INF/xconf/cocoon-core.xconf (original)
+++ cocoon/trunk/src/webapp/WEB-INF/xconf/cocoon-core.xconf Wed Sep 28 15:03:40 2005
@@ -539,8 +539,7 @@
     <component-instance name="upload" class="org.apache.cocoon.components.source.impl.PartSourceFactory"/>
     <component-instance name="module" class="org.apache.cocoon.components.source.impl.ModuleSourceFactory"/>
     <component-instance name="xmodule" class="org.apache.cocoon.components.source.impl.XModuleSourceFactory"/>
-
-    <component-instance name="create-document" class="org.apache.cocoon.components.source.impl.CreateDocumentSourceFactory"/>
+    <component-instance name="empty" class="org.apache.cocoon.components.source.impl.EmptySourceFactory"/>
 
     <!--+
         | The "*" protocol handles all uri schemes that are not explicitely

Modified: cocoon/trunk/status.xml
URL: http://svn.apache.org/viewcvs/cocoon/trunk/status.xml?rev=292327&r1=292326&r2=292327&view=diff
==============================================================================
--- cocoon/trunk/status.xml (original)
+++ cocoon/trunk/status.xml Wed Sep 28 15:03:40 2005
@@ -701,8 +701,8 @@
       This means that "cocoon:" URLs are no more rewritten as external http requests.
     </action>
     <action dev="CZ" type="add" fixes-bug="35521" due-to="Mark Lundquist" due-to-email="mlundquist2@comcast.net">
-      Added the create-document source than either generates empty documents or documents containing
-      just a root node.
+      Added the <code>empty:</code> source than either generates empty documents
+      or documents containing just a root node.
     </action>
     <action dev="CZ" type="fix" fixes-bug="35457" due-to="Doug Bennett" due-to-email="dbennett1556@netscape.net">
       Fix NPE in RequestGenerator when request.getHeaderNames() returns null.