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 2007/06/07 12:32:12 UTC
svn commit: r545141 -
/lenya/trunk/src/modules/sourcerepository/java/src/org/apache/lenya/cms/repository/SourceNodeRCML.java
Author: andreas
Date: Thu Jun 7 03:32:05 2007
New Revision: 545141
URL: http://svn.apache.org/viewvc?view=rev&rev=545141
Log:
Don't reload source node RCML data if RCML object has been modified
Modified:
lenya/trunk/src/modules/sourcerepository/java/src/org/apache/lenya/cms/repository/SourceNodeRCML.java
Modified: lenya/trunk/src/modules/sourcerepository/java/src/org/apache/lenya/cms/repository/SourceNodeRCML.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/sourcerepository/java/src/org/apache/lenya/cms/repository/SourceNodeRCML.java?view=diff&rev=545141&r1=545140&r2=545141
==============================================================================
--- lenya/trunk/src/modules/sourcerepository/java/src/org/apache/lenya/cms/repository/SourceNodeRCML.java (original)
+++ lenya/trunk/src/modules/sourcerepository/java/src/org/apache/lenya/cms/repository/SourceNodeRCML.java Thu Jun 7 03:32:05 2007
@@ -23,6 +23,7 @@
import java.io.IOException;
import java.net.MalformedURLException;
import java.util.ArrayList;
+import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@@ -36,6 +37,7 @@
import org.apache.lenya.cms.rc.RCML;
import org.apache.lenya.cms.rc.RCMLEntry;
import org.apache.lenya.cms.rc.RevisionControlException;
+import org.apache.lenya.util.Assert;
import org.apache.lenya.xml.DocumentHelper;
import org.apache.xpath.XPathAPI;
import org.w3c.dom.Document;
@@ -105,11 +107,9 @@
* @throws Exception if an error occurs
*/
public synchronized void write() throws Exception {
- if (getDocument() == null) {
- throw new IllegalStateException("The XML for RC source [" + getRcmlSourceUri()
- + "] is null!");
- }
- SourceUtil.writeDOM(getDocument(), getRcmlSourceUri(), this.manager);
+ Document xml = getDocument();
+ Assert.notNull("XML document", xml);
+ SourceUtil.writeDOM(xml, getRcmlSourceUri(), this.manager);
clearDirty();
}
@@ -123,7 +123,7 @@
* @throws IOException if an error occurs
* @throws Exception if an error occurs
*/
- public void checkOutIn(short type, String identity, long time, boolean backup)
+ public synchronized void checkOutIn(short type, String identity, long time, boolean backup)
throws IOException, Exception {
Document doc = getDocument();
@@ -216,7 +216,9 @@
}
}
else {
- this.xml = DocumentHelper.createDocument(null, "XPSRevisionControl", null);
+ if (this.xml == null) {
+ this.xml = DocumentHelper.createDocument(null, "XPSRevisionControl", null);
+ }
}
} catch (Exception e) {
throw new RevisionControlException("Could not read RC file [" + getRcmlSourceUri()
@@ -413,7 +415,8 @@
* @throws Exception if an error occurs
*/
public void pruneEntries() throws Exception {
- Element parent = getDocument().getDocumentElement();
+ Document doc = getDocument();
+ Element parent = doc.getDocumentElement();
NodeList entries = XPathAPI.selectNodeList(parent,
"/XPSRevisionControl/CheckOut|/XPSRevisionControl/CheckIn");
@@ -429,6 +432,7 @@
// remove the entry from the list
current.getParentNode().removeChild(current);
}
+ setDirty();
}
protected void deleteBackup(SourceWrapper wrapper, long time) throws ServiceException,
@@ -465,6 +469,7 @@
*/
protected void setDirty() {
this.dirty = true;
+ this.lastModified = new Date().getTime();
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org