svn commit: r640262 - in /lenya/trunk/src: modules-core/metadata/ modules-core/metadata/config/ modules-core/metadata/config/cocoon-xconf/ modules-core/metadata/config/sitemap/ modules-core/metadata/java/ modules-core/metadata/java/src/ modules-core/me...

[email protected]
Newsgroups gmane.comp.cms.lenya.cvs
Message-ID <[email protected]>
Author: andreas
Date: Sun Mar 23 15:25:38 2008
New Revision: 640262

URL: http://svn.apache.org/viewvc?rev=640262&view=rev
Log:
Moving meta-data related Cocoon components to metadata module.

Added:
    lenya/trunk/src/modules-core/metadata/
    lenya/trunk/src/modules-core/metadata/config/
    lenya/trunk/src/modules-core/metadata/config/cocoon-xconf/
    lenya/trunk/src/modules-core/metadata/config/cocoon-xconf/dc-elements.xconf
      - copied unchanged from r636674, lenya/trunk/src/webapp/lenya/config/cocoon-xconf/metadata/dc-elements.xconf
    lenya/trunk/src/modules-core/metadata/config/cocoon-xconf/dc-terms.xconf
      - copied unchanged from r636674, lenya/trunk/src/webapp/lenya/config/cocoon-xconf/metadata/dc-terms.xconf
    lenya/trunk/src/modules-core/metadata/config/cocoon-xconf/document.xconf
      - copied unchanged from r636674, lenya/trunk/src/webapp/lenya/config/cocoon-xconf/metadata/document.xconf
    lenya/trunk/src/modules-core/metadata/config/cocoon-xconf/metadata-cache.xconf
      - copied unchanged from r636674, lenya/trunk/src/webapp/lenya/config/cocoon-xconf/metadata/metadata-cache.xconf
    lenya/trunk/src/modules-core/metadata/config/module.xml
    lenya/trunk/src/modules-core/metadata/config/sitemap/
    lenya/trunk/src/modules-core/metadata/config/sitemap/metadata-generator.xmap
    lenya/trunk/src/modules-core/metadata/config/sitemap/metadata-transformer.xmap
    lenya/trunk/src/modules-core/metadata/java/
    lenya/trunk/src/modules-core/metadata/java/src/
    lenya/trunk/src/modules-core/metadata/java/src/org/
    lenya/trunk/src/modules-core/metadata/java/src/org/apache/
    lenya/trunk/src/modules-core/metadata/java/src/org/apache/lenya/
    lenya/trunk/src/modules-core/metadata/java/src/org/apache/lenya/modules/
    lenya/trunk/src/modules-core/metadata/java/src/org/apache/lenya/modules/metadata/
    lenya/trunk/src/modules-core/metadata/java/src/org/apache/lenya/modules/metadata/LenyaMetaDataGenerator.java
    lenya/trunk/src/modules-core/metadata/java/src/org/apache/lenya/modules/metadata/MetaDataTransformer.java
Removed:
    lenya/trunk/src/webapp/lenya/config/cocoon-xconf/metadata/dc-elements.xconf
    lenya/trunk/src/webapp/lenya/config/cocoon-xconf/metadata/dc-terms.xconf
    lenya/trunk/src/webapp/lenya/config/cocoon-xconf/metadata/document.xconf
    lenya/trunk/src/webapp/lenya/config/cocoon-xconf/metadata/metadata-cache.xconf
Modified:
    lenya/trunk/src/webapp/lenya/config/sitemap/generators.xmap
    lenya/trunk/src/webapp/lenya/config/sitemap/transformers.xmap

Added: lenya/trunk/src/modules-core/metadata/config/module.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/metadata/config/module.xml?rev=640262&view=auto
==============================================================================
--- lenya/trunk/src/modules-core/metadata/config/module.xml (added)
+++ lenya/trunk/src/modules-core/metadata/config/module.xml Sun Mar 23 15:25:38 2008
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+  
+  http://www.apache.org/licenses/LICENSE-2.0
+  
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<module xmlns="http://apache.org/lenya/module/1.0">
+  <id>org.apache.lenya.modules.metadata</id>
+  <export package="org.apache.lenya.modules.metadata"/>
+  <package>org.apache.lenya.modules</package>
+  <version>2.0.2-dev</version>
+  <name>Meta Data</name>
+  <lenya-version>@lenya.version@</lenya-version>
+  <description>Meta data declaration and handling.</description>
+</module> 

Added: lenya/trunk/src/modules-core/metadata/config/sitemap/metadata-generator.xmap
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/metadata/config/sitemap/metadata-generator.xmap?rev=640262&view=auto
==============================================================================
--- lenya/trunk/src/modules-core/metadata/config/sitemap/metadata-generator.xmap (added)
+++ lenya/trunk/src/modules-core/metadata/config/sitemap/metadata-generator.xmap Sun Mar 23 15:25:38 2008
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<xmap xpath="/sitemap/components/generators" 
+  unless="/sitemap/components/generators/generator[@name = 'lenyaMetaData']"
+  xmlns:map="http://apache.org/cocoon/sitemap/1.0">
+
+  <map:generator label="content" logger="sitemap.generator.lenyaMetaData"
+    name="lenyaMetaData" pool-max="16"
+    src="org.apache.lenya.modules.metadata.LenyaMetaDataGenerator"/>
+    
+</xmap>

Added: lenya/trunk/src/modules-core/metadata/config/sitemap/metadata-transformer.xmap
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/metadata/config/sitemap/metadata-transformer.xmap?rev=640262&view=auto
==============================================================================
--- lenya/trunk/src/modules-core/metadata/config/sitemap/metadata-transformer.xmap (added)
+++ lenya/trunk/src/modules-core/metadata/config/sitemap/metadata-transformer.xmap Sun Mar 23 15:25:38 2008
@@ -0,0 +1,24 @@
+<?xml version="1.0"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+  
+  http://www.apache.org/licenses/LICENSE-2.0
+  
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<xmap xpath="/sitemap/components/transformers" 
+  unless="/sitemap/components/transformers/transformer[@name = 'metaData']"
+  xmlns:map="http://apache.org/cocoon/sitemap/1.0">
+  <map:transformer name="metaData" logger="lenya.sitemap.transformer.metaData"
+    src="org.apache.lenya.modules.metadata.MetaDataTransformer"/>
+</xmap>

Added: lenya/trunk/src/modules-core/metadata/java/src/org/apache/lenya/modules/metadata/LenyaMetaDataGenerator.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/metadata/java/src/org/apache/lenya/modules/metadata/LenyaMetaDataGenerator.java?rev=640262&view=auto
==============================================================================
--- lenya/trunk/src/modules-core/metadata/java/src/org/apache/lenya/modules/metadata/LenyaMetaDataGenerator.java (added)
+++ lenya/trunk/src/modules-core/metadata/java/src/org/apache/lenya/modules/metadata/LenyaMetaDataGenerator.java Sun Mar 23 15:25:38 2008
@@ -0,0 +1,235 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.lenya.modules.metadata;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.Map;
+
+import org.apache.avalon.framework.parameters.Parameters;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.cocoon.ProcessingException;
+import org.apache.cocoon.caching.CacheableProcessingComponent;
+import org.apache.cocoon.environment.SourceResolver;
+import org.apache.cocoon.generation.ServiceableGenerator;
+import org.apache.excalibur.source.SourceValidity;
+import org.apache.excalibur.source.impl.validity.TimeStampValidity;
+import org.apache.excalibur.xml.dom.DOMParser;
+import org.apache.lenya.cms.cocoon.source.RepositorySource;
+import org.apache.lenya.cms.metadata.MetaData;
+import org.apache.lenya.cms.metadata.MetaDataException;
+import org.apache.lenya.cms.repository.ContentHolder;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.AttributesImpl;
+
+/**
+ * <p>
+ * Generates the meta data of a document. The <code>src</code> attribute must be
+ * a {@link RepositorySource} URI (e.g., <code>lenya-document:...</code>).
+ * </p>
+ * <p>
+ * For multi-value elements, multiple &lt;prefix:key&gt; elements are generated.
+ * </p>
+ * <p>
+ * Example output:
+ * </p>
+ * 
+ * <pre>
+ *  &lt;meta:metadata xmlns:meta=&quot;http://apache.org/cocoon/lenya/metadata/1.0&quot;&gt;
+ *  &lt;elements xmlns=&quot;http://purl.org/dc/elements/1.1/&quot;&gt;
+ *  &lt;title&gt;Search&lt;/title&gt;
+ *  &lt;date&gt;2006-06-12 13:43:14&lt;/date&gt;
+ *  &lt;language&gt;en&lt;/language&gt;
+ *  &lt;creator&gt;lenya&lt;/creator&gt;
+ *  &lt;/elements&gt;
+ *  &lt;elements xmlns=&quot;http://apache.org/lenya/metadata/document/1.0&quot;&gt;
+ *  &lt;extension&gt;xml&lt;/extension&gt;
+ *  &lt;resourceType&gt;usecase&lt;/resourceType&gt;
+ *  &lt;contentType&gt;xml&lt;/contentType&gt;
+ *  &lt;/elements&gt;
+ *  &lt;/meta:metadata&gt;
+ * </pre>
+ */
+public class LenyaMetaDataGenerator extends ServiceableGenerator implements
+        CacheableProcessingComponent {
+
+    /** Node and attribute names */
+    protected AttributesImpl attributes;
+
+    /** Metadata */
+    protected static final String ROOT_META_NODE_NAME = "meta";
+
+    /** The URI of the namespace of the metadata */
+    protected static final String URI_META = "http://apache.org/cocoon/lenya/metadata/1.0";
+
+    /** The namespace prefix for this namespace */
+    protected static final String PREFIX_META = "lenya";
+
+    /** The parser for the XML snippets to be included. */
+    protected DOMParser parser = null;
+    
+    private String src;
+    
+    /** The repository content holder to generate the meta data for */
+    private ContentHolder content;
+    
+    private SourceValidity validity;
+
+    /**
+     * Recycle this component. All instance variables are set to <code>null</code>.
+     */
+    public void recycle() {
+        this.content = null;
+        this.src = null;
+        this.parser = null;
+        this.validity = null;
+        super.recycle();
+    }
+    
+    /**
+     * Serviceable
+     * 
+     * @param manager the ComponentManager
+     * 
+     * @throws ServiceException in case a component could not be found
+     */
+    public void service(ServiceManager manager) throws ServiceException {
+        super.service(manager);
+        this.parser = (DOMParser) manager.lookup(DOMParser.ROLE);
+        this.attributes = new AttributesImpl();
+    }
+
+    /**
+     * Setup the file generator. Try to get the last modification date of the source for caching.
+     */
+    public void setup(SourceResolver resolver, Map objectModel, String src, Parameters par)
+            throws ProcessingException, SAXException, IOException {
+        
+        super.setup(resolver, objectModel, src, par);
+        this.src = src;
+        
+        RepositorySource source = null;
+        try {
+            source = (RepositorySource) resolver.resolveURI(src);
+            this.content = source.getContent();
+            this.validity = source.getValidity();
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+        finally {
+            if (source != null) {
+                resolver.release(source);
+            }
+        }
+    }
+
+    /**
+     * Generate the unique key. This key must be unique inside the space of this component.
+     * 
+     * @return The generated key hashes the src
+     */
+    public Serializable getKey() {
+        return this.src;
+    }
+
+    /**
+     * Generate the validity object.
+     * 
+     * @return The generated validity object or <code>null</code> if the component is currently
+     *         not cacheable.
+     */
+    public SourceValidity getValidity() {
+        return this.validity;
+    }
+
+    /**
+     * Generate XML data.
+     */
+    public void generate() throws IOException, SAXException, ProcessingException {
+        startNodeRoot();
+        performIncludesMeta();
+        endNodeRoot();
+    }
+
+    private void performIncludesMeta() throws SAXException, ProcessingException {
+
+        try {
+            String[] namespaces = this.content.getMetaDataNamespaceUris();
+            for (int i = 0; i < namespaces.length; i++) {
+                this.contentHandler.startPrefixMapping("", namespaces[i]);
+                startNodeMeta(namespaces[i]);
+                parseMetaData(namespaces[i]);
+                endNodeMeta(namespaces[i]);
+                this.contentHandler.endPrefixMapping("");
+            }
+        } catch (MetaDataException e) {
+            throw new ProcessingException(e);
+        }
+
+    }
+
+    private void parseMetaData(String namespace) throws ProcessingException, SAXException {
+        MetaData metaData = getMetaData(namespace);
+        String[] names = metaData.getAvailableKeys();
+        for (int i = 0; i < names.length; i++) {
+            String[] values;
+            try {
+                values = metaData.getValues(names[i]);
+            } catch (MetaDataException e) {
+                throw new ProcessingException(e);
+            }
+            for (int j = 0; j < values.length; j++) {
+                this.contentHandler.startElement(namespace, names[i], names[i],
+                        new AttributesImpl());
+                char[] valueChars = values[j].toCharArray();
+                this.contentHandler.characters(valueChars, 0, valueChars.length);
+                this.contentHandler.endElement(namespace, names[i], names[i]);
+            }
+        }
+    }
+
+    private void endNodeRoot() throws SAXException {
+        this.contentHandler.endElement(URI_META, "metadata", PREFIX_META + ":metadata");
+        this.contentHandler.endPrefixMapping(PREFIX_META);
+        this.contentHandler.endDocument();
+    }
+
+    private void startNodeRoot() throws SAXException {
+        this.contentHandler.startDocument();
+        this.contentHandler.startPrefixMapping(PREFIX_META, URI_META);
+        this.contentHandler.startElement(URI_META, "metadata", PREFIX_META + ":metadata",
+                attributes);
+    }
+
+    private void startNodeMeta(String namespace) throws SAXException {
+        this.contentHandler.startElement(namespace, "elements", "elements", attributes);
+    }
+
+    private void endNodeMeta(String namespace) throws SAXException {
+        this.contentHandler.endElement(namespace, "elements", "elements");
+    }
+
+    protected MetaData getMetaData(String namespaceUri) throws ProcessingException {
+        try {
+            return this.content.getMetaData(namespaceUri);
+        } catch (Exception e1) {
+            throw new ProcessingException("Obtaining meta data value for [" + this.content
+                    + "] failed: ", e1);
+        }
+    }
+}

Added: lenya/trunk/src/modules-core/metadata/java/src/org/apache/lenya/modules/metadata/MetaDataTransformer.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/metadata/java/src/org/apache/lenya/modules/metadata/MetaDataTransformer.java?rev=640262&view=auto
==============================================================================
--- lenya/trunk/src/modules-core/metadata/java/src/org/apache/lenya/modules/metadata/MetaDataTransformer.java (added)
+++ lenya/trunk/src/modules-core/metadata/java/src/org/apache/lenya/modules/metadata/MetaDataTransformer.java Sun Mar 23 15:25:38 2008
@@ -0,0 +1,213 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package org.apache.lenya.modules.metadata;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.avalon.framework.activity.Disposable;
+import org.apache.avalon.framework.parameters.Parameters;
+import org.apache.cocoon.ProcessingException;
+import org.apache.cocoon.environment.ObjectModelHelper;
+import org.apache.cocoon.environment.Request;
+import org.apache.cocoon.environment.SourceResolver;
+import org.apache.cocoon.transformation.AbstractSAXTransformer;
+import org.apache.lenya.cms.metadata.MetaData;
+import org.apache.lenya.cms.publication.Area;
+import org.apache.lenya.cms.publication.Document;
+import org.apache.lenya.cms.publication.DocumentFactory;
+import org.apache.lenya.cms.publication.DocumentUtil;
+import org.apache.lenya.cms.publication.Publication;
+import org.apache.lenya.cms.publication.PublicationException;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.AttributesImpl;
+
+/**
+ * <p>Meta data transformer.</p>
+ * <p>Usage example:</p>
+ * <pre>
+ * &lt;meta:value xmlns:meta="http://apache.org/lenya/meta/1.0/"
+ *   element="title"
+ *   ns="http://purl.org/dc/elements/1.1/"
+ *   uuid="{$uuid}"
+ *   lang="{$language}"
+ *   default="default-title"
+ *   i18n:attr="default" /&gt;
+ * </pre>
+ * <p>The attribute <em>default</em> is optional.</p>
+ */
+public class MetaDataTransformer extends AbstractSAXTransformer implements Disposable {
+    /**
+     * The namespace for the meta data is http://apache.org/lenya/meta/1.0
+     */
+    static public final String NAMESPACE_URI = "http://apache.org/lenya/meta/1.0/";
+
+    /**
+     * The namespace prefix for this namespace.
+     */
+    static public final String PREFIX = "meta";
+
+    /**
+     * The value element is getting the value for a specific ns and key. It is the only method
+     * implemented so far.
+     */
+    static public final String VALUE_ELEMENT = "value";
+
+    /**
+     * ELEMENT_ATT - which meta data key do we want to look up
+     */
+    static public final String ELEMENT_ATT = "element";
+
+    /**
+     * NS_ATT - in which namespace should we look
+     */
+    static public final String NS_ATT = "ns";
+
+    /**
+     * UUID_ATT - for which uuid?
+     */
+    static public final String UUID_ATT = "uuid";
+
+    /**
+     * LANG_ATT - in which language this is optional (when not found use publication default)
+     */
+    static public final String LANG_ATT = "lang";
+
+    /**
+     * Use this attribute to provide a default value to be used if the document doesn't exist.
+     */
+    static public final String DEFAULT_ATT = "default";
+
+    /** Helper for lenya document retrival */
+    protected String publicationId = null;
+
+    protected String area = null;
+
+    protected String language = null;
+
+    protected String uuid = null;
+
+    protected Publication pub;
+
+    private DocumentFactory factory;
+
+    /**
+     * Setup the MetaDataTransformer.
+     */
+    public void setup(SourceResolver resolver, Map objectModel, String src, Parameters par)
+            throws ProcessingException, SAXException, IOException {
+        super.setup(resolver, objectModel, src, par);
+        this.publicationId = par.getParameter("pubid", null);
+        if (this.publicationId == null) {
+            throw new ProcessingException(
+                    "The pubid is not set! Please set like e.g. <map:parameter name='pubid' value='{request-param:pubid}'/>");
+        }
+
+        this.area = par.getParameter("area", null);
+        if (this.area == null) {
+            throw new ProcessingException(
+                    "The area is not set! Please set like e.g. <map:parameter name='area' value='{request-param:area}'/>");
+        }
+        Request request = ObjectModelHelper.getRequest(objectModel);
+        factory = DocumentUtil.getDocumentFactory(this.manager, request);
+        try {
+            pub = factory.getPublication(this.publicationId);
+        } catch (PublicationException e) {
+            throw new ProcessingException("Error geting publication id / area from page envelope",
+                    e);
+        }
+    }
+
+    public void startElement(String uri, String name, String raw, Attributes attr)
+            throws SAXException {
+        if (NAMESPACE_URI.equals(uri)) {
+            if (VALUE_ELEMENT.equals(name)) {
+                String lang = null, uuid = null, ns = null, key = null, defaultValue = null;
+                for (int i = 0; i < attr.getLength(); i++) {
+                    String localName = attr.getLocalName(i);
+                    String value = attr.getValue(i);
+                    if (ELEMENT_ATT.equals(localName))
+                        key = value;
+                    else if (NS_ATT.equals(localName))
+                        ns = value;
+                    else if (UUID_ATT.equals(localName))
+                        uuid = value;
+                    else if (LANG_ATT.equals(localName))
+                        lang = value;
+                    else if (DEFAULT_ATT.equals(localName))
+                        defaultValue = value;
+                }// end for
+                if (uuid == null || ns == null || key == null)
+                    throw new SAXException(
+                            "Error by setting up the transformation. Please fix the calling code.");
+                if (lang == null)
+                    lang = pub.getDefaultLanguage();
+                List returnValues = new ArrayList();
+                try {
+                    Area areaObj = pub.getArea(this.area);
+                    if (areaObj.contains(uuid, lang)) {
+                        Document document = areaObj.getDocument(uuid, lang);
+                        MetaData metaData = document.getMetaData(ns);
+                        returnValues.addAll(Arrays.asList(metaData.getValues(key)));
+                    } else if (defaultValue != null) {
+                        returnValues.add(defaultValue);
+                    } else {
+                        String doc = this.publicationId + ":" + this.area + ":" + uuid + ":" + lang;
+                        throw new SAXException("The document [" + doc
+                                + "] does not exist and no default value is provided.");
+                    }
+                } catch (Exception e) {
+                    throw new SAXException(e);
+                }
+                if (returnValues.size() > 1) {
+                    for (Iterator i = returnValues.iterator(); i.hasNext();) {
+                        String value = (String) i.next();
+                        AttributesImpl attributes = new AttributesImpl();
+                        attributes.addAttribute("", VALUE_ELEMENT, VALUE_ELEMENT, "CDATA", value);
+                        attributes.addAttribute("", ELEMENT_ATT, ELEMENT_ATT, "CDATA", key);
+                        this.contentHandler.startElement(ns, VALUE_ELEMENT, PREFIX + ":"
+                                + VALUE_ELEMENT, attributes);
+                        this.contentHandler.endElement(ns, VALUE_ELEMENT, PREFIX + ":"
+                                + VALUE_ELEMENT);
+                    }
+                } else if (returnValues.size() == 1) {
+                    String value = (String) returnValues.get(0);
+                    this.contentHandler.characters(value.toCharArray(), 0,
+                            value.toCharArray().length);
+                }
+
+            } else {
+                String warn = "Could not find method for " + name + ". Ignoring.";
+                getLogger().warn(warn);
+            }
+        } else {
+            super.startElement(uri, name, raw, attr);
+        }
+    }
+
+    public void endElement(String uri, String name, String raw) throws SAXException {
+        if (!NAMESPACE_URI.equals(uri)) {
+            super.endElement(uri, name, raw);
+        }
+    }
+}

Modified: lenya/trunk/src/webapp/lenya/config/sitemap/generators.xmap
URL: http://svn.apache.org/viewvc/lenya/trunk/src/webapp/lenya/config/sitemap/generators.xmap?rev=640262&r1=640261&r2=640262&view=diff
==============================================================================
--- lenya/trunk/src/webapp/lenya/config/sitemap/generators.xmap (original)
+++ lenya/trunk/src/webapp/lenya/config/sitemap/generators.xmap Sun Mar 23 15:25:38 2008
@@ -19,10 +19,6 @@
 <xmap xpath="/sitemap/components/generators" 
   unless="/sitemap/components/generators/generator[@name = 'lenyaMetaData']"
   xmlns:map="http://apache.org/cocoon/sitemap/1.0">
-
-  <map:generator label="content" logger="sitemap.generator.lenyaMetaData"
-    name="lenyaMetaData" pool-max="16"
-    src="org.apache.lenya.cms.cocoon.generation.LenyaMetaDataGenerator"/>
     
   <map:generator label="content" logger="sitemap.generator.sessionattr"
     name="session-attr" pool-max="16"

Modified: lenya/trunk/src/webapp/lenya/config/sitemap/transformers.xmap
URL: http://svn.apache.org/viewvc/lenya/trunk/src/webapp/lenya/config/sitemap/transformers.xmap?rev=640262&r1=640261&r2=640262&view=diff
==============================================================================
--- lenya/trunk/src/webapp/lenya/config/sitemap/transformers.xmap (original)
+++ lenya/trunk/src/webapp/lenya/config/sitemap/transformers.xmap Sun Mar 23 15:25:38 2008
@@ -19,8 +19,6 @@
 <xmap xpath="/sitemap/components/transformers" 
   unless="/sitemap/components/transformers/transformer[@name = 'metaData']"
   xmlns:map="http://apache.org/cocoon/sitemap/1.0">
-  
-    <map:transformer name="metaData" logger="lenya.sitemap.transformer.metaData" src="org.apache.lenya.cms.cocoon.transformation.MetaDataTransformer"/>
     <map:transformer name="pattern" 
        src="org.apache.cocoon.transformation.PatternTransformer" 
        logger="sitemap.transformer.pattern">
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.