[exo-jcr-commits] exo-jcr SVN: r369 - jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache.
do-not-reply at jboss.org
do-not-reply at jboss.org
Mon Oct 26 07:27:32 EDT 2009
Author: areshetnyak
Date: 2009-10-26 07:27:32 -0400 (Mon, 26 Oct 2009)
New Revision: 369
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java
Log:
EXOJCR-201 : The JBossCacheStorageConnection was changed.
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java 2009-10-26 11:14:55 UTC (rev 368)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java 2009-10-26 11:27:32 UTC (rev 369)
@@ -63,6 +63,11 @@
private final Node<Serializable, Object> treeRoot;
private final Node<Serializable, Object> itemsRoot;
+
+ /**
+ * Start batching flag. 'true' if batching was started, 'false' if batching is not start.
+ */
+ private boolean batchStarted = false;
/**
* JBossCacheStorageConnection constructor.
@@ -74,10 +79,7 @@
{
this.cache = cache;
this.itemsRoot = itemsRoot;
- this.treeRoot = treeRoot;
-
- // start batch
- this.cache.startBatch();
+ this.treeRoot = treeRoot;
}
private Fqn<String> makeNodeFqn(QPath nodePath)
@@ -121,6 +123,7 @@
public void add(NodeData data) throws RepositoryException, UnsupportedOperationException, InvalidItemStateException,
IllegalStateException
{
+ startBatch();
cache.put(makeNodeFqn(data.getQPath()), ITEM_ID, data.getIdentifier());
cache.put(makeIdFqn(data.getIdentifier()), ITEM_DATA, data);
}
@@ -131,6 +134,7 @@
public void add(PropertyData data) throws RepositoryException, UnsupportedOperationException,
InvalidItemStateException, IllegalStateException
{
+ startBatch();
Fqn<String> parentFqn = makeParentFqn(data.getQPath());
// add an attr to the parent node as key=PropertyName value=PropertyId
@@ -145,6 +149,7 @@
public void delete(NodeData data) throws RepositoryException, UnsupportedOperationException,
InvalidItemStateException, IllegalStateException
{
+ startBatch();
cache.removeNode(makeNodeFqn(data.getQPath()));
cache.removeNode(makeIdFqn(data.getIdentifier()));
}
@@ -155,6 +160,7 @@
public void delete(PropertyData data) throws RepositoryException, UnsupportedOperationException,
InvalidItemStateException, IllegalStateException
{
+ startBatch();
// delete attr on parent by key=PropertyName
cache.remove(makeParentFqn(data.getQPath()),
data.getQPath().getEntries()[data.getQPath().getEntries().length - 1].getAsString(true));
@@ -280,7 +286,7 @@
public void rename(NodeData data) throws RepositoryException, UnsupportedOperationException,
InvalidItemStateException, IllegalStateException
{
- // TODO Auto-generated method stub
+ startBatch();
}
@@ -299,7 +305,7 @@
public void update(NodeData data) throws RepositoryException, UnsupportedOperationException,
InvalidItemStateException, IllegalStateException
{
- // TODO Auto-generated method stub
+ startBatch();
}
@@ -309,7 +315,7 @@
public void update(PropertyData data) throws RepositoryException, UnsupportedOperationException,
InvalidItemStateException, IllegalStateException
{
- // TODO Auto-generated method stub
+ startBatch();
}
@@ -329,5 +335,14 @@
// end batch
this.cache.endBatch(true);
}
+
+ /**
+ * Start batching.
+ */
+ private void startBatch()
+ {
+ if (!batchStarted)
+ this.cache.startBatch();
+ }
}
More information about the exo-jcr-commits
mailing list