You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by jw...@apache.org on 2005/05/04 09:49:23 UTC

svn commit: r168097 - in /lenya/trunk/src: java/org/apache/lenya/cms/publication/ java/org/apache/lenya/cms/repository/ webapp/lenya/pubs/default/config/doctypes/samples/ webapp/lenya/pubs/default/config/doctypes/schemas/

Author: jwkaltz
Date: Wed May  4 00:49:22 2005
New Revision: 168097

URL: http://svn.apache.org/viewcvs?rev=168097&view=rev
Log:
handle document metadata the same as resource metadata, that is under separate URI, separated from contents

Modified:
    lenya/trunk/src/java/org/apache/lenya/cms/publication/DefaultDocument.java
    lenya/trunk/src/java/org/apache/lenya/cms/publication/DefaultResourcesManager.java
    lenya/trunk/src/java/org/apache/lenya/cms/publication/Document.java
    lenya/trunk/src/java/org/apache/lenya/cms/repository/SourceNode.java
    lenya/trunk/src/webapp/lenya/pubs/default/config/doctypes/samples/homepage.xml
    lenya/trunk/src/webapp/lenya/pubs/default/config/doctypes/samples/xhtml.xml
    lenya/trunk/src/webapp/lenya/pubs/default/config/doctypes/schemas/homepage.rng
    lenya/trunk/src/webapp/lenya/pubs/default/config/doctypes/schemas/xhtml.rng

Modified: lenya/trunk/src/java/org/apache/lenya/cms/publication/DefaultDocument.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/publication/DefaultDocument.java?rev=168097&r1=168096&r2=168097&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/publication/DefaultDocument.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/publication/DefaultDocument.java Wed May  4 00:49:22 2005
@@ -389,7 +389,7 @@
      * @see org.apache.lenya.cms.metadata.MetaDataOwner#getMetaData()
      */
     public MetaDataManager getMetaData() {
-        return new DublinCoreProxy(getSourceURI(), this.manager, getLogger());
+        return new DublinCoreProxy(getMetaSourceURI(), this.manager, getLogger());
     }
 
     private History history;
@@ -471,25 +471,38 @@
     }
 
     /**
+     * @return The meta source URI.
+     */
+    public String getMetaSourceURI() {
+        return getSourceURI() + Document.DOCUMENT_META_SUFFIX;
+    }
+
+    /**
      * @see org.apache.lenya.cms.publication.Document#getRepositoryNodes()
      */
     public Node[] getRepositoryNodes() {
-        Node[] nodes = new Node[2];
+        Node[] nodes = new Node[3];
         SourceResolver resolver = null;
         RepositorySource documentSource = null;
+        RepositorySource metaSource = null;
         RepositorySource historySource = null;
         try {
             resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
             documentSource = (RepositorySource) resolver.resolveURI(getSourceURI());
+            metaSource = (RepositorySource) resolver.resolveURI(getMetaSourceURI());
             historySource = (RepositorySource) resolver.resolveURI(getHistory().getSourceURI());
             nodes[0] = documentSource.getNode();
-            nodes[1] = historySource.getNode();
+            nodes[1] = metaSource.getNode();
+            nodes[2] = historySource.getNode();
         } catch (Exception e) {
             throw new RuntimeException(e);
         } finally {
             if (resolver != null) {
                 if (documentSource != null) {
                     resolver.release(documentSource);
+                }
+                if (metaSource != null) {
+                    resolver.release(metaSource);
                 }
                 if (historySource != null) {
                     resolver.release(historySource);

Modified: lenya/trunk/src/java/org/apache/lenya/cms/publication/DefaultResourcesManager.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/publication/DefaultResourcesManager.java?rev=168097&r1=168096&r2=168097&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/publication/DefaultResourcesManager.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/publication/DefaultResourcesManager.java Wed May  4 00:49:22 2005
@@ -109,6 +109,9 @@
      */
     public void addResource(Document document, Part part, Map metadata) throws Exception {
 
+        if (getLogger().isDebugEnabled())
+            getLogger().debug("DefaultResourcesManager::addResource() called");
+
         try {
             String fileName = part.getFileName();
             if (!fileName.matches(FILE_NAME_REGEXP)) {
@@ -150,6 +153,9 @@
             getLogger().error("IO Error " + e.toString());
             throw e;
         }
+
+        if (getLogger().isDebugEnabled())
+            getLogger().debug("DefaultResourcesManager::addResource() done.");
     }
 
     /**
@@ -213,24 +219,19 @@
      */
     protected void createMetaData(Resource resource, Map metadata) throws DocumentException {
 
-        SourceResolver resolver = null;
-        try {
-            resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
-            MetaDataManager meta = resource.getMetaData();
-            Iterator iter = metadata.entrySet().iterator();
+        if (getLogger().isDebugEnabled())
+            getLogger().debug("DefaultResourcesManager::createMetaData() called");
 
-            while (iter.hasNext()) {
-                Map.Entry entry = (Map.Entry) iter.next();
-                meta.setValue((String) entry.getKey(), (String) entry.getValue());
-            }
-        } catch (final Exception e) {
-            getLogger().error("Saving of [" + resource.getSourceURI() + "]� failed.");
-            throw new DocumentException(e);
-        } finally {
-            if (resolver != null) {
-                this.manager.release(resolver);
-            }
+        MetaDataManager meta = resource.getMetaData();
+        Iterator iter = metadata.entrySet().iterator();
+
+        while (iter.hasNext()) {
+            Map.Entry entry = (Map.Entry) iter.next();
+            meta.setValue((String) entry.getKey(), (String) entry.getValue());
         }
+
+        if (getLogger().isDebugEnabled())
+            getLogger().debug("DefaultResourcesManager::createMetaData() done.");
     }
 
     /**

Modified: lenya/trunk/src/java/org/apache/lenya/cms/publication/Document.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/publication/Document.java?rev=168097&r1=168096&r2=168097&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/publication/Document.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/publication/Document.java Wed May  4 00:49:22 2005
@@ -50,6 +50,11 @@
     String TRANSACTIONABLE_TYPE = "document";
     
     /**
+     * <code>DOCUMENT_META_SUFFIX</code> The suffix for document meta Uris
+     */
+    final String DOCUMENT_META_SUFFIX = ".meta";
+
+    /**
      * Returns the document ID of this document.
      * @return the document-id of this document.
      */

Modified: lenya/trunk/src/java/org/apache/lenya/cms/repository/SourceNode.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/repository/SourceNode.java?rev=168097&r1=168096&r2=168097&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/repository/SourceNode.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/repository/SourceNode.java Wed May  4 00:49:22 2005
@@ -117,6 +117,10 @@
      * @see org.apache.lenya.transaction.Transactionable#checkout()
      */
     public void checkout() throws TransactionException {
+
+        if (getLogger().isDebugEnabled())
+            getLogger().debug("SourceNode::checkout() called, sourceUri [" + sourceUri + "]");
+
         if (!isCheckedOut()) {
             try {
                 getRevisionController().reservedCheckOut(getRCPath(), getUserId());
@@ -505,4 +509,4 @@
         }
     }
 
-}
\ No newline at end of file
+}

Modified: lenya/trunk/src/webapp/lenya/pubs/default/config/doctypes/samples/homepage.xml
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/pubs/default/config/doctypes/samples/homepage.xml?rev=168097&r1=168096&r2=168097&view=diff
==============================================================================
--- lenya/trunk/src/webapp/lenya/pubs/default/config/doctypes/samples/homepage.xml (original)
+++ lenya/trunk/src/webapp/lenya/pubs/default/config/doctypes/samples/homepage.xml Wed May  4 00:49:22 2005
@@ -1,44 +1,23 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<html xmlns="http://www.w3.org/1999/xhtml" 
-      xmlns:xhtml="http://www.w3.org/1999/xhtml" 
-      xmlns:dc="http://purl.org/dc/elements/1.1/" 
-      xmlns:dcterms="http://purl.org/dc/terms/"
-      xmlns:lenya="http://apache.org/cocoon/lenya/page-envelope/1.0" 
-      xhtml:dummy="FIXME:keepNamespace" dc:dummy="FIXME:keepNamespace" 
-      lenya:dummy="FIXME:keepNamespace" dcterms:dummy="FIXME:keepNamespace"
->
-    <lenya:meta>
-        <dc:title>dctitle</dc:title>
-        <dc:creator>dccreator</dc:creator>
-        <dc:subject>dcsubject</dc:subject>
-        <dc:description>Abstract that can be used on an overview page</dc:description>
-        <dc:publisher/>
-        <dc:contributor/>
-        <dc:date>2003-5-21</dc:date>
-        <dc:type/>
-        <dc:format/>
-        <dc:identifier/>
-        <dc:source/>
-        <dc:language>en</dc:language>
-        <dc:relation/>
-        <dc:coverage/>
-        <dc:rights>dcrights</dc:rights>
-    </lenya:meta>
-  <head>
-    <title>Default Publication</title>
-  </head>
-  <body>
-    <h1>Default Publication</h1>
-    <p>Welcome to the default Lenya publication!</p>
-    <p>The purpose of this publication is</p>
-    <ul>
-      <li>to show beginners the basic functionality of the Lenya CMS,</li>
-      <li>to provide an "out of the box" publication that can be easily adapted and used, and</li>
-      <li>to provide a basis for reference implementations of new concepts and best practices.</li>
-    </ul>
-    <p>
-    You won't find any fancy and confusing bells and whistles here, but the
-    publication contains everything you need to get started.
-    </p>
-  </body>
-</html>
+<?xml version="1.0" encoding="UTF-8"?>
+<html xmlns="http://www.w3.org/1999/xhtml" 
+      xmlns:xhtml="http://www.w3.org/1999/xhtml" 
+      xmlns:lenya="http://apache.org/cocoon/lenya/page-envelope/1.0"
+>
+  <head>
+    <title>Default Publication</title>
+  </head>
+  <body>
+    <h1>Default Publication</h1>
+    <p>Welcome to the default Lenya publication!</p>
+    <p>The purpose of this publication is</p>
+    <ul>
+      <li>to show beginners the basic functionality of the Lenya CMS,</li>
+      <li>to provide an "out of the box" publication that can be easily adapted and used, and</li>
+      <li>to provide a basis for reference implementations of new concepts and best practices.</li>
+    </ul>
+    <p>
+    You won't find any fancy and confusing bells and whistles here, but the
+    publication contains everything you need to get started.
+    </p>
+  </body>
+</html>

Modified: lenya/trunk/src/webapp/lenya/pubs/default/config/doctypes/samples/xhtml.xml
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/pubs/default/config/doctypes/samples/xhtml.xml?rev=168097&r1=168096&r2=168097&view=diff
==============================================================================
--- lenya/trunk/src/webapp/lenya/pubs/default/config/doctypes/samples/xhtml.xml (original)
+++ lenya/trunk/src/webapp/lenya/pubs/default/config/doctypes/samples/xhtml.xml Wed May  4 00:49:22 2005
@@ -1,29 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <html xmlns="http://www.w3.org/1999/xhtml" 
       xmlns:xhtml="http://www.w3.org/1999/xhtml" 
-      xmlns:dc="http://purl.org/dc/elements/1.1/" 
-      xmlns:dcterms="http://purl.org/dc/terms/"
-      xmlns:lenya="http://apache.org/cocoon/lenya/page-envelope/1.0" 
-      xhtml:dummy="FIXME:keepNamespace" dc:dummy="FIXME:keepNamespace" 
-      lenya:dummy="FIXME:keepNamespace" dcterms:dummy="FIXME:keepNamespace"
+      xmlns:lenya="http://apache.org/cocoon/lenya/page-envelope/1.0"
 >
-    <lenya:meta>
-        <dc:title>dctitle</dc:title>
-        <dc:creator>dccreator</dc:creator>
-        <dc:subject>dcsubject</dc:subject>
-        <dc:description>Abstract that can be used on an overview page</dc:description>
-        <dc:publisher/>
-        <dc:contributor/>
-        <dc:date>2003-5-21</dc:date>
-        <dc:type/>
-        <dc:format/>
-        <dc:identifier/>
-        <dc:source/>
-        <dc:language>en</dc:language>
-        <dc:relation/>
-        <dc:coverage/>
-        <dc:rights>dcrights</dc:rights>
-    </lenya:meta>
   <head>
     <title>Default Publication</title>
   </head>

Modified: lenya/trunk/src/webapp/lenya/pubs/default/config/doctypes/schemas/homepage.rng
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/pubs/default/config/doctypes/schemas/homepage.rng?rev=168097&r1=168096&r2=168097&view=diff
==============================================================================
--- lenya/trunk/src/webapp/lenya/pubs/default/config/doctypes/schemas/homepage.rng (original)
+++ lenya/trunk/src/webapp/lenya/pubs/default/config/doctypes/schemas/homepage.rng Wed May  4 00:49:22 2005
@@ -21,12 +21,15 @@
     | XHTML doctype
     +-->
 
+<!--+
+    | Namespaces:
+    | lenya namespace is required for embedding assets.
+    +-->
+
 <grammar ns="http://www.w3.org/1999/xhtml"
          xmlns="http://relaxng.org/ns/structure/1.0"
-         xmlns:lenya="http://apache.org/cocoon/lenya/page-envelope/1.0"
-         xmlns:dc="http://purl.org/dc/elements/1.1/"
-         xmlns:dcterms="http://purl.org/dc/terms/"
          xmlns:xhtml="http://www.w3.org/1999/xhtml"
+         xmlns:lenya="http://apache.org/cocoon/lenya/page-envelope/1.0"
          >
 
 <include href="xhtml.rng"/>

Modified: lenya/trunk/src/webapp/lenya/pubs/default/config/doctypes/schemas/xhtml.rng
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/pubs/default/config/doctypes/schemas/xhtml.rng?rev=168097&r1=168096&r2=168097&view=diff
==============================================================================
--- lenya/trunk/src/webapp/lenya/pubs/default/config/doctypes/schemas/xhtml.rng (original)
+++ lenya/trunk/src/webapp/lenya/pubs/default/config/doctypes/schemas/xhtml.rng Wed May  4 00:49:22 2005
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
-  Copyright 1999-2004 The Apache Software Foundation
+  Copyright 1999-2005 The Apache Software Foundation
 
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
@@ -15,22 +15,26 @@
   limitations under the License.
 -->
 
-<!-- $Id: xhtml.rng,v 1.5 2004/03/13 12:34:17 gregor Exp $ -->
+<!-- $Id$ -->
 
 <!--+
     | XHTML doctype
     +-->
 
+<!--+
+    | Namespaces:
+    | lenya namespace is required for embedding assets.
+    +-->
+
 <grammar ns="http://www.w3.org/1999/xhtml"
          xmlns="http://relaxng.org/ns/structure/1.0"
-         xmlns:lenya="http://apache.org/cocoon/lenya/page-envelope/1.0"
-         xmlns:dc="http://purl.org/dc/elements/1.1/"
-         xmlns:dcterms="http://purl.org/dc/terms/"
          xmlns:xhtml="http://www.w3.org/1999/xhtml"
+         xmlns:lenya="http://apache.org/cocoon/lenya/page-envelope/1.0"
          >
 
-<include href="lenya.rng"/>
 
+<!-- include Lenya schema, for Lenya assets within xhtml -->
+<include href="lenya.rng"/>
 
 <!-- include original XHTML transitional schema -->
 <include href="xhtml/xhtml-basic.rng">
@@ -38,7 +42,6 @@
   <define name="html">
     <element name="html">
       <ref name="html.attlist"/>
-      <ref name="lenya.meta"/>
       <ref name="head"/>
       <ref name="body"/>
     </element>
@@ -47,7 +50,6 @@
   <define name="html.attlist">
     <ref name="XHTML.version.attrib"/>
     <ref name="I18n.attrib"/>
-    <ref name="dummy.attlist"/>
   </define>
 
 </include>



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org