Author: andreas
Date: Wed Aug 17 05:52:46 2005
New Revision: 233163
URL: http://svn.apache.org/viewcvs?rev=233163&view=rev
Log:
Lock meta data source node when locking source node.
Modified:
lenya/trunk/src/java/org/apache/lenya/cms/repository/SourceNode.java
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=233163&r1=233162&r2=233163&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
Aug 17 05:52:46 2005
@@ -35,6 +35,7 @@
import org.apache.lenya.ac.Identity;
import org.apache.lenya.ac.User;
import org.apache.lenya.cms.cocoon.source.SourceUtil;
+import org.apache.lenya.cms.metadata.MetaDataImpl;
import org.apache.lenya.cms.metadata.MetaDataManager;
import org.apache.lenya.cms.publication.DocumentException;
import org.apache.lenya.cms.publication.Publication;
@@ -321,6 +322,14 @@
throw new RepositoryException(e);
}
this.lock = new Lock(currentVersion);
+
+ if (!getSourceURI().endsWith(".meta")) {
+ lockMetaData();
+ }
+ }
+
+ protected void lockMetaData() throws RepositoryException {
+ SourceUtil.lock(getMetaSourceURI(), this.manager);
}
/**
@@ -474,10 +483,12 @@
* @see org.apache.lenya.cms.repository.Node#getOutputStream()
*/
public synchronized OutputStream getOutputStream() throws
RepositoryException {
- if (getLogger().isDebugEnabled()) getLogger().debug("Get OutputStream
for " + getSourceURI());
+ if (getLogger().isDebugEnabled())
+ getLogger().debug("Get OutputStream for " + getSourceURI());
try {
if (!isLocked()) {
- throw new RuntimeException("Cannot write to source [" +
getSourceURI() + "]: not locked!");
+ throw new RuntimeException("Cannot write to source [" +
getSourceURI()
+ + "]: not locked!");
}
if (getSession().getUnitOfWork() == null) {
throw new RuntimeException("Cannot write to source outside of
a transaction (UnitOfWork is null)!");
@@ -607,7 +618,7 @@
}
return this.metaDataManager;
}
-
+
private Session session;
/**
|