You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2005/03/04 17:44:55 UTC

svn commit: r156181 - lenya/trunk/src/java/org/apache/lenya/cms/publication/DefaultResourcesManager.java

Author: andreas
Date: Fri Mar  4 08:44:52 2005
New Revision: 156181

URL: http://svn.apache.org/viewcvs?view=rev&rev=156181
Log:
create meta file before saving

Modified:
    lenya/trunk/src/java/org/apache/lenya/cms/publication/DefaultResourcesManager.java

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?view=diff&r1=156180&r2=156181
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/publication/DefaultResourcesManager.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/publication/DefaultResourcesManager.java Fri Mar  4 08:44:52 2005
@@ -38,6 +38,8 @@
 
 import org.apache.cocoon.servlet.multipart.Part;
 import org.apache.lenya.cms.metadata.dublincore.DublinCoreImpl;
+import org.apache.lenya.xml.DocumentHelper;
+import org.apache.lenya.xml.NamespaceHelper;
 
 
 /**
@@ -93,7 +95,8 @@
     }
 
     private Document document = null;
-    private DublinCoreImpl dc = null;
+    
+    protected static final String NAMESPACE_META = "http://lenya.apache.org/meta/1.0";
 
     /**
      * Create a new instance of Resources.
@@ -148,9 +151,10 @@
             saveResource(resourceFile, part);
         } catch (final DocumentException e) {
             getLogger().error("Document exception " +e.toString());
-            throw new IOException(e.toString());
+            throw new RuntimeException(e);
         } catch (final IOException e) {
             getLogger().error("IO Error " +e.toString());
+            throw e;
         }
     }
 
@@ -209,21 +213,27 @@
 
         assert (metaDataFile.getParentFile().exists());
 		try {
+            
+            if (!metaDataFile.exists()) {
+                metaDataFile.createNewFile();
+                NamespaceHelper helper = new NamespaceHelper(NAMESPACE_META, "", "meta");
+                DocumentHelper.writeDocument(helper.getDocument(), metaDataFile);
+            }
             String		key;
             String		value;
             Map.Entry	entry;
-            this.dc = new DublinCoreImpl(metaDataFile);
+            DublinCoreImpl dc = new DublinCoreImpl(metaDataFile);
             Iterator iter = metadata.entrySet().iterator();
 
             while (iter.hasNext()) {
             	entry 	= (Map.Entry)iter.next();
             	key 	= (String)entry.getKey();
             	value 	= (String)entry.getValue();
-                this.dc.setValue(key, value);
+                dc.setValue(key, value);
             }
-            this.dc.save();
-        } catch (final DocumentException e) {
-            getLogger().error("Saving of [" + metaDataFile + "]�failed.");
+            dc.save();
+        } catch (final Exception e) {
+            getLogger().error("Saving of [" + metaDataFile + "] �failed.");
             throw new DocumentException(e);
         }
     }



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


Re: svn commit: r156181 - lenya/trunk/src/java/org/apache/lenya/cms/publication/DefaultResourcesManager.java

Posted by "Gregor J. Rothfuss" <gr...@apache.org>.
Andreas Hartmann wrote:

> Actually I have a big refactoring of the ResourceManager and DublinCore
> in my sandbox (using Avalon and Sources), but I won't check them in
> before the site usecases work (kind of) correctly.

awesome. thanks for taking up the site tabs where i left them, its 
looking great. with that done, most remaining xsp are in the admin area, 
with some stragglers in search, scheduler and rc.

we are definitely getting pretty close to bye bye XSP ;)

-- 
Gregor J. Rothfuss
COO, Wyona       Content Management Solutions    http://wyona.com
Apache Lenya                              http://lenya.apache.org
gregor.rothfuss@wyona.com                       gregor@apache.org

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


Re: svn commit: r156181 - lenya/trunk/src/java/org/apache/lenya/cms/publication/DefaultResourcesManager.java

Posted by Andreas Hartmann <an...@apache.org>.
Gregor J. Rothfuss wrote:
> andreas@apache.org wrote:
> 
>> Author: andreas
>> Date: Fri Mar  4 08:44:52 2005
>> New Revision: 156181
>>
>> URL: http://svn.apache.org/viewcvs?view=rev&rev=156181
>> Log:
>> create meta file before saving
> 
> 
> i forgot whether i actually implemented this, but asset .meta files have 
> a different root element than lenya:meta, which means we cannot use 
> DublinCore on them. we should fix this at the same time.

Yeah, I'm using a dummy document element for now.

Actually I have a big refactoring of the ResourceManager and DublinCore
in my sandbox (using Avalon and Sources), but I won't check them in
before the site usecases work (kind of) correctly.

-- Andreas


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


Re: svn commit: r156181 - lenya/trunk/src/java/org/apache/lenya/cms/publication/DefaultResourcesManager.java

Posted by "Gregor J. Rothfuss" <gr...@apache.org>.
andreas@apache.org wrote:
> Author: andreas
> Date: Fri Mar  4 08:44:52 2005
> New Revision: 156181
> 
> URL: http://svn.apache.org/viewcvs?view=rev&rev=156181
> Log:
> create meta file before saving

i forgot whether i actually implemented this, but asset .meta files have 
a different root element than lenya:meta, which means we cannot use 
DublinCore on them. we should fix this at the same time.


-- 
Gregor J. Rothfuss
COO, Wyona       Content Management Solutions    http://wyona.com
Apache Lenya                              http://lenya.apache.org
gregor.rothfuss@wyona.com                       gregor@apache.org

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