stephan     2002/06/21 06:39:43

  Modified:    .        changes.xml
               src/documentation/xdocs who.xml
               src/scratchpad/src/org/apache/cocoon/components/repository
                        SourceRepository.java repository.roles
               src/scratchpad/src/org/apache/cocoon/components/repository/impl
                        SlideSourceRepository.java slide.xconf
  Added:       src/scratchpad/lib slide-webdavlib.jar
               src/scratchpad/src/org/apache/cocoon/components/source
                        BrowseableSource.java InspectableSource.java
                        LockableSource.java RestrictableSource.java
                        VersionableSource.java
               src/scratchpad/src/org/apache/cocoon/components/source/helpers
                        SourceCredential.java SourceLock.java
                        SourcePermission.java SourceProperty.java
               src/scratchpad/src/org/apache/cocoon/components/source/impl
                        RepositorySourceFactory.java SlideSource.java
                        WebDAVSource.java WebDAVSourceFactory.java
                        repository.xconf webdav.xconf
               src/scratchpad/src/org/apache/cocoon/generation
                        SourceDescriptionGenerator.java
  Removed:     src/scratchpad/src/org/apache/cocoon/components/repository
                        SourceCredential.java SourceDescriptor.java
                        SourceLock.java SourcePermission.java
                        SourceProperty.java
               src/scratchpad/src/org/apache/cocoon/components/repository/impl
                        SlideSource.java SlideSourceDescriptor.java
               src/scratchpad/src/org/apache/cocoon/components/source
                        RepositorySourceFactory.java SlideSource.java
                        SlideSourceFactory.java repository.xconf
                        slide.xconf
               src/scratchpad/src/org/apache/cocoon/generation
                        RepositorySourceDescriptionGenerator.java
                        SlideCollectionGenerator.java
  Log:
  A new draft for supporting content management systems. Including a
  new SourceFactory for WebDAV resources. Also add new interfaces for
  the excalibur source implementation from the discussion
  http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=102408194012255&w=2.
  All classes are very alpha, and not been tested.
  
  Revision  Changes    Path
  1.193     +12 -1     xml-cocoon2/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/changes.xml,v
  retrieving revision 1.192
  retrieving revision 1.193
  diff -u -r1.192 -r1.193
  --- changes.xml       19 Jun 2002 14:51:52 -0000      1.192
  +++ changes.xml       21 Jun 2002 13:39:42 -0000      1.193
  @@ -24,6 +24,7 @@
     <person name="Ivelin Ivanov" email="[EMAIL PROTECTED]" id="II"/>
     <person name="Berin Loritsch" email="[EMAIL PROTECTED]" id="BL"/>
     <person name="Stefano Mazzocchi" email="[EMAIL PROTECTED]" id="SM"/>
  +  <person name="Stephan Michels" email="[EMAIL PROTECTED]" id="SMS"/>
     <person name="Giacomo Pati" email="[EMAIL PROTECTED]" id="GP"/>
     <person name="Konstantin Piroumian" email="[EMAIL PROTECTED]" id="KP"/>
     <person name="Ovidiu Predescu" email="[EMAIL PROTECTED]" id="OP"/>
  @@ -38,6 +39,16 @@
    </devs>
   
    <release version="@version@" date="@date@">
  +  <action dev="SMS" type="update">
  +   Changes the design from the SourceRepository. Removed the 
SourceDescriptor.
  +  </action>
  +  <action dev="SMS" type="add">
  +   Add some proposed interfaces for the excalibur source class:
  +   http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=102408194012255&w=2
  +  </action>
  +  <action dev="SMS" type="add" fixes-bug="8975">
  +   Add the Chaperon text parser and the examples.
  +  </action>
     <action dev="VG" type="fix" fixes-bug="9693" due-to="Vladimir Kralik" 
due-to-email="[EMAIL PROTECTED]">
      Properly escape (national) characters included in element's attributes
      in XSP page.
  
  
  
  1.23      +1 -1      xml-cocoon2/src/documentation/xdocs/who.xml
  
  Index: who.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/documentation/xdocs/who.xml,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- who.xml   19 Jun 2002 20:18:11 -0000      1.22
  +++ who.xml   21 Jun 2002 13:39:42 -0000      1.23
  @@ -42,6 +42,7 @@
         <li>Vadim Gritsenko ([EMAIL PROTECTED])</li>
         <li>Christian Haul ([EMAIL PROTECTED])</li>
         <li>Ivelin Ivanov ([EMAIL PROTECTED])</li>
  +      <li>Stephan Michels ([EMAIL PROTECTED])</li>
         <li>John Morrison ([EMAIL PROTECTED])</li>
         <li>Konstantin Piroumian ([EMAIL PROTECTED])</li>
         <li>Ovidiu Predescu ([EMAIL PROTECTED])</li>
  @@ -64,7 +65,6 @@
         <li>Berin Loritsch ([EMAIL PROTECTED])</li>
         <li>Martin Man ([EMAIL PROTECTED])</li>
         <li>Stefano Mazzocchi ([EMAIL PROTECTED])</li>
  -      <li>Stephan Michels ([EMAIL PROTECTED])</li>
         <li>Giacomo Pati ([EMAIL PROTECTED])</li>
         <li>Peter Royal ([EMAIL PROTECTED])</li>
         <li>Carsten Ziegeler ([EMAIL PROTECTED])</li>
  
  
  
  1.1                  xml-cocoon2/src/scratchpad/lib/slide-webdavlib.jar
  
        <<Binary file>>
  
  
  1.2       +33 -75    
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/repository/SourceRepository.java
  
  Index: SourceRepository.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/repository/SourceRepository.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SourceRepository.java     11 Jun 2002 18:09:12 -0000      1.1
  +++ SourceRepository.java     21 Jun 2002 13:39:42 -0000      1.2
  @@ -1,64 +1,38 @@
  -/*
  - * 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 [EMAIL PROTECTED]
  - *
  - * 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/>.
  - */
  +/* * 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 [EMAIL PROTECTED]  * * 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.repository;
   
  +import org.apache.excalibur.source.Source;
   import org.apache.excalibur.source.SourceException;
   
  +import java.util.Map;
  +
   /**
  - * This interface represents a repository for sources
  + * This interface represents a repository for sources. It is very similar
  + * to the SourceFactory. The difference is only for the head.
  + * Also this interface can contain methods, which aren't source orientated,
  + * like user management.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]">Stephan Michels</a>
    * @version $Id$
  @@ -70,28 +44,12 @@
   
       /**
        * Returns a source descriptor from a repository
  -     *
  -     * @param credential The used credential to do the operations
  +     * 
        * @param namespace The namespace represents a 'subrepository'
        * @param uri The uniform resource identifier for the source
  -     *
  -     * @return The descriptor of the source
  +     * @param parameters This is optional.
        */
  -    public SourceDescriptor getSourceDescriptor(SourceCredential credential, 
String namespace, String uri) 
  +    public Source getSource(String namespace, String uri, Map parameters)
           throws SourceException;
  -
  -    /**
  -     * Returns a source descriptor from a repository
  -     *
  -     * @param credential The used credential to do the operations
  -     * @param namespace The namespace represents a 'subrepository'
  -     * @param uri The uniform resource identifier for the source
  -     * @param revision The wanted revision of the source
  -     * @param branch The wanted branch of the revision
  -     *
  -     * @return The descriptor of the source
  -     */
  -    public SourceDescriptor getSourceDescriptor(SourceCredential credential, 
String namespace, 
  -                                                String uri, String revision) 
throws SourceException;
   }
   
  
  
  
  1.3       +0 -5      
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/repository/repository.roles
  
  Index: repository.roles
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/repository/repository.roles,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- repository.roles  12 Jun 2002 20:07:37 -0000      1.2
  +++ repository.roles  21 Jun 2002 13:39:42 -0000      1.3
  @@ -1,12 +1,7 @@
   <?xml version="1.0"?>
   
   <xroles xpath="/role-list" unless="[EMAIL 
PROTECTED]'org.apache.cocoon.components.repository.SourceRepositorySelector']">
  -
  -<!--  <role 
name="org.apache.cocoon.components.repository.SourceRepositorySelector"
  -        shorthand="repositories"
  -        
default-class="org.apache.avalon.excalibur.component.ExcaliburComponentSelector"/>-->
     <role 
name="org.apache.cocoon.components.repository.SourceRepositorySelector"
           shorthand="repositories"
           
default-class="org.apache.cocoon.components.ExtendedComponentSelector"/>
  -
   </xroles>
  
  
  
  1.3       +14 -40    
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/repository/impl/SlideSourceRepository.java
  
  Index: SlideSourceRepository.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/repository/impl/SlideSourceRepository.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SlideSourceRepository.java        12 Jun 2002 20:07:37 -0000      1.2
  +++ SlideSourceRepository.java        21 Jun 2002 13:39:42 -0000      1.3
  @@ -62,10 +62,10 @@
   import org.apache.avalon.framework.logger.Loggable;
   import org.apache.avalon.framework.thread.ThreadSafe;
   
  -import org.apache.cocoon.components.repository.SourceCredential;
  -import org.apache.cocoon.components.repository.SourceDescriptor;
   import org.apache.cocoon.components.repository.SourceRepository;
  +import org.apache.cocoon.components.source.impl.SlideSource;
   
  +import org.apache.excalibur.source.Source;
   import org.apache.excalibur.source.SourceException;
   
   import org.apache.log.Logger;
  @@ -73,6 +73,8 @@
   import org.apache.slide.authenticate.CredentialsToken;
   import org.apache.slide.common.EmbeddedDomain;
   
  +import java.util.Map;
  +
   /**
    * The class represent a manger for slide repositories
    *
  @@ -137,49 +139,21 @@
   
       /**
        * Returns a source descriptor from a repository
  -     *
  -     * @param credential The used credential to do the operations
  +     * 
        * @param namespace The namespace represents a 'subrepository'
        * @param uri The uniform resource identifier for the source
  -     *
  -     * @return The descriptor of the source
  +     * @param parameters This is optional.
        */
  -    public SourceDescriptor getSourceDescriptor(SourceCredential credential, 
  -                                                String namespace, String 
uri) throws SourceException {
  -        CredentialsToken credToken = new 
CredentialsToken(credential.getPrincipal());
  -
  +    public Source getSource(String namespace, String uri, Map parameters)
  +        throws SourceException {
  +        
           if (domain.getNamespaceToken(namespace)==null)
               throw new SourceException("Repository with the namespace 
'"+namespace+"' couldn't be found");
  -
  +        
           if ((uri==null) || (uri.length()==0))
  -          return new SlideSourceDescriptor(credToken, 
domain.getNamespaceToken(namespace), "/");
  -
  -        return new SlideSourceDescriptor(credToken, 
domain.getNamespaceToken(namespace), uri);
  -    }
  -
  -    /**
  -     * Returns a source descriptor from a repository
  -     *
  -     * @param credential The used credential to do the operations
  -     * @param namespace The namespace represents a 'subrepository'
  -     * @param uri The uniform resource identifier for the source
  -     * @param revision The wanted revision of the source
  -     * @param branch The wanted branch of the revision
  -     *
  -     * @return The descriptor of the source
  -     */
  -    public SourceDescriptor getSourceDescriptor(SourceCredential credential, 
String namespace,
  -                                                String uri, String revision) 
throws SourceException {
  -        CredentialsToken credToken = new 
CredentialsToken(credential.getPrincipal());
  -
  -        if (domain.getNamespaceToken(namespace)==null)
  -            throw new SourceException("Repository with the namespace 
'"+namespace+"' couldn't be found");
  -
  -        if ((uri==null) || (uri.length()==0))
  -          return new SlideSourceDescriptor(credToken, 
domain.getNamespaceToken(namespace), "/");
  -
  -        return new SlideSourceDescriptor(credToken, 
domain.getNamespaceToken(namespace), 
  -                                         uri, revision);
  +          return new SlideSource(domain.getNamespaceToken(namespace), "/");
  +        
  +        return new SlideSource(domain.getNamespaceToken(namespace), uri);
       }
   }
   
  
  
  
  1.4       +0 -1      
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/repository/impl/slide.xconf
  
  Index: slide.xconf
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/repository/impl/slide.xconf,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- slide.xconf       12 Jun 2002 20:07:37 -0000      1.3
  +++ slide.xconf       21 Jun 2002 13:39:42 -0000      1.4
  @@ -1,7 +1,6 @@
   <?xml version="1.0"?>
   
   <xconf xpath="/cocoon" unless="[EMAIL 
PROTECTED]'org.apache.cocoon.components.repository.SourceRepositorySelector']">
  -<!--<xconf xpath="/cocoon" unless="repositories">-->
   
    <component 
role="org.apache.cocoon.components.repository.SourceRepositorySelector" 
               class="org.apache.cocoon.components.ExtendedComponentSelector"
  
  
  
  1.1                  
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/source/BrowseableSource.java
  
  Index: BrowseableSource.java
  ===================================================================
  /*
   * 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 [EMAIL PROTECTED]
   *
   * 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;
  
  import org.apache.excalibur.source.Source;
  import org.apache.excalibur.source.SourceException;
  
  import java.util.Enumeration;
  
  /**
   * A source, which can a directory of collection of sources.
   *
   * @author <a href="mailto:[EMAIL PROTECTED]">Stephan Michels</a>
   * @version $Id: BrowseableSource.java,v 1.1 2002/06/21 13:39:42 stephan Exp $
   */
  public interface BrowseableSource extends Source {
  
      /** 
       * If the source a directory or a collection
       */
      public boolean isSourceCollection() throws SourceException;
  
      /**
       * Returns the count of child sources.
       */
      public int getChildSourceCount()  throws SourceException;
  
      /**
       * Return the system id of a child source.
       *
       * @param index Index of the child
       */
      public String getChildSource(int index)  throws SourceException;
  }
  
  
  
  
  1.1                  
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/source/InspectableSource.java
  
  Index: InspectableSource.java
  ===================================================================
  /*
   * 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 [EMAIL PROTECTED]
   *
   * 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;
  
  import org.apache.cocoon.components.source.helpers.SourceProperty;
  
  import org.apache.excalibur.source.Source;
  import org.apache.excalibur.source.SourceException;
  
  import java.util.Enumeration;
  
  /**
   * A source, which owns meta informations in form of properties
   *
   * @author <a href="mailto:[EMAIL PROTECTED]">Stephan Michels</a>
   * @version $Id: InspectableSource.java,v 1.1 2002/06/21 13:39:42 stephan Exp 
$
   */
  public interface InspectableSource extends Source {
  
      /** 
       * To get a meta information from a source 
       */
      public SourceProperty getSourceProperty(String namespace, String name) 
throws SourceException;
  
      /** 
       * To set a meta information 
       */
      public void setSourceProperty(SourceProperty property) throws 
SourceException;
  
      /** 
       * Get alll informations 
       */
      public Enumeration getSourceProperties() throws SourceException;
  }
  
  
  
  
  1.1                  
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/source/LockableSource.java
  
  Index: LockableSource.java
  ===================================================================
  /*
   * 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 [EMAIL PROTECTED]
   *
   * 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;
  
  import org.apache.excalibur.source.Source;
  import org.apache.excalibur.source.SourceException;
  
  import org.apache.cocoon.components.source.helpers.SourceLock;
  
  import java.util.Enumeration;
  
  /**
   * A source, which could be locked
   *
   * @author <a href="mailto:[EMAIL PROTECTED]">Stephan Michels</a>
   * @version $Id: LockableSource.java,v 1.1 2002/06/21 13:39:42 stephan Exp $
   */
  public interface LockableSource extends Source {
  
      /**
       * Add a lock to this source
       *
       * @param sourcelock Lock, which should be added
       *
       * @throws SourceException If an exception occurs during this operation
       */
      public void addSourceLocks(SourceLock sourcelock) throws SourceException;
  
      /**
       * Returns a enumeration of the existing locks
       *
       * @return Enumeration of SourceLock
       */
      public Enumeration getSourceLocks() throws SourceException;
  }
  
  
  
  
  1.1                  
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/source/RestrictableSource.java
  
  Index: RestrictableSource.java
  ===================================================================
  /*
   * 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 [EMAIL PROTECTED]
   *
   * 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;
  
  import org.apache.cocoon.components.source.helpers.SourceCredential;
  
  import org.apache.excalibur.source.Source;
  import org.apache.excalibur.source.SourceException;
  
  /**
   * A source, which is restrictable, which means you need a username and 
password.
   *
   * @author <a href="mailto:[EMAIL PROTECTED]">Stephan Michels</a>
   * @version $Id: RestrictableSource.java,v 1.1 2002/06/21 13:39:42 stephan 
Exp $
   */
  public interface RestrictableSource extends Source {
  
      /** 
       * Get the current credential for the source
       */
      public SourceCredential getSourceCredential() throws SourceException;
  
      /** 
       * Set the credential for the source
       */
      public void setSourceCredential(SourceCredential sourcecredential) throws 
SourceException;
  
      /*
       * Add a permission to this source
       *
       * @param sourcepermission Permission, which should be added
       *
       * @throws SourceException If an exception occurs during this operation
       *
      public void addSourcePermission(SourcePermission sourcepermission) throws 
SourceException;
  
      /*
       * Returns a enumeration of the existing locks
       *
       * @return Enumeration of SourcePermission
       *
      public Enumeration getSourcePermissions() throws SourceException;*/
  }
  
  
  
  
  1.1                  
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/source/VersionableSource.java
  
  Index: VersionableSource.java
  ===================================================================
  /*
   * 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 [EMAIL PROTECTED]
   *
   * 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;
  
  import org.apache.excalibur.source.Source;
  import org.apache.excalibur.source.SourceException;
  
  /**
   * A source, which could exist in different versions
   *
   * @author <a href="mailto:[EMAIL PROTECTED]">Stephan Michels</a>
   * @version $Id: VersionableSource.java,v 1.1 2002/06/21 13:39:43 stephan Exp 
$
   */
  public interface VersionableSource extends Source {
  
      /** 
       * If this source versioned
       */
      public boolean isVersioned() throws SourceException;
  
      /** 
       * Get the current revision of the source
       */
      public String getSourceRevision() throws SourceException;
  
      /** 
       * Sets the wanted revision of the source
       */
      public void setSourceRevision(String sourcerevision) throws 
SourceException;
  
      /** 
       * Get the current branch of the revision from the source
       */
      public String getSourceRevisionBranch() throws SourceException;
  
      /** 
       * Sets the wanted branch of the revision from the source
       */
      public void setSourceRevisionBranch(String sourcerevisionbranch) throws 
SourceException;
  
      /** 
       * Get the latest revision
       */
      public String getLatestSourceRevision() throws SourceException;
  }
  
  
  
  
  1.1                  
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/source/helpers/SourceCredential.java
  
  Index: SourceCredential.java
  ===================================================================
  /*
   * 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 [EMAIL PROTECTED]
   *
   * 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;
  
  /**
   * This class represents a credential for a given user
   *
   * @author <a href="mailto:[EMAIL PROTECTED]">Stephan Michels</a>
   * @version $Id: SourceCredential.java,v 1.1 2002/06/21 13:39:43 stephan Exp $
   */
  public class SourceCredential {
  
      private String principal;
      private String password;
  
      /**
       * Create a new credential
       *
       * @param principal The user name
       */
      public SourceCredential(String principal) {
          this.principal = principal;
      }
  
      /**
       * Create a new credential
       *
       * @param principal The user name
       * @param password Password
       */
      public SourceCredential(String principal, String password) {
          this.principal = principal;
          this.password  = password;
      }
  
      /**
       * Sets the principal
       *
       * @param principal The user name
       */
      public void setPrincipal(String principal) {
          this.principal = principal;
      }
  
      /**
       * Returns the principal
       * 
       * @return Principal
       */
      public String getPrincipal() {
          return this.principal;
      }
  
      /**
       * Sets the password
       *
       * @param password Password
       */
      public void setPassword(String password) {
          this.password = password;
      }
  
      /**
       * Returns the password
       * 
       * @return Password
       */
      public String getPassword() {
          return this.password;
      }
  }
  
  
  
  1.1                  
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/source/helpers/SourceLock.java
  
  Index: SourceLock.java
  ===================================================================
  /*
   * 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 [EMAIL PROTECTED]
   *
   * 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;
  
  import java.util.Date;
  
  /**
   * This interface for lock of a source
   *
   * @author <a href="mailto:[EMAIL PROTECTED]">Stephan Michels</a>
   * @version $Id: SourceLock.java,v 1.1 2002/06/21 13:39:43 stephan Exp $
   */
  public class SourceLock {
  
      private String  subject;
      private String  type;
      private Date    expiration;
      private boolean inheritable;
      private boolean exclusive;
  
      /**
       * Creates a new lock for a source
       *
       * @param subject Which user should be locked
       * @param type Type of lock
       * @param expiration When the lock expires
       * @param inheritable If the lock is inheritable
       * @param exclusive If the lock is exclusive
       */
      public SourceLock(String subject, String type, Date expiration,
                        boolean inheritable, boolean exclusive) {
  
          this.subject     = subject;
          this.type        = type;
          this.expiration  = expiration;
          this.inheritable = inheritable;
          this.exclusive   = exclusive;
      }
  
      /**
       *  Sets the subject for this lock
       *
       * @param subject Which user should be locked
       */
      public void setSubject(String subject) {
          this.subject = subject;
      }
  
      /**
       * return the subject of the lock
       * 
       * @return Which user should be locked
       */
      public String getSubject() {
          return this.subject;
      }
  
      /**
       * Sets the type of the lock
       *
       * @param type Type of lock
       */
      public void setType(String type) {
          this.type = type;
      }
  
      /**
       * Return ths type of the lock
       * 
       * @return Type of lock
       */
      public String getType() {
          return this.type;
      }
  
      /**
       * Set the expiration date
       *
       * @param expiration Expiration date
       */
      public void setExpiration(Date expiration) {
          this.expiration = expiration;
      }
  
      /**
       * Returns the expiration date
       * 
       * @return Expiration date
       */
      public Date getExpiration() {
          return this.expiration;
      }
  
      /**
       * Sets the inheritable flag
       *
       * @param inheritable If the lock is inheritable
       */
      public void setInheritable(boolean inheritable) {
          this.inheritable = inheritable;
      }
  
      /**
       * Returns the inheritable flag
       * 
       * @return If the lock is inheritable
       */
      public boolean isInheritable() {
          return this.inheritable;
      }
  
      /**
       * Sets the exclusive flag
       *
       * @param exclusive If the lock is exclusive
       */
      public void setExclusive(boolean exclusive) {
          this.exclusive = exclusive;
      }
  
      /**
       * Returns the exclusive flag
       * 
       * @return If the lock is exclusive
       */
      public boolean isExclusive() {
          return this.exclusive;
      }
  }
  
  
  
  1.1                  
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/source/helpers/SourcePermission.java
  
  Index: SourcePermission.java
  ===================================================================
  /*
   * 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 [EMAIL PROTECTED]
   *
   * 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;
  
  /**
   * This class represents a permission for a source
   *
   * @author <a href="mailto:[EMAIL PROTECTED]">Stephan Michels</a>
   * @version $Id: SourcePermission.java,v 1.1 2002/06/21 13:39:43 stephan Exp $
   */
  public class SourcePermission {
  
      private String  subject;
      private String  action;
      private boolean inheritable;
      private boolean negative;
  
      /**
       * Creates a new permission
       *
       * @param subject Subject of the permission
       * @param inheritable If the permission is inheritable
       * @param negative If the permission is negative
       */
      public SourcePermission(String subject, String action, 
                              boolean inheritable, boolean negative) {
  
          this.subject     = subject;
          this.inheritable = inheritable;
          this.negative    = negative;
      }
  
      /**
       * Sets the subject of the permission
       *
       * @param subject Subject of the permission
       */
      public void setSubject(String subject) {
          this.subject = subject;
      }
  
      /**
       * Returns the subject of the permission
       * 
       * @return Subject of the permission
       */
      public String getSubject() {
          return this.subject;
      }
  
      /**
       * Sets the action of the permission
       *
       * @param action Action of the permission
       */
      public void setAction(String action) {
          this.action = action;
      }
  
      /**
       * Returns the action of the permission
       * 
       * @return Action of the permission
       */
      public String getAction() {
          return this.action;
      }
  
      /**
       * Sets the inheritable flag
       *
       * @param inheritable If the permission is inheritable
       */
      public void setInheritable(boolean inheritable) {
          this.inheritable = inheritable;
      }
  
      /**
       * Returns the inheritable flag
       *
       * @return If the permission is inheritable
       */
      public boolean isInheritable() {
          return this.inheritable;
      }
  
      /**
       * Sets the negative flag
       *
       * @param negative If the permission is negative
       */
      public void setNegative(boolean negative) {
          this.negative = negative;
      }
  
      /**
       * Returns the negative flag
       * 
       * @return If the permission is negative
       */
      public boolean isNegative() {
          return this.negative;
      }
  }
  
  
  
  1.1                  
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/source/helpers/SourceProperty.java
  
  Index: SourceProperty.java
  ===================================================================
  /*
   * 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 [EMAIL PROTECTED]
   *
   * 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;
  
  import org.apache.cocoon.xml.dom.DOMBuilder;
  import org.w3c.dom.Document;
  import org.w3c.dom.Element;
  
  import org.xml.sax.SAXException;
  import org.xml.sax.helpers.AttributesImpl;
  
  
  /**
   * This interface for a property of a source
   *
   * @author <a href="mailto:[EMAIL PROTECTED]">Stephan Michels</a>
   * @version $Id: SourceProperty.java,v 1.1 2002/06/21 13:39:43 stephan Exp $
   */
  public class SourceProperty {
  
      private String namespace;
      private String name;
      private Element value;
  
      /**
       * Creates a new property for a source
       *
       * @param namespace The namespace of the property
       * @param name The name of the property
       */
      public SourceProperty(String namespace, String name) {
  
          this.namespace = namespace;
          this.name      = name;
      }
  
      /**
       * Creates a new property for a source
       *
       * @param namespace The namespace of the property
       * @param name The name of the property
       * @param value The value of the property
       */
      /*public SourceProperty(String namespace, String name, String value) {
          this.namespace = namespace;
          this.name      = name;
          this.value     = value;
      }*/
  
      public SourceProperty(Element property) {
          this.namespace = property.getNamespaceURI();
          this.name = property.getLocalName();
          this.value = property;
      }
  
      /**
       * Sets the namespace for this property
       *
       * @param namespace The namespace of the property
       */
      public void setNamespace(String namespace) {
          this.namespace = namespace;
      }
  
      /**
       * Return the namespace of the property
       * 
       * @return The namespace of the property
       */
      public String getNamespace() {
          return this.namespace;
      }
  
      /**
       * Sets the name of the property
       *
       * @param name Name of the property
       */
      public void setName(String name) {
          this.name = name;
      }
  
      /**
       * Return the name of the property
       * 
       * @return Name of the property
       */
      public String getName() {
          return this.name;
      }
  
      /**
       * Sets the value of the property
       *
       * @param value Value of the property
       */
      public void setValue(String value) {
          //this.value = value;
  
          try {
              DOMBuilder builder = new DOMBuilder();
              builder.startDocument();
              builder.startElement(namespace, name, name, new AttributesImpl());
              builder.endElement(namespace, name, name);
              builder.endDocument();
  
              Document doc = builder.getDocument();
              this.value = doc.getDocumentElement();
          } catch (SAXException se) {
              // do nothing
          }
      }
  
      /**
       * Returns the value of the property
       * 
       * @return Value of the property
       */
      /*public String getValueAsString() {
          return this.value;
      }*/
  
      /**
       * Sets the value of the property
       *
       * @param value Value of the property
       */
      public void setValue(Element value) {
          if ((value.getLocalName().equals(name)) && 
              (value.getNamespaceURI().equals(namespace)))
              this.value = value;
      }
  
      /**
       * Returns the value of the property
       * 
       * @return Value of the property
       */
      /*public String getValueAsElement() {
          return this.value;
      }*/
  
      public Element getValue() {
          return this.value;
      }
  }
  
  
  
  1.1                  
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/source/impl/RepositorySourceFactory.java
  
  Index: RepositorySourceFactory.java
  ===================================================================
  /*
   * 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 [EMAIL PROTECTED]
   *
   * 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.impl;
  
  import org.apache.avalon.framework.configuration.Configuration;
  import org.apache.avalon.framework.configuration.ConfigurationException;
  import org.apache.avalon.framework.configuration.Configurable;
  import org.apache.avalon.framework.component.Component;
  import org.apache.avalon.framework.component.ComponentException;
  import org.apache.avalon.framework.component.ComponentManager;
  import org.apache.avalon.framework.component.ComponentSelector;
  import org.apache.avalon.framework.component.Composable;
  import org.apache.avalon.framework.context.Context;
  import org.apache.avalon.framework.context.ContextException;
  import org.apache.avalon.framework.context.Contextualizable;
  import org.apache.avalon.framework.logger.AbstractLoggable;
  import org.apache.avalon.framework.thread.ThreadSafe;
  
  import org.apache.cocoon.Constants;
  import org.apache.cocoon.components.repository.SourceRepository;
  import org.apache.cocoon.components.source.RestrictableSource;
  import org.apache.cocoon.components.source.VersionableSource;
  import org.apache.cocoon.components.source.helpers.SourceCredential;
  
  
  import org.apache.excalibur.source.Source;
  import org.apache.excalibur.source.SourceException;
  import org.apache.excalibur.source.SourceFactory;
  import org.apache.excalibur.source.SourceParameters;
  
  import org.apache.slide.common.Domain;
  
  import java.io.IOException;
  import java.net.MalformedURLException;
  import java.util.Map;
  
  /**
   * A factory for sources from repositories. 
   *
   * @author <a href="mailto:[EMAIL PROTECTED]">Stephan Michels</a>
   * @version $Id: RepositorySourceFactory.java,v 1.1 2002/06/21 13:39:43 
stephan Exp $
   */
  public class RepositorySourceFactory extends AbstractLoggable
    implements SourceFactory, ThreadSafe {
  
      /** The component manager instance */
      private ComponentManager manager = null;
  
      /**
       * Set the current <code>ComponentManager</code> instance used by this
       * <code>Composable</code>.
       */
      public void compose(ComponentManager manager) throws ComponentException {
          this.manager = manager;
      }
  
  
      /**
       * Get a <code>Source</code> object.
       * @param parameters This is optional.
       */
      public Source getSource(String location, Map parameters)
          throws MalformedURLException, IOException, SourceException {
          if ((this.getLogger()!=null) && (this.getLogger().isDebugEnabled())) {
              this.getLogger().debug( "Creating source object for " + location 
);
          }
  
          int position = location.indexOf("://");
          if (position >= 0)
              position += 3;
          else
              position = 0;
      
          // create the queryString (if available)
          String queryString = null;
          SourceParameters locationParameters = null;
          int queryStringPos = location.indexOf('?');
          if (queryStringPos != -1) {
              queryString = location.substring(queryStringPos + 1);
              location = location.substring(position, queryStringPos);
              locationParameters = new SourceParameters(queryString);
  
          } else if (position > 0) {
              location = location.substring(position);
              locationParameters = new SourceParameters();
          }
  
          String repository = locationParameters.getParameter("repository", 
null);
          String namespace = locationParameters.getParameter("namespace", null);
          String principal = locationParameters.getParameter("principal", null);
          String password = locationParameters.getParameter("paswword", null);
          String revision = locationParameters.getParameter("revision", null);
          String branch = locationParameters.getParameter("branch", null);
  
          SourceCredential credential;
          if (password!=null)
              credential = new SourceCredential(principal, password);
          else
              credential = new SourceCredential(principal);
  
          ComponentSelector sourcerepositories = null;
          SourceRepository sourcerepository = null;
          try {
              sourcerepositories = 
(ComponentSelector)this.manager.lookup(SourceRepository.ROLE+"Selector");
  
              sourcerepository = 
(SourceRepository)sourcerepositories.select(repository);
  
              Source source = sourcerepository.getSource(namespace, location, 
parameters);
  
              if ((source instanceof RestrictableSource) && (principal!=null))
                  ((RestrictableSource)source).setSourceCredential(new 
SourceCredential(principal, password));
  
              if (source instanceof VersionableSource) {
                  VersionableSource versionablesource = 
(VersionableSource)source;
                  if (versionablesource.isVersioned()) {
                      if (revision!=null)
                          versionablesource.setSourceRevision(revision);
                      if (branch!=null)
                          versionablesource.setSourceRevisionBranch(branch);
                  }
              }
  
  
          } catch (ComponentException ce) {
              getLogger().error("Could not lookup for component.", ce);
          } finally {
              if ((sourcerepository!=null) && (sourcerepository instanceof 
Component))
                  sourcerepositories.release((Component)sourcerepository);
              sourcerepository = null;
  
              this.manager.release(sourcerepositories);
              sourcerepositories = null;
          }
  
          return null;
      }
  }
  
  
  
  
  1.1                  
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/source/impl/SlideSource.java
  
  Index: SlideSource.java
  ===================================================================
  /*
   * 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 [EMAIL PROTECTED]
   *
   * 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.impl;
  
  import org.apache.avalon.framework.configuration.Configuration;
  import org.apache.avalon.framework.configuration.ConfigurationException;
  import org.apache.avalon.framework.context.Context;
  import org.apache.avalon.framework.context.ContextException;
  import org.apache.avalon.framework.context.Contextualizable;
  import org.apache.avalon.framework.component.ComponentException;
  import org.apache.avalon.framework.component.ComponentManager;
  import org.apache.avalon.framework.component.Composable;
  import org.apache.avalon.framework.logger.AbstractLoggable;
  import org.apache.avalon.framework.thread.ThreadSafe;
  
  import org.apache.cocoon.Constants;
  import org.apache.cocoon.components.source.BrowseableSource;
  import org.apache.cocoon.components.source.InspectableSource;
  import org.apache.cocoon.components.source.LockableSource;
  import org.apache.cocoon.components.source.RestrictableSource;
  import org.apache.cocoon.components.source.WriteableSource;
  import org.apache.cocoon.components.source.VersionableSource;
  import org.apache.cocoon.components.source.helpers.SourceCredential;
  import org.apache.cocoon.components.source.helpers.SourceLock;
  import org.apache.cocoon.components.source.helpers.SourcePermission;
  
  import org.apache.excalibur.source.Source;
  import org.apache.excalibur.source.SourceException;
  import org.apache.excalibur.source.SourceFactory;
  import org.apache.excalibur.source.SourceValidity;
  import org.apache.excalibur.source.impl.validity.TimeStampValidity;
  
  import org.apache.slide.authenticate.CredentialsToken;
  import org.apache.slide.authenticate.SecurityToken;
  import org.apache.slide.common.EmbeddedDomain;
  import org.apache.slide.common.NamespaceAccessToken;
  //import org.apache.slide.common.ServiceAccessException;
  import org.apache.slide.common.SlideException;
  import org.apache.slide.common.SlideToken;
  import org.apache.slide.common.SlideTokenImpl;
  import org.apache.slide.content.Content;
  import org.apache.slide.content.NodeProperty;
  import org.apache.slide.content.NodeRevisionContent;
  import org.apache.slide.content.NodeRevisionDescriptor;
  import org.apache.slide.content.NodeRevisionDescriptors;
  //import org.apache.slide.content.RevisionContentNotFoundException;
  //import org.apache.slide.content.RevisionDescriptorNotFoundException;
  //import org.apache.slide.content.RevisionNotFoundException;
  import org.apache.slide.content.NodeRevisionNumber;
  import org.apache.slide.lock.Lock;
  import org.apache.slide.lock.NodeLock;
  //import org.apache.slide.lock.ObjectLockedException;
  import org.apache.slide.macro.Macro;
  //import org.apache.slide.security.AccessDeniedException;
  import org.apache.slide.security.NodePermission;
  import org.apache.slide.security.Security;
  //import org.apache.slide.structure.LinkedObjectNotFoundException;
  import org.apache.slide.structure.ObjectNode;
  //import org.apache.slide.structure.ObjectNotFoundException;
  import org.apache.slide.structure.Structure;
  
  import java.io.ByteArrayOutputStream;
  import java.io.InputStream;
  import java.io.IOException;
  import java.io.OutputStream;
  import java.net.MalformedURLException;
  import java.net.URL;
  import java.util.Date;
  import java.util.Enumeration;
  import java.util.Iterator;
  import java.util.Map;
  import java.util.Vector;
  
  /**
   * A sources from jakarta slide repositories.
   *
   * @author <a href="mailto:[EMAIL PROTECTED]">Stephan Michels</a>
   * @version $Id: SlideSource.java,v 1.1 2002/06/21 13:39:43 stephan Exp $
   */
  public class SlideSource extends AbstractLoggable implements 
        Source, WriteableSource, BrowseableSource, RestrictableSource, 
        LockableSource/*, InspectableSource*/, VersionableSource {
  
      /** Component manager */
      private ComponentManager manager;
  
      /** Sytem id */
      private String systemid;
  
      //private String uri;
  
      //private SourceParameters locationParameters;
  
      /** Namespace access token. */
      private NamespaceAccessToken nat;
  
      /** Structure helper. */
      private Structure structure;
  
      /** Content helper. */
      private Content content;
  
      /** Security helper. */
      private Security security;
  
      /** Lock helper. */
      private Lock lock;
  
      /** Macro helper. */
      private Macro macro;
  
      private CredentialsToken credToken;
  
      /** Slide token. */
      private SlideToken slideToken;
  
      /** The URI of the source*/
      private String uri;
  
      /** Revision number */
      private NodeRevisionNumber revisionNumber;
  
      private NodeRevisionDescriptors revisionDescriptors = null;
      private NodeRevisionDescriptor revisionDescriptor = null;
  
      //private String branch;
  
      private SourceCredential sourcecredential = new SourceCredential("guest", 
"guest");
      private String sourcerevision = null;
      private String sourcerevisionbranch = null;
      private SourceValidity validity = null;
  
      private SlideSourceOutputStream outputstream;
  
      private boolean initialized = false;
  
      public SlideSource(NamespaceAccessToken nat, String uri)
          throws SourceException {
  
          this.credToken = new 
CredentialsToken(this.sourcecredential.getPrincipal());
          this.nat = nat;
          this.uri = uri;
  
          this.structure = nat.getStructureHelper();
          this.content = nat.getContentHelper();
          this.security = nat.getSecurityHelper();
          this.lock = nat.getLockHelper();
          this.macro = nat.getMacroHelper();
  
          this.slideToken = new SlideTokenImpl(credToken);
  
          try {
              this.revisionDescriptors = content.retrieve(this.slideToken, 
this.uri);
  
              // Retrieve latest revision descriptor
              this.revisionDescriptor = content.retrieve(slideToken, 
revisionDescriptors);
  
              this.sourcerevision = 
this.revisionDescriptor.getRevisionNumber().toString();
              this.sourcerevisionbranch = 
this.revisionDescriptor.getBranchName();
  
          } catch (SlideException se) {
              throw new SourceException("Could not retrieve revision 
descriptor", se);
          }
      }
  
      /**
       * Pass the ComponentManager to the composer. The Composable 
implementation
       * should use the specified ComponentManager to acquire the components it 
needs for execution
       *
       * @param manager The ComponentManager which this Composable uses
       *
       * @throws ComponentException
       */
      public void compose(ComponentManager manager) throws ComponentException {
          this.manager = manager;
      }
  
      /**
       * Return an <code>InputStream</code> object to read from the source.
       * This is the data at the point of invocation of this method,
       * so if this is Modifiable, you might get different content
       * from two different invocations.
       */
      public InputStream getInputStream()
          throws IOException, SourceException {
          try {
              ObjectNode object = structure.retrieve(this.slideToken, this.uri);
  
              return content.retrieve(slideToken, revisionDescriptors,
                         revisionDescriptor).streamContent();
          } catch (SlideException se) {
              throw new SourceException("Could not get source", se);
          }
      }
  
      /**
       * Return the unique identifer for this source
       */
      public String getSystemId() {
          return this.systemid;
      }
  
      /**
       *  Get the Validity object. This can either wrap the last modification
       *  date or the expires information or...
       *  If it is currently not possible to calculate such an information
       *  <code>null</code> is returned.
       */
      public SourceValidity getValidity() {
          try {
              if (validity!=null) {
                  this.validity = new TimeStampValidity(
                      revisionDescriptor.getLastModifiedAsDate().getTime());
              }
          } catch (Exception e) {
              return null;
          }
          return this.validity;
      }
  
      /**
       * Refresh the content of this object after the underlying data
       * content has changed.
       */
      public void discardValidity() {
          this.validity = null;
      }
  
      /**
       * The mime-type of the content described by this object.
       * If the source is not able to determine the mime-type by itself
       * this can be null.
       */
      public String getMimeType() {
          return revisionDescriptor.getContentType();
      }
  
      /**
       * Does this source actually exist ?
       *
       * @return true if the resource exists.
       */
      public boolean exists() {
          try {
              structure.retrieve(this.slideToken, this.uri);
          } catch (SlideException e) {
              return false;
          }
          return true;
      }
  
      /**
       * Get an <code>InputStream</code> where raw bytes can be written to.
       * The signification of these bytes is implementation-dependent and
       * is not restricted to a serialized XML document.
       *
       * @return a stream to write to
       */
      public OutputStream getOutputStream() throws IOException, SourceException 
{
          if (outputstream==null)
              outputstream = new SlideSourceOutputStream();
          return outputstream;
      }
  
      /**
       * Can the data sent to an <code>OutputStream</code> returned by
       * [EMAIL PROTECTED] #getOutputStream()} be cancelled ?
       *
       * @return true if the stream can be cancelled
       */
      public boolean canCancel(OutputStream stream) {
          return outputstream.canCancel();
      }
  
      /**
       * Cancel the data sent to an <code>OutputStream</code> returned by
       * [EMAIL PROTECTED] #getOutputStream()}.
       * <p>
       * After cancel, the stream should no more be used.
       */
      public void cancel(OutputStream stream) throws SourceException {
          if (outputstream==stream) {
              try {
                  outputstream.cancel();
              } catch (Exception e) {
                  throw new SourceException("Could not cancel output stream", 
e);
              }
          }
      }
  
      /**
       * A helper can the getOutputStream() method
       */
      public class SlideSourceOutputStream extends ByteArrayOutputStream {
          private boolean isClosed = false;
  
          public void close() throws IOException {
              super.close();
  
              try {
                  NodeRevisionContent revisionContent =
                      new NodeRevisionContent();
  
                  byte[] bytes = toByteArray();
                  revisionContent.setContent(bytes);
  
                  revisionDescriptor.setContentLength(bytes.length);
  
                  // Last modification date
                  revisionDescriptor.setLastModified(new Date());
  
                  //nat.begin();
  
                  if (revisionNumber==null)
                      content.create(slideToken, uri, revisionDescriptor, null);
                  content.store(slideToken, uri, revisionDescriptor,
                                revisionContent);
  
                  //nat.commit();
  
              } catch (Exception e) {
                  throw new IOException(e.getMessage());
              } finally {
                  this.isClosed = true;
              }
          }
  
          public boolean canCancel() {
              return !this.isClosed;
          }
  
          public void cancel() throws Exception {
              if (this.isClosed) {
                  throw new IllegalStateException("Cannot cancel : outputstrem 
is already closed");
              }
  
              this.isClosed = true;
              super.close();
          }
      }
  
      /**
       * Return the content length of the content or -1 if the length is
       * unknown
       */
      public long getContentLength()
      {
          return -1;
      }
  
      /**
       * Get the last modification date of the source or 0 if it
       * is not possible to determine the date.
       */
      public long getLastModified()
      {
          return 0;
      }
  
      /**
       * Get the value of a parameter.
       * Using this it is possible to get custom information provided by the
       * source implementation, like an expires date, HTTP headers etc.
       */
      public String getParameter(String name) {
          return null;
      }
  
      /**
       * Get the value of a parameter.
       * Using this it is possible to get custom information provided by the
       * source implementation, like an expires date, HTTP headers etc.
       */
      public long getParameterAsLong(String name) {
          return 0;
      }
  
      /**
       * Get parameter names
       * Using this it is possible to get custom information provided by the
       * source implementation, like an expires date, HTTP headers etc.
       */
      public Iterator getParameterNames() {
          return new EmptyIterator();
      }
  
      class EmptyIterator implements Iterator {
          public boolean hasNext() { return false; }
          public Object next() { return null; }
          public void remove() {}
      }
  
      /**
       * Tests whether a resource is a collection resource.
       *
       * @return true if the descriptor represents a collection, false otherwise
       */
      public boolean isSourceCollection() throws SourceException {
  
          boolean result = false;
  
          if (revisionDescriptor == null)
              return true;
  
          NodeProperty property = 
revisionDescriptor.getProperty("resourcetype");
  
          if ((property != null)
              && (property.getValue().equals("<collection/>"))) {
              result = true;
          }
  
          return result;
      }
  
      /**
       * Returns the count of child sources.
       */
      public int getChildSourceCount() throws SourceException {
          try {
              int i=0;
              for(Enumeration children=structure.retrieve(this.slideToken,
                  this.uri).enumerateChildren(); 
children.hasMoreElements();i++) 
                  children.nextElement();
              return i;
          } catch (SlideException se) {
              throw new SourceException("Could not get children", se);
          }
      }
      
      /**
       * Return the system id of a child source.
       *
       * @param index Index of the child
       */
      public String getChildSource(int index) throws SourceException {
          try {
              int i=0;
              ObjectNode node;
              for(Enumeration children=structure.retrieve(this.slideToken, 
                  this.uri).enumerateChildren(); 
children.hasMoreElements();i++) {
    
                  node = ((ObjectNode)children.nextElement());
                  if (i==index)
                      return node.getUri();
              }
              return null;
          } catch (SlideException se) {
              throw new SourceException("Could not get children", se);
          }
      }
  
      /** 
       * Get the current credential for the source
       */
      public SourceCredential getSourceCredential() throws SourceException {
          return this.sourcecredential;
      }
  
      /** 
       * Set the credential for the source
       */
      public void setSourceCredential(SourceCredential sourcecredential) throws 
SourceException {
          if (sourcecredential==null)
              throw new NullPointerException();
          this.sourcecredential = sourcecredential;
          this.credToken = new 
CredentialsToken(this.sourcecredential.getPrincipal());
      }
  
      /**
       * Add a permission to this source
       *
       * @param sourcepermission Permission, which should be added
       *
       * @throws SourceException If an exception occurs during this operation
       */
      public void addSourcePermission(SourcePermission sourcepermission) throws 
SourceException {
          /*NodePermission permission = 
              new NodePermission(this.uri, sourcepermission.getSubject(), 
action, 
                                 sourcepermission.isInheritable(),
                                 sourcepermission.isNegative());
          this.security.grantPermission(this.slideToken, permission);*/
  
          throw new SourceException("Operation not yet supported");
      }
  
      /**
       * Returns a enumeration of the existing locks
       *
       * @return Enumeration of SourcePermission
       */
      public Enumeration getSourcePermissions() throws SourceException {
          try {
              Vector sourcepermissions = new Vector();
  
              NodePermission permission;
              for(Enumeration permissions = 
this.lock.enumerateLocks(this.slideToken, this.uri);
                  permissions.hasMoreElements();) {
  
                  permission = (NodePermission) permissions.nextElement();
  
                  sourcepermissions.addElement(new 
SourcePermission(permission.getSubjectUri(),
                                                                    
permission.getActionUri(),
                                                                    
permission.isInheritable(),
                                                                    
permission.isNegative()));
              }
  
              return sourcepermissions.elements();
          } catch (SlideException se) {
              throw new SourceException("Could not remove property", se);
          }
      }
  
      /**
       * Add a lock to this source
       *
       * @param sourcelock Lock, which should be added
       *
       * @throws SourceException If an exception occurs during this operation
       */
      public void addSourceLocks(SourceLock sourcelock) throws SourceException {
          throw new SourceException("Operation not yet supported");
      }
      
      /**
       * Returns a enumeration of the existing locks
       *
       * @return Enumeration of SourceLock
       */
      public Enumeration getSourceLocks() throws SourceException {
          try {
              Vector sourcelocks = new Vector();
  
              NodeLock lock;
              for(Enumeration locks = this.lock.enumerateLocks(this.slideToken, 
this.uri, false);
                  locks.hasMoreElements();) {
  
                  lock = (NodeLock) locks.nextElement();
  
                  sourcelocks.addElement(new SourceLock(lock.getSubjectUri(),
                                                        lock.getTypeUri(),
                                                        
lock.getExpirationDate(),
                                                        lock.isInheritable(),
                                                        lock.isExclusive()));
              }
  
              return sourcelocks.elements();
          } catch (SlideException se) {
              throw new SourceException("Could not remove property", se);
          }
      }
  
      /**
       * Sets a property for a source.
       *
       * @param sourceproperty Property of the source
       *
       * @throws SourceException If an exception occurs during this operation
       */
      /*public void setProperty(SourceProperty sourceproperty) throws 
SourceException {
          try {
              revisionDescriptor.setProperty(sourceproperty.getName(), 
sourceproperty.getNamespace(),
                                             sourceproperty.getValue());
              content.store(slideToken, this.uri, revisionDescriptor, null);
          } catch (SlideException se) {
              throw new SourceException("Could not set property", se);
          }
      }*/
  
      /**
       * Returns a property from a source.
       *
       * @param namespace Namespace of the property
       * @param name Name of the property
       */
      /*public SourceProperty getProperty(String namespace, String name) throws 
SourceException {
  
          if (namespace.equals(DEFAULTNAMESPACE)) {
  
              if (name.equals(PROPERTY_URI))
                  return new SourceProperty(namespace, name, this.uri);
              if (name.equals(PROPERTY_REVISION))
                  return new SourceProperty(namespace, name, 
revisionDescriptor.getRevisionNumber().toString());
          }
  
          return new SourceProperty(namespace, name,
                  revisionDescriptor.getProperty(name, 
namespace).getValue().toString());
      }*/
  
      /**
       * Returns a enumeration of the properties
       *
       * @return Enumeration of SourceProperty
       */
      /*public Enumeration getSourceProperties() throws SourceException {
          Vector sourceproperties = new Vector();
  
          NodeProperty property;
          for(Enumeration e = revisionDescriptor.enumerateProperties(); 
e.hasMoreElements();) {
              property = (NodeProperty)e.nextElement();
              sourceproperties.addElement(new 
SourceProperty(property.getNamespace(), property.getName(),
                                                             
property.getValue().toString()));
          }
  
          sourceproperties.addElement(new SourceProperty(DEFAULTNAMESPACE, 
PROPERTY_URI, this.uri));
  
          if (revisionDescriptor.getRevisionNumber()!=null)
              sourceproperties.addElement(
                  new SourceProperty(DEFAULTNAMESPACE, PROPERTY_REVISION,
                                     
revisionDescriptor.getRevisionNumber().toString()));
  
          if (revisionDescriptor.getBranchName()!=null)
              sourceproperties.addElement(
                  new SourceProperty(DEFAULTNAMESPACE, PROPERTY_BRANCH, 
revisionDescriptor.getBranchName()));
  
          return sourceproperties.elements();
      }*/
      
      /*public void removeProperty(String namespace, String name) throws 
SourceException {
          try {
              if (revisionDescriptor!=null) {
                  revisionDescriptor.removeProperty(name,namespace);
                  content.store(slideToken, this.uri, revisionDescriptor, null);
              }
          } catch (SlideException se) {
              throw new SourceException("Could not remove property", se);
          }
      }*/
  
      /** 
       * If this source versioned
       */
      public boolean isVersioned() throws SourceException {
          try {
              this.revisionDescriptors = content.retrieve(this.slideToken, 
this.uri);
  
              return this.revisionDescriptors.hasRevisions();
  
          } catch (SlideException se) {
              throw new SourceException("Could not retrieve revision 
descriptor", se);
          }
      }
  
      /** 
       * Get the current revision of the source
       */
      public String getSourceRevision() throws SourceException {
          return this.sourcerevision;
      }
  
      /** 
       * Sets the wanted revision of the source
       */
      public void setSourceRevision(String sourcerevision) throws 
SourceException {
          this.sourcerevision = sourcerevision;
  
          try {
              this.revisionDescriptors = content.retrieve(this.slideToken, 
this.uri);
  
              // Retrieve revision descriptor by the revision
              this.revisionDescriptor = content.retrieve(slideToken, 
revisionDescriptors, 
                                            new 
NodeRevisionNumber(this.sourcerevision));
  
          } catch (SlideException se) {
              throw new SourceException("Could not retrieve revision 
descriptor", se);
          }
      }
  
      /** 
       * Get the current branch of the revision from the source
       */
      public String getSourceRevisionBranch() throws SourceException {
          return this.sourcerevisionbranch;
      }
  
      /** 
       * Sets the wanted branch of the revision from the source
       */
      public void setSourceRevisionBranch(String sourcerevisionbranch) throws 
SourceException {
          this.sourcerevisionbranch  =  sourcerevisionbranch;
  
          // FIXME Retrieve the the revsion descriptor with current branch
      }
  
      /** 
       * Get the latest revision
       */
      public String getLatestSourceRevision() throws SourceException {
          try {
              this.revisionDescriptors = content.retrieve(this.slideToken, 
this.uri);
  
              return this.revisionDescriptors.getLatestRevision().toString();
  
          } catch (SlideException se) {
              throw new SourceException("Could not retrieve revision 
descriptor", se);
          }
      }
  }
  
  
  
  
  1.1                  
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/source/impl/WebDAVSource.java
  
  Index: WebDAVSource.java
  ===================================================================
  /*
   * 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 [EMAIL PROTECTED]
   *
   * 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.impl;
  
  import org.apache.log.Logger;
  
  import org.apache.cocoon.components.source.RestrictableSource;
  import org.apache.cocoon.components.source.WriteableSource;
  import org.apache.cocoon.components.source.helpers.SourceCredential;
  
  import org.apache.commons.httpclient.HttpException;
  
  import org.apache.excalibur.source.Source;
  import org.apache.excalibur.source.SourceException;
  import org.apache.excalibur.source.SourceFactory;
  import org.apache.excalibur.source.SourceParameters;
  import org.apache.excalibur.source.SourceValidity;
  import org.apache.excalibur.source.impl.validity.TimeStampValidity;
  
  import org.apache.webdav.lib.WebdavResource;
  
  import java.io.ByteArrayOutputStream;
  import java.io.InputStream;
  import java.io.IOException;
  import java.io.OutputStream;
  
  import java.util.Iterator;
  
  /**
   * A source implementation to get access to WebDAV repositories
   *
   * @author <a href="mailto:[EMAIL PROTECTED]">Stephan Michels</a>
   * @version $Id: WebDAVSource.java,v 1.1 2002/06/21 13:39:43 stephan Exp $
   */
  public class WebDAVSource implements Source, WriteableSource, 
RestrictableSource {
  
      private String systemId;
      private SourceValidity validity = null;
      private SourceCredential sourcecredential = null;
  
      private WebdavResource resource = null;
  
      public WebDAVSource(String location) throws SourceException {
          this.systemId = 
"http://"+location.substring(location.indexOf("://")+3);
  
          try { 
              this.resource = new WebdavResource(this.systemId);
          } catch (HttpException he) {
              throw new SourceException("Could get WebDAV resource", he);
          } catch (IOException ioe) {
              throw new SourceException("Could get WebDAV resource", ioe);
          }
      }
  
      /**
       * Return an <code>InputStream</code> object to read from the source.
       * This is the data at the point of invocation of this method,
       * so if this is Modifiable, you might get different content
       * from two different invocations.
       */
      public InputStream getInputStream()
          throws IOException, SourceException{
          try {
              return this.resource.getMethodData();
          } catch (HttpException he) {
              throw new SourceException("Could get WebDAV resource", he);
          }
      }
  
      /**
       * Return the unique identifer for this source
       */
      public String getSystemId() {
          return this.systemId;
      }
      
      /**
       *  Get the Validity object. This can either wrap the last modification
       *  date or the expires information or...
       *  If it is currently not possible to calculate such an information
       *  <code>null</code> is returned.
       */
      public SourceValidity getValidity() {
          if (this.validity==null)
              this.validity = new 
TimeStampValidity(this.resource.getGetLastModified());
          return this.validity;
      }
      
      /**
       * Refresh the content of this object after the underlying data
       * content has changed.
       */
      public void discardValidity() {
          try {
              this.resource = new WebdavResource(this.systemId);
  
              if (sourcecredential!=null)
                  resource.setUserInfo(sourcecredential.getPrincipal(), 
sourcecredential.getPassword());
          } catch (HttpException he) {
              throw new IllegalStateException(he.getMessage());
          } catch (IOException ioe) {
              throw new IllegalStateException(ioe.getMessage());
          }
  
          this.validity = null;
      }
      
      /**
       * The mime-type of the content described by this object.
       * If the source is not able to determine the mime-type by itself
       * this can be <code>null</code>.
       */
      public String getMimeType() {
          return this.resource.getGetContentType();
      }
      
      /**
       * Return the content length of the content or -1 if the length is
       * unknown
       */
      public long getContentLength() {
          return this.resource.getGetContentLength();
      }
      
      /**
       * Get the last modification date.
       * @return The last modification in milliseconds since January 1, 1970 GMT
       *         or 0 if it is unknown
       */
      public long getLastModified() {
          return this.resource.getGetLastModified();
      }
      
      /**
       * Get the value of a parameter.
       * Using this it is possible to get custom information provided by the
       * source implementation, like an expires date, HTTP headers etc.
       */
      public String getParameter(String name) {
          return null;
      }
      
      /**
       * Get the value of a parameter.
       * Using this it is possible to get custom information provided by the
       * source implementation, like an expires date, HTTP headers etc.
       */
      public long getParameterAsLong(String name) {
          return -1;
      }
      
      /**
       * Get parameter names
       * Using this it is possible to get custom information provided by the
       * source implementation, like an expires date, HTTP headers etc.
       */
      public Iterator getParameterNames() {
          return null;
      }
  
      /**
       * Does this source actually exist ?
       *
       * @return true if the resource exists.
       */
      public boolean exists() {
          return this.resource.getExistence();
      }
  
      /**
       * Get an <code>InputStream</code> where raw bytes can be written to.
       * The signification of these bytes is implementation-dependent and
       * is not restricted to a serialized XML document.
       *
       * @return a stream to write to
       */
      public OutputStream getOutputStream() throws IOException, SourceException 
{
          return new WebDAVSourceOutputStream(this.resource);
      }
  
      /**
       * Can the data sent to an <code>OutputStream</code> returned by
       * [EMAIL PROTECTED] #getOutputStream()} be cancelled ?
       *
       * @return true if the stream can be cancelled
       */
      public boolean canCancel(OutputStream stream) {
          return true;
      }
  
      /**
       * Cancel the data sent to an <code>OutputStream</code> returned by
       * [EMAIL PROTECTED] #getOutputStream()}.
       * <p>
       * After cancel, the stream should no more be used.
       */
      public void cancel(OutputStream stream) throws SourceException {
          // The content will only be send, if outputstream.close() executed.
      }
  
      /** 
       * Get the current credential for the source
       */
      public SourceCredential getSourceCredential() throws SourceException {
          return this.sourcecredential;
      }
  
      /** 
       * Set the credential for the source
       */
      public void setSourceCredential(SourceCredential sourcecredential) throws 
SourceException {
          this.sourcecredential = sourcecredential;
  
          try {
              resource.setUserInfo(sourcecredential.getPrincipal(), 
sourcecredential.getPassword());
          } catch (HttpException he) {
              throw new SourceException("Could not set credentials", he);
          } catch (IOException ioe) {
              throw new IllegalStateException(ioe.getMessage());
          }
      }
  
      public class WebDAVSourceOutputStream extends ByteArrayOutputStream {
  
          private WebdavResource resource = null;
  
          private WebDAVSourceOutputStream(WebdavResource resource) {
              this.resource = resource;
          }
  
          public void close() throws IOException {
              super.close();
  
              try {
                  this.resource.putMethod(toByteArray());
              } catch (HttpException he) {
                  throw new IOException(he.getMessage());
              }
          }
      }
  }
  
  
  
  
  1.1                  
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/source/impl/WebDAVSourceFactory.java
  
  Index: WebDAVSourceFactory.java
  ===================================================================
  /*
   * 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 [EMAIL PROTECTED]
   *
   * 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.impl;
  
  import org.apache.avalon.framework.configuration.Configuration;
  import org.apache.avalon.framework.configuration.ConfigurationException;
  import org.apache.avalon.framework.configuration.Configurable;
  import org.apache.avalon.framework.component.Component;
  import org.apache.avalon.framework.component.ComponentException;
  import org.apache.avalon.framework.component.ComponentManager;
  import org.apache.avalon.framework.component.ComponentSelector;
  import org.apache.avalon.framework.component.Composable;
  import org.apache.avalon.framework.context.Context;
  import org.apache.avalon.framework.context.ContextException;
  import org.apache.avalon.framework.context.Contextualizable;
  import org.apache.avalon.framework.logger.AbstractLoggable;
  import org.apache.avalon.framework.thread.ThreadSafe;
  
  import org.apache.cocoon.Constants;
  import org.apache.cocoon.components.source.helpers.SourceCredential;
  
  import org.apache.excalibur.source.Source;
  import org.apache.excalibur.source.SourceException;
  import org.apache.excalibur.source.SourceFactory;
  import org.apache.excalibur.source.SourceParameters;
  
  import org.apache.slide.common.Domain;
  
  import java.io.IOException;
  import java.net.MalformedURLException;
  import java.util.Map;
  
  /**
   * A factory for sources from repositories. 
   *
   * @author <a href="mailto:[EMAIL PROTECTED]">Stephan Michels</a>
   * @version $Id: WebDAVSourceFactory.java,v 1.1 2002/06/21 13:39:43 stephan 
Exp $
   */
  public class WebDAVSourceFactory extends AbstractLoggable
    implements SourceFactory, ThreadSafe {
  
      /** The component manager instance */
      private ComponentManager manager = null;
  
      /**
       * Set the current <code>ComponentManager</code> instance used by this
       * <code>Composable</code>.
       */
      public void compose(ComponentManager manager) throws ComponentException {
          this.manager = manager;
      }
  
  
      /**
       * Get a <code>Source</code> object.
       * @param parameters This is optional.
       */
      public Source getSource( String location, Map parameters )
          throws MalformedURLException, IOException, SourceException {
          if ((this.getLogger()!=null) && (this.getLogger().isDebugEnabled())) {
              this.getLogger().debug( "Creating source object for " + location 
);
          }
  
          int position = location.indexOf("://");
          if (position >= 0)
              position += 3;
          else
              position = 0;
      
          // create the queryString (if available)
          String queryString = null;
          SourceParameters locationParameters = null;
          int queryStringPos = location.indexOf('?');
          if (queryStringPos != -1) {
              queryString = location.substring(queryStringPos + 1);
              location = location.substring(position, queryStringPos);
              locationParameters = new SourceParameters(queryString);
  
          } else if (position > 0) {
              location = location.substring(position);
              locationParameters = new SourceParameters();
          }
  
          String repository = locationParameters.getParameter("repository", 
null);
          String namespace = locationParameters.getParameter("namespace", null);
          String principal = locationParameters.getParameter("principal", 
"guest");
          String password = locationParameters.getParameter("paswword", null);
          String revision = locationParameters.getParameter("revision", null);
          //String branch = locationParameters.getParameter("branch", null);
  
          SourceCredential credential;
          if (password!=null)
              credential = new SourceCredential(principal, password);
          else
              credential = new SourceCredential(principal);
  
          WebDAVSource source = new WebDAVSource(location);
  
          source.setSourceCredential(credential); // RestrictableSource
          //source.setSourceRevision(revision); // VersionableSource
  
          return source;
      }
  }
  
  
  
  
  1.1                  
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/source/impl/repository.xconf
  
  Index: repository.xconf
  ===================================================================
  <?xml version="1.0"?>
  
  <xconf xpath="/cocoon/source-factories" unless="[EMAIL 
PROTECTED]'repository']">
  
      <!-- repository pseudo protocol -->
      <component-instance name="repository" 
class="org.apache.cocoon.components.source.impl.RepositorySourceFactory"/>
  </xconf>
  
  
  
  1.1                  
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/source/impl/webdav.xconf
  
  Index: webdav.xconf
  ===================================================================
  <?xml version="1.0"?>
  
  <xconf xpath="/cocoon/source-factories" unless="[EMAIL PROTECTED]'dav']">
  
      <!-- WebDAV pseudo protocol -->
      <component-instance name="dav" 
class="org.apache.cocoon.components.source.impl.WebDAVSourceFactory"/>
  </xconf>
  
  
  
  1.1                  
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/generation/SourceDescriptionGenerator.java
  
  Index: SourceDescriptionGenerator.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
      [EMAIL PROTECTED]
  
   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  <[EMAIL PROTECTED]>. For more  information on the Apache
   Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.cocoon.generation;
  
  import org.apache.avalon.excalibur.pool.Recyclable;
  
  import org.apache.avalon.framework.activity.Disposable;
  import org.apache.avalon.framework.component.Component;
  import org.apache.avalon.framework.component.ComponentException;
  import org.apache.avalon.framework.component.ComponentManager;
  import org.apache.avalon.framework.component.ComponentSelector;
  import org.apache.avalon.framework.component.Composable;
  import org.apache.avalon.framework.configuration.Configurable;
  import org.apache.avalon.framework.configuration.Configuration;
  import org.apache.avalon.framework.configuration.ConfigurationException;
  import org.apache.avalon.framework.parameters.Parameters;
  
  import org.apache.cocoon.ProcessingException;
  import org.apache.cocoon.components.source.BrowseableSource;
  import org.apache.cocoon.components.source.InspectableSource;
  import org.apache.cocoon.components.source.LockableSource;
  import org.apache.cocoon.components.source.RestrictableSource;
  import org.apache.cocoon.components.source.WriteableSource;
  import org.apache.cocoon.components.source.VersionableSource;
  import org.apache.cocoon.components.source.helpers.SourceCredential;
  import org.apache.cocoon.components.source.helpers.SourceLock;
  import org.apache.cocoon.components.source.helpers.SourcePermission;
  import org.apache.cocoon.components.source.helpers.SourceProperty;
  //import org.apache.cocoon.environment.Source;
  import org.apache.cocoon.environment.SourceResolver;
  
  import org.apache.excalibur.source.Source;
  import org.apache.excalibur.source.SourceException;
  
  import org.xml.sax.SAXException;
  import org.xml.sax.helpers.AttributesImpl;
  
  import java.io.IOException;
  import java.net.MalformedURLException;
  import java.util.Enumeration;
  import java.util.Date;
  import java.util.Map;
  
  /**
   * Generates an source description from a source of a repository.
   * The generator uses RDF(http://www.w3.org/RDF/) for the description.
   *
   * @author <a href="mailto:[EMAIL PROTECTED]">Stephan Michels</a>
   * @version CVS $Id: SourceDescriptionGenerator.java,v 1.1 2002/06/21 
13:39:43 stephan Exp $
   */
  public class SourceDescriptionGenerator extends ComposerGenerator 
          implements Recyclable, Configurable{
  
      /** Namespace of the resource description framework. */
      private static final String RDF_NS =
        "http://www.w3.org/1999/02/22-rdf-syntax-ns#";;
  
      /** The namespace prefix of the resource description framework. */
      private static final String RDF_PREFIX             = "rdf";
  
      /** Namespace of the resource description framework. */
      private static final String SOURCE_NS = 
"http://xml.apache.org/cocoon/source/1.0";;
  
      private static final String RDF_NODE_NAME          = "RDF";
      private static final String DESCRIPTION_NODE_NAME  = "Description";
  
      private static final String SEQUENCE_NODE_NAME     = "Seq";
      private static final String SEQUENCEITEM_NODE_NAME = "li";
  
      private static final String PERMISSIONS_NODE_NAME  = "permissions";
      private static final String PERMISSION_NODE_NAME   = "permission";
      private static final String LOCKS_NODE_NAME        = "locks";
      private static final String LOCK_NODE_NAME         = "lock";
      private static final String CHILDREN_NODE_NAME     = "children";
   
      private static final String URI_ATTR_NAME          = "about";
  
      private static final String SUBJECT_ATTR_NAME      = "subject";
      private static final String ACTION_ATTR_NAME       = "action";
      private static final String INHERITABLE_ATTR_NAME  = "inheritable";
      private static final String NEGATIVE_ATTR_NAME     = "negative";
  
      private static final String TYPE_ATTR_NAME         = "type";
      private static final String EXPIRATION_ATTR_NAME   = "expiration";
      private static final String EXCLUSIVE_ATTR_NAME    = "exclusive";
  
      /**
       * Pass the Configuration to the Configurable  class. This method must 
       * always be called after the constructor and before any other method.
       *
       * @param conf the class configurations.
       *
       * @throws ConfigurationException Thrown when a Configurable component 
       *                                cannot be configured properly, or if 
       *                                a value cannot be retrieved properly.
       */
      public void configure(Configuration conf) throws ConfigurationException {
      }
  
      public void setup(SourceResolver resolver, Map objectModel, String 
location, Parameters parameters)
          throws ProcessingException, SAXException, IOException {
          super.setup(resolver, objectModel, location, parameters);
      }
  
      /**
       * Generate XML data.
       */
      public void generate() throws IOException, SAXException, 
ProcessingException {
  
          try
          {
              this.contentHandler.startDocument();
              this.contentHandler.startPrefixMapping(RDF_PREFIX,RDF_NS);
  
              this.contentHandler.startElement(RDF_NS, RDF_NODE_NAME,
                                               RDF_PREFIX+':'+RDF_NODE_NAME, 
new AttributesImpl());
  
              pushSourceDescription(this.source, 1);
  
              this.contentHandler.endElement(RDF_NS, RDF_NODE_NAME, 
RDF_PREFIX+':'+RDF_NODE_NAME);
  
              this.contentHandler.endPrefixMapping(RDF_PREFIX);
              this.contentHandler.endDocument();
  
          } catch (SourceException se) {
            throw new ProcessingException("Could not get source", se);
          }
      }
  
      private void pushSourceDescription(String location, int deep) 
          throws SAXException, SourceException, ProcessingException, 
IOException {
  
          Source source = null;
          try { 
              source = this.resolver.resolveURI(location);
          } catch (MalformedURLException urle) {
              throw new ProcessingException("Could not retrieve a source", 
urle);
          }
  
          try {
              AttributesImpl attributes = new AttributesImpl();
              attributes.addAttribute("", URI_ATTR_NAME, URI_ATTR_NAME, 
"CDATA", source.getSystemId());
  
              this.contentHandler.startElement(RDF_NS, DESCRIPTION_NODE_NAME, 
                                               
RDF_PREFIX+':'+DESCRIPTION_NODE_NAME, attributes);
  
              if (source instanceof InspectableSource)
                  pushSourceProperties((InspectableSource)source);
              /*if (source instanceof RestrictableSource)
                  pushSourcePermissions((RestrictableSource)source);*/
              if (source instanceof LockableSource)
                  pushSourceLocks((LockableSource)source);
              if ((source instanceof BrowseableSource) && (deep>0))
                  pushSourceChilds((BrowseableSource)source, deep);
              this.contentHandler.endElement(RDF_NS, DESCRIPTION_NODE_NAME, 
RDF_PREFIX+':'+DESCRIPTION_NODE_NAME);
          } catch (SAXException saxe) {
              throw saxe;
          } finally {
              this.resolver.release(source);
          }
      }
  
      private void pushSourceChilds(BrowseableSource source, int deep) 
          throws SAXException, SourceException, ProcessingException, 
IOException {
  
          if (source.isSourceCollection()) {
  
              if (source.getChildSourceCount()>0) {
    
                  this.contentHandler.startElement(SOURCE_NS, 
CHILDREN_NODE_NAME, 
                                                   CHILDREN_NODE_NAME, new 
AttributesImpl());
                  this.contentHandler.startElement(RDF_NS, SEQUENCE_NODE_NAME,
                                                   
RDF_PREFIX+':'+SEQUENCE_NODE_NAME, new AttributesImpl());
    
                  for(int i=0; i<source.getChildSourceCount(); i++) {
  
                      this.contentHandler.startElement(RDF_NS, 
SEQUENCEITEM_NODE_NAME,
                                                       
RDF_PREFIX+':'+SEQUENCEITEM_NODE_NAME, new AttributesImpl());
  
                      pushSourceDescription(source.getChildSource(i), deep-1);
  
                      this.contentHandler.endElement(RDF_NS, 
SEQUENCEITEM_NODE_NAME,
                                                     
RDF_PREFIX+':'+SEQUENCEITEM_NODE_NAME);
                  }
  
                  this.contentHandler.endElement(RDF_NS, SEQUENCE_NODE_NAME,
                                                 
RDF_PREFIX+':'+SEQUENCE_NODE_NAME);
                  this.contentHandler.endElement(SOURCE_NS, CHILDREN_NODE_NAME, 
CHILDREN_NODE_NAME);
              }
          }
      }
  
      private void pushSourceProperties(InspectableSource source) throws 
SAXException, SourceException {
          Enumeration properties = source.getSourceProperties();
          SourceProperty property;
          while (properties.hasMoreElements()) {
  
              property = (SourceProperty) properties.nextElement();
  
              this.contentHandler.startPrefixMapping("", 
property.getNamespace());
  
              this.contentHandler.startElement(property.getNamespace(), 
property.getName(), 
                                               property.getName(), new 
AttributesImpl());
              
this.contentHandler.characters(property.getValue().toString().toCharArray(), 0,
                                             
property.getValue().toString().length());
              this.contentHandler.endElement(property.getNamespace(), 
property.getName(), 
                                             property.getName());
  
              this.contentHandler.endPrefixMapping("");
          }
      }
  
      /*private void pushSourcePermissions(RestrictableSource source) throws 
SAXException, SourceException {
          Enumeration permissionsList = source.getSourcePermissions();
          SourcePermission permission;
  
          if (permissionsList.hasMoreElements()) {
  
              this.contentHandler.startElement(SOURCE_NS, PERMISSIONS_NODE_NAME,
                                               PERMISSIONS_NODE_NAME, new 
AttributesImpl());
              this.contentHandler.startElement(RDF_NS, SEQUENCE_NODE_NAME,
                                               
RDF_PREFIX+':'+SEQUENCE_NODE_NAME, new AttributesImpl());
  
              while (permissionsList.hasMoreElements()) {
      
                  permission = (SourcePermission) permissionsList.nextElement();
      
                  this.contentHandler.startElement(RDF_NS, 
SEQUENCEITEM_NODE_NAME,
                                                   
RDF_PREFIX+':'+SEQUENCEITEM_NODE_NAME, new AttributesImpl());
  
                  AttributesImpl attributes = new AttributesImpl();
                  attributes.addAttribute("", SUBJECT_ATTR_NAME, 
SUBJECT_ATTR_NAME, "CDATA",
                                          permission.getSubject());
                  attributes.addAttribute("", ACTION_ATTR_NAME, 
ACTION_ATTR_NAME, "CDATA",
                                          permission.getAction());
                  attributes.addAttribute("", INHERITABLE_ATTR_NAME, 
INHERITABLE_ATTR_NAME, "CDATA",
                                          
String.valueOf(permission.isInheritable()));
                  attributes.addAttribute("", NEGATIVE_ATTR_NAME, 
NEGATIVE_ATTR_NAME, "CDATA",
                                          
String.valueOf(permission.isNegative()));
  
                  this.contentHandler.startElement(SOURCE_NS, 
PERMISSION_NODE_NAME,
                                                   PERMISSION_NODE_NAME, 
attributes);
                  this.contentHandler.endElement(SOURCE_NS, 
PERMISSION_NODE_NAME, 
                                                 PERMISSION_NODE_NAME);
  
                  this.contentHandler.endElement(RDF_NS, 
SEQUENCEITEM_NODE_NAME, 
                                                 
RDF_PREFIX+':'+SEQUENCEITEM_NODE_NAME);
              }
  
              this.contentHandler.endElement(RDF_NS, SEQUENCE_NODE_NAME, 
                                             RDF_PREFIX+':'+SEQUENCE_NODE_NAME);
              this.contentHandler.endElement(SOURCE_NS, PERMISSIONS_NODE_NAME, 
                                             PERMISSIONS_NODE_NAME);
          }
      }*/
  
      public void pushSourceLocks(LockableSource source) throws SAXException, 
SourceException {
          Enumeration locks = source.getSourceLocks();
          SourceLock lock;
  
          if (locks.hasMoreElements()) {
  
              this.contentHandler.startElement(SOURCE_NS, LOCKS_NODE_NAME,
                                               LOCKS_NODE_NAME, new 
AttributesImpl());
              this.contentHandler.startElement(RDF_NS, SEQUENCE_NODE_NAME,
                                               
RDF_PREFIX+':'+SEQUENCE_NODE_NAME, new AttributesImpl());
  
              while (locks.hasMoreElements()) {
  
                  lock = (SourceLock) locks.nextElement();
  
                  this.contentHandler.startElement(RDF_NS, 
SEQUENCEITEM_NODE_NAME,
                                                   
RDF_PREFIX+':'+SEQUENCEITEM_NODE_NAME, new AttributesImpl());
  
                  AttributesImpl attributes = new AttributesImpl();
                  attributes = new AttributesImpl();
                  attributes.addAttribute("", SUBJECT_ATTR_NAME, 
SUBJECT_ATTR_NAME, "CDATA",
                                          lock.getSubject());
                  attributes.addAttribute("", TYPE_ATTR_NAME, TYPE_ATTR_NAME, 
"CDATA",
                                          lock.getType());
                  attributes.addAttribute("", EXPIRATION_ATTR_NAME, 
EXPIRATION_ATTR_NAME, "CDATA",
                                          lock.getExpiration().toString());
                  attributes.addAttribute("", INHERITABLE_ATTR_NAME, 
INHERITABLE_ATTR_NAME, "CDATA",
                                          String.valueOf(lock.isInheritable()));
                  attributes.addAttribute("", EXCLUSIVE_ATTR_NAME, 
EXCLUSIVE_ATTR_NAME, "CDATA",
                                          String.valueOf(lock.isExclusive()));
  
                  this.contentHandler.startElement(SOURCE_NS, LOCK_NODE_NAME, 
                                                   LOCK_NODE_NAME, attributes);
                  this.contentHandler.endElement(SOURCE_NS, LOCK_NODE_NAME, 
                                                 LOCK_NODE_NAME);
  
                  this.contentHandler.endElement(RDF_NS, SEQUENCEITEM_NODE_NAME,
                                                 
RDF_PREFIX+':'+SEQUENCEITEM_NODE_NAME);
              }
  
              this.contentHandler.endElement(RDF_NS, SEQUENCE_NODE_NAME,
                                             RDF_PREFIX+':'+SEQUENCE_NODE_NAME);
              this.contentHandler.endElement(SOURCE_NS, LOCKS_NODE_NAME,
                                             LOCKS_NODE_NAME);
          }
      }
  }
  
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     [EMAIL PROTECTED]
To unsubscribe, e-mail:          [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to