You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by st...@apache.org on 2003/02/15 23:56:25 UTC

cvs commit: xml-cocoon2/src/blocks/slide/samples slide.xconf

stephan     2003/02/15 14:56:25

  Modified:    src/blocks/slide/java/org/apache/cocoon/components/repository/impl
                        SlideRepository.java
               src/blocks/slide/java/org/apache/cocoon/components/source/helpers
                        SourceProperty.java
               src/blocks/slide/java/org/apache/cocoon/components/source/impl
                        SlideSource.java
               src/blocks/slide/samples slide.xconf
  Added:       src/blocks/slide/java/org/apache/cocoon/components/repository/impl
                        ContextFileContentStore.java
                        ContextFileDescriptorsStore.java
  Log:
  Add specialized content store for the Slide blocks, which
  respects the context directory.
  Also patched the SourceProperty helper.
  
  Revision  Changes    Path
  1.3       +32 -4     xml-cocoon2/src/blocks/slide/java/org/apache/cocoon/components/repository/impl/SlideRepository.java
  
  Index: SlideRepository.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/blocks/slide/java/org/apache/cocoon/components/repository/impl/SlideRepository.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SlideRepository.java	31 Jan 2003 22:49:32 -0000	1.2
  +++ SlideRepository.java	15 Feb 2003 22:56:25 -0000	1.3
  @@ -4,7 +4,7 @@
                      The Apache Software License, Version 1.1
    ============================================================================
   
  - Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
  + Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
   
    Redistribution and use in source and binary forms, with or without modifica-
    tion, are permitted provided that the following conditions are met:
  @@ -51,6 +51,8 @@
   
   package org.apache.cocoon.components.repository.impl;
   
  +import java.util.Hashtable;
  +
   import org.apache.avalon.framework.activity.Disposable;
   import org.apache.avalon.framework.component.Component;
   import org.apache.avalon.framework.component.ComponentException;
  @@ -60,11 +62,15 @@
   import org.apache.avalon.framework.configuration.Configuration;
   import org.apache.avalon.framework.configuration.ConfigurationException;
   import org.apache.avalon.framework.configuration.SAXConfigurationHandler;
  +import org.apache.avalon.framework.context.ContextException;
  +import org.apache.avalon.framework.context.Contextualizable;
   import org.apache.avalon.framework.logger.LogEnabled;
   import org.apache.avalon.framework.logger.Logger;
   import org.apache.avalon.framework.thread.ThreadSafe;
   
  +import org.apache.cocoon.Constants;
   import org.apache.cocoon.components.repository.Repository;
  +import org.apache.cocoon.environment.Context;
   
   import org.apache.excalibur.source.Source;
   import org.apache.excalibur.source.SourceResolver;
  @@ -83,8 +89,8 @@
    * @version $Id$
    */
   public class SlideRepository
  -  implements Repository, ThreadSafe, Composable, Configurable,
  -             LogEnabled /* , Initializable */, Disposable {
  +  implements Repository, ThreadSafe, Composable, Configurable, LogEnabled,
  +             Contextualizable, Disposable {
   
       /** The component manager instance */
       protected ComponentManager manager = null;
  @@ -98,6 +104,7 @@
       private Logger logger;
       private String file;
       private boolean initialized = false;
  +    private String contextpath = null;
   
       /**
        * Provide component with a logger.
  @@ -119,6 +126,16 @@
       }
   
       /**
  +     * Get the context
  +     *
  +     * @param context
  +     */
  +    public void contextualize(org.apache.avalon.framework.context.Context context)
  +      throws ContextException {
  +        this.contextpath = ((Context) context.get(Constants.CONTEXT_ENVIRONMENT_CONTEXT)).getRealPath("/");
  +    }
  +
  +    /**
        * Pass the Configuration to the Configurable class. This method must
        * always be called after the constructor and before any other method.
        *
  @@ -183,6 +200,17 @@
           }
   
           try {
  +            Configuration[] parameters = configuration.getChildren("parameter");
  +            Hashtable table = new Hashtable();
  +
  +            for (int i = 0; i<parameters.length; i++) {
  +                String name = parameters[i].getAttribute("name");
  +
  +                table.put(name, parameters[i].getValue(""));
  +            }
  +            table.put("contextpath", this.contextpath);
  +            this.domain.setParameters(table);
  +
               domain.setDefaultNamespace(configuration.getAttribute("default",
                   "slide"));
   
  
  
  
  1.1                  xml-cocoon2/src/blocks/slide/java/org/apache/cocoon/components/repository/impl/ContextFileContentStore.java
  
  Index: ContextFileContentStore.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:   "This product includes software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Apache Cocoon" and  "Apache Software Foundation" must  not  be
      used to  endorse or promote  products derived from  this software without
      prior written permission. For written permission, please contact
      apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation and was  originally created by
   Stefano Mazzocchi  <st...@apache.org>. For more  information on the Apache
   Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.cocoon.components.repository.impl;
  
  import java.util.Hashtable;
  import java.io.File;
  
  import org.apache.slide.common.Domain;
  import org.apache.slide.common.ServiceParameterErrorException;
  import org.apache.slide.common.ServiceParameterMissingException;
  
  import slidestore.reference.FileContentStore;
  
  /**
   * Specialized version of the FileContentStore from the
   * Jakarta Slide project, which respects the context directory.
   *
   * @author <a href="mailto:stephan@apache.org">Stephan Michels </a>
   * @version CVS $Id: ContextFileContentStore.java,v 1.1 2003/02/15 22:56:25 stephan Exp $
   */
  public class ContextFileContentStore extends FileContentStore {
  
      /**
       * Initializes the descriptors store with a set of parameters.
       * Those could be :
       * <li>User name, login info
       * <li>Host name on which to connect
       * <li>Remote port
       * <li>JDBC driver whoich is to be used :-)
       * <li>Anything else ...
       *
       * @param parameters Hashtable containing the parameters' name
       * and associated value
       */
      public void setParameters(Hashtable parameters)
        throws ServiceParameterErrorException,
               ServiceParameterMissingException {
  
          // A parameter will tell were serialization files are.
          String rootpath = (String) parameters.get("rootpath");
  
          rootpath = new File(Domain.getParameter("contextpath"),
                              rootpath).toString();
          parameters.put("rootpath", rootpath);
          super.setParameters(parameters);
      }
  }
  
  
  
  1.1                  xml-cocoon2/src/blocks/slide/java/org/apache/cocoon/components/repository/impl/ContextFileDescriptorsStore.java
  
  Index: ContextFileDescriptorsStore.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:   "This product includes software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Apache Cocoon" and  "Apache Software Foundation" must  not  be
      used to  endorse or promote  products derived from  this software without
      prior written permission. For written permission, please contact
      apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation and was  originally created by
   Stefano Mazzocchi  <st...@apache.org>. For more  information on the Apache
   Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.cocoon.components.repository.impl;
  
  import java.util.Hashtable;
  import java.io.File;
  
  import org.apache.slide.common.Domain;
  import org.apache.slide.common.ServiceParameterErrorException;
  import org.apache.slide.common.ServiceParameterMissingException;
  
  import slidestore.file.XMLFileDescriptorsStore;
  
  /**
   * Specialized version of the XMLFileDescriptorsStore from the
   * Jakarta Slide project, which respects the context directory.
   *
   * @author <a href="mailto:stephan@apache.org">Stephan Michels </a>
   * @version CVS $Id: ContextFileDescriptorsStore.java,v 1.1 2003/02/15 22:56:25 stephan Exp $
   */
  public class ContextFileDescriptorsStore extends XMLFileDescriptorsStore {
  
      /**
       * Initializes the descriptors store with a set of parameters.
       * Those could be :
       * <li>User name, login info
       * <li>Host name on which to connect
       * <li>Remote port
       * <li>JDBC driver whoich is to be used :-)
       * <li>Anything else ...
       *
       * @param parameters Hashtable containing the parameters' name
       * and associated value
       */
      public void setParameters(Hashtable parameters)
        throws ServiceParameterErrorException,
               ServiceParameterMissingException {
  
          // A parameter will tell were serialization files are.
          String rootpath = (String) parameters.get("rootpath");
  
          rootpath = new File(Domain.getParameter("contextpath"),
                              rootpath).toString();
          parameters.put("rootpath", rootpath);
          super.setParameters(parameters);
      }
  }
  
  
  
  1.2       +123 -72   xml-cocoon2/src/blocks/slide/java/org/apache/cocoon/components/source/helpers/SourceProperty.java
  
  Index: SourceProperty.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/blocks/slide/java/org/apache/cocoon/components/source/helpers/SourceProperty.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SourceProperty.java	31 Jan 2003 18:08:43 -0000	1.1
  +++ SourceProperty.java	15 Feb 2003 22:56:25 -0000	1.2
  @@ -1,60 +1,55 @@
   /*
  - * The Apache Software License, Version 1.1
  - *
  - *
  - * Copyright (c) 2001 The Apache Software Foundation.  All rights
  - * reserved.
  - *
  - * Redistribution and use in source and binary forms, with or without
  - * modification, are permitted provided that the following conditions
  - * are met:
  - *
  - * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer.
  - *
  - * 2. Redistributions in binary form must reproduce the above copyright
  - *    notice, this list of conditions and the following disclaimer in
  - *    the documentation and/or other materials provided with the
  - *    distribution.
  - *
  - * 3. The end-user documentation included with the redistribution,
  - *    if any, must include the following acknowledgment:
  - *       "This product includes software developed by the
  - *        Apache Software Foundation (http://www.apache.org/)."
  - *    Alternately, this acknowledgment may appear in the software itself,
  - *    if and wherever such third-party acknowledgments normally appear.
  - *
  - * 4. The names "Apache Cocoon" and "Apache Software Foundation" must
  - *    not be used to endorse or promote products derived from this
  - *    software without prior written permission. For written
  - *    permission, please contact apache@apache.org.
  - *
  - * 5. Products derived from this software may not be called "Apache",
  - *    nor may "Apache" appear in their name, without prior written
  - *    permission of the Apache Software Foundation.
  - *
  - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  - * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  - * SUCH DAMAGE.
  - * ====================================================================
  - *
  - * This software consists of voluntary contributions made by many
  - * individuals on behalf of the Apache Software Foundation.  For more
  - * information on the Apache Software Foundation, please see
  - * <http://www.apache.org/>.
  - */
   
  -package org.apache.cocoon.components.source.helpers;
  + ============================================================================
  +                   The Apache Software License, Version 1.1
  + ============================================================================
  +
  + Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  +
  + Redistribution and use in source and binary forms, with or without modifica-
  + tion, are permitted provided that the following conditions are met:
  +
  + 1. Redistributions of  source code must  retain the above copyright  notice,
  +    this list of conditions and the following disclaimer.
  +
  + 2. Redistributions in binary form must reproduce the above copyright notice,
  +    this list of conditions and the following disclaimer in the documentation
  +    and/or other materials provided with the distribution.
  +
  + 3. The end-user documentation included with the redistribution, if any, must
  +    include  the following  acknowledgment:   "This product includes software
  +    developed  by the  Apache Software Foundation  (http://www.apache.org/)."
  +    Alternately, this  acknowledgment may  appear in the software itself,  if
  +    and wherever such third-party acknowledgments normally appear.
  +
  + 4. The names "Apache Cocoon" and  "Apache Software Foundation" must  not  be
  +    used to  endorse or promote  products derived from  this software without
  +    prior written permission. For written permission, please contact
  +    apache@apache.org.
  +
  + 5. Products  derived from this software may not  be called "Apache", nor may
  +    "Apache" appear  in their name,  without prior written permission  of the
  +    Apache Software Foundation.
  +
  + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  + FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
  + APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
  + INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
  + DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
  + OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
  + ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
  + (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
  + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  +
  + This software  consists of voluntary contributions made  by many individuals
  + on  behalf of the Apache Software  Foundation and was  originally created by
  + Stefano Mazzocchi  <st...@apache.org>. For more  information on the Apache
  + Software Foundation, please see <http://www.apache.org/>.
  +
  +*/
   
  +package org.apache.cocoon.components.source.helpers;
   
   import org.apache.cocoon.xml.dom.DOMBuilder;
   import org.apache.cocoon.xml.dom.DOMStreamer;
  @@ -69,11 +64,13 @@
   import org.xml.sax.SAXException;
   import org.xml.sax.helpers.AttributesImpl;
   
  +import org.apache.xml.serialize.*;
   
   /**
  - * This interface for a property of a source
  + * The interface for a property of a source
    *
    * @author <a href="mailto:stephan@apache.org">Stephan Michels</a>
  + * @author <a href="mailto:holz@fiz-chemie.de">Martin Holz</a>
    * @version $Id$
    */
   public class SourceProperty implements XMLizable {
  @@ -82,6 +79,12 @@
       private String name;
       private Element value;
   
  +    /**  */
  +    public static final String NS_PREFIX = "property";
  +    private static final String D_PREFIX = NS_PREFIX+":";
  +
  +    private static final String XMLNS_NS = "http://www.w3.org/2000/xmlns/";
  +
       /**
        * Creates a new property for a source
        *
  @@ -91,7 +94,28 @@
       public SourceProperty(String namespace, String name) {
   
           this.namespace = namespace;
  -        this.name      = name;
  +        this.name = name;
  +
  +        try {
  +            // FIXME: There must be an easier way to create a DOM element
  +            DOMBuilder builder = new DOMBuilder();
  +
  +            builder.startDocument();
  +            builder.startPrefixMapping(NS_PREFIX, namespace);
  +            AttributesImpl attrs = new AttributesImpl();
  +
  +            attrs.addAttribute(XMLNS_NS, NS_PREFIX, "xmlns:"+NS_PREFIX,
  +                               "NMTOKEN", namespace);
  +            builder.startElement(namespace, name, D_PREFIX+name, attrs);
  +            builder.endElement(namespace, name, D_PREFIX+name);
  +            builder.endPrefixMapping(NS_PREFIX);
  +
  +            Document doc = builder.getDocument();
  +
  +            this.value = doc.getDocumentElement();
  +        } catch (SAXException se) {
  +            // do nothing
  +        }
       }
   
       /**
  @@ -103,7 +127,7 @@
        */
       public SourceProperty(String namespace, String name, String value) {
           this.namespace = namespace;
  -        this.name      = name;
  +        this.name = name;
           setValue(value);
       }
   
  @@ -122,6 +146,7 @@
        * Sets the namespace for this property
        *
        * @param namespace The namespace of the property
  +     * @deprecated buggy
        */
       public void setNamespace(String namespace) {
           this.namespace = namespace;
  @@ -129,7 +154,7 @@
   
       /**
        * Return the namespace of the property
  -     * 
  +     *
        * @return The namespace of the property
        */
       public String getNamespace() {
  @@ -140,6 +165,7 @@
        * Sets the name of the property
        *
        * @param name Name of the property
  +     * @deprecated buggy
        */
       public void setName(String name) {
           this.name = name;
  @@ -147,7 +173,7 @@
   
       /**
        * Return the name of the property
  -     * 
  +     *
        * @return Name of the property
        */
       public String getName() {
  @@ -160,19 +186,29 @@
        * @param value Value of the property
        */
       public void setValue(String value) {
  -        //this.value = value;
  +        // this.value = value;
   
           try {
               DOMBuilder builder = new DOMBuilder();
  +
               builder.startDocument();
  -            builder.startElement(namespace, name, name, new AttributesImpl());
  +            builder.startPrefixMapping(NS_PREFIX, namespace);
  +            AttributesImpl attrs = new AttributesImpl();
  +
  +            attrs.addAttribute(XMLNS_NS, NS_PREFIX, "xmlns:"+NS_PREFIX,
  +                               "NMTOKEN", namespace);
  +            attrs.addAttribute("", "foo", "foo", "NMTOKEN", "bar");
  +
  +            builder.startElement(namespace, name, D_PREFIX+name, attrs);
   
               builder.characters(value.toCharArray(), 0, value.length());
   
  -            builder.endElement(namespace, name, name);
  +            builder.endElement(namespace, name, D_PREFIX+name);
  +            builder.endPrefixMapping(NS_PREFIX);
               builder.endDocument();
   
               Document doc = builder.getDocument();
  +
               this.value = doc.getDocumentElement();
           } catch (SAXException se) {
               // do nothing
  @@ -181,17 +217,19 @@
   
       /**
        * Returns the value of the property
  -     * 
  +     *
        * @return Value of the property
        */
       public String getValueAsString() {
   
           NodeList nodeslist = this.value.getChildNodes();
           StringBuffer buffer = new StringBuffer();
  -        for(int i=0; i<nodeslist.getLength(); i++)
  -            if ((nodeslist.item(i).getNodeType()==Node.TEXT_NODE) || 
  -                (nodeslist.item(i).getNodeType()==Node.CDATA_SECTION_NODE))
  +
  +        for (int i = 0; i<nodeslist.getLength(); i++)
  +            if ((nodeslist.item(i).getNodeType()==Node.TEXT_NODE) ||
  +                (nodeslist.item(i).getNodeType()==Node.CDATA_SECTION_NODE)) {
                   buffer.append(nodeslist.item(i).getNodeValue());
  +            }
   
           return buffer.toString();
       }
  @@ -202,36 +240,46 @@
        * @param value Value of the property
        */
       public void setValue(Element value) {
  -        if ((value.getLocalName().equals(name)) && 
  -            (value.getNamespaceURI().equals(namespace)))
  +        if ((value.getLocalName().equals(name)) &&
  +            (value.getNamespaceURI().equals(namespace))) {
               this.value = value;
  +        }
       }
   
       /**
        * Sets the value of the property
        *
  -     * @param value Value of the property
  +     *
  +     * @param values
        */
       public void setValue(NodeList values) {
           try {
               DOMBuilder builder = new DOMBuilder();
  +
               builder.startDocument();
               builder.startElement(namespace, name, name, new AttributesImpl());
   
               DOMStreamer stream = new DOMStreamer(builder);
  -             for (int i = 0; i < values.getLength(); i++)
  -               stream.stream(values.item(i));
  +
  +            for (int i = 0; i<values.getLength(); i++)
  +                stream.stream(values.item(i));
   
               builder.endElement(namespace, name, name);
               builder.endDocument();
   
               Document doc = builder.getDocument();
  +
               this.value = doc.getDocumentElement();
           } catch (SAXException se) {
               // do nothing
           }
       }
   
  +    /**
  +     *
  +     *
  +     * @return
  +     */
       public Element getValue() {
           return this.value;
       }
  @@ -241,9 +289,12 @@
        * <b>NOTE</b> : if the implementation can produce lexical events, care should be taken
        * that <code>handler</code> can actually be a {@link org.apache.cocoon.xml.XMLConsumer} that accepts such
        * events.
  +     *
  +     * @param handler
        */
       public void toSAX(ContentHandler handler) throws SAXException {
           DOMStreamer stream = new DOMStreamer(handler);
  +
           stream.stream(this.value);
       }
   }
  
  
  
  1.4       +2 -3      xml-cocoon2/src/blocks/slide/java/org/apache/cocoon/components/source/impl/SlideSource.java
  
  Index: SlideSource.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/blocks/slide/java/org/apache/cocoon/components/source/impl/SlideSource.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SlideSource.java	6 Feb 2003 12:19:45 -0000	1.3
  +++ SlideSource.java	15 Feb 2003 22:56:25 -0000	1.4
  @@ -576,7 +576,6 @@
       /**
        * Move the current source to a specified destination.
        *
  -     *
        * @param source     
        *
        * @throws SourceException If an exception occurs during
  @@ -600,7 +599,6 @@
       /**
        * Copy the current source to a specified destination.
        *
  -     *
        * @param source     
        *
        * @throws SourceException If an exception occurs during
  @@ -624,6 +622,7 @@
       /**
        * Delete the source.
        *
  +     * @return True, if the delete operation was successful.
        */
       public boolean delete() {
           try {
  
  
  
  1.2       +6 -121    xml-cocoon2/src/blocks/slide/samples/slide.xconf
  
  Index: slide.xconf
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/blocks/slide/samples/slide.xconf,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- slide.xconf	31 Jan 2003 18:08:44 -0000	1.1
  +++ slide.xconf	15 Feb 2003 22:56:25 -0000	1.2
  @@ -23,128 +23,14 @@
   
           <definition>
   
  -            <!-- ### Memory Configuration ###
  -            The following memory configuration uses the MemoryDescriptorsStore for
  -            node, security, locks and revisions. For content the FileContentStore
  -            is used. Content is reset before start.
  -            -->
  -            <store name="memory">
  -                <nodestore
  -                    classname="slidestore.reference.MemoryDescriptorsStore"/>
  -                <securitystore>
  -                    <reference store="nodestore"/>
  -                </securitystore>
  -                <lockstore>
  -                    <reference store="nodestore"/>
  -                </lockstore>
  -                <revisiondescriptorsstore>
  -                    <reference store="nodestore"/>
  -                </revisiondescriptorsstore>
  -                <revisiondescriptorstore>
  -                    <reference store="nodestore"/>
  -                </revisiondescriptorstore>
  -                <contentstore classname="slidestore.reference.FileContentStore">
  -                    <parameter name="rootpath">contentstore</parameter>
  -                    <parameter name="version">false</parameter>
  -                    <parameter name="resetBeforeStarting">true</parameter>
  -                </contentstore>
  -            </store>
  -
  -            <!-- ### JDBC Configuration ###
  -            The following jdbc sample configuration uses the hsql Database Engine
  -            a relational database engine written in Java, for more info:
  -            http://hsqldb.sourceforge.net/
  -            -->     
  -            <!--
  -            <store name="jdbc">
  -                <nodestore classname="slidestore.reference.JDBCDescriptorsStore">
  -                    <parameter name="driver">org.hsqldb.jdbcDriver</parameter>
  -                    <parameter name="url">jdbc:hsqldb:slidestructure</parameter>
  -                    <parameter name="user">sa</parameter>
  -                    <parameter name="password"></parameter>
  -                </nodestore>
  -                <securitystore>
  -                    <reference store="nodestore" />
  -                </securitystore>
  -                <lockstore>
  -                    <reference store="nodestore" />
  -                </lockstore>
  -                <revisiondescriptorsstore>
  -                    <reference store="nodestore" />
  -                </revisiondescriptorsstore>
  -                <revisiondescriptorstore>
  -                    <reference store="nodestore" />
  -                </revisiondescriptorstore>
  -                <contentstore classname="slidestore.reference.JDBCContentStore">
  -                    <parameter name="driver">org.hsqldb.jdbcDriver</parameter>
  -                    <parameter name="url">jdbc:hsqldb:slidecontent</parameter>
  -                    <parameter name="user">sa</parameter>
  -                    <parameter name="password"></parameter>
  -                </contentstore>
  -            </store>
  -            -->
  -            <!-- ### MySQL Configuration ###
  -            The following jdbc sample configuration uses the MySQL Database.
  -            -->
  -            <!--
  -            <store name="mysql">
  -                <nodestore classname="slidestore.mysql.MySQLDescriptorsStore">
  -                    <parameter name="driver">org.gjt.mm.mysql.Driver</parameter>
  -                    <parameter name="url">jdbc:mysql://localhost/myDB</parameter>
  -                    <parameter name="user">cocoon</parameter>
  -                    <parameter name="password">cocoon</parameter>
  -                </nodestore>
  -                <securitystore>
  -                    <reference store="nodestore" />
  -                </securitystore>
  -                <lockstore>
  -                    <reference store="nodestore" />
  -                </lockstore>
  -                <revisiondescriptorsstore>
  -                    <reference store="nodestore" />
  -                </revisiondescriptorsstore>
  -                <revisiondescriptorstore>
  -                    <reference store="nodestore" />
  -                </revisiondescriptorstore>
  -                <contentstore classname="slidestore.mysql.MySQLContentStore">
  -                    <parameter name="driver">org.gjt.mm.mysql.Driver</parameter>
  -                    <parameter name="url">jdbc:mysql://localhost/myDB</parameter>
  -                    <parameter name="user">cocoon</parameter>
  -                    <parameter name="password">cocoon</parameter>
  -                </contentstore>
  -            </store>
  -            -->
  -
  -            <!-- ### Mixed JDBC - Filesystem ###
  -            stores: slidestore.reference.JDBCDescriptorsStore
  -                    slidestore.reference.FileContentStore
  -            !!! set resetBeforeStarting parameter for FileContentStore to false !!!
  -            -->
  -
  -            <!-- ### Cloudscape configuration (embedded database) ###
  -            stores: slidestore.cloudscape.CloudscapeDescriptorsStore
  -                    slidestore.cloudscape.CloudscapeContentStore
  -            driver: COM.cloudscape.core.JDBCDriver
  -            url:    jdbc:cloudscape:slidestructure;create=true
  -                    jdbc:cloudscape:slidecontent;create=true
  -            -->
  -
  -            <!-- ### Oracle configuration (thin driver) ###
  -            stores: slidestore.reference.JDBCDescriptorsStore
  -                    slidestore.oracle.OracleContentStore
  -            driver: oracle.jdbc.OracleDriver
  -            url:    jdbc:oracle:thin:@localhost:1521:slide
  -            -->
  -
               <!-- ### XML Configuration ###
               The following XML configuration uses the XMLDescriptorsStore for
               node, security, locks and revisions. For content the FileContentStore
               is used. 
               -->
  -            <!--
  -            <store name="xml">
  -                <nodestore classname="slidestore.file.XMLFileDescriptorsStore">
  -                    <parameter name="rootpath">slide</parameter>
  +            <store name="context">
  +                <nodestore classname="org.apache.cocoon.components.repository.impl.ContextFileDescriptorsStore">
  +                    <parameter name="rootpath">samples/slide/content</parameter>
                   </nodestore>
                   <securitystore>
                       <reference store="nodestore" />
  @@ -158,15 +44,14 @@
                   <revisiondescriptorstore>
                       <reference store="nodestore" />
                   </revisiondescriptorstore>
  -                <contentstore classname="slidestore.reference.FileContentStore">
  -                    <parameter name="rootpath">slide</parameter>
  +                <contentstore classname="org.apache.cocoon.components.repository.impl.ContextFileContentStore">
  +                    <parameter name="rootpath">samples/slide/content</parameter>
                       <parameter name="version">false</parameter>
                       <parameter name="resetBeforeStarting">false</parameter>
                   </contentstore>
               </store>
  -            -->
   
  -            <scope match="/" store="memory"/>
  +            <scope match="/" store="context"/>
   
           </definition>
   
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org