cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From step...@apache.org
Subject cvs commit: xml-cocoon2/src/webapp/WEB-INF web.xml
Date Tue, 11 Jun 2002 18:09:13 GMT
stephan     2002/06/11 11:09:13

  Modified:    src/scratchpad/webapp/mount/slide README collection2html.xsl
                        sitemap.xmap
               src/webapp/WEB-INF web.xml
  Added:       src/scratchpad/src/org/apache/cocoon/components/repository
                        SourceCredential.java SourceDescriptor.java
                        SourceLock.java SourcePermission.java
                        SourceProperty.java SourceRepository.java
                        repository.roles
               src/scratchpad/src/org/apache/cocoon/components/repository/impl
                        SlideConfigurationAdapter.java
                        SlideLoggerAdapter.java SlideSource.java
                        SlideSourceDescriptor.java
                        SlideSourceRepository.java slide.xconf
               src/scratchpad/src/org/apache/cocoon/components/source
                        RepositorySourceFactory.java repository.xconf
                        slide.xconf
               src/scratchpad/src/org/apache/cocoon/generation
                        RepositorySourceDescriptionGenerator.java
               src/scratchpad/webapp/mount/slide login-failed.html
                        login.html logout.html web.xml
  Removed:     src/scratchpad/webapp/mount/slide Domain.xml snippet.xconf
  Log:
  First draft of supporting of cms, like Jakarta Slide. The sources
  are not complete working. There are problems in combination
  with the SourceDescriptionGenerator.
  
  Revision  Changes    Path
  1.1                  xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/repository/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 apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.cocoon.components.repository;
  
  /**
   * This class represents a credential for a given user
   *
   * @author <a href="mailto:stephan@vern.chem.tu-berlin.de">Stephan Michels</a>
   * @version $Id: SourceCredential.java,v 1.1 2002/06/11 18:09:11 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/repository/SourceDescriptor.java
  
  Index: SourceDescriptor.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 apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.cocoon.components.repository;
  
  import org.apache.excalibur.source.Source;
  import org.apache.excalibur.source.SourceException;
  
  import java.util.Enumeration;
  
  /**
   * This interface represent a descriptor for the source from a repository.
   *
   * @author <a href="mailto:stephan@vern.chem.tu-berlin.de">Stephan Michels</a>
   * @version $Id: SourceDescriptor.java,v 1.1 2002/06/11 18:09:12 stephan Exp $
   */
  public interface SourceDescriptor {
  
      /** Default namespace */
      public final static String DEFAULTNAMESPACE = "http://xml.apache.org/cocoon/repository";
  
      /** Name of the property uri */
      public final static String PROPERTY_URI = "uri";
  
      /** Name of the property revision */
      public final static String PROPERTY_REVISION = "revision";
  
      /** Name of the property branch */
      public final static String PROPERTY_BRANCH = "branch";
  
      /**
       * Return the source from the descriptor
       *
       * @return A excalibur source
       */
      public Source getSource() throws SourceException;
  
      /**
       * If the source from the repository is versioned.
       */
      public boolean isVersioned() throws SourceException;
  
      /**
       * Tests whether a resource is a collection resource.
       *
       * @return true if the descriptor represents a collection, false otherwise
       */
      public boolean isCollection() throws SourceException;
  
      /**
       * 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;
  
      /**
       * Returns a property from a source.
       *
       * @param namespace Namespace of the property
       * @param name Name of the property
       *
       * @return Value of the property
       */
      public SourceProperty getProperty(String namespace, String name) throws SourceException;
  
      /**
       * Returns a enumeration of the properties
       *
       * @return Enumeration of SourceProperty
       */
      public Enumeration getSourceProperties() throws SourceException;
  
      /**
       * Removes a property from a source.
       *
       * @param namespace Namespace of the property
       * @param name Name of the property
       */
      public void removeProperty(String namespace, String name) throws SourceException;
  
      /**
       * 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;
  
      /**
       * 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;
  
      /**
       * Returns a enumeration of the existing children of the source
       *
       * @return Enumeration of SourceDescriptor
       */
      public Enumeration getChildren() throws SourceException;
  }
  
  
  
  
  1.1                  xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/repository/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 apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.cocoon.components.repository;
  
  import java.util.Date;
  
  /**
   * This interface for lock of a source
   *
   * @author <a href="mailto:stephan@vern.chem.tu-berlin.de">Stephan Michels</a>
   * @version $Id: SourceLock.java,v 1.1 2002/06/11 18:09:12 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/repository/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 apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.cocoon.components.repository;
  
  /**
   * This class represents a permission for a source
   *
   * @author <a href="mailto:stephan@vern.chem.tu-berlin.de">Stephan Michels</a>
   * @version $Id: SourcePermission.java,v 1.1 2002/06/11 18:09:12 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/repository/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 apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.cocoon.components.repository;
  
  /**
   * This interface for a property of a source
   *
   * @author <a href="mailto:stephan@vern.chem.tu-berlin.de">Stephan Michels</a>
   * @version $Id: SourceProperty.java,v 1.1 2002/06/11 18:09:12 stephan Exp $
   */
  public class SourceProperty {
  
      private String namespace;
      private String name;
      private String 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;
  
          System.out.println("SourceProperty namespace="+namespace+" name="+name+" value="+value);
      }
  
      /**
       * 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;
      }
  
      /**
       * Returns the value of the property
       * 
       * @return Value of the property
       */
      public String getValue() {
          return this.value;
      }
  }
  
  
  
  1.1                  xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/repository/SourceRepository.java
  
  Index: SourceRepository.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 apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.cocoon.components.repository;
  
  import org.apache.excalibur.source.SourceException;
  
  /**
   * This interface represents a repository for sources
   *
   * @author <a href="mailto:stephan@vern.chem.tu-berlin.de">Stephan Michels</a>
   * @version $Id: SourceRepository.java,v 1.1 2002/06/11 18:09:12 stephan Exp $
   */
  public interface SourceRepository {
  
      /** Role for the component */
      public final static String ROLE = "org.apache.cocoon.components.repository.SourceRepository";
  
      /**
       * 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
       */
      public SourceDescriptor getSourceDescriptor(SourceCredential credential, String namespace, String uri) 
          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.1                  xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/repository/repository.roles
  
  Index: repository.roles
  ===================================================================
  <?xml version="1.0"?>
  
  <xroles xpath="/role-list" unless="role [@name='org.apache.cocoon.components.repository.SourceRepositorySelector']">
  
  <!--  <role name="org.apache.cocoon.components.repository.SourceRepositorySelector"
          shorthand="source-factories"
          default-class="org.apache.avalon.excalibur.component.ExcaliburComponentSelector"/>-->
    <role name="org.apache.cocoon.components.repository.SourceRepositorySelector"
          shorthand="source-factories"
          default-class="org.apache.cocoon.components.ExtendedComponentSelector"/>
  
  </xroles>
  
  
  
  1.1                  xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/repository/impl/SlideConfigurationAdapter.java
  
  Index: SlideConfigurationAdapter.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 apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.cocoon.components.repository.impl;
  
  import org.apache.slide.util.conf.Configuration;
  import org.apache.slide.util.conf.ConfigurationException;
  
  import java.util.*;
  
  /**
   * The class represent an adapter for the configuration class from jakarta slide
   *
   * @author <a href="mailto:stephan@vern.chem.tu-berlin.de">Stephan Michels</a>
   * @version $Id: SlideConfigurationAdapter.java,v 1.1 2002/06/11 18:09:12 stephan Exp $
   */
  public class SlideConfigurationAdapter implements Configuration {
  
      private org.apache.avalon.framework.configuration.Configuration configuration;
  
      public SlideConfigurationAdapter(org.apache.avalon.framework.configuration.Configuration 
                configuration) {
          this.configuration = configuration;
      }
  
      /**
       * Return the name of the node.
       *
       * @post getName() != null
       *
       * @returns name of the <code>Configuration</code> node.
       */
      public String getName() {
          return this.configuration.getName();
      }
  
      /**
       * Return a new <code>Configuration</code> instance encapsulating the
       * specified child node.
       *
       * @pre child != null
       * @post getConfiguration() != null
       * @param child The name of the child node.
       *
       * @returns Configuration
       *
       * @exception ConfigurationException If no child with that name exists.
       */
      public Configuration getConfiguration(String child)
      throws ConfigurationException
      {
          return new SlideConfigurationAdapter(this.configuration.getChild(child));
      }
  
      /**
       * Return an <code>Enumeration</code> of <code>Configuration<code>
       * elements containing all node children with the specified name.
       *
       * @pre name != null
       * @post getConfigurations() != null
       * @param name The name of the children to get.
       *
       * @returns Enumeration.  The <code>Enumeration</code> will be
       *          empty if there are no nodes by the specified name.
       */
      public Enumeration getConfigurations(String name) {
  
          Vector configurations = new Vector();
          org.apache.avalon.framework.configuration.Configuration[] childs = 
              this.configuration.getChildren(name);
          for (int i=0; i<childs.length; i++) {
              configurations.addElement(new SlideConfigurationAdapter(childs[i]));
          }
          return configurations.elements();
      }
  
      /**
       * Return the value of specified attribute.
       *
       * @pre paramName != null
       * @post getAttribute != null
       * @param paramName The name of the parameter you ask the value of.
       *
       * @returns String value of attribute.
       *
       * @exception ConfigurationException If no attribute with that name exists.
       */
      public String getAttribute(String paramName)
          throws ConfigurationException {
         
          try { 
              return this.configuration.getAttribute(paramName);
          } catch (org.apache.avalon.framework.configuration.ConfigurationException ce) {
              throw new ConfigurationException(ce.getMessage(), this);
          }
      }
  
      /**
       * Return the <code>int</code> value of the specified attribute contained
       * in this node.
       *
       * @pre paramName != null
       * @post getAttributeAsInt() != null
       * @param paramName The name of the parameter you ask the value of.
       *
       * @returns int value of attribute
       *
       * @exception ConfigurationException If no parameter with that name exists.
       *                                   or if conversion to <code>int</code> fails.
       */
      public int getAttributeAsInt(String paramName)
          throws ConfigurationException {
  
          try {
              return this.configuration.getAttributeAsInteger(paramName);
          } catch (org.apache.avalon.framework.configuration.ConfigurationException ce) {
              throw new ConfigurationException(ce.getMessage(), this);
          }
      }
  
      /**
       * Returns the value of the attribute specified by its name as a
       * <code>long</code>.
       *
       * @pre paramName != null
       * @post getAttributeAsLong() != null
       * @param paramName The name of the parameter you ask the value of.
       *
       * @returns long value of attribute
       *
       * @exception ConfigurationException If no parameter with that name exists.
       *                                   or if conversion to <code>long</code> fails.
       */
      public long getAttributeAsLong(String name)
        	throws ConfigurationException {
  
          try {
              return this.configuration.getAttributeAsLong(name);
          } catch (org.apache.avalon.framework.configuration.ConfigurationException ce) {
              throw new ConfigurationException(ce.getMessage(), this);
          }
      }
  
      /**
       * Return the <code>float</code> value of the specified parameter contained
       * in this node.
       *
       * @pre paramName != null
       * @post getAttributeAsFloat() != null
       * @param paramName The name of the parameter you ask the value of.
       *
       * @returns float value of attribute
       *
       * @exception ConfigurationException If no parameter with that name exists.
       *                                   or if conversion to <code>float</code> fails.
       */
      public float getAttributeAsFloat(String paramName)
          throws ConfigurationException {
  
          try {
              return this.configuration.getAttributeAsFloat(paramName);
          } catch (org.apache.avalon.framework.configuration.ConfigurationException ce) {
              throw new ConfigurationException(ce.getMessage(), this);
          }
      }
  
      /**
       * Return the <code>boolean</code> value of the specified parameter contained
       * in this node.<br>
       *
       * @pre paramName != null
       * @post getAttributeAsBoolean() != null
       * @param paramName The name of the parameter you ask the value of.
       *
       * @returns boolean value of attribute
       *
       * @exception ConfigurationException If no parameter with that name exists.
       *                                   or if conversion to <code>boolean</code> fails.
       */
      public boolean getAttributeAsBoolean(String paramName)
          throws ConfigurationException {
  
          try {
              return this.configuration.getAttributeAsBoolean(paramName);
          } catch (org.apache.avalon.framework.configuration.ConfigurationException ce) {
              throw new ConfigurationException(ce.getMessage(), this);
          }
      }
  
      /**
       * Return the <code>String</code> value of the node.
       *
       * @post getValue() != null
       *
       * @returns the value of the node.
       */
      public String getValue() {
  
          try {
              return this.configuration.getValue();
          } catch (org.apache.avalon.framework.configuration.ConfigurationException ce) {
              return null;
          }
      }
      
  
      /**
       * Return the <code>int</code> value of the node.
       *
       * @post getValueAsInt() != null
       *
       * @returns the value of the node.
       *
       * @exception ConfigurationException If conversion to <code>int</code> fails.
       */
      public int getValueAsInt()
          throws ConfigurationException {
  
          try {
              return this.configuration.getValueAsInteger();
          } catch (org.apache.avalon.framework.configuration.ConfigurationException ce) {
              throw new ConfigurationException(ce.getMessage(), this);
          }
      }
  
      /**
       * Return the <code>float</code> value of the node.
       *
       * @post getValueAsFloat() != null
       *
       * @returns the value of the node.
       *
       * @exception ConfigurationException If conversion to <code>float</code> fails.
       */
      public float getValueAsFloat()
          throws ConfigurationException {
  
          try {
              return this.configuration.getValueAsFloat();
          } catch (org.apache.avalon.framework.configuration.ConfigurationException ce) {
              throw new ConfigurationException(ce.getMessage(), this);
          }
      }
  
      /**
       * Return the <code>boolean</code> value of the node.
       *
       * @post getValueAsBoolean() != null
       *
       * @returns the value of the node.
       *
       * @exception ConfigurationException If conversion to <code>boolean</code> fails.
       */
      public boolean getValueAsBoolean()
          throws ConfigurationException {
  
          try {
              return this.configuration.getValueAsBoolean();
          } catch (org.apache.avalon.framework.configuration.ConfigurationException ce) {
              throw new ConfigurationException(ce.getMessage(), this);
          }
      }
  
      /**
       * Return the <code>long</code> value of the node.<br>
       *
       * @post getValueAsLong() != null
       *
       * @returns the value of the node.
       *
       * @exception ConfigurationException If conversion to <code>long</code> fails.
       */
      public long getValueAsLong()
          throws ConfigurationException {
  
          try { 
              return this.configuration.getValueAsLong();
          } catch (org.apache.avalon.framework.configuration.ConfigurationException ce) {
              throw new ConfigurationException(ce.getMessage(), this);
          }
      }
  
      /**
       * Returns the value of the configuration element as a <code>String</code>.
       * If the configuration value is not set, the default value will be
       * used.
       *
       * @pre defaultValue != null
       * @post getValue(defaultValue) != null
       * @param defaultValue The default value desired.
       *
       * @returns String value of the <code>Configuration</code>, or default
       *          if none specified.
       */
    	public String getValue(String defaultValue) {
  
          return this.configuration.getValue(defaultValue);
      }
  
      /**
       * Returns the value of the configuration element as an <code>int</code>.
       * If the configuration value is not set, the default value will be
       * used.
       *
       * @pre defaultValue != null
       * @post getValueAsInt(defaultValue) != null
       * @param defaultValue The default value desired.
       *
       * @returns int value of the <code>Configuration</code>, or default
       *          if none specified.
       */
      public int getValueAsInt(int defaultValue) {
  
          return this.configuration.getValueAsInteger(defaultValue);
      }
  
      /**
       * Returns the value of the configuration element as a <code>long</code>.
       * If the configuration value is not set, the default value will be
       * used.
       *
       * @pre defaultValue != null
       * @post getValueAsLong(defaultValue) != null
       * @param defaultValue The default value desired.
       *
       * @returns long value of the <code>Configuration</code>, or default
       *          if none specified.
       */
      public long getValueAsLong(long defaultValue) {
      
          return this.configuration.getValueAsLong(defaultValue);
      }
  
      /**
       * Returns the value of the configuration element as a <code>float</code>.
       * If the configuration value is not set, the default value will be
       * used.
       *
       * @pre defaultValue != null
       * @post getValueAsFloat(defaultValue) != null
       * @param defaultValue The default value desired.
       *
       * @returns float value of the <code>Configuration</code>, or default
       *          if none specified.
       */
      public float getValueAsFloat(float defaultValue) {
  
          return this.configuration.getValueAsFloat(defaultValue);
      }
  
      /**
       * Returns the value of the configuration element as a <code>boolean</code>.
       * If the configuration value is not set, the default value will be
       * used.
       *
       * @pre defaultValue != null
       * @post getValueAsBoolean(defaultValue) != null
       * @param defaultValue The default value desired.
       *
       * @returns boolean value of the <code>Configuration</code>, or default
       *          if none specified.
       */
      public boolean getValueAsBoolean(boolean defaultValue) {
  
          return this.configuration.getValueAsBoolean(defaultValue);
      }
  
      /**
       * Returns the value of the attribute specified by its name as a
       * <code>String</code>, or the default value if no attribute by
       * that name exists or is empty.
       *
       * @pre name != null
       * @pre defaultValue != null
       * @post getAttribute(name, defaultValue) != null
       * @param name The name of the attribute you ask the value of.
       * @param defaultValue The default value desired.
       *
       * @returns String value of attribute. It will return the default
       *          value if the named attribute does not exist, or if
       *          the value is not set.
       */
    	public String getAttribute(String name, String defaultValue) {
  
          return this.configuration.getAttribute(name, defaultValue);
      }
  
      /**
       * Returns the value of the attribute specified by its name as a
       * <code>int</code>, or the default value if no attribute by
       * that name exists or is empty.
       *
       * @pre name != null
       * @pre defaultValue != null
       * @post getAttributeAsInt(name, defaultValue) != null
       * @param name The name of the attribute you ask the value of.
       * @param defaultValue The default value desired.
       *
       * @returns int value of attribute. It will return the default
       *          value if the named attribute does not exist, or if
       *          the value is not set.
       */
      public int getAttributeAsInt(String name, int defaultValue) {
  
          return this.configuration.getAttributeAsInteger(name, defaultValue);
      }
  
      /**
       * Returns the value of the attribute specified by its name as a
       * <code>long</code>, or the default value if no attribute by
       * that name exists or is empty.
       *
       * @pre name != null
       * @pre defaultValue != null
       * @post getAttributeAsLong(name, defaultValue) != null
       * @param name The name of the attribute you ask the value of.
       * @param defaultValue The default value desired.
       *
       * @returns long value of attribute. It will return the default
       *          value if the named attribute does not exist, or if
       *          the value is not set.
       */
      public long getAttributeAsLong(String name, long defaultValue) {
  
          return this.configuration.getAttributeAsLong(name, defaultValue);
      }
  
      /**
       * Returns the value of the attribute specified by its name as a
       * <code>float</code>, or the default value if no attribute by
       * that name exists or is empty.
       *
       * @pre name != null
       * @pre defaultValue != null
       * @post getAttributeAsFloat(name, defaultValue) != null
       * @param name The name of the attribute you ask the value of.
       * @param defaultValue The default value desired.
       *
       * @returns float value of attribute. It will return the default
       *          value if the named attribute does not exist, or if
       *          the value is not set.
       */
      public float getAttributeAsFloat(String name, float defaultValue) {
  
          return this.configuration.getAttributeAsFloat(name, defaultValue);
      }
  
      /**
       * Returns the value of the attribute specified by its name as a
       * <code>boolean</code>, or the default value if no attribute by
       * that name exists or is empty.
       *
       * @pre name != null
       * @pre defaultValue != null
       * @post getAttributeAsBoolean(name, defaultValue) != null
       * @param name The name of the attribute you ask the value of.
       * @param defaultValue The default value desired.
       *
       * @returns boolean value of attribute. It will return the default
       *          value if the named attribute does not exist, or if
       *          the value is not set.
       */
      public boolean getAttributeAsBoolean(String name, boolean defaultValue) {
  
          return this.configuration.getAttributeAsBoolean(name, defaultValue);
      }
  
    	/**
    	 * Return a <code>String</code> indicating the position of this
    	 * configuration element in a source file or URI.
       *
       * @returns String if a source file or URI is specified.  Otherwise
       *          it returns <code>null</code>
    	 */
  	  public String getLocation() {
  
          return this.configuration.getLocation();
      }
  }
  
  
  
  1.1                  xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/repository/impl/SlideLoggerAdapter.java
  
  Index: SlideLoggerAdapter.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 apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.cocoon.components.repository.impl;
  
  import org.apache.log.Logger;
  
  /**
   * The class represent an adapter for the logger for jakarta slide
   *
   * @author <a href="mailto:stephan@vern.chem.tu-berlin.de">Stephan Michels</a>
   * @version $Id: SlideLoggerAdapter.java,v 1.1 2002/06/11 18:09:12 stephan Exp $
   */
  public class SlideLoggerAdapter implements org.apache.slide.util.logger.Logger {
      private Logger logger;
      private int currentLogLevel = ERROR;
  
      public SlideLoggerAdapter(Logger logger) {
          this.logger = logger;
      }
  
      /**
       * Log an object thru the specified channel and with the specified level.
       *
       * @param data The object to log.
       * @param channel The channel name used for logging.
       * @param level The level used for logging.
       */
      public void log(Object data, String channel, int level) {
          if (level==CRITICAL) {
              this.logger.fatalError(data.toString());
          } else if (level==ERROR) {
              this.logger.error(data.toString());
          } else if (level==WARNING) {
              this.logger.warn(data.toString());
          } else if (level==INFO) {
              this.logger.info(data.toString());
          } else if (level==DEBUG) {
              this.logger.debug(data.toString());
          } else {
              this.logger.error(data.toString());
          }
      }
  
      /**
       * Log an object with the specified level.
       *
       * @param data The object to log.
       * @param level The level used for logging.
       */
      public void log(Object data, int level) {
          if (level==CRITICAL) {
              this.logger.fatalError(data.toString());
          } else if (level==ERROR) {
              this.logger.error(data.toString());
          } else if (level==WARNING) {
              this.logger.warn(data.toString());
          } else if (level==INFO) {
              this.logger.info(data.toString());
          } else if (level==DEBUG) {
              this.logger.debug(data.toString());
          } else {
              this.logger.error(data.toString());
          }
      }
  
      /**
       * Log an object.
       *
       * @param data The object to log.
       */
      public void log(Object data) {
         if (currentLogLevel==CRITICAL) {
             this.logger.fatalError(data.toString());
         } else if (currentLogLevel==ERROR) {
             this.logger.error(data.toString());
         } else if (currentLogLevel==WARNING) {
             this.logger.warn(data.toString());
         } else if (currentLogLevel==INFO) {
             this.logger.info(data.toString());
         } else if (currentLogLevel==DEBUG) {
             this.logger.debug(data.toString());
         } else {
             this.logger.error(data.toString());
         }
      }
  
      /**
       * Set the logger level for the default channel
       *
       * @param data The object to log.
       */
      public void setLoggerLevel(int level) {
          currentLogLevel = level;
      }
  
      /**
       * Set the logger level for the specified channel
       *
       * @param data The object to log.
       */
      public void setLoggerLevel(String channel, int level) {
          currentLogLevel = level;
      }
  
      /**
       * Get the logger level for the default channel
       *
       * @param data The object to log.
       */
      public int getLoggerLevel() {
          return currentLogLevel;
      }
  
      /**
       * Get the logger level for the specified channel
       *
       * @param data The object to log.
       */
      public int getLoggerLevel(String channel) {
          if (this.logger.isDebugEnabled()) {
              return DEBUG;
          } else if (this.logger.isInfoEnabled()) {
              return INFO;
          } else if (this.logger.isWarnEnabled()) {
              return WARNING;
          } else if (this.logger.isErrorEnabled()) {
              return ERROR;
          } else if (this.logger.isFatalErrorEnabled() ) {
              return CRITICAL;
          } else {
              return ERROR;
          }
      }
  
      /**
       * Check if the channel with the specified level is enabled for logging.
       *
       * @param channel The channel specification
       * @param level   The level specification
       */
      public boolean isEnabled(String channel, int level) {
          if (this.logger.isDebugEnabled()) {
              return DEBUG<=level;
          } else if (this.logger.isInfoEnabled()) {
              return INFO<=level;
          } else if (this.logger.isWarnEnabled()) {
              return WARNING<=level;
          } else if (this.logger.isErrorEnabled()) {
              return ERROR<=level;
          } else if (this.logger.isFatalErrorEnabled() ) {
              return CRITICAL<=level;
          } else {
              return ERROR<=level;
          }
      }
  
      /**
       * Check if the default channel with the specified level is enabled for logging.
       *
       * @param level   The level specification
       */
      public boolean isEnabled(int level) {
          if (this.logger.isDebugEnabled()) {
              return DEBUG<=level;
          } else if (this.logger.isInfoEnabled()) {
              return INFO<=level;
          } else if (this.logger.isWarnEnabled()) {
              return WARNING<=level;
          } else if (this.logger.isErrorEnabled()) {
              return ERROR<=level;
          } else if (this.logger.isFatalErrorEnabled() ) {
              return CRITICAL<=level;
          } else {
              return ERROR<=level;
          }
      }
  }
  
  
  
  
  1.1                  xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/repository/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 apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.cocoon.components.repository.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.WriteableSource;
  
  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.ObjectLockedException;
  import org.apache.slide.macro.Macro;
  //import org.apache.slide.security.AccessDeniedException;
  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.Map;
  
  /**
   * A sources from jakarta slide repositories. 
   *
   * @author <a href="mailto:stephan@vern.chem.tu-berlin.de">Stephan Michels</a>
   * @version $Id: SlideSource.java,v 1.1 2002/06/11 18:09:12 stephan Exp $
   */
  public class SlideSource extends AbstractLoggable implements Source, WriteableSource
  {
      /** 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 SourceValidity validity;
  
  		private SlideSourceOutputStream outputstream;
  
      private boolean initialized = false;
  
      protected SlideSource(CredentialsToken credToken, NamespaceAccessToken nat, String uri) 
          throws SourceException {
  
          this.credToken = credToken;
          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);
      
          } catch (SlideException se) {
              throw new SourceException("Could determine the if the source is a collection", se);
          } 
      }
  
  		protected SlideSource(CredentialsToken credToken, NamespaceAccessToken nat,
                                      String uri, String revision) throws SourceException {
          this.credToken = credToken;
          this.nat = nat;
          this.uri = uri;
          this.revisionNumber = new NodeRevisionNumber(revision);
          //this.branch = branch;
  
          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 revision descriptor by the revision
              this.revisionDescriptor = content.retrieve(slideToken, revisionDescriptors, this.revisionNumber);
  
          } catch (SlideException se) {
              throw new SourceException("Could determine the if the source is a collection", 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
  		 * {@link #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
  		 * {@link #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 file outputStream that will rename the temp file to the destination file upon close()
  		 * and discard the temp file upon cancel().
  		 */
  		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) {
  								// FIXME: What should I do?
  								e.printStackTrace();
  						} 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();
  				}
  		}
  }
  
  
  
  
  1.1                  xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/repository/impl/SlideSourceDescriptor.java
  
  Index: SlideSourceDescriptor.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 apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.cocoon.components.repository.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.repository.SourceCredential;
  import org.apache.cocoon.components.repository.SourceDescriptor;
  import org.apache.cocoon.components.repository.SourceLock;
  import org.apache.cocoon.components.repository.SourcePermission;
  import org.apache.cocoon.components.repository.SourceProperty;
  
  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.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.util.Date;
  import java.util.Enumeration;
  import java.util.Vector;
  
  /**
   * A descriptor for sources from a jakarta slide repository. 
   *
   * @author <a href="mailto:stephan@vern.chem.tu-berlin.de">Stephan Michels</a>
   * @version $Id: SlideSourceDescriptor.java,v 1.1 2002/06/11 18:09:12 stephan Exp $
   */
  public class SlideSourceDescriptor implements SourceDescriptor
  {
      /** Component manager */
      private ComponentManager manager;
  
      /** The uri of the source */
      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;
  
      private NodeRevisionDescriptors revisionDescriptors = null;
      private NodeRevisionDescriptor revisionDescriptor = null;
  
  		/** Revision */
  		private String revision;
  
      //private String branch;
  
      private SlideSource source;
  
      private Vector sourceproperties;
      private Vector sourcepermissions;
      private Vector sourcelocks;
  
      //private boolean initialized = false;
  
  		protected SlideSourceDescriptor(CredentialsToken credToken, NamespaceAccessToken nat, String uri) 
          throws SourceException {
  
          this.credToken = credToken;
          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 {
              revisionDescriptors = content.retrieve(this.slideToken, this.uri);
  
              // Retrieve latest revision descriptor
              revisionDescriptor = content.retrieve(slideToken, revisionDescriptors);
  
          } catch (SlideException se) {
              throw new SourceException("Could determine the if the source is a collection", se);
          }
      }
  
      protected SlideSourceDescriptor(CredentialsToken credToken, NamespaceAccessToken nat, 
                                      String uri, String revision) throws SourceException {
  
          this.credToken = credToken;
          this.nat = nat;
          this.uri = uri;
          this.revision = revision;
          //this.branch = branch;
  
          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 {
              revisionDescriptors = content.retrieve(this.slideToken, this.uri);
  
              // Retrieve revision descriptor by the revision
              revisionDescriptor = content.retrieve(slideToken, revisionDescriptors, new NodeRevisionNumber(revision));
  
          } catch (SlideException se) {
              throw new SourceException("Could determine the if the source is a collection", se);
          }
      }
  
      /**
       * Return the source from the descriptor
       *
       * @return A excalibur source
       */
      public Source getSource() throws SourceException {
          if (this.source == null)
              this.source = new SlideSource(this.credToken, this.nat, 
                                            this.uri, this.revision);
          return this.source;
      }
  
      /**
       * If the source from the repository is versioned.
       */
      public boolean isVersioned() throws SourceException {
          return revisionDescriptors.hasRevisions();
      }
  
      /**
       * Tests whether a resource is a collection resource.
       *
       * @return true if the descriptor represents a collection, false otherwise
       */
      public boolean isCollection() 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;
      }
  
      /**
       * 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));
          sourceproperties.addElement(
              new SourceProperty(DEFAULTNAMESPACE, PROPERTY_REVISION, revisionDescriptor.getRevisionNumber().toString()));
          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);
          }
      }
  
  
      /**
       * 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);
          }
      }
  
      /**
       * 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);
          }
      }
  
      /**
       * Returns a enumeration of the existing children of the source
       *
       * @return Enumeration of SourceDescriptor
       */
      public Enumeration getChildren() throws SourceException {
          try {
              Vector sourcedescriptors = new Vector();
  
              ObjectNode child;
              for(Enumeration children = this.structure.getChildren(this.slideToken, 
                  this.structure.retrieve(this.slideToken, this.uri)); children.hasMoreElements();) {
  
                  child = (ObjectNode) children.nextElement();
  
                  sourcedescriptors.addElement(new SlideSourceDescriptor(this.credToken, this.nat, child.getUri()));
              }
  
              return sourcedescriptors.elements();
          } catch (SlideException se) {
              throw new SourceException("Could not remove property", se);
          }
      }
  }
  
  
  
  
  1.1                  xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/repository/impl/SlideSourceRepository.java
  
  Index: SlideSourceRepository.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 apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.cocoon.components.repository.impl;
  
  import org.apache.avalon.framework.component.Component;
  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.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.excalibur.source.SourceException;
  
  import org.apache.log.Logger;
  
  import org.apache.slide.authenticate.CredentialsToken;
  import org.apache.slide.common.EmbeddedDomain;
  
  /**
   * The class represent a manger for slide repositories
   *
   * @author <a href="mailto:stephan@vern.chem.tu-berlin.de">Stephan Michels</a>
   * @version $Id: SlideSourceRepository.java,v 1.1 2002/06/11 18:09:12 stephan Exp $
   */
  public class SlideSourceRepository implements SourceRepository, ThreadSafe, 
                                                Configurable, Loggable {
  
      private EmbeddedDomain domain = new EmbeddedDomain();
      private Logger logger;
  
      /**
       * Provide component with a logger.
       */
      public void setLogger(Logger logger) {
          this.logger = logger;
          domain.setLogger(new SlideLoggerAdapter(this.logger));
      }
  
      /**
       * Pass the Configuration to the Configurable class. This method must 
       * always be called after the constructor and before any other method.
       *
       * @param configuration the class configurations.
       */
      public void configure(Configuration configuration)
          throws ConfigurationException {
  
          domain.setDefaultNamespace(configuration.getAttribute("default", "slide"));
  
          this.logger.info("Initializing Domain");
  
          Configuration[] namespaceDefinitions = configuration.getChildren("namespace");
  
          for (int i=0; i<namespaceDefinitions.length; i++) {
  
              // Initializes a new namespace based on the given configuration data.
  
              this.logger.info("Initializing namespace : "
                               + namespaceDefinitions[i].getAttribute("name"));
  
              String name = namespaceDefinitions[i].getAttribute("name");
  
              Configuration namespaceDefinition =
                  namespaceDefinitions[i].getChild("definition");
  
              Configuration namespaceConfigurationDefinition =
                  namespaceDefinitions[i].getChild("configuration");
  
              Configuration namespaceBaseDataDefinition =
                  namespaceDefinitions[i].getChild("data");
  
              domain.addNamespace(name, new SlideLoggerAdapter(this.logger.getChildLogger(name)),
                                        new SlideConfigurationAdapter(namespaceDefinition),
                                        new SlideConfigurationAdapter(namespaceConfigurationDefinition),
                                        new SlideConfigurationAdapter(namespaceBaseDataDefinition));
  
              this.logger.info("Namespace configuration complete");
          }
      }
  
      /**
       * 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
       */
      public SourceDescriptor getSourceDescriptor(SourceCredential credential, 
                                                  String namespace, String uri) throws SourceException {
          CredentialsToken credToken = new CredentialsToken(credential.getPrincipal());
          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());
          return new SlideSourceDescriptor(credToken, domain.getNamespaceToken(namespace), 
                                           uri, revision);
      }
  }
  
  
  
  
  1.1                  xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/repository/impl/slide.xconf
  
  Index: slide.xconf
  ===================================================================
  <?xml version="1.0"?>
  
  <xconf xpath="/cocoon" unless="component[@role='org.apache.cocoon.components.repository.RepositoryManagerSelector']">
  <!--<xconf xpath="/cocoon" unless="repositories">-->
  
   <component role="org.apache.cocoon.components.repository.RepositoryManagerSelector" 
              class="org.apache.cocoon.components.ExtendedComponentSelector"
              logger="core.repositories"
              default="slide">
    <!--<repositories logger="core.repositories" 
                      default="ownrepository">-->
  
    <component-instance class="org.apache.cocoon.components.repository.SlideRepositoryManager" 
                        name="slide"
                        logger="core.repositories.slide"
                        default="ownrepository"/>
     <namespace name="ownrepository">
  
      <definition>
       <store name="jdbc">
        <nodestore classname="slidestore.reference.JDBCDescriptorsStore">
         <parameter name="driver">org.hsqldb.jdbcDriver</parameter>
         <parameter name="url">jdbc:hsqldb:slidestructure</parameter>
         <parameter name="user">sa</parameter>
         <parameter name="password"></parameter>
        </nodestore>
        <securitystore>
          <reference store="nodestore" />
        </securitystore>
        <lockstore>
          <reference store="nodestore" />
        </lockstore>
        <revisiondescriptorsstore>
          <reference store="nodestore" />
        </revisiondescriptorsstore>
        <revisiondescriptorstore>
          <reference store="nodestore" />
        </revisiondescriptorstore>
        <contentstore classname="slidestore.reference.FileContentStore">
          <parameter name="rootpath">contentstore</parameter>
          <parameter name="version">true</parameter>
          <parameter name="resetBeforeStarting">false</parameter>
        </contentstore>
       </store>
       <scope match="/" store="jdbc" />
      </definition>
  
      <configuration>
       <!-- Actions mapping -->
       <default-action>/actions</default-action>
       <read-object>/actions/read</read-object>
       <create-object>/actions/write</create-object>
       <remove-object>/actions/write</remove-object>
       <grant-permission>/actions/manage</grant-permission>
       <revoke-permission>/actions/manage</revoke-permission>
       <read-permissions>/actions/manage</read-permissions>
       <lock-object>/actions/write</lock-object>
       <kill-lock>/actions/manage</kill-lock>
       <read-locks>/actions/read</read-locks>
       <read-revision-metadata>/actions/read</read-revision-metadata>
       <create-revision-metadata>/actions/write</create-revision-metadata>
       <modify-revision-metadata>/actions/write</modify-revision-metadata>
       <remove-revision-metadata>/actions/write</remove-revision-metadata>
       <read-revision-content>/actions/read</read-revision-content>
       <create-revision-content>/actions/write</create-revision-content>
       <modify-revision-content>/actions/write</modify-revision-content>
       <remove-revision-content>/actions/write</remove-revision-content>
  
       <!-- Paths configuration -->
       <userspath>/users</userspath>
       <guestpath>guest</guestpath>
       <filespath>/files</filespath>
       <parameter name="dav">true</parameter>
       <parameter name="standalone">true</parameter>
  
       <!-- Roles definition -->
       <role name="root">slideroles.basic.RootRole</role>
       <role name="user">slideroles.basic.UserRole</role>
       <role name="guest">slideroles.basic.GuestRole</role>
  
       <!-- Users management -->
       <auto-create-users>false</auto-create-users>
      </configuration>
     
      <data>
       <objectnode classname="org.apache.slide.structure.SubjectNode" uri="/">
          
        <permission action="/actions" subject="root"/>
        <permission action="/actions/read" subject="user"
         inheritable="false"/>
        <permission action="/actions/read" subject="nobody"
         inheritable="false"/>
          
        <!-- /users represents the unauthenticated user -->
          
        <objectnode classname="org.apache.slide.structure.SubjectNode" 
         uri="/users">
            
          <permission action="/actions" subject="~"/>
          <permission action="/actions" subject="guest" inheritable="true" negative="true"/>
          <permission action="/actions/read" subject="user" inheritable="false"/>
  
          <!-- Permission group example -->
            
          <objectnode classname="org.apache.slide.structure.GroupNode" 
            uri="/users/writer">
             <objectnode classname="org.apache.slide.structure.LinkNode" 
                uri="/users/writer/stephan" linkedUri="/users/stephan" />
             <objectnode classname="org.apache.slide.structure.LinkNode" 
                uri="/users/writer/root" linkedUri="/users/root" />
          </objectnode>
  
          <!-- /users/root represents the administrator -->
          <objectnode classname="slideroles.basic.RootRoleImpl" uri="/users/root">
            <!-- Uncomment and change the password to allow login as root to
             edit the namespace -->
            <revision>
              <property name="password" 
               namespace="http://jakarta.apache.org/slide/">root</property>
            </revision>
          </objectnode>
            
          <!-- /users/john represents an authenticated user -->
          <objectnode classname="slideroles.basic.UserRoleImpl" 
           uri="/users/john" >
          
           <revision>
            <property name="password" 
               namespace="http://jakarta.apache.org/slide/">john</property>
           </revision>
          </objectnode>
  
        </objectnode>
  
        <objectnode classname="org.apache.slide.structure.ActionNode" 
         uri="/actions">
  
          <objectnode classname="org.apache.slide.structure.ActionNode" 
           uri="/actions/read"/>
  
          <objectnode classname="org.apache.slide.structure.ActionNode" 
           uri="/actions/write"/>
  
          <objectnode classname="org.apache.slide.structure.ActionNode" 
           uri="/actions/manage"/>
  
        </objectnode>
  
        <objectnode classname="org.apache.slide.structure.SubjectNode" 
         uri="/files">
  
          <!-- ### Give read/write/manage permission to guest ### 
               Uncomment the following line to give permission to do
               all actions on /files to guest (unauthenticated users) -->
          <permission action="/actions" subject="/users/guest"/>
  
          <permission action="/actions/manage" subject="/users/root"/>
          <permission action="/actions/write" subject="+/users/writer"/>
          <permission action="/actions/read" subject="nobody"/>
  
        </objectnode>
       </objectnode>
  
      </data>
  
     </namespace>
   
    </component-instance>
  
   <!--</repositories>-->
   </component>
  
  </xconf>
  
  
  
  1.1                  xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/source/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 apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.cocoon.components.source;
  
  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.SourceCredential;
  import org.apache.cocoon.components.repository.SourceDescriptor;
  import org.apache.cocoon.components.repository.SourceRepository;
  
  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 jakarta slide domains. The sources wrappers
   * to the stores of slide. It uses slide:// as pseudo-protocoll. It is also 
   * possible to get access to the store 
   * via webdav.
   *
   * Possible parameter are username and revision
   *
   * @author <a href="mailto:stephan@vern.chem.tu-berlin.de">Stephan Michels</a>
   * @version $Id: RepositorySourceFactory.java,v 1.1 2002/06/11 18:09:12 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", "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);
  
          ComponentSelector sourcerepositories = null;
          SourceRepository sourcerepository = null;
          try {
              sourcerepositories = (ComponentSelector)this.manager.lookup(SourceRepository.ROLE+"Selector");
  
              sourcerepository = (SourceRepository)sourcerepositories.select(repository);
  
              SourceDescriptor descriptor;
              if (revision!=null)
                  descriptor = sourcerepository.getSourceDescriptor(credential, namespace, location);
              else
                  descriptor = sourcerepository.getSourceDescriptor(credential, namespace, location, revision);
  
              return descriptor.getSource();
  
  
          } 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/repository.xconf
  
  Index: repository.xconf
  ===================================================================
  <?xml version="1.0"?>
  
  <xconf xpath="/cocoon/source-factories" unless="component-instance[@name='repository']">
  
      <!-- repository pseudo protocol -->
      <component-instance name="repository" class="org.apache.cocoon.components.eource.RepositorySourceFactory"/>
  
  </xconf>
  
  
  
  1.1                  xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/source/slide.xconf
  
  Index: slide.xconf
  ===================================================================
  <?xml version="1.0"?>
  
  <xconf xpath="/cocoon/source-factories" unless="component-instance[@name='repository']">
  
      <!-- repository pseudo protocol -->
      <component-instance name="repository" class="org.apache.cocoon.components.source.SlideSourceFactory"/>
  
  </xconf>
  
  
  
  1.1                  xml-cocoon2/src/scratchpad/src/org/apache/cocoon/generation/RepositorySourceDescriptionGenerator.java
  
  Index: RepositorySourceDescriptionGenerator.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Apache Cocoon" and  "Apache Software Foundation" must  not  be
      used to  endorse or promote  products derived from  this software without
      prior written permission. For written permission, please contact
      apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation and was  originally created by
   Stefano Mazzocchi  <stefano@apache.org>. 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.repository.SourceCredential;
  import org.apache.cocoon.components.repository.SourceDescriptor;
  import org.apache.cocoon.components.repository.SourceLock;
  import org.apache.cocoon.components.repository.SourcePermission;
  import org.apache.cocoon.components.repository.SourceProperty;
  import org.apache.cocoon.components.repository.SourceRepository;
  import org.apache.cocoon.environment.Source;
  import org.apache.cocoon.environment.SourceResolver;
  
  import org.apache.excalibur.source.SourceException;
  
  import org.xml.sax.SAXException;
  import org.xml.sax.helpers.AttributesImpl;
  
  import java.io.IOException;
  import java.util.Enumeration;
  import java.util.Date;
  import java.util.Map;
  
  /**
   * Generates an source description from a source of a repository.
   *
   * @author <a href="mailto:stephan@vern.chem.tu-berlin.de">Stephan Michels</a>
   * @version CVS $Id: RepositorySourceDescriptionGenerator.java,v 1.1 2002/06/11 18:09:12 stephan Exp $
   */
  public class RepositorySourceDescriptionGenerator 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 = SourceDescriptor.DEFAULTNAMESPACE;
  
      /** The namespace prefix of the resource description framework. */
      private static final String SOURCE_PREFIX          = "source";
      
  
      private static final String RDF_NODE_NAME          = "RDF";
      private static final String DESCRIPTION_NODE_NAME  = "Description";
  
      private static final String PERMISSION_NODE_NAME   = "permission";
      private static final String LOCK_NODE_NAME         = "lock";
   
      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";
  
      private SourceDescriptor descriptor;
  
      /**
       * 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);
  
          String repository = parameters.getParameter("repository", null);
          String namespace = parameters.getParameter("namespace", null);
          String principal = parameters.getParameter("principal", "guest");
          String password = parameters.getParameter("paswword", null);
          String revision = parameters.getParameter("revision", null);
          //String branch = parameters.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);
  
              if (revision!=null)
                  descriptor = sourcerepository.getSourceDescriptor(credential, namespace, location);
              else
                  descriptor = sourcerepository.getSourceDescriptor(credential, namespace, location, revision);
          } catch (ComponentException ce) {
              getLogger().error("Could not lookup for component.", ce);
              throw new ProcessingException("Could not lookup for component.", ce);
          } catch (SourceException se) {
              getLogger().error("Could not get source descriptor.", se);
              throw new ProcessingException("Could not get source descriptor.", se);
          } finally {
              if ((sourcerepository!=null) && (sourcerepository instanceof Component))
                  sourcerepositories.release((Component)sourcerepository); 
              sourcerepository = null;
  
              this.manager.release(sourcerepositories);
              sourcerepositories = null;
          }
      }
  
      /**
       * 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());
  
              pushSourceDescriptor(this.descriptor, 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 pushSourceDescriptor(SourceDescriptor descriptor, int deep) 
          throws SAXException, SourceException {
  
          AttributesImpl attributes = new AttributesImpl();
          attributes.addAttribute("", URI_ATTR_NAME, URI_ATTR_NAME, "CDATA",
                                  descriptor.getProperty(SourceDescriptor.DEFAULTNAMESPACE, 
                                                         SourceDescriptor.PROPERTY_URI).getValue());
  
          this.contentHandler.startElement(RDF_NS, DESCRIPTION_NODE_NAME, 
                                           RDF_PREFIX+':'+DESCRIPTION_NODE_NAME, attributes);
  
          pushSourceProperties(descriptor);
          pushSourcePermissions(descriptor);
          pushSourceLocks(descriptor);
  
          SourceDescriptor child;
          if ((descriptor.isCollection()) && (deep>0)) 
              for(Enumeration children = descriptor.getChildren(); children.hasMoreElements();) {
                  child = (SourceDescriptor) children.nextElement();
                  pushSourceDescriptor(child, deep-1);
              }
  
          this.contentHandler.endElement(RDF_NS, DESCRIPTION_NODE_NAME, RDF_PREFIX+':'+DESCRIPTION_NODE_NAME);
      }
  
      private void pushSourceProperties(SourceDescriptor descriptor) throws SAXException, SourceException {
          Enumeration properties = descriptor.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(SourceDescriptor descriptor) throws SAXException, SourceException {
          Enumeration permissionsList = descriptor.getSourcePermissions();
          SourcePermission permission;
          while (permissionsList.hasMoreElements()) {
  
              permission = (SourcePermission) permissionsList.nextElement();
  
              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,
                                               SOURCE_PREFIX+':'+PERMISSION_NODE_NAME, attributes);
              this.contentHandler.endElement(SOURCE_NS, PERMISSION_NODE_NAME, 
                                             SOURCE_PREFIX+':'+PERMISSION_NODE_NAME);
          }
      }
  
      public void pushSourceLocks(SourceDescriptor descriptor) throws SAXException, SourceException {
          Enumeration locks = descriptor.getSourceLocks();
          SourceLock lock;
          while (locks.hasMoreElements()) {
  
              lock = (SourceLock) locks.nextElement();
  
              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, 
                                               SOURCE_PREFIX+':'+LOCK_NODE_NAME, attributes);
              this.contentHandler.endElement(SOURCE_NS, LOCK_NODE_NAME, 
                                             SOURCE_PREFIX+':'+LOCK_NODE_NAME);
          }
      }
  }
  
  
  
  
  1.2       +11 -9     xml-cocoon2/src/scratchpad/webapp/mount/slide/README
  
  Index: README
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/webapp/mount/slide/README,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- README	22 May 2002 15:29:11 -0000	1.1
  +++ README	11 Jun 2002 18:09:12 -0000	1.2
  @@ -3,8 +3,6 @@
     Using Jakarta Slide with Cocoon
   ====================================
   
  -1. Uncomment the entries for WebDAV in src/webapp/WEB-INF/web.xml
  -
   1. Install the Web Application via in Tomcat
   
    ./build.sh  -Dinclude.webapp.libs=yes -Dinstall.war=$TOMCAT_HOME/webapps -Dinclude.scratchpad.libs=yes install
  @@ -13,19 +11,23 @@
   
    $TOMCAT_HOME/bin/catalina.sh run
   
  -3. Access WebDAV via MS WebFolders, Cadaver or what ever
  +3. Access the slide repository via Cocoon
   
  - http://localhost:8080/cocoon/webdav/
  + http://vernjava:8080/cocoon/mount/slide/browse/ownrepository/ 
   
  -4. Access the slide repository via Cocoon
  +[OPTIONAL]
   
  - http://vernjava:8080/cocoon/mount/slide/browse/ownrepository/ 
  +4. If you want an access via WebDAV copy the web.xml into WEB-INF/
  +   This file includes the WebDAV Servlet from Slide.
  +
  +5. Access WebDAV via MS WebFolders, Cadaver or what ever
  +
  + http://localhost:8080/cocoon/webdav/
   
   Have fun, Stephan Michels <stephan@vern.chem.tu-berlin.de>
   
   
   Some things must be fixed:
   
  -* The logger should be set
  -* Also the base directory should be set
  -* <map:read src="slide://..."/> doesn't work
  +* The base directory for the content stores should be set, but don't know how.
  +
  
  
  
  1.2       +300 -50   xml-cocoon2/src/scratchpad/webapp/mount/slide/collection2html.xsl
  
  Index: collection2html.xsl
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/webapp/mount/slide/collection2html.xsl,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- collection2html.xsl	22 May 2002 15:29:11 -0000	1.1
  +++ collection2html.xsl	11 Jun 2002 18:09:12 -0000	1.2
  @@ -1,12 +1,16 @@
   <?xml version="1.0"?>
   <xsl:stylesheet version="1.0"
                   xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
  -                xmlns:col="http://apache.org/cocoon/slidecollection/1.0">
  -<!--                xmlns="http://www.w3.org/1999/xhtml">-->
  +                xmlns:col="http://apache.org/cocoon/slidecollection/1.0"
  +                xmlns:slide="http://apache.org/cocoon/slidetransformer/1.0">
   
    <xsl:output indent="yes"/>
   
    <xsl:param name="namespace">ownrepository</xsl:param>
  + <xsl:param name="cocoon-action-addproperty"></xsl:param>
  + <xsl:param name="propertynamespace">bla1</xsl:param>
  + <xsl:param name="propertyname">bla2</xsl:param>
  + <xsl:param name="propertyvalue">bla3</xsl:param>
   
    <xsl:template match="/">
     <html>
  @@ -14,70 +18,307 @@
       <title>Jakarta Slide Collection</title>
      </head>
      <body>
  -    <xsl:apply-templates select="col:collection"/>
  +    <xsl:apply-templates select="col:actionnode|col:groupnode|col:linknode|col:subjectnode|col:objectnode"/>
      </body>
     </html>   
    </xsl:template>
   
  - <xsl:template match="col:collection">
  + <xsl:template match="col:actionnode|col:groupnode|col:linknode|col:subjectnode|col:objectnode">
  +<!--
  +  "cocoon-action-addproperty=<xsl:value-of select="$cocoon-action-addproperty"/>"
  +  "propertynamespace=<xsl:value-of select="$propertynamespace"/>"
  +  "propertyname=<xsl:value-of select="$propertynamespace"/>"
  +  "propertyvalue=<xsl:value-of select="$propertyvalue"/>"
  +-->
  +  <xsl:choose>
  +   <xsl:when test="$cocoon-action-addproperty!=''">
  +    <slide:slide namespace="{$namespace}" uri="{@uri}">
  +     <slide:setproperty namespace="{$propertynamespace}" name="{$propertyname}"><xsl:value-of 
  +              select="$propertyvalue"/></slide:setproperty>
  +    </slide:slide>
  +   </xsl:when>
  +  </xsl:choose>
  +
     <table width="90%" cellspacing="0" cellpadding="5" align="center">
      <tr>
  -    <td colspan="3">
  -     <font size="+2"><strong>Directory listing for <xsl:value-of select="@uri"/></strong></font>
  +    <td  bgcolor="#cccccc" colspan="5">
  +     <font size="+2">
  +      <strong>
  +       <xsl:choose>
  +        <xsl:when test="local-name(.)='actionnode'">Action</xsl:when>
  +        <xsl:when test="local-name(.)='groupnode'">Group</xsl:when>
  +        <xsl:when test="local-name(.)='linknode'">Link</xsl:when>
  +        <xsl:when test="local-name(.)='subjectnode'">Subject</xsl:when>
  +        <xsl:otherwise>Object</xsl:otherwise>
  +       </xsl:choose>
  +       &#160;&#160;<xsl:value-of select="@uri"/>
  +      </strong>
  +     </font>
       </td>
      </tr>
      <tr>
  -    <td colspan="5" bgcolor="#ffffff"><a href="/cocoon/mount/slide/{$namespace}/">Home</a></td>
  -   </tr>
  -   <tr bgcolor="#cccccc">
  -    <td align="left" colspan="5"><tt><b>ACL Info</b></tt></td>
  -   </tr>
  -   <tr bgcolor="#cccccc">
  -    <td align="left" colspan="2"><tt><b>Subject</b></tt></td>
  -    <td align="left"><tt><b>Action</b></tt></td>
  -    <td align="right"><tt><b>Inheritable</b></tt></td>
  -    <td align="right"><tt><b>Deny</b></tt></td>
  +    <td colspan="3" bgcolor="#eeeeee"><a href="/cocoon/mount/slide/browse/{$namespace}/">Home</a></td>
  +    <td colspan="2" bgcolor="#eeeeee">
  +     <xsl:if test="col:property[@name='getcontentlength']!='' and col:property[@name='getcontentlength']!='0'">
  +      <xsl:if test="col:property[@name='resourcetype']!='&lt;collection/>'">
  +       <a href="/cocoon/mount/slide/view/{$namespace}{@uri}">Download</a>
  +      </xsl:if>
  +     </xsl:if>
  +    </td>
      </tr>
   
  -   <xsl:apply-templates select="col:permission"/>
  +   <xsl:if test="@branch!='' or @revision!=''">
  +    <tr><td colspan="5" bgcolor="#ffffff">&#160;</td></tr>
  +    
  +    <tr>
  +     <td colspan="5">
  +      <table width="100%" cellspacing="0" cellpadding="5" align="center">
  +       <tr bgcolor="#cccccc">
  +        <td align="left" colspan="3"><tt><b>Revision</b></tt></td>
  +       </tr>
  +       <tr bgcolor="#cccccc">
  +        <td align="left"><tt><b>Branch</b></tt></td>
  +        <td align="left"><tt><b>Revision</b></tt></td>
  +       </tr>
  +
  +       <tr bgcolor="#eeeeee">
  +        <td align="left"><tt><xsl:value-of select="@branch"/></tt></td>
  +        <td align="left"><tt><xsl:value-of select="@revision"/></tt></td>
  +       </tr>
  +      </table>
  +     </td>
  +    </tr>
  +
  +   </xsl:if>
   
      <tr><td colspan="5" bgcolor="#ffffff">&#160;</td></tr>
   
  -   <tr bgcolor="#cccccc">
  -    <td align="left" colspan="5"><tt><b>Lock Info</b></tt></td>
  +   <tr>
  +    <td colspan="5">
  +     <table width="100%" cellspacing="0" cellpadding="5" align="center">
  +
  +      <tr bgcolor="#cccccc">
  +       <td align="left" colspan="4"><tt><b>Properties</b></tt></td>
  +      </tr>
  +
  +      <tr bgcolor="#cccccc">
  +       <td align="left"><tt><b>Namespace</b></tt></td>
  +       <td align="left"><tt><b>Name</b></tt></td>
  +       <td align="left"><tt><b>Value</b></tt></td>
  +       <td align="right"></td>
  +      </tr>
  +
  +      <xsl:apply-templates select="col:property"/>
  +
  +      <tr bgcolor="#eeeeee">
  +       <form action="" method="get">
  +        <input type="hidden" name="namespace" value="{$namespace}"/>
  +        <input type="hidden" name="uri" value="{@uri}"/>
  +        <td align="left">
  +         <input name="propertynamespace" type="text" size="25" maxlength="40"/>
  +        </td>
  +        <td align="left">
  +         <input name="propertyname" type="text" size="25" maxlength="40"/>
  +        </td>
  +        <td align="left">
  +         <input name="propertyvalue" type="text" size="25" maxlength="40"/>
  +        </td>
  +        <td align="right">
  +         <input type="submit" name="cocoon-action-addproperty" value="Add/Modify"/>
  +        </td>
  +       </form>
  +      </tr>
  +
  +     </table>
  +    </td>
      </tr>
   
  -   <tr bgcolor="#cccccc">
  -    <td align="left"><tt><b>Subject</b></tt></td>
  -    <td align="left"><tt><b>Type</b></tt></td>
  -    <td align="right"><tt><b>Expiration</b></tt></td>
  -    <td align="right"><tt><b>Inheritable</b></tt></td>
  -    <td align="right"><tt><b>Exclusive</b></tt></td>
  +   <tr><td colspan="5" bgcolor="#ffffff">&#160;</td></tr>
  +
  +   <tr>
  +    <td colspan="5">
  +     <table width="100%" cellspacing="0" cellpadding="5" align="center">
  +      <tr bgcolor="#cccccc">
  +       <td align="left" colspan="5"><tt><b>ACL Info</b></tt></td>
  +      </tr>
  +      <tr bgcolor="#cccccc">
  +       <td align="left"><tt><b>Subject</b></tt></td>
  +       <td align="left"><tt><b>Action</b></tt></td>
  +       <td align="left"><tt><b>Inheritable</b></tt></td>
  +       <td align="left"><tt><b>Deny</b></tt></td>
  +       <td align="right"></td>
  +      </tr>
  +
  +      <xsl:apply-templates select="col:permission"/>
  +
  +      <tr bgcolor="#eeeeee">
  +       <form action="" method="post">
  +        <input type="hidden" name="namespace" value="{$namespace}"/>
  +        <input type="hidden" name="uri" value="{@uri}"/>
  +        <td align="left">
  +         <input name="permissonsubject" type="text" size="25" maxlength="40"/>
  +        </td>
  +        <td align="left">
  +         <input name="permissonaction" type="text" size="25" maxlength="40"/>
  +        </td>
  +        <td align="left">
  +         <select name="permissoninheritable">
  +          <option>true</option>
  +          <option>false</option>
  +         </select>
  +        </td>
  +        <td align="left">
  +         <select name="permissondeny">
  +          <option>true</option>
  +          <option>false</option>
  +         </select>
  +        </td>
  +        <td align="right">
  +         <input type="submit" name="cocoon-action-addpermission" value="Add/Modify"/>
  +        </td>
  +       </form>
  +      </tr>
  +
  +     </table>
  +    </td>
      </tr>
   
  -   <xsl:apply-templates select="col:lock"/>
  +   <tr><td colspan="5" bgcolor="#ffffff">&#160;</td></tr>
  +
  +   <tr>
  +    <td colspan="5">
  +     <table width="100%" cellspacing="0" cellpadding="5" align="center">
  +      <tr bgcolor="#cccccc">
  +       <td align="left" colspan="6"><tt><b>Lock Info</b></tt></td>
  +      </tr>
  +
  +      <tr bgcolor="#cccccc">
  +       <td align="left"><tt><b>Subject</b></tt></td>
  +       <td align="left"><tt><b>Type</b></tt></td>
  +       <td align="left"><tt><b>Expiration</b></tt></td>
  +       <td align="left"><tt><b>Inheritable</b></tt></td>
  +       <td align="left"><tt><b>Exclusive</b></tt></td>
  +       <td align="right"></td>
  +      </tr>
  +
  +      <xsl:apply-templates select="col:lock"/>
  +
  +      <tr bgcolor="#eeeeee">
  +       <form action="" method="post">
  +        <input type="hidden" name="namespace" value="{$namespace}"/>
  +        <input type="hidden" name="uri" value="{@uri}"/>
  +        <td align="left">
  +         <input name="locksubject" type="text" size="25" maxlength="40"/>
  +        </td>
  +        <td align="left">
  +         <input name="locktype" type="text" size="25" maxlength="40"/>
  +        </td>
  +        <td align="left">
  +         <input name="lockexpiration" type="text" size="25" maxlength="40"/>
  +        </td>
  +        <td align="left">
  +         <select name="lockinheritable">
  +          <option>true</option>
  +          <option>false</option>
  +         </select>
  +        </td>
  +        <td align="left">
  +         <select name="lockexclusive">
  +          <option>true</option>
  +          <option>false</option>
  +         </select>
  +        </td>
  +        <td align="right">
  +         <input type="submit" name="cocoon-action-addlock" value="Add/Modify"/>
  +        </td>
  +       </form>
  +      </tr>
  +
  +     </table>
  +    </td>
  +   </tr>      
   
      <tr><td colspan="5" bgcolor="#ffffff">&#160;</td></tr>
   
  -   <tr bgcolor="#cccccc">
  -    <td align="left" colspan="3"><font size="+1"><strong>Filename</strong></font></td>
  -    <td align="center"><font size="+1"><strong>Size</strong></font></td>
  -    <td align="right"><font size="+1"><strong>Last Modified</strong></font></td>
  -   </tr>
  +   <tr>
  +    <td colspan="5">
  +     <table width="100%" cellspacing="0" cellpadding="5" align="center">
  +      <tr bgcolor="#cccccc">
  +       <td align="left"><font size="+1"><strong>Child</strong></font></td>
  +       <td align="left"><font size="+1"><strong>Type</strong></font></td>
  +       <td align="left"><font size="+1"><strong>Size</strong></font></td>
  +       <td align="left"><font size="+1"><strong>Last Modified</strong></font></td>
  +       <td align="right"></td>
  +      </tr>
  +
  +      <xsl:apply-templates select="col:actionnode|col:groupnode|col:linknode|col:subjectnode|col:objectnode" mode="enumerate"/>
  +
  +      <tr bgcolor="#eeeeee">
  +       <form action="" method="post">
  +        <input type="hidden" name="namespace" value="{$namespace}"/>
  +        <input type="hidden" name="uri" value="{@uri}"/>
  +        <td align="left">
  +         <input name="nodename" type="text" size="30" maxlength="40"/>&#160;&#160;
  +         <!--<select name="nodetype">
  +          <option>action</option>
  +          <option>group</option>
  +          <option>link</option>
  +          <option selected="">subject</option>
  +         </select>-->
  +        </td>
  +        <td colspan="3" align="left">
  +        </td>
  +        <td align="right">
  +         <input type="submit" name="cocoon-action-addnode" value="Add"/>
  +        </td>
  +       </form>
  +      </tr>
   
  -   <xsl:apply-templates select="col:collection|col:object" mode="enumerate"/>
  +     </table>
  +    </td>
  +   </tr>
   
      <tr><td colspan="5">&#160;</td></tr>
      <tr><td colspan="5" bgcolor="#cccccc"><font size="-1">Jakarta Slide 1.0 + Apache Cocoon 2</font></td></tr>
     </table>
    </xsl:template>
   
  + <xsl:template match="col:property">
  +  <tr bgcolor="#eeeeee">
  +   <td align="left"><tt><xsl:value-of select="@namespace"/></tt></td>
  +   <td align="left"><tt><xsl:value-of select="@name"/></tt></td>
  +   <td align="left"><tt><xsl:value-of select="."/></tt></td>
  +   <td align="right">
  +    <xsl:if test="@namespace!='DAV:'">
  +     <form action="" method="get">
  +      <input type="hidden" name="namespace" value="{$namespace}"/>
  +      <input type="hidden" name="uri" value="{../@uri}"/>
  +      <input type="hidden" name="propertynamespace" value="{@namespace}"/>
  +      <input type="hidden" name="propertyname" value="{@name}"/>
  +
  +      <input type="submit" name="cocoon-action-deleteproperty" value="Delete"/>
  +     </form>
  +    </xsl:if>
  +   </td>
  +  </tr>
  + </xsl:template>
  +
    <xsl:template match="col:permission">
     <tr bgcolor="#eeeeee">
  -   <td align="left" colspan="2"><tt><xsl:value-of select="@subjecturi"/></tt></td>
  +   <td align="left"><tt><xsl:value-of select="@subjecturi"/></tt></td>
      <td align="left"><tt><xsl:value-of select="@actionuri"/></tt></td>
  -   <td align="right"><tt><xsl:value-of select="@inheritable"/></tt></td>
  -   <td align="right"><tt><xsl:value-of select="@negative"/></tt></td>
  +   <td align="left"><tt><xsl:value-of select="@inheritable"/></tt></td>
  +   <td align="left"><tt><xsl:value-of select="@negative"/></tt></td>
  +   <td align="right">
  +    <form action="" method="post">
  +     <input type="hidden" name="namespace" value="{$namespace}"/>
  +     <input type="hidden" name="uri" value="{../@uri}"/>
  +     <input type="hidden" name="permissionsubject" value="{@subjecturi}"/>
  +     <input type="hidden" name="permissionsaction" value="{@actionuri}"/>
  +
  +     <input type="submit" name="cocoon-action-deletepermission" value="Delete"/>
  +    </form>
  +   </td>
     </tr>
    </xsl:template>
   
  @@ -85,28 +326,37 @@
     <tr bgcolor="#eeeeee">
      <td align="left"><tt><xsl:value-of select="@subjecturi"/></tt></td>
      <td align="left"><tt><xsl:value-of select="@typeuri"/></tt></td>
  -   <td align="right"><tt><xsl:value-of select="@expiration"/></tt></td>
  -   <td align="right"><tt><xsl:value-of select="@inheritable"/></tt></td>
  -   <td align="right"><tt><xsl:value-of select="@exclusive"/></tt></td>
  -  </tr>
  - </xsl:template>
  +   <td align="left"><tt><xsl:value-of select="@expiration"/></tt></td>
  +   <td align="left"><tt><xsl:value-of select="@inheritable"/></tt></td>
  +   <td align="left"><tt><xsl:value-of select="@exclusive"/></tt></td>
  +   <td align="right">
  +    <form action="" method="post">
  +     <input type="hidden" name="namespace" value="{$namespace}"/>
  +     <input type="hidden" name="uri" value="{../@uri}"/>
  +     <input type="hidden" name="locksubject" value="{@subjecturi}"/>
   
  - <xsl:template match="col:collection" mode="enumerate">
  -  <tr bgcolor="#eeeeee">
  -   <td align="left" colspan="4">&#160;&#160;
  -    <a href="/cocoon/mount/slide/browse/{$namespace}{@uri}"><tt><xsl:value-of select="@uri"/></tt></a>
  +     <input type="submit" name="cocoon-action-deletelock" value="Delete"/>
  +    </form>
      </td>
  -   <td align="right"><tt><xsl:value-of select="@lastmodified"/></tt></td>
     </tr>
    </xsl:template>
   
  - <xsl:template match="col:object" mode="enumerate">
  + <xsl:template match="col:actionnode|col:actionnode|col:groupnode|col:linknode|col:subjectnode|col:objectnode" mode="enumerate">
     <tr bgcolor="#eeeeee">
  -   <td align="left" colspan="3">&#160;&#160;
  -    <a href="/cocoon/mount/slide/view/{$namespace}{@uri}"><tt><xsl:value-of select="@uri"/></tt></a>
  +   <td align="left">&#160;&#160;
  +    <a href="/cocoon/mount/slide/browse/{$namespace}{@uri}"><tt><xsl:value-of select="@uri"/></tt></a>
  +   </td>
  +   <td align="left"><tt><xsl:value-of select="local-name(.)"/></tt></td>
  +   <td align="left"><tt><xsl:value-of select="col:property[@name='getcontentlength']"/></tt></td>
  +   <td align="left"><tt><xsl:value-of select="col:property[@name='getlastmodified']"/></tt></td>
  +   <td align="right">
  +    <form action="" method="post">
  +     <input type="hidden" name="namespace" value="{$namespace}"/>
  +     <input type="hidden" name="uri" value="{@uri}"/>
  +     
  +     <input type="submit" name="cocoon-action-deletenode" value="Delete"/>
  +    </form>
      </td>
  -   <td align="right"><tt><xsl:value-of select="@contentlength"/></tt></td>
  -   <td align="right"><tt><xsl:value-of select="@lastmodified"/></tt></td>
     </tr>
    </xsl:template>
   
  
  
  
  1.2       +115 -16   xml-cocoon2/src/scratchpad/webapp/mount/slide/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/webapp/mount/slide/sitemap.xmap,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- sitemap.xmap	22 May 2002 15:29:11 -0000	1.1
  +++ sitemap.xmap	11 Jun 2002 18:09:12 -0000	1.2
  @@ -3,48 +3,147 @@
   <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
    <map:components>
     <map:generators default="file">
  -   <map:generator name="slidecollection" 
  +<!--   <map:generator name="slidecollection" 
                     src="org.apache.cocoon.generation.SlideCollectionGenerator" 
  -                  logger="sitemap.generator.slidecollection"/>
  +                  logger="sitemap.generator.slidecollection"/>-->
  +
  +   <map:generator name="sourcedescription" 
  +                  src="org.apache.cocoon.generation.RepositorySourceDescriptionGenerator" 
  +                  logger="sitemap.generator.repositorysourcedescriptiongenerator"/>
     </map:generators>
   
     <map:serializers default="html"/>
  -  <map:transformers default="xslt"/>
  +  <map:transformers default="xslt">
  +   <map:transformer name="session" logger="sitemap.transformer.session"
  +                    src="org.apache.cocoon.webapps.session.transformation.SessionTransformer"/>
  +   <map:transformer logger="sitemap.transformer.write-source" name="write-source"
  +                    src="org.apache.cocoon.transformation.SourceWritingTransformer"/>
  +<!--   <map:transformer logger="sitemap.transformer.slidetransformer" name="slidetransformer"
  +                    src="org.apache.cocoon.transformation.SlideTransformer"/>-->
  +  </map:transformers>
  +
     <map:readers default="resource"/>
     <map:matchers default="wildcard"/>
     <map:selectors default="browser"/>
  +
  +  <map:actions>
  +   <map:action name="portal-auth" src="org.apache.cocoon.webapps.portal.acting.AuthAction"/>
  +
  +   <map:action name="auth-protect" logger="sitemap.action.auth-protect" 
  +               src="org.apache.cocoon.webapps.authentication.acting.AuthAction">
  +    <handlers>
  +     <handler name="slidehandler" xmlns:map="http://apache.org/cocoon/sitemap/1.0">
  +      <redirect-to    uri="cocoon://mount/slide/login.html"/>
  +      <authentication uri="cocoon://mount/slide/slide-authuser"/>
  +     </handler>
  +    </handlers>
  +   </map:action>
  +
  +   <map:action name="auth-login" logger="sitemap.action.auth-login"
  +               src="org.apache.cocoon.webapps.authentication.acting.LoginAction"/>
  +   <map:action name="auth-logout" logger="sitemap.action.auth-logout"
  +               src="org.apache.cocoon.webapps.authentication.acting.LogoutAction"/>
  +   <map:action name="auth-loggedIn" logger="sitemap.action.auth-loggedIn"
  +               src="org.apache.cocoon.webapps.authentication.acting.LoggedInAction"/>
  +
  +  </map:actions>
  +
    </map:components>
   
    <map:pipelines>
   
  +<!--  <map:pipeline>
  +   <map:match pattern="slide-*">
  +
  +    <map:match pattern="slide-authuser">
  +     <map:generate type="slidecollection" src="ownrepository/users"/>
  +     <map:transform src="resources/slideuser2user.xsl">
  +      <map:parameter name="use-request-parameters" value="true"/>
  +     </map:transform>
  +     <map:serialize type="xml"/>
  +    </map:match>
  +
  +   </map:match>
  +
  +   <map:handle-errors>
  +    <map:transform src="context://stylesheets/system/error2html.xsl"/>
  +    <map:serialize status-code="500"/>
  +   </map:handle-errors>
  +
  +  </map:pipeline>-->
  +
     <map:pipeline>
   
      <map:match pattern="">
  -	  <map:redirect-to uri="browse/ownrepository/"/>
  +	  <map:redirect-to uri="browse/"/>
   	 </map:match>
  + 
  +<!--   <map:match pattern="login.html">
  +    <map:read src="resources/login.html"/>
  +   </map:match>
   
  -   <map:match pattern="browse/*/**">
  -	  <map:generate type="slidecollection" src="{1}/{2}">
  -     <map.parameter name="username" value="root"/><!-- Doesn't work right now -->
  -    </map:generate>
  -
  -    <map:transform src="collection2html.xsl">
  -     <map:parameter name="namespace" value="{1}"/>
  -    </map:transform>
  +   <map:match pattern="login">
  +    <map:act type="auth-login">
  +     <map:parameter name="handler" value="slidehandler"/>
  +     <map:parameter name="parameter_userid" value="request:name"/>
  +     <map:parameter name="parameter_password" value="request:password"/>
  +     <map:redirect-to uri="browse/ownrepository/"/>
  +    </map:act>
   
  -    <map:serialize type="html"/>								
  +    <map:generate src="resources/login-failed.html"/>
  +    <map:serialize/>
      </map:match>
   
  -   <map:match pattern="view/*/**">
  -    <!-- Ask me how should I handle the mime type ?!?! -->
  -    <map:read src="slide://{1}/{2}" mime-type="application/octet-stream"/> 
  +   <map:match pattern="logout.html">
  +    <map:act type="auth-logout">
  +     <map:parameter name="handler" value="slidehandler"/>
  +
  +     <map:read src="resources/logout.html"/>
  +    </map:act>
  +
  +    <map:redirect-to uri="login.html"/>
      </map:match>
   
  +   <map:match pattern="**">
  +    <map:act type="auth-protect">
  +     <map:parameter name="handler" value="slidehandler"/>-->
  +
  +     <map:match pattern="browse/**">
  +
  +<!--      <map:generate type="slidecollection" src="{1}/{2}">
  +       <map:parameter name="username" value="root"/>
  +      </map:generate>-->
  +
  +      <map:generate type="sourcedescription" src="{2}">
  +       <map:parameter name="repository" value="slide"/>
  +       <map:parameter name="namespace" value="myrepository"/>
  +       <map:parameter name="principal" value="root"/>
  +      </map:generate>
  +
  +<!--      <map:transform src="collection2html.xsl">
  +       <map:parameter name="use-request-parameters" value="true"/>
  +       <map:parameter name="namespace" value="{1}"/>
  +      </map:transform>-->
  +
  +<!--      <map:transform type="slidetransformer"/>-->
  +
  +      <map:serialize type="html"/>							
  +     </map:match>
  +
  +     <map:match pattern="view/**">
  +<!--      <map:read src="slide://{1}/{2}"/>-->
  +      <map:read src="repository://{1}?repository=slide&amp;namespace=myrepository&amp;principal=root"/>
  +     </map:match>
  +
  +<!--    </map:act>
  +   </map:match>-->
  +
      <map:handle-errors>
       <map:transform src="context://stylesheets/system/error2html.xsl"/>
       <map:serialize status-code="500"/>
      </map:handle-errors>
   			
   	</map:pipeline>
  +
    </map:pipelines>
   </map:sitemap>
  
  
  
  1.1                  xml-cocoon2/src/scratchpad/webapp/mount/slide/login-failed.html
  
  Index: login-failed.html
  ===================================================================
  <html>
   <head>
    <title>Login failed</title>
   </head>
   <body>
    <h3>Login failed!</h3>
   </body>
  </html>
  
  
  
  1.1                  xml-cocoon2/src/scratchpad/webapp/mount/slide/login.html
  
  Index: login.html
  ===================================================================
  <html>
   <head>
    <title>Login page</title>
   </head>
   <body>
    <form action="login" method="post">
     Username:<input name="name" type="text" size="25" maxlength="40"/><br/>
     Password:<input name="password" type="text" size="25" maxlength="40"/><br/>
     <input type="submit" name="login" value="Login"/>
    </form>
   </body>
  </html>
  
  
  
  1.1                  xml-cocoon2/src/scratchpad/webapp/mount/slide/logout.html
  
  Index: logout.html
  ===================================================================
  <html>
   <head>
    <title>Logout</title>
   </head>
   <body>
    <h3>You are logged out!</h3>
   </body>
  </html>
  
  
  
  1.1                  xml-cocoon2/src/scratchpad/webapp/mount/slide/web.xml
  
  Index: web.xml
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  
  <!--
    This is the web-app configurations that allow Cocoon to work under
    Apache Tomcat. Please, follow the installation section of the
    documentation for more information about installing Cocoon on Tomcat
  -->
  
  <!DOCTYPE web-app
      PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
      "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
  
  <web-app>
    <display-name>Cocoon2 Demo</display-name>
    <description>Demo application for Cocoon2</description>
    <servlet>
      <servlet-name>Cocoon2</servlet-name>
      <display-name>Cocoon2</display-name>
      <description>The main Cocoon2 servlet</description>
  
      <!--
        In cases you're facing class loader problems you can alternatively
        use the following servlet-class instead of the normal one
  
        <servlet-class>org.apache.cocoon.servlet.ParanoidCocoonServlet</servlet-class>
  
      -->
      <servlet-class>org.apache.cocoon.servlet.CocoonServlet</servlet-class>
  
      <!--
        This parameter points to the main configuration file for Cocoon.
        Note that the path is specified in absolute notation but it will be
        resolved relative to the servlets webapp context path
      -->
      <init-param>
        <param-name>configurations</param-name>
        <param-value>/WEB-INF/cocoon.xconf</param-value>
      </init-param>
  
      <!--
        This parameter tells cocoon to load all the required libraries into
        it's own classloader instead of trusting the Servlet Vendor's
        classloader.  If you experience strange classloader issues,
        try setting this parameter to "true".
      -->
      <init-param>
        <param-name>init-classloader</param-name>
        <param-value>false</param-value>
      </init-param>
  
      <!--
        This parameter indicates the configuration file of the LogKit management
      -->
      <init-param>
        <param-name>logkit-config</param-name>
        <param-value>/WEB-INF/logkit.xconf</param-value>
      </init-param>
  
      <!--
        This parameter indicates the category id of the logger from the LogKit
        configuration used by the CocoonServlet.
      -->
      <init-param>
        <param-name>servlet-logger</param-name>
        <param-value>access</param-value>
      </init-param>
  
      <!--
        This parameter indicates the category id of the logger from the LogKit
        management configuration for the Cocoon engine.
        This logger is used for all components described in the cocoon.xconf
        and sitemap.xmap file not having specified a logger with the
        logger="..." attribute in the component configuration file.
      -->
      <init-param>
        <param-name>cocoon-logger</param-name>
        <param-value>core</param-value>
      </init-param>
  
      <!--
        This parameter indicates the log level to use throughout startup of the system.
        As soon as the logkit.xconf the setting of the logkit.xconf configuration is
        used instead! Only for startup and if the logkit.xconf is not readable/available
        this log level is of importance.
  
        Available levels are:
          DEBUG:        prints all level of log messages.
          INFO:         prints all level of log messages except DEBUG ones.
          WARN:         prints all level of log messages except DEBUG and INFO ones.
          ERROR:        prints all level of log messages except DEBUG, INFO and WARN ones.
          FATAL_ERROR: prints only log messages of this level
      -->
      <init-param>
        <param-name>log-level</param-name>
        <param-value>DEBUG</param-value>
      </init-param>
  
      <!--
        Allow reinstantiating (reloading) of the cocoon instance. If this is
        set to "yes" or "true", a new cocoon instance can be created using
        the request parameter "cocoon-reload".
      -->
      <init-param>
        <param-name>allow-reload</param-name>
        <param-value>yes</param-value>
      </init-param>
  
      <!--
        This parameter is used to list classes that should be loaded
        at initialization time of the servlet.
        Usually this classes are JDBC Drivers used
      -->
      <init-param>
        <param-name>load-class</param-name>
        <param-value>
          <!-- For IBM WebSphere:
          com.ibm.servlet.classloader.Handler -->
  
          <!-- For Database Driver: -->
          org.hsqldb.jdbcDriver
  
          <!-- For parent ComponentManager sample:
          org.apache.cocoon.samples.parentcm.Configurator
          -->
        </param-value>
      </init-param>
  
      <!--
        This parameter allows to specify where Cocoon should put files
        which are uploaded by the upload.xsp sample. The path specified
        is always relative to the context path of the servlet.
        The default directory is "upload-dir" in the work-directory
  
      <init-param>
        <param-name>upload-directory</param-name>
        <param-value>/WEB-INF/work/upload-dir</param-value>
      </init-param>
      -->
  
      <!--
        This parameter allows to specify where Cocoon should put files
        which are cached by the storing class. The path specified
        is always relative to the context path of the servlet.
        The default directory is "cache-dir" in the work-directory
  
      <init-param>
        <param-name>cache-directory</param-name>
        <param-value>/WEB-INF/work/cache-dir</param-value>
      </init-param>
      -->
  
      <!--
        This parameter allows to specify where Cocoon should put it's
        working files. The path specified is always relative to the
        context path of the Cocoon servlet.
        Usually it is obtained from the servlet engine.
  
      <init-param>
        <param-name>work-directory</param-name>
        <param-value>/WEB-INF/work</param-value>
      </init-param>
      -->
  
      <!--
        This parameter allows to specify additional directories or jars
        which Cocoon should put into it's own classpath.
        Note that you must separate them using the platforms path.separator
        (":" for *nix and ";" for Windows systems). Also note that absolute
        pathes are take as such but relative pathes are rooted at the context
        root of the Cocoon servlet.
  
      <init-param>
        <param-name>extra-classpath</param-name>
        <param-value>WEB-INF/extra-classes1:/[YOU-ABSOLUTE-PATH-TO]/own.jar</param-value>
      </init-param>
      -->
  
      <!--
        This parameter allows you to select the parent component manager.
        The class will be instantiated via the constructor that takes a single
        String as a parameter. That String will be equal to the text after the
        '/'.
  
        Cocoon honors the Loggable and Initializable interfaces for this class,
        if it implements them.
  
        If you uncomment the following lines the parent CM is set to the Parent CM sample, which will look up
        a configuration via JNDI at org/apache/cocoon/samples/parentcm/ParentCMConfiguration
        and use it.
      <init-param>
        <param-name>parent-component-manager</param-name>
        <param-value>org.apache.cocoon.samples.parentcm.ParentComponentManager/org/apache/cocoon/samples/parentcm/ParentCMConfiguration</param-value>
      </init-param>
      -->
  
      <!--
        This parameter allows you to select the request factory. Possible choices are as follows:
            - org.apache.cocoon.components.request.MultipartRequestFactoryImpl
            - org.apache.cocoon.components.request.MaybeUploadRequestFactoryImpl
      -->
      <init-param>
        <param-name>request-factory</param-name>
        <param-value>org.apache.cocoon.components.request.MultipartRequestFactoryImpl</param-value>
      </init-param>
  
      <!--
        If you set this parameter to 'true' or 'yes', Cocoon will add processing
        time to the end of each response. Value 'hide' adds processing time as an HTML
        comment. By default, processing time is not added (corresponds to value 'no').
  
      <init-param>
        <param-name>show-time</param-name>
        <param-value>hide</param-value>
      </init-param>
      -->
  
      <!--
        This parameter allows you to startup Cocoon2 immediately after startup
        of your servlet engine.
      -->
      <load-on-startup>1</load-on-startup>
    </servlet>
  
    <servlet>
      <servlet-name>WebDAV</servlet-name>
      <display-name>WebDAV</display-name>
      <description>The WebDAV servlet</description>
  
      <servlet-class>org.apache.slide.webdav.WebdavServlet</servlet-class>
  
      <init-param>
        <param-name>scope</param-name>
        <param-value>/files</param-value>
        <description>
           Scope of the Slide namespace that should be exposed by this servlet.
           For example, if you want to expose only the /files collection via
           WebDAV, set this parameter to '/files'. In that case, any URLs of the
           form '/context-path/servlet-path/*' will be mapped to '/files/*'
           in the Slide namespace.
           The default value is an empty string.
        </description>
      </init-param>
  
      <init-param>
        <param-name>depth-limit</param-name>
        <param-value>3</param-value>
        <description>
           This init-parameter determines the depth limit for PROPFIND and other
           methods, to avoid performance hits on the server for requests with
           infinite depth.
           The default value is '3'.
        </description>
      </init-param>
  
      <init-param>
        <param-name>default-mime-type</param-name>
        <param-value>application/octet-stream</param-value>
        <description>
          The MIME type that should be used for resources of unknown type. For
          example, if a WebDAV client uploads a file (via PUT) without specifying
          the Content-Type header, the MIME type defined here will be used.
          The default value is 'application/octet-stream'.
        </description>
      </init-param>
  
      <init-param>
        <param-name>default-servlet</param-name>
        <param-value>false</param-value>
        <description>
          By default, the WebDAV servlet is mapped as default servlet of the
          web application context (the url-pattern in servlet-mapping is '/').
          If you want to change that mapping so the servlet is no longer the
          default servlet, you must change this initialization parameter to
          indicate the situation to the servlet, by setting it to 'false'.
          The default value is 'true'.
        </description>
      </init-param>
  
      <init-param>
        <param-name>domain</param-name>
        <param-value>/WEB-INF/Domain.xml</param-value>
        <description>
          Path to the domain configuration file, relative to the path of the
          web application.
          The default is '/Domain.xml'.
        </description>
      </init-param>
  
      <init-param>
        <param-name>namespace</param-name>
        <param-value>ownrepository</param-value>
        <description>
          Name of the Slide namespace that should be accessed by this servlet.
          If this parameter is provided, make sure the corresponding namespace
          is defined in the domain configuration file. Otherwise, the default
          namespace will be used, if one exists.
        </description>
      </init-param>
  
      <init-param>
        <param-name>directory-browsing</param-name>
        <param-value>false</param-value>
        <description>
           Use the 'directory-browsing' init-parameter to turn off generation of
           HTML index pages that enable browsing of collections.
           The default value is 'true'. 
        </description>
      </init-param>
  
      <init-param>
        <param-name>debug</param-name>
        <param-value>0</param-value>
      </init-param>
  
      <load-on-startup>1</load-on-startup>
  
    </servlet>
  
  
    <!--
      Cocoon handles all the URL space assigned to the webapp using its sitemap.
      It is recommended to leave it unchanged. Under some circumstances though
      (like integration with proprietary webapps or servlets) you might have
      to change this parameter.
    -->
    <servlet-mapping>
      <servlet-name>Cocoon2</servlet-name>
      <url-pattern>/</url-pattern>
    </servlet-mapping>
    <!--
      Some servlet engines (Tomcat) have defaults which are not overriden
      by '/' mapping, but must be overriden explicitly.
    -->
    <servlet-mapping>
      <servlet-name>Cocoon2</servlet-name>
      <url-pattern>*.jsp</url-pattern>
    </servlet-mapping>
    <!--
      Some servlet engines (WebLogic) have defaults which are not overriden
      by '/' mapping, but must be overriden explicitly.
    -->
    <servlet-mapping>
      <servlet-name>Cocoon2</servlet-name>
      <url-pattern>*.html</url-pattern>
    </servlet-mapping>
  
    <servlet-mapping>
      <servlet-name>WebDAV</servlet-name>
      <url-pattern>/webdav/*</url-pattern>
    </servlet-mapping>
  
    <mime-mapping>
      <extension>css</extension>
      <mime-type>text/css</mime-type>
    </mime-mapping>
  
    <!-- Authetication for the WebDAV servlet -->
    <security-constraint>
      <web-resource-collection>
        <web-resource-name>DAV resource</web-resource-name>
        <url-pattern>/webdav/*</url-pattern>
        <http-method>COPY</http-method>
        <http-method>DELETE</http-method>
        <http-method>GET</http-method>
        <http-method>HEAD</http-method>
        <http-method>LOCK</http-method>
        <http-method>MKCOL</http-method>
        <http-method>MOVE</http-method>
        <http-method>OPTIONS</http-method>
        <http-method>POST</http-method>
        <http-method>PROPFIND</http-method>
        <http-method>PROPPATCH</http-method>
        <http-method>PUT</http-method>
        <http-method>UNLOCK</http-method>
      </web-resource-collection>
      <auth-constraint>
        <role-name>root</role-name>
        <role-name>guest</role-name>
        <role-name>user</role-name>
      </auth-constraint>
    </security-constraint>
    
    <login-config>
      <auth-method>BASIC</auth-method>
      <realm-name>Slide DAV Server</realm-name>
    </login-config>
    
  </web-app>
  
  
  
  1.14      +1 -58     xml-cocoon2/src/webapp/WEB-INF/web.xml
  
  Index: web.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/webapp/WEB-INF/web.xml,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- web.xml	11 Jun 2002 13:47:36 -0000	1.13
  +++ web.xml	11 Jun 2002 18:09:13 -0000	1.14
  @@ -229,58 +229,6 @@
       -->
       <load-on-startup>1</load-on-startup>
     </servlet>
  -<!--
  -  <servlet>
  -    <servlet-name>WebDAV</servlet-name>
  -    <display-name>WebDAV</display-name>
  -    <description>The WebDAV servlet</description>
  -
  -    <servlet-class>org.apache.slide.webdav.WebdavServlet</servlet-class>
  -
  -    <init-param>
  -      <param-name>scope</param-name>
  -      <param-value></param-value>
  -    </init-param>
  -
  -    <init-param>
  -      <param-name>depth-limit</param-name>
  -      <param-value>3</param-value>
  -    </init-param>
  -
  -    <init-param>
  -      <param-name>default-mime-type</param-name>
  -      <param-value>application/octet-stream</param-value>
  -    </init-param>
  -
  -    <init-param>
  -      <param-name>default-servlet</param-name>
  -      <param-value>false</param-value>
  -    </init-param>
  -
  -    <init-param>
  -      <param-name>domain</param-name>
  -      <param-value>/mount/slide/Domain.xml</param-value>
  -    </init-param>
  -
  -    <init-param>
  -      <param-name>namespace</param-name>
  -      <param-value>ownrepository</param-value>
  -    </init-param>
  -
  -    <init-param>
  -      <param-name>directory-browsing</param-name>
  -      <param-value>false</param-value>
  -    </init-param>
  -
  -    <init-param>
  -      <param-name>debug</param-name>
  -      <param-value>0</param-value>
  -    </init-param>
  -
  -    <load-on-startup>1</load-on-startup>
  -
  -  </servlet>
  --->
   
     <!--
       Cocoon handles all the URL space assigned to the webapp using its sitemap.
  @@ -308,12 +256,7 @@
       <servlet-name>Cocoon2</servlet-name>
       <url-pattern>*.html</url-pattern>
     </servlet-mapping>
  -<!--
  -  <servlet-mapping>
  -    <servlet-name>WebDAV</servlet-name>
  -    <url-pattern>/webdav/*</url-pattern>
  -  </servlet-mapping>
  --->  
  +
     <mime-mapping>
       <extension>css</extension>
       <mime-type>text/css</mime-type>
  
  
  

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


Mime
View raw message