stephan     2003/01/29 05:06:11

  Modified:    src/scratchpad/src/org/apache/cocoon/components/repository/impl
                        SlideRepository.java
               src/scratchpad/src/org/apache/cocoon/components/source/impl
                        SlideSourceFactory.java
               src/scratchpad/src/org/apache/cocoon/generation
                        SourceDescriptionGenerator.java
  Log:
  The slide repository only initialized, when org.apache.slide.common.Domain
  is not initialized. This prevents before to run the WebDAV servlet into the
  same container with cocoon.
  Second, make the source credential inheritable for the
  SourceDescriptionGenerator.
  Thanks to Martin Holz([EMAIL PROTECTED]).
  
  Revision  Changes    Path
  1.9       +127 -98   
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/repository/impl/SlideRepository.java
  
  Index: SlideRepository.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/repository/impl/SlideRepository.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- SlideRepository.java      22 Jan 2003 05:19:19 -0000      1.8
  +++ SlideRepository.java      29 Jan 2003 13:06:11 -0000      1.9
  @@ -1,57 +1,53 @@
   /*
  - * The Apache Software License, Version 1.1
  - *
  - *
  - * Copyright (c) 2001 The Apache Software Foundation.  All rights
  - * reserved.
  - *
  - * Redistribution and use in source and binary forms, with or without
  - * modification, are permitted provided that the following conditions
  - * are met:
  - *
  - * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer.
  - *
  - * 2. Redistributions in binary form must reproduce the above copyright
  - *    notice, this list of conditions and the following disclaimer in
  - *    the documentation and/or other materials provided with the
  - *    distribution.
  - *
  - * 3. The end-user documentation included with the redistribution,
  - *    if any, must include the following acknowledgment:
  - *       "This product includes software developed by the
  - *        Apache Software Foundation (http://www.apache.org/)."
  - *    Alternately, this acknowledgment may appear in the software itself,
  - *    if and wherever such third-party acknowledgments normally appear.
  - *
  - * 4. The names "Apache Cocoon" and "Apache Software Foundation" must
  - *    not be used to endorse or promote products derived from this
  - *    software without prior written permission. For written
  - *    permission, please contact [EMAIL PROTECTED]
  - *
  - * 5. Products derived from this software may not be called "Apache",
  - *    nor may "Apache" appear in their name, without prior written
  - *    permission of the Apache Software Foundation.
  - *
  - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  - * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  - * SUCH DAMAGE.
  - * ====================================================================
  - *
  - * This software consists of voluntary contributions made by many
  - * individuals on behalf of the Apache Software Foundation.  For more
  - * information on the Apache Software Foundation, please see
  - * <http://www.apache.org/>.
  - */
  +
  + ============================================================================
  +                   The Apache Software License, Version 1.1
  + ============================================================================
  +
  + Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  +
  + Redistribution and use in source and binary forms, with or without modifica-
  + tion, are permitted provided that the following conditions are met:
  +
  + 1. Redistributions of  source code must  retain the above copyright notice,
  +    this list of conditions and the following disclaimer.
  +
  + 2. Redistributions in binary form must reproduce the above copyright notice,
  +    this list of conditions and the following disclaimer in the documentation
  +    and/or other materials provided with the distribution.
  +
  + 3. The end-user documentation included with the redistribution, if any, must
  +    include  the following  acknowledgment:  "This product includes software
  +    developed  by the  Apache Software Foundation (http://www.apache.org/)."
  +    Alternately, this  acknowledgment may  appear in the software itself, if
  +    and wherever such third-party acknowledgments normally appear.
  +
  + 4. The names "Apache Cocoon" and  "Apache Software Foundation" must  not be
  +    used to  endorse or promote  products derived from  this software without
  +    prior written permission. For written permission, please contact
  +    [EMAIL PROTECTED]
  +
  + 5. Products  derived from this software may not  be called "Apache", nor may
  +    "Apache" appear  in their name,  without prior written permission  of the
  +    Apache Software Foundation.
  +
  + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  + FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL THE
  + APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
  + INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
  + DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
  + OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
  + ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
  + (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
  + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  +
  + This software  consists of voluntary contributions made  by many individuals
  + on  behalf of the Apache Software  Foundation and was  originally created by
  + Stefano Mazzocchi  <[EMAIL PROTECTED]>. For more  information on the Apache
  + Software Foundation, please see <http://www.apache.org/>.
  +
  +*/
   
   package org.apache.cocoon.components.repository.impl;
   
  @@ -74,25 +70,31 @@
   import org.apache.excalibur.source.SourceResolver;
   import org.apache.excalibur.xml.sax.SAXParser;
   
  +import org.apache.slide.common.Domain;
   import org.apache.slide.common.EmbeddedDomain;
   
   import org.xml.sax.InputSource;
   
  -//import java.util.Map;
  -
   /**
    * The class represent a manger for slide repositories
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Stephan Michels</a>
    * @version $Id$
    */
  -public class SlideRepository implements Repository, ThreadSafe, 
  -                                        Composable, Configurable, LogEnabled/*, 
Initializable*/, Disposable {
  +public class SlideRepository
  +  implements Repository, ThreadSafe, Composable, Configurable,
  +             LogEnabled /* , Initializable */, Disposable
  +{
   
       /** The component manager instance */
       protected ComponentManager manager = null;
   
  -    private EmbeddedDomain domain = new EmbeddedDomain();
  +    /**
  +     * The SlideRepository will handle the domain lifecycle only,
  +     * if it is not already initialzed.
  +     */
  +    private EmbeddedDomain domain = null;
  +
       private Logger logger;
       private String file;
       private boolean initialized = false;
  @@ -104,28 +106,30 @@
        */
       public void enableLogging(Logger logger) {
           this.logger = logger;
  -
  -        // FIXME Could not remove deprecated method, because some important 
  -        // messages were thrown over the domain logger
  -        domain.setLogger(new SlideLoggerAdapter(this.logger));
       }
   
       /**
        * Set the current <code>ComponentManager</code> instance used by this
        * <code>Composable</code>.
  +     *
  +     * @param manager    
  +     *
  +     * @throws ComponentException
        */
       public void compose(ComponentManager manager) throws ComponentException {
           this.manager = manager;
       }
   
       /**
  -     * Pass the Configuration to the Configurable class. This method must 
  +     * 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.
  +     *
  +     * @throws ConfigurationException
        */
       public void configure(Configuration configuration)
  -        throws ConfigurationException {
  +      throws ConfigurationException {
   
           this.file = configuration.getAttribute("file", "WEB-INF/slide.xconf");
       }
  @@ -138,20 +142,34 @@
        * @throws Exception if an error occurs
        */
       public void initialize() throws Exception {
  +
           SourceResolver resolver = null;
           SAXParser parser = null;
           Source source = null;
           Configuration configuration = null;
   
  +        this.domain = new EmbeddedDomain();
  +        // FIXME Could not remove deprecated method, because some important
  +        // messages were thrown over the domain logger
  +        domain.setLogger(new SlideLoggerAdapter(this.logger));
  +
  +        if (Domain.isInitialized()) {
  +            this.logger.info("Domain already initialized.");
  +            return;
  +        } else {
  +            this.logger.info("Initializing domain.");
  +        }
  +
           try {
  -            resolver = (SourceResolver)this.manager.lookup(SourceResolver.ROLE);
  +            resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
   
  -            parser = (SAXParser)this.manager.lookup(SAXParser.ROLE);
  +            parser = (SAXParser) this.manager.lookup(SAXParser.ROLE);
               SAXConfigurationHandler confighandler = new SAXConfigurationHandler();
   
               source = resolver.resolveURI(this.file);
   
  -            parser.parse(new InputSource(source.getInputStream()), confighandler);
  +            parser.parse(new InputSource(source.getInputStream()),
  +                         confighandler);
   
               configuration = confighandler.getConfiguration();
   
  @@ -159,43 +177,44 @@
               this.logger.error("Could not load slide configuration file", e);
               return;
           } finally {
  -            if (source!=null)
  +            if (source!=null) {
                   resolver.release(source);
  -            if (parser!=null) 
  -                this.manager.release((Component)parser);
  -            if (resolver!=null)
  +            }
  +            if (parser!=null) {
  +                this.manager.release((Component) parser);
  +            }
  +            if (resolver!=null) {
                   this.manager.release(resolver);
  +            }
           }
   
           try {
  -            domain.setDefaultNamespace(configuration.getAttribute("default", 
"slide"));
  +            domain.setDefaultNamespace(configuration.getAttribute("default",
  +                "slide"));
   
               this.logger.info("Initializing Domain");
   
               Configuration[] namespaceDefinitions = 
configuration.getChildren("namespace");
   
  -            for (int i=0; i<namespaceDefinitions.length; i++) {
  -
  +            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"));
  +
  +                this.logger.info("Initializing namespace : "+
  +                                 namespaceDefinitions[i].getAttribute("name"));
   
                   String name = namespaceDefinitions[i].getAttribute("name");
   
  -                Configuration namespaceDefinition =
  -                      namespaceDefinitions[i].getChild("definition");
  +                Configuration namespaceDefinition = 
namespaceDefinitions[i].getChild("definition");
   
  -                Configuration namespaceConfigurationDefinition =
  -                    namespaceDefinitions[i].getChild("configuration");
  +                Configuration namespaceConfigurationDefinition = 
namespaceDefinitions[i].getChild("configuration");
   
  -                Configuration namespaceBaseDataDefinition =
  -                    namespaceDefinitions[i].getChild("data");
  +                Configuration namespaceBaseDataDefinition = 
namespaceDefinitions[i].getChild("data");
   
  -                domain.addNamespace(name, new 
SlideLoggerAdapter(this.logger.getChildLogger(name)),
  -                                          new 
SlideConfigurationAdapter(namespaceDefinition),
  -                                          new 
SlideConfigurationAdapter(namespaceConfigurationDefinition),
  -                                          new 
SlideConfigurationAdapter(namespaceBaseDataDefinition));
  +                domain.addNamespace(name,
  +                                    new 
SlideLoggerAdapter(this.logger.getChildLogger(name)),
  +                                    new 
SlideConfigurationAdapter(namespaceDefinition),
  +                                    new 
SlideConfigurationAdapter(namespaceConfigurationDefinition),
  +                                    new 
SlideConfigurationAdapter(namespaceBaseDataDefinition));
   
                   this.logger.info("Namespace configuration complete");
               }
  @@ -204,10 +223,14 @@
               return;
           }
   
  -        try {
  -            domain.start();
  -        } catch (Exception e) {
  -            this.logger.error("Could not start domain", e);
  +        initialized = true;
  +
  +        if (initialized) {
  +            try {
  +                domain.start();
  +            } catch (Exception e) {
  +                this.logger.error("Could not start domain", e);
  +            }
           }
       }
   
  @@ -218,18 +241,24 @@
        * resources that the Component owns.
        */
       public void dispose() {
  -        try {
  -            domain.stop();
  -        } catch (Exception e) {
  -            this.logger.error("Could not stop domain", e);
  +        if (initialized) {
  +            try {
  +                domain.stop();
  +            } catch (Exception e) {
  +                this.logger.error("Could not stop domain", e);
  +            }
           }
       }
   
  +    /**
  +     *
  +     *
  +     * @return
  +     */
       public EmbeddedDomain getDomain() {
  -        if (!initialized) {
  +        if (domain==null) {
               try {
                   initialize();
  -                initialized = true;
               } catch (Exception e) {
                   this.logger.error("Could not initialize Slide repository", e);
               }
  
  
  
  1.6       +7 -1      
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/source/impl/SlideSourceFactory.java
  
  Index: SlideSourceFactory.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/source/impl/SlideSourceFactory.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- SlideSourceFactory.java   9 Jan 2003 15:21:49 -0000       1.5
  +++ SlideSourceFactory.java   29 Jan 2003 13:06:11 -0000      1.6
  @@ -133,12 +133,18 @@
               locationParameters = new SourceParameters();
           }
   
  +        if ((this.getLogger()!=null) && (this.getLogger().isDebugEnabled())) 
  +          this.getLogger().debug( "Location is  " + location + " QueryString is " + 
queryString);
  +        this.getLogger().debug( "Source parameters:  " + 
locationParameters.toString());
  +
           String repositoryname = 
locationParameters.getParameter("cocoon-repository", null);
           String namespace = 
locationParameters.getParameter("cocoon-repository-namespace", null);
           String principal = 
locationParameters.getParameter("cocoon-source-principal", "guest");
           String password = locationParameters.getParameter("cocoon-source-password", 
null);
           String revision = locationParameters.getParameter("cocoon-source-revision", 
null);
           String branch = locationParameters.getParameter("cocoon-source-branch", 
null);
  +
  +        getLogger().debug("Used prinical '"+principal+"' for source");
   
           SourceCredential credential;
           if (password!=null)
  
  
  
  1.16      +357 -164  
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/generation/SourceDescriptionGenerator.java
  
  Index: SourceDescriptionGenerator.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/generation/SourceDescriptionGenerator.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- SourceDescriptionGenerator.java   7 Jan 2003 23:56:14 -0000       1.15
  +++ SourceDescriptionGenerator.java   29 Jan 2003 13:06:11 -0000      1.16
  @@ -9,7 +9,7 @@
    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,
  + 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,
  @@ -17,12 +17,12 @@
       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
  +    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
  + 4. The names "Apache Cocoon" and  "Apache Software Foundation" must  not be
       used to  endorse or promote  products derived from  this software without
       prior written permission. For written permission, please contact
       [EMAIL PROTECTED]
  @@ -33,7 +33,7 @@
   
    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
  + 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
  @@ -95,54 +95,62 @@
    * @author <a href="mailto:[EMAIL PROTECTED]";>Stephan Michels</a>
    * @version CVS $Id$
    */
  -public class SourceDescriptionGenerator extends ComposerGenerator 
  -        implements CacheableProcessingComponent, Recyclable {
  +public class SourceDescriptionGenerator extends ComposerGenerator
  +  implements CacheableProcessingComponent, Recyclable
  +{
   
       /** Namespace of the source description. */
       private static final String SOURCE_NS = 
"http://xml.apache.org/cocoon/source/2.0";;
   
       /** The namespace prefix of the source description. */
  -    private static final String SOURCE_PREFIX          = "source";
  +    private static final String SOURCE_PREFIX = "source";
   
  -    private static final String SOURCE_NODE_NAME       = "source";
  -    private static final String SOURCE_NODE_QNAME      = 
SOURCE_PREFIX+":"+SOURCE_NODE_NAME;
  -
  -    private static final String NAME_ATTR_NAME           = "name";
  -    private static final String SYSTEMID_ATTR_NAME       = "systemid";
  -    private static final String MIMETYPE_ATTR_NAME       = "mime-type";
  -    private static final String CONTENTLENGTH_ATTR_NAME  = "contentlength";
  -    private static final String LASTMODIFIED_ATTR_NAME   = "lastmodified";
  -    private static final String COLLECTION_ATTR_NAME     = "collection";
  -    private static final String PARENT_ATTR_NAME         = "parent";
  -    private static final String REVISION_ATTR_NAME       = "revision";
  +    private static final String SOURCE_NODE_NAME = "source";
  +    private static final String SOURCE_NODE_QNAME = SOURCE_PREFIX+":"+
  +                                                    SOURCE_NODE_NAME;
  +
  +    private static final String NAME_ATTR_NAME = "name";
  +    private static final String SYSTEMID_ATTR_NAME = "systemid";
  +    private static final String MIMETYPE_ATTR_NAME = "mime-type";
  +    private static final String CONTENTLENGTH_ATTR_NAME = "contentlength";
  +    private static final String LASTMODIFIED_ATTR_NAME = "lastmodified";
  +    private static final String COLLECTION_ATTR_NAME = "collection";
  +    private static final String PARENT_ATTR_NAME = "parent";
  +    private static final String REVISION_ATTR_NAME = "revision";
       private static final String REVISIONBRANCH_ATTR_NAME = "branch";
   
  -    private static final String PROPERTIES_NODE_NAME    = "properties";
  -    private static final String PROPERTIES_NODE_QNAME   = 
SOURCE_PREFIX+":"+PROPERTIES_NODE_NAME;
  +    private static final String PROPERTIES_NODE_NAME = "properties";
  +    private static final String PROPERTIES_NODE_QNAME = SOURCE_PREFIX+":"+
  +                                                        PROPERTIES_NODE_NAME;
       private static final String PROPERTY_TYPE_ATTR_NAME = "type";
   
  -    private static final String PERMISSIONS_NODE_NAME  = "permissions";
  -    private static final String PERMISSIONS_NODE_QNAME = 
SOURCE_PREFIX+":"+PERMISSIONS_NODE_NAME;
  -    private static final String PERMISSION_NODE_NAME   = "permission";
  -    private static final String PERMISSION_NODE_QNAME  = 
SOURCE_PREFIX+":"+PERMISSION_NODE_NAME;
  -
  -    private static final String LOCKS_NODE_NAME        = "locks";
  -    private static final String LOCKS_NODE_QNAME       = 
SOURCE_PREFIX+":"+LOCKS_NODE_NAME;
  -    private static final String LOCK_NODE_NAME         = "lock";
  -    private static final String LOCK_NODE_QNAME        = 
SOURCE_PREFIX+":"+LOCK_NODE_NAME;
  -
  -    private static final String CHILDREN_NODE_NAME     = "children";
  -    private static final String CHILDREN_NODE_QNAME    = 
SOURCE_PREFIX+":"+CHILDREN_NODE_NAME;
  - 
  -    private static final String PRINCIPAL_ATTR_NAME    = "principal";
  -    private static final String GROUP_ATTR_NAME        = "group";
  -    private static final String PRIVILEGE_ATTR_NAME    = "privilege";
  -    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 static final String PERMISSIONS_NODE_NAME = "permissions";
  +    private static final String PERMISSIONS_NODE_QNAME = SOURCE_PREFIX+":"+
  +                                                         PERMISSIONS_NODE_NAME;
  +    private static final String PERMISSION_NODE_NAME = "permission";
  +    private static final String PERMISSION_NODE_QNAME = SOURCE_PREFIX+":"+
  +                                                        PERMISSION_NODE_NAME;
  +
  +    private static final String LOCKS_NODE_NAME = "locks";
  +    private static final String LOCKS_NODE_QNAME = SOURCE_PREFIX+":"+
  +                                                   LOCKS_NODE_NAME;
  +    private static final String LOCK_NODE_NAME = "lock";
  +    private static final String LOCK_NODE_QNAME = SOURCE_PREFIX+":"+
  +                                                  LOCK_NODE_NAME;
  +
  +    private static final String CHILDREN_NODE_NAME = "children";
  +    private static final String CHILDREN_NODE_QNAME = SOURCE_PREFIX+":"+
  +                                                      CHILDREN_NODE_NAME;
  +
  +    private static final String PRINCIPAL_ATTR_NAME = "principal";
  +    private static final String GROUP_ATTR_NAME = "group";
  +    private static final String PRIVILEGE_ATTR_NAME = "privilege";
  +    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";
   
       /** Include properties into the description */
       private boolean properties = true;
  @@ -156,23 +164,49 @@
       /** Include version into the description */
       private boolean version = true;
   
  -    /** How deep the generator traverse the source */ 
  +    /** How deep the generator traverse the source */
       private int deep = 1;
   
       /** Traversed source for the keys and validities */
       private Hashtable cachedsources = new Hashtable();
   
  +    /** The queryString of the location including the "?" */
  +    private String queryString;
  +
       /**
        * Set the <code>SourceResolver</code>, objectModel <code>Map</code>,
        * the source and sitemap <code>Parameters</code> used to process the request.
  +     *
  +     * @param resolver Source Resolver
  +     * @param objectModel Object model.
  +     * @param location Location of the source.
  +     * @param parameters Parameters for the generator. 
  +     *
  +     * @throws IOException If an IO exception occurs.
  +     * @throws ProcessingException If an exception occurs, during the processing.
  +     * @throws SAXException If a SAX exception occurs.
        */
  -    public void setup(SourceResolver resolver, Map objectModel, String location, 
Parameters parameters)
  -        throws ProcessingException, SAXException, IOException {
  +    public void setup(SourceResolver resolver, Map objectModel,
  +                      String location,
  +                      Parameters parameters)
  +                        throws ProcessingException, SAXException,
  +                               IOException {
  +
  +        int idx = location.indexOf('?');
  +
  +        if (idx!=-1) {
  +            this.queryString = location.substring(idx);
  +            location = location.substring(0, idx);
  +        } else {
  +            this.queryString = "";
  +        }
   
           super.setup(resolver, objectModel, location, parameters);
   
  -        this.properties = parameters.getParameterAsBoolean("properties", true);
  -        this.permissions = parameters.getParameterAsBoolean("permissions", true);
  +        this.properties = parameters.getParameterAsBoolean("properties",
  +            true);
  +        this.permissions = parameters.getParameterAsBoolean("permissions",
  +            true);
           this.locks = parameters.getParameterAsBoolean("locks", true);
           this.version = parameters.getParameterAsBoolean("version", true);
   
  @@ -188,15 +222,18 @@
       public Serializable generateKey() {
   
           StringBuffer key = new StringBuffer();
  +
           key.append("SDG(");
   
           Source source;
  -        for (Enumeration e = cachedsources.elements(); e.hasMoreElements();) {
  -            source = (Source)e.nextElement();
  +
  +        for (Enumeration e = cachedsources.elements(); e.hasMoreElements(); ) {
  +            source = (Source) e.nextElement();
   
               key.append(source.getSystemId());
  -            if (e.hasMoreElements())
  +            if (e.hasMoreElements()) {
                   key.append(";");
  +            }
           }
   
           key.append(")");
  @@ -215,8 +252,9 @@
           AggregatedValidity validity = new AggregatedValidity();
   
           Source source;
  -        for (Enumeration e = cachedsources.elements(); e.hasMoreElements();) {
  -            source = (Source)e.nextElement();
  +
  +        for (Enumeration e = cachedsources.elements(); e.hasMoreElements(); ) {
  +            source = (Source) e.nextElement();
   
               validity.add(source.getValidity());
           }
  @@ -226,25 +264,35 @@
   
       /**
        * Traverse the source tree and retrieve all sources.
  +     *
  +     * @param sources Collection of sources.
  +     * @param uri Uri of the source.
  +     * @param deep Deep of the hirachy, which should traversed.
        */
       private void collectSources(Hashtable sources, String uri, int deep) {
           Source source = null;
  +
           try {
  -            source = this.resolver.resolveURI(uri);
  +            source = this.resolver.resolveURI(uri+this.queryString);
           } catch (Exception e) {
  -            getLogger().warn("Could not retrieve source with the id '"+uri+"'", e); 
  +            getLogger().warn("Could not retrieve source with the id '"+uri+
  +                             "'", e);
               return;
           }
   
           sources.put(uri, source);
   
           if (source instanceof TraversableSource) {
  -            TraversableSource traversablesource = (TraversableSource)source;
  +            TraversableSource traversablesource = (TraversableSource) source;
   
               try {
  -                if (traversablesource.isSourceCollection() && (deep>0)) 
  -                    for(int i=0; i<traversablesource.getChildSourceCount(); i++)
  -                        collectSources(sources, 
traversablesource.getChildSource(i), deep-1);
  +                if (traversablesource.isSourceCollection() && (deep>0)) {
  +                    for (int i = 0; i<traversablesource.getChildSourceCount();
  +                        i++)
  +                        collectSources(sources,
  +                                       traversablesource.getChildSource(i),
  +                                       deep-1);
  +                }
               } catch (SourceException se) {
                   getLogger().warn("Could not traverse source", se);
               }
  @@ -253,13 +301,17 @@
   
       /**
        * Generate XML data.
  +     *
  +     * @throws IOException If an IO exception occurs.
  +     * @throws ProcessingException If an exception occurs, during the processing.
  +     * @throws SAXException If a SAX exception occurs.
        */
  -    public void generate() throws IOException, SAXException, ProcessingException {
  +    public void generate()
  +      throws IOException, SAXException, ProcessingException {
   
  -        try
  -        {
  +        try {
               this.contentHandler.startDocument();
  -            this.contentHandler.startPrefixMapping(SOURCE_PREFIX,SOURCE_NS);
  +            this.contentHandler.startPrefixMapping(SOURCE_PREFIX, SOURCE_NS);
   
               pushSourceDescription(this.source, this.deep);
   
  @@ -271,220 +323,360 @@
           }
       }
   
  -    private void pushSourceDescription(String systemid, int deep) 
  -        throws SAXException, SourceException, ProcessingException, IOException {
  +    /**
  +     * Push a XML description of specified source.
  +     *
  +     * @param systemid System identifier of the source.
  +     * @param deep Deep of the hirachy, which should traversed.
  +     *
  +     * @throws IOException If an IO exception occurs.
  +     * @throws ProcessingException If an exception occurs, during the processing.
  +     * @throws SAXException If a SAX exception occurs.
  +     * @throws SourceException If a source exception occurs.
  +     */
  +    private void pushSourceDescription(String systemid,
  +                                       int deep)
  +                                         throws SAXException,
  +                                                SourceException,
  +                                                ProcessingException,
  +                                                IOException {
   
  -        Source source = (Source)this.cachedsources.get(systemid);
  +        Source source = (Source) this.cachedsources.get(systemid);
   
           try {
               AttributesImpl attributes = new AttributesImpl();
  -            attributes.addAttribute(SOURCE_NS, SYSTEMID_ATTR_NAME, 
SYSTEMID_ATTR_NAME, "CDATA", 
  +
  +            attributes.addAttribute(SOURCE_NS, SYSTEMID_ATTR_NAME,
  +                                    SYSTEMID_ATTR_NAME, "CDATA",
                                       source.getSystemId());
   
               String name = source.getSystemId();
  -            if (name.endsWith("://"))
  -                attributes.addAttribute(SOURCE_NS, NAME_ATTR_NAME, NAME_ATTR_NAME, 
"CDATA", "");
  -            else if (name.endsWith("/")) {
  +
  +            if (name.endsWith("://")) {
  +                attributes.addAttribute(SOURCE_NS, NAME_ATTR_NAME,
  +                                        NAME_ATTR_NAME, "CDATA", "");
  +            } else if (name.endsWith("/")) {
                   name = name.substring(1, name.length()-1);
  -                attributes.addAttribute(SOURCE_NS, NAME_ATTR_NAME, NAME_ATTR_NAME, 
"CDATA",
  -                                        name.substring(name.lastIndexOf("/")+1, 
name.length()));
  -            } else 
  -                attributes.addAttribute(SOURCE_NS, NAME_ATTR_NAME, NAME_ATTR_NAME, 
"CDATA", 
  -                                        name.substring(name.lastIndexOf("/")+1, 
name.length()));
  -
  -            if ((source.getMimeType()!=null) && (source.getMimeType().length()>0));
  -                attributes.addAttribute(SOURCE_NS, MIMETYPE_ATTR_NAME, 
MIMETYPE_ATTR_NAME, "CDATA",
  -                                        source.getMimeType());
  +                attributes.addAttribute(SOURCE_NS, NAME_ATTR_NAME,
  +                                        NAME_ATTR_NAME, "CDATA",
  +                                        name.substring(name.lastIndexOf("/")+
  +                                                       1, name.length()));
  +            } else {
  +                attributes.addAttribute(SOURCE_NS, NAME_ATTR_NAME,
  +                                        NAME_ATTR_NAME, "CDATA",
  +                                        name.substring(name.lastIndexOf("/")+
  +                                                       1, name.length()));
  +            }
   
  -            if (source.getContentLength()>=0)
  -                attributes.addAttribute(SOURCE_NS, CONTENTLENGTH_ATTR_NAME, 
CONTENTLENGTH_ATTR_NAME, "CDATA",
  +            if ((source.getMimeType()!=null) &&
  +                (source.getMimeType().length()>0)) {
  +                ;
  +            }
  +            attributes.addAttribute(SOURCE_NS, MIMETYPE_ATTR_NAME,
  +                                    MIMETYPE_ATTR_NAME, "CDATA",
  +                                    source.getMimeType());
  +
  +            if (source.getContentLength()>=0) {
  +                attributes.addAttribute(SOURCE_NS, CONTENTLENGTH_ATTR_NAME,
  +                                        CONTENTLENGTH_ATTR_NAME, "CDATA",
                                           String.valueOf(source.getContentLength()));
  +            }
   
  -            if (source.getLastModified()>0)
  -                attributes.addAttribute(SOURCE_NS, LASTMODIFIED_ATTR_NAME, 
LASTMODIFIED_ATTR_NAME, "CDATA",
  +            if (source.getLastModified()>0) {
  +                attributes.addAttribute(SOURCE_NS, LASTMODIFIED_ATTR_NAME,
  +                                        LASTMODIFIED_ATTR_NAME, "CDATA",
                                           String.valueOf(source.getLastModified()));
  +            }
   
               if (this.version && (source instanceof VersionableSource)) {
  -                VersionableSource versionablesource = (VersionableSource)source;
  +                VersionableSource versionablesource = (VersionableSource) source;
  +
                   if (versionablesource.isVersioned()) {
  -                    if ((versionablesource.getSourceRevision()!=null) && 
  -                        (versionablesource.getSourceRevision().length()>0))
  -                        attributes.addAttribute(SOURCE_NS, REVISION_ATTR_NAME, 
REVISION_ATTR_NAME, 
  -                                                "CDATA", 
versionablesource.getSourceRevision());
  +                    if ((versionablesource.getSourceRevision()!=null) &&
  +                        (versionablesource.getSourceRevision().length()>0)) {
  +                        attributes.addAttribute(SOURCE_NS,
  +                                                REVISION_ATTR_NAME,
  +                                                REVISION_ATTR_NAME, "CDATA",
  +                                                
versionablesource.getSourceRevision());
  +                    }
   
                       if ((versionablesource.getSourceRevisionBranch()!=null) &&
  -                        (versionablesource.getSourceRevisionBranch().length()>0))
  -                        attributes.addAttribute(SOURCE_NS, 
REVISIONBRANCH_ATTR_NAME, REVISIONBRANCH_ATTR_NAME,
  -                                                "CDATA", 
versionablesource.getSourceRevisionBranch());
  +                        (versionablesource.getSourceRevisionBranch().length()>
  +                         0)) {
  +                        attributes.addAttribute(SOURCE_NS,
  +                                                REVISIONBRANCH_ATTR_NAME,
  +                                                REVISIONBRANCH_ATTR_NAME,
  +                                                "CDATA",
  +                                                
versionablesource.getSourceRevisionBranch());
  +                    }
                   }
               }
   
               boolean isCollection = false;
               TraversableSource traversablesource = null;
  +
               if (source instanceof TraversableSource) {
  -                traversablesource = (TraversableSource)source;
  +                traversablesource = (TraversableSource) source;
   
                   isCollection = traversablesource.isSourceCollection();
   
  -                attributes.addAttribute(SOURCE_NS, COLLECTION_ATTR_NAME, 
COLLECTION_ATTR_NAME, "CDATA",
  +                attributes.addAttribute(SOURCE_NS, COLLECTION_ATTR_NAME,
  +                                        COLLECTION_ATTR_NAME, "CDATA",
                                           String.valueOf(isCollection));
   
                   String parent = traversablesource.getParentSource();
  -                if ((parent!=null) && (parent.length()>0))
  -                    attributes.addAttribute(SOURCE_NS, PARENT_ATTR_NAME, 
PARENT_ATTR_NAME, "CDATA",
  +
  +                if ((parent!=null) && (parent.length()>0)) {
  +                    attributes.addAttribute(SOURCE_NS, PARENT_ATTR_NAME,
  +                                            PARENT_ATTR_NAME, "CDATA",
                                               parent);
  +                }
               }
   
  -            this.contentHandler.startElement(SOURCE_NS, SOURCE_NODE_NAME, 
SOURCE_NODE_QNAME, attributes);
  +            this.contentHandler.startElement(SOURCE_NS, SOURCE_NODE_NAME,
  +                                             SOURCE_NODE_QNAME, attributes);
   
  -            if (this.properties && (source instanceof InspectableSource))
  -                pushLiveSourceProperties((InspectableSource)source);
  +            if (this.properties && (source instanceof InspectableSource)) {
  +                pushLiveSourceProperties((InspectableSource) source);
  +            }
   
  -            if (this.properties)
  +            if (this.properties) {
                   pushComputedSourceProperties(source);
  +            }
   
               if (this.permissions) {
                   try {
  -                    if (source instanceof RestrictableSource)
  -                        pushSourcePermissions((RestrictableSource)source);
  +                    if (source instanceof RestrictableSource) {
  +                        pushSourcePermissions((RestrictableSource) source);
  +                    }
                   } catch (SourceException se) {
  -                    if (getLogger().isDebugEnabled())
  -                        getLogger().debug("Could not retrieve source permissions", 
se);
  +                    if (getLogger().isDebugEnabled()) {
  +                        getLogger().debug("Could not retrieve source permissions",
  +                                          se);
  +                    }
                   }
               }
   
  -            if (this.locks && (source instanceof LockableSource))
  -                pushSourceLocks((LockableSource)source);
  +            if (this.locks && (source instanceof LockableSource)) {
  +                pushSourceLocks((LockableSource) source);
  +            }
   
               if ((isCollection) && (deep>0)) {
  -                this.contentHandler.startElement(SOURCE_NS, CHILDREN_NODE_NAME, 
CHILDREN_NODE_QNAME, new AttributesImpl());
  -                for(int i=0; i<traversablesource.getChildSourceCount(); i++) {
  +                this.contentHandler.startElement(SOURCE_NS,
  +                                                 CHILDREN_NODE_NAME,
  +                                                 CHILDREN_NODE_QNAME,
  +                                                 new AttributesImpl());
  +                for (int i = 0; i<traversablesource.getChildSourceCount();
  +                    i++) {
                       try {
  -                        pushSourceDescription(traversablesource.getChildSource(i), 
deep-1);
  +                        pushSourceDescription(traversablesource.getChildSource(i),
  +                                              deep-1);
                       } catch (SourceException se) {
  -                        if (getLogger().isDebugEnabled())
  -                            getLogger().debug("Could not retrieve source", se);
  +                        if (getLogger().isDebugEnabled()) {
  +                            getLogger().debug("Could not retrieve source",
  +                                              se);
  +                        }
                       }
                   }
  -                this.contentHandler.endElement(SOURCE_NS, SOURCE_NODE_NAME, 
SOURCE_NODE_QNAME);
  +                this.contentHandler.endElement(SOURCE_NS, SOURCE_NODE_NAME,
  +                                               SOURCE_NODE_QNAME);
               }
   
  -            this.contentHandler.endElement(SOURCE_NS, SOURCE_NODE_NAME, 
SOURCE_NODE_QNAME);
  +            this.contentHandler.endElement(SOURCE_NS, SOURCE_NODE_NAME,
  +                                           SOURCE_NODE_QNAME);
   
           } catch (SAXException saxe) {
               throw saxe;
  -        } 
  +        }
       }
   
  -    private void pushLiveSourceProperties(InspectableSource source) throws 
SAXException, SourceException {
  +    /**
  +     * Push a XML description about all properties, which
  +     * the source owns.
  +     *
  +     * @param source Source.  
  +     *
  +     * @throws SAXException If a SAX exception occurs.  
  +     * @throws SourceException If a source exception occurs.
  +     */
  +    private void pushLiveSourceProperties(InspectableSource source)
  +      throws SAXException, SourceException {
           SourceProperty[] properties = source.getSourceProperties();
           SourceProperty property;
   
           AttributesImpl attributes = new AttributesImpl();
  -        attributes.addAttribute(SOURCE_NS, PROPERTY_TYPE_ATTR_NAME, 
PROPERTY_TYPE_ATTR_NAME, "CDATA",
  -                                "live");
  -        this.contentHandler.startElement(SOURCE_NS, PROPERTIES_NODE_NAME, 
PROPERTIES_NODE_QNAME, attributes);
  +
  +        attributes.addAttribute(SOURCE_NS, PROPERTY_TYPE_ATTR_NAME,
  +                                PROPERTY_TYPE_ATTR_NAME, "CDATA", "live");
  +        this.contentHandler.startElement(SOURCE_NS, PROPERTIES_NODE_NAME,
  +                                         PROPERTIES_NODE_QNAME, attributes);
   
           IncludeXMLConsumer consumer = new IncludeXMLConsumer(this.contentHandler);
  -        for (int i=0; i<properties.length; i++) {
  +
  +        for (int i = 0; i<properties.length; i++) {
               property = properties[i];
   
  -            this.contentHandler.startPrefixMapping("", property.getNamespace());
  +            this.contentHandler.startPrefixMapping("",
  +                                                   property.getNamespace());
               property.toSAX(consumer);
               this.contentHandler.endPrefixMapping("");
           }
   
  -        this.contentHandler.endElement(SOURCE_NS, PROPERTIES_NODE_NAME, 
PROPERTIES_NODE_QNAME);
  +        this.contentHandler.endElement(SOURCE_NS, PROPERTIES_NODE_NAME,
  +                                       PROPERTIES_NODE_QNAME);
       }
   
  -    private void pushComputedSourceProperties(Source source) throws SAXException, 
SourceException {
  +    /**
  +     * Push a XML description about all properties, which
  +     * were computed by source inspectors.
  +     *
  +     * @param source Source
  +     *
  +     * @throws SAXException If a SAX exception occurs.  
  +     * @throws SourceException If a source exception occurs.
  +     */
  +    private void pushComputedSourceProperties(Source source)
  +      throws SAXException, SourceException {
           AttributesImpl attributes = new AttributesImpl();
  -        attributes.addAttribute(SOURCE_NS, PROPERTY_TYPE_ATTR_NAME, 
PROPERTY_TYPE_ATTR_NAME, "CDATA",
  -                                "computed");
  -        this.contentHandler.startElement(SOURCE_NS, PROPERTIES_NODE_NAME, 
PROPERTIES_NODE_QNAME, attributes);
  +
  +        attributes.addAttribute(SOURCE_NS, PROPERTY_TYPE_ATTR_NAME,
  +                                PROPERTY_TYPE_ATTR_NAME, "CDATA", "computed");
  +        this.contentHandler.startElement(SOURCE_NS, PROPERTIES_NODE_NAME,
  +                                         PROPERTIES_NODE_QNAME, attributes);
   
           SourceInspector inspector = null;
  +
           try {
  -            inspector = (SourceInspector)this.manager.lookup(SourceInspector.ROLE);
  +            inspector = (SourceInspector) this.manager.lookup(SourceInspector.ROLE);
   
               SourceProperty[] properties = inspector.getSourceProperties(source);
  -            for (int i=0; i<properties.length; i++)
  -                properties[i].toSAX(new EmbeddedXMLPipe(this.contentHandler));
  +            IncludeXMLConsumer consumer = new 
IncludeXMLConsumer(this.contentHandler);
  +
  +            for (int i = 0; i<properties.length; i++) {
  +                SourceProperty property = properties[i];
  +
  +                this.contentHandler.startPrefixMapping("",
  +                                                       
properties[i].getNamespace());
  +                properties[i].toSAX(consumer);
  +                this.contentHandler.endPrefixMapping("");
  +            }
           } catch (ComponentException ce) {
  -            if (getLogger().isDebugEnabled())
  +            if (getLogger().isDebugEnabled()) {
                   getLogger().debug("Could not retrieve source inspector", ce);
  +            }
           } finally {
  -            if (inspector!=null)
  +            if (inspector!=null) {
                   this.manager.release(inspector);
  +            }
           }
   
  -        this.contentHandler.endElement(SOURCE_NS, PROPERTIES_NODE_NAME, 
PROPERTIES_NODE_QNAME);
  +        this.contentHandler.endElement(SOURCE_NS, PROPERTIES_NODE_NAME,
  +                                       PROPERTIES_NODE_QNAME);
       }
   
  -    private void pushSourcePermissions(RestrictableSource source) throws 
SAXException, SourceException {
  +    /**
  +     * Push a XML description of all permissions of a source.
  +     *
  +     * @param source Source
  +     *
  +     * @throws SAXException If a SAX exception occurs.  
  +     * @throws SourceException If a source exception occurs.
  +     */
  +    private void pushSourcePermissions(RestrictableSource source)
  +      throws SAXException, SourceException {
           SourcePermission[] permissions = source.getSourcePermissions();
   
           if ((permissions!=null) && (permissions.length>0)) {
  +            this.contentHandler.startElement(SOURCE_NS,
  +                                             PERMISSIONS_NODE_NAME,
  +                                             PERMISSIONS_NODE_QNAME,
  +                                             new AttributesImpl());
   
  -            this.contentHandler.startElement(SOURCE_NS, PERMISSIONS_NODE_NAME, 
PERMISSIONS_NODE_QNAME, new AttributesImpl());
  -
  -            for(int i=0; i<permissions.length; i++) {
  -    
  +            for (int i = 0; i<permissions.length; i++) {
                   AttributesImpl attributes = new AttributesImpl();
   
  -                if (permissions[i] instanceof PrincipalSourcePermission)
  -                    attributes.addAttribute("", PRINCIPAL_ATTR_NAME, 
PRINCIPAL_ATTR_NAME, "CDATA",
  -                                            
((PrincipalSourcePermission)permissions[i]).getPrincipal());
  -                else if (permissions[i] instanceof GroupSourcePermission)
  -                    attributes.addAttribute("", GROUP_ATTR_NAME, GROUP_ATTR_NAME, 
"CDATA",
  -                                            
((GroupSourcePermission)permissions[i]).getGroup());
  +                if (permissions[i] instanceof PrincipalSourcePermission) {
  +                    attributes.addAttribute("", PRINCIPAL_ATTR_NAME,
  +                                            PRINCIPAL_ATTR_NAME, "CDATA",
  +                                            ((PrincipalSourcePermission) 
permissions[i]).getPrincipal());
  +                } else if (permissions[i] instanceof GroupSourcePermission) {
  +                    attributes.addAttribute("", GROUP_ATTR_NAME,
  +                                            GROUP_ATTR_NAME, "CDATA",
  +                                            ((GroupSourcePermission) 
permissions[i]).getGroup());
  +                }
   
  -                attributes.addAttribute("", PRIVILEGE_ATTR_NAME, 
PRIVILEGE_ATTR_NAME, "CDATA",
  +                attributes.addAttribute("", PRIVILEGE_ATTR_NAME,
  +                                        PRIVILEGE_ATTR_NAME, "CDATA",
                                           permissions[i].getPrivilege());
  -                attributes.addAttribute("", INHERITABLE_ATTR_NAME, 
INHERITABLE_ATTR_NAME, "CDATA",
  +                attributes.addAttribute("", INHERITABLE_ATTR_NAME,
  +                                        INHERITABLE_ATTR_NAME, "CDATA",
                                           
String.valueOf(permissions[i].isInheritable()));
  -                attributes.addAttribute("", NEGATIVE_ATTR_NAME, NEGATIVE_ATTR_NAME, 
"CDATA",
  +                attributes.addAttribute("", NEGATIVE_ATTR_NAME,
  +                                        NEGATIVE_ATTR_NAME, "CDATA",
                                           
String.valueOf(permissions[i].isNegative()));
   
  -                this.contentHandler.startElement(SOURCE_NS, PERMISSION_NODE_NAME, 
PERMISSION_NODE_QNAME, attributes);
  -                this.contentHandler.endElement(SOURCE_NS, PERMISSION_NODE_NAME, 
PERMISSION_NODE_QNAME);
  +                this.contentHandler.startElement(SOURCE_NS,
  +                                                 PERMISSION_NODE_NAME,
  +                                                 PERMISSION_NODE_QNAME,
  +                                                 attributes);
  +                this.contentHandler.endElement(SOURCE_NS,
  +                                               PERMISSION_NODE_NAME,
  +                                               PERMISSION_NODE_QNAME);
               }
   
  -            this.contentHandler.endElement(SOURCE_NS, PERMISSIONS_NODE_NAME, 
PERMISSIONS_NODE_QNAME);
  +            this.contentHandler.endElement(SOURCE_NS, PERMISSIONS_NODE_NAME,
  +                                           PERMISSIONS_NODE_QNAME);
           }
       }
   
  -    public void pushSourceLocks(LockableSource source) throws SAXException, 
SourceException {
  +    /**
  +     * Push a XML description about all locks of a source.
  +     *
  +     * @param source Source
  +     *
  +     * @throws SAXException If a SAX exception occurs.  
  +     * @throws SourceException If a source exception occurs.
  +     */
  +    public void pushSourceLocks(LockableSource source)
  +      throws SAXException, SourceException {
           Enumeration locks = source.getSourceLocks();
           SourceLock lock;
   
           if (locks.hasMoreElements()) {
  -
  -            this.contentHandler.startElement(SOURCE_NS, LOCKS_NODE_NAME, 
LOCKS_NODE_QNAME, new AttributesImpl());
  +            this.contentHandler.startElement(SOURCE_NS, LOCKS_NODE_NAME,
  +                                             LOCKS_NODE_QNAME,
  +                                             new AttributesImpl());
   
               while (locks.hasMoreElements()) {
  -
                   lock = (SourceLock) locks.nextElement();
   
                   AttributesImpl attributes = new AttributesImpl();
  +
                   attributes = new AttributesImpl();
  -                attributes.addAttribute("", PRINCIPAL_ATTR_NAME, 
PRINCIPAL_ATTR_NAME, "CDATA",
  +                attributes.addAttribute("", PRINCIPAL_ATTR_NAME,
  +                                        PRINCIPAL_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",
  +                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",
  +                attributes.addAttribute("", INHERITABLE_ATTR_NAME,
  +                                        INHERITABLE_ATTR_NAME, "CDATA",
                                           String.valueOf(lock.isInheritable()));
  -                attributes.addAttribute("", EXCLUSIVE_ATTR_NAME, 
EXCLUSIVE_ATTR_NAME, "CDATA",
  +                attributes.addAttribute("", EXCLUSIVE_ATTR_NAME,
  +                                        EXCLUSIVE_ATTR_NAME, "CDATA",
                                           String.valueOf(lock.isExclusive()));
   
  -                this.contentHandler.startElement(SOURCE_NS, LOCK_NODE_NAME, 
LOCK_NODE_QNAME, attributes);
  -                this.contentHandler.endElement(SOURCE_NS, LOCK_NODE_NAME, 
LOCK_NODE_QNAME);
  +                this.contentHandler.startElement(SOURCE_NS, LOCK_NODE_NAME,
  +                                                 LOCK_NODE_QNAME, attributes);
  +                this.contentHandler.endElement(SOURCE_NS, LOCK_NODE_NAME,
  +                                               LOCK_NODE_QNAME);
   
               }
   
  -            this.contentHandler.endElement(SOURCE_NS, LOCKS_NODE_NAME, 
LOCKS_NODE_QNAME);
  +            this.contentHandler.endElement(SOURCE_NS, LOCKS_NODE_NAME,
  +                                           LOCKS_NODE_QNAME);
           }
       }
   
  @@ -495,9 +687,10 @@
       public void recycle() {
   
           Object uri;
  -        for (Enumeration e = cachedsources.keys(); e.hasMoreElements();) {
  +
  +        for (Enumeration e = cachedsources.keys(); e.hasMoreElements(); ) {
               uri = e.nextElement();
  -            this.resolver.release((Source)cachedsources.get(uri));
  +            this.resolver.release((Source) cachedsources.get(uri));
               cachedsources.remove(uri);
           }
       }
  
  
  

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

Reply via email to