exo-jcr SVN: r718 - jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2009-11-17 08:13:23 -0500 (Tue, 17 Nov 2009)
New Revision: 718
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java
Log:
EXOJCR-245: JBossCacheStorageConnection remove() method implemented
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-11-17 13:01:05 UTC (rev 717)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java 2009-11-17 13:13:23 UTC (rev 718)
@@ -21,8 +21,10 @@
import org.exoplatform.services.jcr.datamodel.ItemData;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
+import org.exoplatform.services.jcr.datamodel.QPath;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
import org.exoplatform.services.jcr.impl.core.lock.LockData;
+import org.exoplatform.services.jcr.impl.dataflow.TransientNodeData;
import org.exoplatform.services.jcr.storage.WorkspaceStorageConnection;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -378,20 +380,20 @@
* {@inheritDoc}
*/
public void deleteNode(String identifier) throws RepositoryException, UnsupportedOperationException,
- InvalidItemStateException, IllegalStateException
+ InvalidItemStateException, IllegalStateException
{
// TODO Auto-generated method stub
-
+
}
/**
* {@inheritDoc}
*/
- public void deleteProperty(String identifier) throws RepositoryException,
- UnsupportedOperationException, InvalidItemStateException, IllegalStateException
+ public void deleteProperty(String identifier) throws RepositoryException, UnsupportedOperationException,
+ InvalidItemStateException, IllegalStateException
{
// TODO Auto-generated method stub
-
+
}
/**
@@ -449,9 +451,99 @@
public void rename(NodeData data) throws RepositoryException, UnsupportedOperationException,
InvalidItemStateException, IllegalStateException
{
+ //TODO we expecting that on session.move() there will be only one rename() method call
+
startBatch();
- // TODO move Node to a new position at the tree,
- // but prev location was in prev DELETE.
+
+ String nodeUUID = data.getIdentifier();
+
+ //1. Update renamed node and also get old parent node UUID
+ Node<Serializable, Object> node = nodesRoot.getChild(makeNodeFqn(nodeUUID));
+ if (node == null)
+ {
+ throw new RepositoryException("FATAL renamed node is not exist" + data.getQPath().getAsString());
+ }
+ String oldParentIdentifier = null;
+ Object itemData = node.put(ITEM_DATA, data);
+ if (itemData != null)
+ {
+ oldParentIdentifier = ((NodeData)itemData).getParentIdentifier();
+ }
+ else
+ {
+ throw new RepositoryException("FATAL NodeData is empty " + data.getQPath().getAsString());
+ }
+
+ // 2. remove renamed node from child list of previous parent node
+ // check if parent is cached
+ Node<Serializable, Object> oldparent = nodesRoot.getChild(makeNodeFqn(oldParentIdentifier));
+ if (oldparent == null)
+ {
+ throw new RepositoryException("Nodes old parent doesn't exist " + data.getQPath().getAsString());
+ }
+
+ // remove child on old Parent
+ boolean removed =
+ oldparent.removeChild(makeChildNodeFqn(data.getQPath().getEntries()[data.getQPath().getEntries().length - 1]));
+ if (!removed)
+ {
+ throw new RepositoryException("Node was not removed from child list of old parent "
+ + data.getQPath().getAsString());
+ }
+
+ // 3. add node to child list of new parent node
+ if (data.getParentIdentifier() != null)
+ {
+ // check if parent is cached
+ Node<Serializable, Object> newparent = nodesRoot.getChild(makeNodeFqn(data.getParentIdentifier()));
+ if (newparent == null)
+ {
+ throw new RepositoryException("Nodes new parent doesn't exist " + data.getQPath().getAsString());
+ }
+
+ // add child to Parent
+ Node<Serializable, Object> childNode =
+ newparent.addChild(makeChildNodeFqn(data.getQPath().getEntries()[data.getQPath().getEntries().length - 1]));
+
+ // set child id attr
+ childNode.put(ITEM_ID, data.getIdentifier());
+ }
+
+ // 4. update all child nodes
+ Set<Node<Serializable, Object>> childNodes = node.getChildren();
+
+ for (Node<Serializable, Object> child : childNodes)
+ {
+ String childNodeId = (String)child.get(ITEM_ID);
+ if (childNodeId == null)
+ {
+ throw new RepositoryException("FATAL Child Node Id key is null. Parent " + data.getQPath().getAsString());
+ }
+
+ // TODO NodeData or PropertyData? As ItemData check then and cast.
+ Node<Serializable, Object> childnode = nodesRoot.getChild(makeNodeFqn(childNodeId));
+ if (childnode == null)
+ {
+ throw new RepositoryException("FATAL Node record not found(" + childNodeId + "), but listed in childs of "
+ + data.getQPath().getAsString());
+ }
+ NodeData nodeData = (NodeData)childnode.get(ITEM_DATA);
+ if (nodeData == null)
+ {
+ // TODO should not occurs by contract
+ throw new RepositoryException("Child node data is null. Parent " + data.getQPath().getAsString());
+ }
+
+ //repack child NodeData with new QPath
+ //TODO check it
+ QPath newPath = QPath.makeChildPath(data.getQPath(), nodeData.getQPath().getName());
+ TransientNodeData newNodeData =
+ new TransientNodeData(newPath, nodeData.getIdentifier(), nodeData.getPersistedVersion(), nodeData
+ .getPrimaryTypeName(), nodeData.getMixinTypeNames(), nodeData.getOrderNumber(), nodeData
+ .getParentIdentifier(), nodeData.getACL());
+ childnode.put(ITEM_DATA, newNodeData);
+ }
+
}
/**
16 years, 8 months
exo-jcr SVN: r717 - in kernel/branches/mc-int-branch: exo.kernel.commons and 10 other directories.
by do-not-reply@jboss.org
Author: mstruk
Date: 2009-11-17 08:01:05 -0500 (Tue, 17 Nov 2009)
New Revision: 717
Modified:
kernel/branches/mc-int-branch/exo.kernel.commons/pom.xml
kernel/branches/mc-int-branch/exo.kernel.component.cache/pom.xml
kernel/branches/mc-int-branch/exo.kernel.component.command/pom.xml
kernel/branches/mc-int-branch/exo.kernel.component.common/pom.xml
kernel/branches/mc-int-branch/exo.kernel.component.remote/pom.xml
kernel/branches/mc-int-branch/exo.kernel.container/pom.xml
kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/mc/MCIntegrationContainer.java
kernel/branches/mc-int-branch/exo.kernel.demos/mc-injection/pom.xml
kernel/branches/mc-int-branch/exo.kernel.demos/pom.xml
kernel/branches/mc-int-branch/org.jboss.mc-kernel-extras/pom.xml
kernel/branches/mc-int-branch/packaging/module/pom.xml
kernel/branches/mc-int-branch/pom.xml
Log:
Merged in trunk changes up to rev. 710
Modified: kernel/branches/mc-int-branch/exo.kernel.commons/pom.xml
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.commons/pom.xml 2009-11-17 12:41:22 UTC (rev 716)
+++ kernel/branches/mc-int-branch/exo.kernel.commons/pom.xml 2009-11-17 13:01:05 UTC (rev 717)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>kernel-parent</artifactId>
- <version>2.2.0-Beta03-SNAPSHOT</version>
+ <version>2.2.0-Beta04-SNAPSHOT</version>
</parent>
<artifactId>exo.kernel.commons</artifactId>
Modified: kernel/branches/mc-int-branch/exo.kernel.component.cache/pom.xml
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.component.cache/pom.xml 2009-11-17 12:41:22 UTC (rev 716)
+++ kernel/branches/mc-int-branch/exo.kernel.component.cache/pom.xml 2009-11-17 13:01:05 UTC (rev 717)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>kernel-parent</artifactId>
- <version>2.2.0-Beta03-SNAPSHOT</version>
+ <version>2.2.0-Beta04-SNAPSHOT</version>
</parent>
<artifactId>exo.kernel.component.cache</artifactId>
Modified: kernel/branches/mc-int-branch/exo.kernel.component.command/pom.xml
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.component.command/pom.xml 2009-11-17 12:41:22 UTC (rev 716)
+++ kernel/branches/mc-int-branch/exo.kernel.component.command/pom.xml 2009-11-17 13:01:05 UTC (rev 717)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>kernel-parent</artifactId>
- <version>2.2.0-Beta03-SNAPSHOT</version>
+ <version>2.2.0-Beta04-SNAPSHOT</version>
</parent>
<artifactId>exo.kernel.component.command</artifactId>
Modified: kernel/branches/mc-int-branch/exo.kernel.component.common/pom.xml
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.component.common/pom.xml 2009-11-17 12:41:22 UTC (rev 716)
+++ kernel/branches/mc-int-branch/exo.kernel.component.common/pom.xml 2009-11-17 13:01:05 UTC (rev 717)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>kernel-parent</artifactId>
- <version>2.2.0-Beta03-SNAPSHOT</version>
+ <version>2.2.0-Beta04-SNAPSHOT</version>
</parent>
<artifactId>exo.kernel.component.common</artifactId>
Modified: kernel/branches/mc-int-branch/exo.kernel.component.remote/pom.xml
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.component.remote/pom.xml 2009-11-17 12:41:22 UTC (rev 716)
+++ kernel/branches/mc-int-branch/exo.kernel.component.remote/pom.xml 2009-11-17 13:01:05 UTC (rev 717)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>kernel-parent</artifactId>
- <version>2.2.0-Beta03-SNAPSHOT</version>
+ <version>2.2.0-Beta04-SNAPSHOT</version>
</parent>
<artifactId>exo.kernel.component.remote</artifactId>
Modified: kernel/branches/mc-int-branch/exo.kernel.container/pom.xml
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/pom.xml 2009-11-17 12:41:22 UTC (rev 716)
+++ kernel/branches/mc-int-branch/exo.kernel.container/pom.xml 2009-11-17 13:01:05 UTC (rev 717)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>kernel-parent</artifactId>
- <version>2.2.0-Beta03-SNAPSHOT</version>
+ <version>2.2.0-Beta04-SNAPSHOT</version>
</parent>
<artifactId>exo.kernel.container</artifactId>
Modified: kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/mc/MCIntegrationContainer.java
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/mc/MCIntegrationContainer.java 2009-11-17 12:41:22 UTC (rev 716)
+++ kernel/branches/mc-int-branch/exo.kernel.container/src/main/java/org/exoplatform/container/mc/MCIntegrationContainer.java 2009-11-17 13:01:05 UTC (rev 717)
@@ -76,7 +76,7 @@
}
catch (ClassNotFoundException ignored)
{
- log.warn("@InterceptMC not supported in this environment (component: " + componentAdapter.getComponentKey() + ") - necessary classes are missing: ", ignored);
+ log.warn("@InterceptMC not supported in this environment (component: " + componentAdapter.getComponentKey() + ") - necessary classes are missing: " + ignored);
return false;
}
catch (NoSuchMethodException e)
Modified: kernel/branches/mc-int-branch/exo.kernel.demos/mc-injection/pom.xml
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.demos/mc-injection/pom.xml 2009-11-17 12:41:22 UTC (rev 716)
+++ kernel/branches/mc-int-branch/exo.kernel.demos/mc-injection/pom.xml 2009-11-17 13:01:05 UTC (rev 717)
@@ -5,7 +5,7 @@
<parent>
<groupId>org.exoplatform.kernel.demos</groupId>
<artifactId>exo.kernel.demos</artifactId>
- <version>2.2.0-Beta03-SNAPSHOT</version>
+ <version>2.2.0-Beta04-SNAPSHOT</version>
</parent>
<artifactId>exo.mc-int.mc-injection</artifactId>
Modified: kernel/branches/mc-int-branch/exo.kernel.demos/pom.xml
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.demos/pom.xml 2009-11-17 12:41:22 UTC (rev 716)
+++ kernel/branches/mc-int-branch/exo.kernel.demos/pom.xml 2009-11-17 13:01:05 UTC (rev 717)
@@ -5,7 +5,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>kernel-parent</artifactId>
- <version>2.2.0-Beta03-SNAPSHOT</version>
+ <version>2.2.0-Beta04-SNAPSHOT</version>
</parent>
<groupId>org.exoplatform.kernel.demos</groupId>
Modified: kernel/branches/mc-int-branch/org.jboss.mc-kernel-extras/pom.xml
===================================================================
--- kernel/branches/mc-int-branch/org.jboss.mc-kernel-extras/pom.xml 2009-11-17 12:41:22 UTC (rev 716)
+++ kernel/branches/mc-int-branch/org.jboss.mc-kernel-extras/pom.xml 2009-11-17 13:01:05 UTC (rev 717)
@@ -6,11 +6,10 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>kernel-parent</artifactId>
- <version>2.2.0-Beta03-SNAPSHOT</version>
+ <version>2.2.0-Beta04-SNAPSHOT</version>
</parent>
<artifactId>mc-kernel-extras</artifactId>
- <version>2.2.0-Beta03-SNAPSHOT</version>
<name>MC Kernel 2.2.0 Selected Classes</name>
<description>MC integration classes that aren't available in mc-kernel 2.0.6.GA</description>
Modified: kernel/branches/mc-int-branch/packaging/module/pom.xml
===================================================================
--- kernel/branches/mc-int-branch/packaging/module/pom.xml 2009-11-17 12:41:22 UTC (rev 716)
+++ kernel/branches/mc-int-branch/packaging/module/pom.xml 2009-11-17 13:01:05 UTC (rev 717)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>kernel-parent</artifactId>
- <version>2.2.0-Beta03-SNAPSHOT</version>
+ <version>2.2.0-Beta04-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: kernel/branches/mc-int-branch/pom.xml
===================================================================
--- kernel/branches/mc-int-branch/pom.xml 2009-11-17 12:41:22 UTC (rev 716)
+++ kernel/branches/mc-int-branch/pom.xml 2009-11-17 13:01:05 UTC (rev 717)
@@ -30,7 +30,7 @@
<groupId>org.exoplatform.kernel</groupId>
<artifactId>kernel-parent</artifactId>
- <version>2.2.0-Beta03-SNAPSHOT</version>
+ <version>2.2.0-Beta04-SNAPSHOT</version>
<packaging>pom</packaging>
<name>eXo Kernel</name>
16 years, 8 months
exo-jcr SVN: r716 - jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache.
by do-not-reply@jboss.org
Author: pnedonosko
Date: 2009-11-17 07:41:22 -0500 (Tue, 17 Nov 2009)
New Revision: 716
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java
Log:
EXOJCR-203: JDBC loader TX support (comments)
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java 2009-11-17 12:39:35 UTC (rev 715)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java 2009-11-17 12:41:22 UTC (rev 716)
@@ -510,7 +510,7 @@
{
final WorkspaceStorageConnection conn = dataContainer.openConnection();
apply(conn, modifications);
- conn.commit();
+ conn.commit(); // same immediately
}
else
{
16 years, 8 months
exo-jcr SVN: r715 - jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache.
by do-not-reply@jboss.org
Author: pnedonosko
Date: 2009-11-17 07:39:35 -0500 (Tue, 17 Nov 2009)
New Revision: 715
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java
Log:
EXOJCR-203: JDBC loader TX support (fixes)
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java 2009-11-17 12:26:25 UTC (rev 714)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java 2009-11-17 12:39:35 UTC (rev 715)
@@ -506,29 +506,27 @@
*/
public void prepare(Object tx, List<Modification> modifications, boolean onePhase) throws Exception
{
-
- final WorkspaceStorageConnection exconn = transactions.remove(tx);
- if (exconn != null)
- {
- apply(exconn, modifications);
- }
- else
- {
- final WorkspaceStorageConnection conn = dataContainer.openConnection();
- apply(exconn, modifications);
- transactions.put(tx, conn);
- }
-
- final WorkspaceStorageConnection conn = dataContainer.openConnection();
- apply(conn, modifications);
-
if (onePhase)
{
+ final WorkspaceStorageConnection conn = dataContainer.openConnection();
+ apply(conn, modifications);
conn.commit();
}
else
{
- transactions.put(tx, conn);
+ final WorkspaceStorageConnection exconn = transactions.remove(tx);
+ if (exconn != null)
+ {
+ // apply in existed connection associated with tx
+ apply(exconn, modifications);
+ }
+ else
+ {
+ // open new tx conn, apply in it, save the conn
+ final WorkspaceStorageConnection conn = dataContainer.openConnection();
+ apply(conn, modifications);
+ transactions.put(tx, conn);
+ }
}
}
16 years, 8 months
exo-jcr SVN: r714 - jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache.
by do-not-reply@jboss.org
Author: pnedonosko
Date: 2009-11-17 07:26:25 -0500 (Tue, 17 Nov 2009)
New Revision: 714
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java
Log:
EXOJCR-203: JDBC loader TX support
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java 2009-11-17 11:57:53 UTC (rev 713)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java 2009-11-17 12:26:25 UTC (rev 714)
@@ -23,6 +23,7 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
import javax.jcr.RepositoryException;
@@ -56,6 +57,12 @@
{
protected static final Log LOG = ExoLogger.getLogger("jcr.JDBCCacheLoader");
+ /**
+ * Storage connections involved in transactions.
+ */
+ protected Map<Object, WorkspaceStorageConnection> transactions =
+ new ConcurrentHashMap<Object, WorkspaceStorageConnection>();
+
private IndividualCacheLoaderConfig config;
private WorkspaceDataContainer dataContainer;
@@ -81,7 +88,7 @@
}
/**
- * Put all Modifications into JDBC database, but don't commite them.
+ * Apply all Modifications to JDBC database, but don't commite them.
*
* @param modifications List if Modification
* @param conn WorkspaceStorageConnection
@@ -103,10 +110,10 @@
switch (m.getType())
{
case PUT_DATA :
- LOG.info("PUT_DATA modification");
+ LOG.warn("PUT_DATA modification");
break;
case PUT_DATA_ERASE :
- LOG.info("PUT_DATA_ERASE modification");
+ LOG.warn("PUT_DATA_ERASE modification");
break;
case PUT_KEY_VALUE :
@@ -117,10 +124,10 @@
break;
case REMOVE_DATA :
- LOG.info("REMOVE_DATA modification");
+ LOG.warn("REMOVE_DATA modification");
break;
case REMOVE_KEY_VALUE :
- LOG.info("REMOVE_KEY_VALUE modification");
+ LOG.warn("REMOVE_KEY_VALUE modification");
break;
case REMOVE_NODE :
@@ -128,7 +135,7 @@
break;
case MOVE :
- LOG.info("MOVE modification");
+ LOG.warn("MOVE modification");
break;
default :
throw new CacheException("Unknown modification " + m.getType());
@@ -492,24 +499,36 @@
}
- // TRANSACTION support
+ // 2-phase TRANSACTION support
/**
* {@inheritDoc}
*/
- public void prepare(Object tx, List<Modification> modifications, boolean one_phase) throws Exception
+ public void prepare(Object tx, List<Modification> modifications, boolean onePhase) throws Exception
{
- put(modifications);
+ final WorkspaceStorageConnection exconn = transactions.remove(tx);
+ if (exconn != null)
+ {
+ apply(exconn, modifications);
+ }
+ else
+ {
+ final WorkspaceStorageConnection conn = dataContainer.openConnection();
+ apply(exconn, modifications);
+ transactions.put(tx, conn);
+ }
- if (one_phase)
+ final WorkspaceStorageConnection conn = dataContainer.openConnection();
+ apply(conn, modifications);
+
+ if (onePhase)
{
- //put(modifications);
- //commitJDBC();
+ conn.commit();
}
else
{
- //transactions.put(tx, modifications);
+ transactions.put(tx, conn);
}
}
@@ -518,14 +537,13 @@
*/
public void commit(Object tx) throws Exception
{
- // List<Modification> modifications = transactions.remove(tx);
- // if (modifications == null)
- // {
- // throw new Exception("transaction " + tx + " not found in transaction table");
- // }
- // put(modifications);
+ final WorkspaceStorageConnection conn = transactions.remove(tx);
+ if (conn == null)
+ {
+ throw new RepositoryException("Transaction " + tx + " not found in transaction table.");
+ }
- //commitJDBC();
+ conn.commit();
}
/**
@@ -533,9 +551,23 @@
*/
public void rollback(Object tx)
{
- //transactions.remove(tx);
-
- //rollbackJDBC();
+ final WorkspaceStorageConnection conn = transactions.remove(tx);
+ if (conn != null)
+ {
+ try
+ {
+ conn.rollback();
+ }
+ catch (Throwable e)
+ {
+ // TODO why we cannot throw an exception???
+ LOG.error("Error of transaction " + tx + " rollback.", e);
+ }
+ }
+ else
+ {
+ LOG.warn("Transaction " + tx + " not found in transaction table, but rollback called.");
+ }
}
// SHOULD NOT BE USED methods
16 years, 8 months
exo-jcr SVN: r713 - jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache.
by do-not-reply@jboss.org
Author: pnedonosko
Date: 2009-11-17 06:57:53 -0500 (Tue, 17 Nov 2009)
New Revision: 713
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java
Log:
EXOJCR-203: loader put(List) rework, JDBC connection replaced on WorkspaceStroageConnection
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java 2009-11-17 11:53:08 UTC (rev 712)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java 2009-11-17 11:57:53 UTC (rev 713)
@@ -32,7 +32,6 @@
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
-import org.exoplatform.services.jcr.impl.storage.jdbc.JDBCStorageConnection;
import org.exoplatform.services.jcr.storage.WorkspaceDataContainer;
import org.exoplatform.services.jcr.storage.WorkspaceStorageConnection;
import org.exoplatform.services.log.ExoLogger;
@@ -56,14 +55,15 @@
public class JDBCCacheLoader extends AbstractCacheLoader
{
protected static final Log LOG = ExoLogger.getLogger("jcr.JDBCCacheLoader");
-
+
private IndividualCacheLoaderConfig config;
-
+
private WorkspaceDataContainer dataContainer;
- public JDBCCacheLoader() {
+ public JDBCCacheLoader()
+ {
}
-
+
/**
* Init the loader DataContainer with given WorkspaceDataContainer instance.
*
@@ -79,156 +79,187 @@
this.dataContainer = dataContainer;
}
-
+
/**
+ * Put all Modifications into JDBC database, but don't commite them.
+ *
+ * @param modifications List if Modification
+ * @param conn WorkspaceStorageConnection
+ * @throws RepositoryException if error
+ */
+ protected void apply(WorkspaceStorageConnection conn, List<Modification> modifications) throws RepositoryException
+ {
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Modifications list size = " + modifications.size());
+ }
+
+ // Prepare modifications list.
+ // Will be added oldValueData to modification for UPDATE.
+ //prepareModifications(modifications);
+
+ for (Modification m : modifications)
+ {
+ switch (m.getType())
+ {
+ case PUT_DATA :
+ LOG.info("PUT_DATA modification");
+ break;
+ case PUT_DATA_ERASE :
+ LOG.info("PUT_DATA_ERASE modification");
+ break;
+ case PUT_KEY_VALUE :
+
+ if (m.getOldValue() != null)
+ doUpdate(m, conn);
+ else
+ doAdd(m, conn);
+
+ break;
+ case REMOVE_DATA :
+ LOG.info("REMOVE_DATA modification");
+ break;
+ case REMOVE_KEY_VALUE :
+ LOG.info("REMOVE_KEY_VALUE modification");
+ break;
+ case REMOVE_NODE :
+
+ doRemove(m, conn);
+
+ break;
+ case MOVE :
+ LOG.info("MOVE modification");
+ break;
+ default :
+ throw new CacheException("Unknown modification " + m.getType());
+ }
+ }
+ }
+
+ /**
* {@inheritDoc}
*/
public void put(List<Modification> modifications) throws Exception
{
- LOG.info("Modifications list size = " + modifications.size());
- // Prepare modifications list.
- // Will be added oldValueData to modification for UPDATE.
- prepareModifications(modifications);
-
- JDBCStorageConnection jdbcConnection = (JDBCStorageConnection)dataContainer.openConnection();
-
- try
- {
- for (Modification m : modifications)
- {
- switch (m.getType())
- {
- case PUT_DATA:
- break;
- case PUT_DATA_ERASE:
- break;
- case PUT_KEY_VALUE:
-
- if (m.getOldValue() != null)
- doUpdate(m, jdbcConnection);
- else
- doAdd(m, jdbcConnection);
-
- break;
- case REMOVE_DATA:
- break;
- case REMOVE_KEY_VALUE:
- break;
- case REMOVE_NODE:
-
- doRemove(m, jdbcConnection);
-
- break;
- case MOVE:
- break;
- default:
- throw new CacheException("Unknown modification " + m.getType());
- }
- }
-
- if (jdbcConnection != null) {
- jdbcConnection.commit();
- jdbcConnection = null;
- }
- }
- catch (Exception e)
- {
- LOG.error("Can not put data to DB", e);
- throw e;
- }
- finally
- {
- if (jdbcConnection != null && jdbcConnection.isOpened()) {
- jdbcConnection.rollback();
- }
-
- }
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Modifications list size = " + modifications.size());
+ }
+
+ // Prepare modifications list.
+ // Will be added oldValueData to modification for UPDATE.
+ //prepareModifications(modifications);
+
+ WorkspaceStorageConnection conn = dataContainer.openConnection();
+ try
+ {
+ apply(conn, modifications);
+ conn.commit();
+ }
+ catch (RepositoryException e)
+ {
+ LOG.error("RepositoryException: ", e); // TODO cleanup
+ throw new RepositoryException(e);
+ }
+ catch (IllegalStateException e)
+ {
+ LOG.error("IllegalStateException: ", e); // TODO cleanup
+ throw new IllegalStateException(e);
+ }
+ finally
+ {
+ if (conn != null && conn.isOpened())
+ {
+ conn.rollback();
+ }
+ }
}
/**
* Remove NodeData or PropertyData.
*
* @param modification
- * @param jdbcConnection
+ * @param conn
* @param identifier
* @throws IllegalStateException
* @throws RepositoryException
*/
- private void doRemove(Modification modification, JDBCStorageConnection jdbcConnection)
- throws IllegalStateException, RepositoryException
+ private void doRemove(Modification modification, WorkspaceStorageConnection conn) throws IllegalStateException,
+ RepositoryException
{
- if ( modification.getFqn().size() == 2 && (modification.getFqn().get(0).equals(JBossCacheStorage.NODES) ||
- modification.getFqn().get(0).equals(JBossCacheStorage.PROPS)))
+ if (modification.getFqn().size() == 2
+ && (modification.getFqn().get(0).equals(JBossCacheStorage.NODES) || modification.getFqn().get(0).equals(
+ JBossCacheStorage.PROPS)))
{
// TODO The removed ItemData was setting to value in prepareModifications();
// That is need because we do not get NodeData from DB if we delete property with primaytype.
-
-// String identifier = (String) modification.getFqn().get(1);
-// ItemData itemData = jdbcConnection.getItemData(identifier);
-
- ItemData itemData = (ItemData) modification.getValue();
-
+
+ // String identifier = (String) modification.getFqn().get(1);
+ // ItemData itemData = jdbcConnection.getItemData(identifier);
+
+ ItemData itemData = (ItemData)modification.getValue();
+
if (itemData instanceof NodeData)
- jdbcConnection.delete((NodeData) itemData);
+ conn.delete((NodeData)itemData);
if (itemData instanceof PropertyData)
- jdbcConnection.delete((PropertyData) itemData);
+ conn.delete((PropertyData)itemData);
}
}
-
+
/**
* Performs ADD to NodeData and PropertyData.
* @param modification
- * @param jdbcConnection
+ * @param conn
* @throws IllegalStateException
* @throws RepositoryException
*/
- private void doAdd(Modification modification, JDBCStorageConnection jdbcConnection)
- throws IllegalStateException, RepositoryException
+ private void doAdd(Modification modification, WorkspaceStorageConnection conn) throws IllegalStateException,
+ RepositoryException
{
if (modification.getValue() instanceof NodeData)
{
//add node data
NodeData nodeData = (NodeData)modification.getValue();
- jdbcConnection.add(nodeData);
+ conn.add(nodeData);
}
else if (modification.getValue() instanceof PropertyData)
{
//add property data
PropertyData propertyData = (PropertyData)modification.getValue();
- jdbcConnection.add(propertyData);
+ conn.add(propertyData);
}
}
-
+
/**
* Performs UPDATE to NodeData and PropertyData.
* @param modification
- * @param jdbcConnection
+ * @param conn
* @throws IllegalStateException
* @throws RepositoryException
*/
- private void doUpdate(Modification modification, JDBCStorageConnection jdbcConnection)
- throws IllegalStateException, RepositoryException
+ private void doUpdate(Modification modification, WorkspaceStorageConnection conn) throws IllegalStateException,
+ RepositoryException
{
if (modification.getValue() instanceof NodeData)
{
//update node data
NodeData nodeData = (NodeData)modification.getValue();
- jdbcConnection.update(nodeData);
+ conn.update(nodeData);
}
else if (modification.getValue() instanceof PropertyData)
{
//update property data
PropertyData propertyData = (PropertyData)modification.getValue();
- jdbcConnection.update(propertyData);
+ conn.update(propertyData);
}
}
-
+
/**
* Prepare list of modifications.
*
@@ -237,47 +268,49 @@
* @param modifications
* @throws RepositoryException
*/
+ @Deprecated
private void prepareModifications(List<Modification> modifications) throws RepositoryException
{
- JDBCStorageConnection jdbcConnection = (JDBCStorageConnection) dataContainer.openConnection();
+ WorkspaceStorageConnection conn = dataContainer.openConnection();
- try {
+ try
+ {
for (int i = 0; i < modifications.size(); i++)
{
Modification m = modifications.get(i);
if (m.getType() == ModificationType.PUT_KEY_VALUE)
{
ItemData itemData = null;
-
+
//Check add or update node data.
if (m.getValue() instanceof NodeData)
{
- NodeData nodeData = (NodeData) m.getValue();
- itemData = jdbcConnection.getItemData(nodeData.getIdentifier());
-
+ NodeData nodeData = (NodeData)m.getValue();
+ itemData = conn.getItemData(nodeData.getIdentifier());
+
// Set oldValueData for update node.
- if (itemData != null)
+ if (itemData != null)
modifications.get(i).setOldValue(itemData);
}
else if (m.getValue() instanceof PropertyData)
{
- PropertyData propertyData = (PropertyData) m.getValue();
- itemData = jdbcConnection.getItemData(propertyData.getIdentifier());
-
+ PropertyData propertyData = (PropertyData)m.getValue();
+ itemData = conn.getItemData(propertyData.getIdentifier());
+
// Set oldValueData for update property.
- if (itemData != null)
+ if (itemData != null)
modifications.get(i).setOldValue(itemData);
- }
+ }
}
else if (m.getType() == ModificationType.REMOVE_NODE)
{
if (m.getFqn().size() == 2
- && (m.getFqn().get(0).equals(JBossCacheStorage.NODES)
- || m.getFqn().get(0).equals(JBossCacheStorage.PROPS)))
+ && (m.getFqn().get(0).equals(JBossCacheStorage.NODES) || m.getFqn().get(0).equals(
+ JBossCacheStorage.PROPS)))
{
- String id = (String) m.getFqn().get(1);
- ItemData removedItemData = jdbcConnection.getItemData(id);
-
+ String id = (String)m.getFqn().get(1);
+ ItemData removedItemData = conn.getItemData(id);
+
// Set valueData for update property or node.
if (removedItemData != null)
modifications.get(i).setValue(removedItemData);
@@ -287,7 +320,7 @@
}
finally
{
- jdbcConnection.close();
+ conn.close();
}
}
@@ -311,7 +344,7 @@
{
Map<Object, Object> attrs = new LinkedHashMap<Object, Object>();
-
+
if (name.size() > 1)
{
if (name.get(0).equals(JBossCacheStorage.NODES))
@@ -324,8 +357,8 @@
try
{
- NodeData nodeData = (NodeData) conn.getItemData(name.getLastElementAsString());
-
+ NodeData nodeData = (NodeData)conn.getItemData(name.getLastElementAsString());
+
if (nodeData != null)
{
attrs.put(JBossCacheStorage.ITEM_DATA, nodeData);
@@ -339,28 +372,28 @@
}
finally
{
- conn.close();
+ conn.close();
}
}
// /$NODES/<NODE_ID>/<SUB_NODE_NAME>
else if (name.size() == 3)
{
QPathEntry nodeName = QPathEntry.parse(name.getLastElementAsString());
-
+
// return [ITEM_Id : nodeData_ID]
WorkspaceStorageConnection conn = dataContainer.openConnection();
try
{
- NodeData parentNodeData = (NodeData) conn.getItemData((String)name.get(1));
-
+ NodeData parentNodeData = (NodeData)conn.getItemData((String)name.get(1));
+
//TODO We do not throw exception if parentNodeData not exists in DB, because we use that method (get(Fqn name)) in exists(Fqn name).
/*if (parentNodeData == null)
throw new JDBCCacheLoaderException("The parent node with ID = " + (String)name.get(1) + " not exis, FQN = '" + name + "'.");*/
-
+
if (parentNodeData != null)
{
- NodeData nodeData = (NodeData) conn.getItemData(parentNodeData, nodeName);
+ NodeData nodeData = (NodeData)conn.getItemData(parentNodeData, nodeName);
if (nodeData != null)
attrs.put(JBossCacheStorage.ITEM_ID, nodeData.getIdentifier());
}
@@ -381,19 +414,19 @@
try
{
- PropertyData propertyData = (PropertyData) conn.getItemData(name.getLastElementAsString());
-
+ PropertyData propertyData = (PropertyData)conn.getItemData(name.getLastElementAsString());
+
if (propertyData != null)
- attrs.put(JBossCacheStorage.ITEM_DATA, propertyData);
+ attrs.put(JBossCacheStorage.ITEM_DATA, propertyData);
}
finally
{
conn.close();
}
- }
+ }
}
}
-
+
return (attrs.size() == 0 ? null : attrs);
}
@@ -412,19 +445,20 @@
public Set<?> getChildrenNames(Fqn name) throws Exception
{
// return child nodes names
-
+
Set<String> childs = new LinkedHashSet<String>();
-
+
// /$NODES/<NODE_ID>
- if (name.size() == 2)
+ if (name.size() == 2)
{
WorkspaceStorageConnection conn = dataContainer.openConnection();
try
{
- NodeData parentNodeData = (NodeData)conn.getItemData((String) name.get(1));
-
+ NodeData parentNodeData = (NodeData)conn.getItemData((String)name.get(1));
+
if (parentNodeData == null)
- throw new JDBCCacheLoaderException("The parent node with ID = " + (String)name.get(1) + " not exis, FQN = '" + name + "'.");
+ throw new JDBCCacheLoaderException("The parent node with ID = " + (String)name.get(1)
+ + " not exis, FQN = '" + name + "'.");
// get child nodes by parent Id
for (NodeData node : conn.getChildNodesData(parentNodeData))
@@ -437,7 +471,7 @@
conn.close();
}
}
-
+
return (childs.size() == 0 ? null : childs);
}
@@ -452,8 +486,66 @@
/**
* {@inheritDoc}
*/
+ public void setConfig(IndividualCacheLoaderConfig config)
+ {
+ this.config = config;
+
+ }
+
+ // TRANSACTION support
+
+ /**
+ * {@inheritDoc}
+ */
+ public void prepare(Object tx, List<Modification> modifications, boolean one_phase) throws Exception
+ {
+
+ put(modifications);
+
+ if (one_phase)
+ {
+ //put(modifications);
+ //commitJDBC();
+ }
+ else
+ {
+ //transactions.put(tx, modifications);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void commit(Object tx) throws Exception
+ {
+ // List<Modification> modifications = transactions.remove(tx);
+ // if (modifications == null)
+ // {
+ // throw new Exception("transaction " + tx + " not found in transaction table");
+ // }
+ // put(modifications);
+
+ //commitJDBC();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void rollback(Object tx)
+ {
+ //transactions.remove(tx);
+
+ //rollbackJDBC();
+ }
+
+ // SHOULD NOT BE USED methods
+
+ /**
+ * {@inheritDoc}
+ */
public Object put(Fqn name, Object key, Object value) throws Exception
{
+ LOG.error("The method 'put(Fqn name, Object key, Object value))' should not be called.");
throw new JDBCCacheLoaderException("The method 'put(Fqn name, Object key, Object value))' should not be called.");
}
@@ -462,7 +554,9 @@
*/
public void put(Fqn name, Map<Object, Object> attributes) throws Exception
{
- throw new JDBCCacheLoaderException("The method 'put(Fqn name, Map<Object, Object> attributes)' should not be called.");
+ LOG.error("The method 'put(Fqn name, Map<Object, Object> attributes)' should not be called.");
+ throw new JDBCCacheLoaderException(
+ "The method 'put(Fqn name, Map<Object, Object> attributes)' should not be called.");
}
/**
@@ -470,6 +564,7 @@
*/
public Object remove(Fqn fqn, Object key) throws Exception
{
+ LOG.error("The method 'remove(Fqn fqn, Object key)' should not be called.");
throw new JDBCCacheLoaderException("The method 'remove(Fqn fqn, Object key)' should not be called.");
}
@@ -478,6 +573,7 @@
*/
public void remove(Fqn fqn) throws Exception
{
+ LOG.error("The method 'remove(Fqn fqn)' should not be called.");
throw new JDBCCacheLoaderException("The method 'remove(Fqn fqn)' should not be called.");
}
@@ -486,16 +582,10 @@
*/
public void removeData(Fqn fqn) throws Exception
{
+ LOG.error("The method 'removeData(Fqn fqn)' should not be called.");
throw new JDBCCacheLoaderException("The method 'removeData(Fqn fqn)' should not be called.");
}
- /**
- * {@inheritDoc}
- */
- public void setConfig(IndividualCacheLoaderConfig config)
- {
- this.config = config;
+ // etc.
- }
-
}
16 years, 8 months
exo-jcr SVN: r712 - in jcr/branches/1.12.0-JBC/component/core/src: main/java/org/exoplatform/services/jcr/impl/storage/jbosscache and 4 other directories.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2009-11-17 06:53:08 -0500 (Tue, 17 Nov 2009)
New Revision: 712
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/inmemory/InmemoryStorageConnection.java
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/JBossCacheTreeStorageConnection.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/storage/WorkspaceStorageConnection.java
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/JDBCStorageConnectionTest.java
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/ObservationCacheLoaderTest.java
Log:
EXOJCR-249 : Add methods delateNode and deleteProperty in WorkspaceStprageConnection.
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/inmemory/InmemoryStorageConnection.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/inmemory/InmemoryStorageConnection.java 2009-11-17 11:05:04 UTC (rev 711)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/inmemory/InmemoryStorageConnection.java 2009-11-17 11:53:08 UTC (rev 712)
@@ -276,4 +276,24 @@
return null;
}
+ /**
+ * {@inheritDoc}
+ */
+ public void deleteNode(String identifier) throws RepositoryException, UnsupportedOperationException,
+ InvalidItemStateException, IllegalStateException
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void deleteProperty(String identifier) throws RepositoryException, UnsupportedOperationException,
+ InvalidItemStateException, IllegalStateException
+ {
+ // TODO Auto-generated method stub
+
+ }
+
}
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-11-17 11:05:04 UTC (rev 711)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java 2009-11-17 11:53:08 UTC (rev 712)
@@ -377,6 +377,26 @@
/**
* {@inheritDoc}
*/
+ public void deleteNode(String identifier) throws RepositoryException, UnsupportedOperationException,
+ InvalidItemStateException, IllegalStateException
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void deleteProperty(String identifier) throws RepositoryException,
+ UnsupportedOperationException, InvalidItemStateException, IllegalStateException
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public ItemData getItemData(String identifier) throws RepositoryException, IllegalStateException
{
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheTreeStorageConnection.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheTreeStorageConnection.java 2009-11-17 11:05:04 UTC (rev 711)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheTreeStorageConnection.java 2009-11-17 11:53:08 UTC (rev 712)
@@ -436,4 +436,24 @@
throw new UnsupportedOperationException();
}
+ /**
+ * {@inheritDoc}
+ */
+ public void deleteNode(String identifier) throws RepositoryException, UnsupportedOperationException,
+ InvalidItemStateException, IllegalStateException
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void deleteProperty(String identifier) throws RepositoryException, UnsupportedOperationException,
+ InvalidItemStateException, IllegalStateException
+ {
+ // TODO Auto-generated method stub
+
+ }
+
}
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java 2009-11-17 11:05:04 UTC (rev 711)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java 2009-11-17 11:53:08 UTC (rev 712)
@@ -490,10 +490,30 @@
exceptionHandler.handleDeleteException(e, data);
}
}
+
+ /**
+ * {@inheritDoc}
+ */
+ public void deleteNode(String identifier) throws RepositoryException, UnsupportedOperationException,
+ InvalidItemStateException, IllegalStateException
+ {
+ // TODO Auto-generated method stub
+ }
+
/**
* {@inheritDoc}
*/
+ public void deleteProperty(String identifier) throws RepositoryException,
+ UnsupportedOperationException, InvalidItemStateException, IllegalStateException
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public void update(NodeData data) throws RepositoryException, UnsupportedOperationException,
InvalidItemStateException, IllegalStateException
{
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/storage/WorkspaceStorageConnection.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/storage/WorkspaceStorageConnection.java 2009-11-17 11:05:04 UTC (rev 711)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/storage/WorkspaceStorageConnection.java 2009-11-17 11:53:08 UTC (rev 712)
@@ -259,6 +259,42 @@
*/
void delete(NodeData data) throws RepositoryException, UnsupportedOperationException, InvalidItemStateException,
IllegalStateException;
+
+ /**
+ * Deletes <code>NodeData</code> by identifier.
+ *
+ * @param identifier
+ * the identifier of NodeData to be deleted
+ *
+ * @throws InvalidItemStateException
+ * if the data is already deleted
+ * @throws UnsupportedOperationException
+ * if operation is not supported (it is container for level 1)
+ * @throws RepositoryException
+ * if some exception occured
+ * @throws IllegalStateException
+ * if connection is closed
+ */
+ void deleteNode(String identifier) throws RepositoryException, UnsupportedOperationException, InvalidItemStateException,
+ IllegalStateException;
+
+ /**
+ * Deletes <code>PropertyData</code> by identifier.
+ *
+ * @param identifier
+ * the identifier of PropertyData to be deleted
+ *
+ * @throws InvalidItemStateException
+ * if the data is already deleted
+ * @throws UnsupportedOperationException
+ * if operation is not supported (it is container for level 1)
+ * @throws RepositoryException
+ * if some exception occured
+ * @throws IllegalStateException
+ * if connection is closed
+ */
+ void deleteProperty(String identifier) throws RepositoryException, UnsupportedOperationException, InvalidItemStateException,
+ IllegalStateException;
/**
* Deletes <code>PropertyData</code>.
Modified: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/JDBCStorageConnectionTest.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/JDBCStorageConnectionTest.java 2009-11-17 11:05:04 UTC (rev 711)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/JDBCStorageConnectionTest.java 2009-11-17 11:53:08 UTC (rev 712)
@@ -18,6 +18,12 @@
*/
package org.exoplatform.services.jcr.impl.storage;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.jcr.PropertyType;
+import javax.jcr.RepositoryException;
+
import org.exoplatform.services.jcr.JcrImplBaseTest;
import org.exoplatform.services.jcr.access.AccessControlEntry;
import org.exoplatform.services.jcr.access.PermissionType;
@@ -37,13 +43,9 @@
import org.exoplatform.services.jcr.impl.dataflow.TransientPropertyData;
import org.exoplatform.services.jcr.impl.dataflow.TransientValueData;
import org.exoplatform.services.jcr.impl.dataflow.persistent.WorkspacePersistentDataManager;
+import org.exoplatform.services.jcr.storage.WorkspaceDataContainer;
+import org.exoplatform.services.jcr.storage.WorkspaceStorageConnection;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.jcr.PropertyType;
-import javax.jcr.RepositoryException;
-
/**
* Created by The eXo Platform SAS Author : Peter Nedonosko peter.nedonosko(a)exoplatform.com.ua
* 30.01.2008
@@ -259,5 +261,27 @@
assertEquals("Wrong permission for operators", PermissionType.SET_PROPERTY, iperms.get(0));
assertEquals("Wrong permission for operators", PermissionType.ADD_NODE, iperms.get(1));
}
+
+ public void testDeleteItemsById() throws Exception
+ {
+ WorkspaceDataContainer dataContainer =
+ (WorkspaceDataContainer) session.getContainer().getComponentInstanceOfType(WorkspaceDataContainer.class);
+ List<PropertyData> propertysData = dataManager.getChildPropertiesData(testRoot);
+
+ assertNotNull(propertysData);
+ assertEquals(1, propertysData.size());
+
+ PropertyData primaryTypeData = propertysData.get(0);
+
+ WorkspaceStorageConnection connection = dataContainer.openConnection();
+
+ connection.deleteProperty(primaryTypeData.getIdentifier());
+ connection.deleteNode(testRoot.getIdentifier());
+ connection.commit();
+
+ assertNull(dataManager.getItemData(testRoot.getIdentifier()));
+ assertNull(dataManager.getItemData(primaryTypeData.getIdentifier()));
+ }
+
}
Modified: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/ObservationCacheLoaderTest.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/ObservationCacheLoaderTest.java 2009-11-17 11:05:04 UTC (rev 711)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/ObservationCacheLoaderTest.java 2009-11-17 11:53:08 UTC (rev 712)
@@ -572,6 +572,26 @@
return null;
}
+ /**
+ * {@inheritDoc}
+ */
+ public void deleteNode(String identifier) throws RepositoryException, UnsupportedOperationException,
+ InvalidItemStateException, IllegalStateException
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void deleteProperty(String identifier) throws RepositoryException, UnsupportedOperationException,
+ InvalidItemStateException, IllegalStateException
+ {
+ // TODO Auto-generated method stub
+
+ }
+
}
}
16 years, 8 months
exo-jcr SVN: r711 - in jcr/branches/1.12.0-JBC/component/core/src: main/java/org/exoplatform/services/jcr/impl/core and 7 other directories.
by do-not-reply@jboss.org
Author: nzamosenchuk
Date: 2009-11-17 06:05:04 -0500 (Tue, 17 Nov 2009)
New Revision: 711
Added:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/dataflow/LockPlainChangesLogImpl.java
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/dataflow/ItemDataConsumer.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/ACLInheritanceSupportedWorkspaceDataManager.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/LocalWorkspaceStorageDataManagerProxy.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/TransactionableDataManager.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/inmemory/InmemoryStorageConnection.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorage.java
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/JBossCacheTreeStorageConnection.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheWorkspaceDataContainer.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/storage/WorkspaceStorageConnection.java
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnectionTest.java
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/ObservationCacheLoaderTest.java
Log:
EXOJCR-242: ItemDataConsumer and WorkspaceStorageConnection (and all their implementators) extended with getLockData() and getLocksData().
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/dataflow/ItemDataConsumer.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/dataflow/ItemDataConsumer.java 2009-11-17 09:58:24 UTC (rev 710)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/dataflow/ItemDataConsumer.java 2009-11-17 11:05:04 UTC (rev 711)
@@ -22,6 +22,7 @@
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
+import org.exoplatform.services.jcr.impl.core.lock.LockData;
import java.util.List;
@@ -56,6 +57,13 @@
ItemData getItemData(String identifier) throws RepositoryException;
/**
+ * @param identifier
+ * @return
+ * LockData by given node uuid, or null if not present
+ */
+ LockData getLockData(String identifier) throws RepositoryException;
+
+ /**
* @param parentIdentifier
* @return children data
*/
@@ -79,4 +87,10 @@
* @throws RepositoryException
*/
List<PropertyData> getReferencesData(String identifier, boolean skipVersionStorage) throws RepositoryException;
+
+ /**
+ * @return
+ * List of all locks.
+ */
+ List<LockData> getLocksData() throws RepositoryException;
}
Added: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/dataflow/LockPlainChangesLogImpl.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/dataflow/LockPlainChangesLogImpl.java (rev 0)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/dataflow/LockPlainChangesLogImpl.java 2009-11-17 11:05:04 UTC (rev 711)
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.services.jcr.dataflow;
+
+import org.exoplatform.services.jcr.impl.core.lock.LockData;
+
+import java.util.ArrayList;
+
+/**
+ * This plain changes log is used to pass lock information through DataManager down to
+ * workspace persistent storage
+ *
+ * @author <a href="mailto:nikolazius@gmail.com">Nikolay Zamosenchuk</a>
+ * @version $Id$
+ *
+ */
+public class LockPlainChangesLogImpl extends PlainChangesLogImpl
+{
+ protected LockData lockData = null;
+
+ /**
+ * @param arrayList
+ * @param id
+ * @param lock
+ */
+ public LockPlainChangesLogImpl(ArrayList<ItemState> arrayList, String id, int lock)
+ {
+ super(arrayList, id, lock);
+ }
+
+ public LockData getLockData()
+ {
+ return lockData;
+ }
+
+ public void setLockData(LockData lockData)
+ {
+ this.lockData = lockData;
+ }
+
+}
Property changes on: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/dataflow/LockPlainChangesLogImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java 2009-11-17 09:58:24 UTC (rev 710)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java 2009-11-17 11:05:04 UTC (rev 711)
@@ -33,6 +33,7 @@
import org.exoplatform.services.jcr.datamodel.QPath;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
import org.exoplatform.services.jcr.impl.Constants;
+import org.exoplatform.services.jcr.impl.core.lock.LockData;
import org.exoplatform.services.jcr.impl.core.nodetype.NodeTypeManagerImpl;
import org.exoplatform.services.jcr.impl.core.version.ChildVersionRemoveVisitor;
import org.exoplatform.services.jcr.impl.core.version.VersionHistoryImpl;
@@ -1891,4 +1892,20 @@
return -i1.getData().getQPath().compareTo(i2.getData().getQPath());
}
}
+
+ /**
+ * @see org.exoplatform.services.jcr.dataflow.ItemDataConsumer#getLockData(java.lang.String)
+ */
+ public LockData getLockData(String identifier) throws RepositoryException
+ {
+ return transactionableManager.getLockData(identifier);
+ }
+
+ /**
+ * @see org.exoplatform.services.jcr.dataflow.ItemDataConsumer#getLocksData()
+ */
+ public List<LockData> getLocksData() throws RepositoryException
+ {
+ return transactionableManager.getLocksData();
+ }
}
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/ACLInheritanceSupportedWorkspaceDataManager.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/ACLInheritanceSupportedWorkspaceDataManager.java 2009-11-17 09:58:24 UTC (rev 710)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/ACLInheritanceSupportedWorkspaceDataManager.java 2009-11-17 11:05:04 UTC (rev 711)
@@ -25,6 +25,7 @@
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
+import org.exoplatform.services.jcr.impl.core.lock.LockData;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -172,4 +173,20 @@
{
return persistentManager.getCurrentTime();
}
+
+ /**
+ * @see org.exoplatform.services.jcr.dataflow.ItemDataConsumer#getLockData(java.lang.String)
+ */
+ public LockData getLockData(String identifier) throws RepositoryException
+ {
+ return persistentManager.getLockData(identifier);
+ }
+
+ /**
+ * @see org.exoplatform.services.jcr.dataflow.ItemDataConsumer#getLocksData()
+ */
+ public List<LockData> getLocksData() throws RepositoryException
+ {
+ return persistentManager.getLocksData();
+ }
}
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java 2009-11-17 09:58:24 UTC (rev 710)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java 2009-11-17 11:05:04 UTC (rev 711)
@@ -34,6 +34,7 @@
import org.exoplatform.services.jcr.datamodel.QPath;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
import org.exoplatform.services.jcr.impl.Constants;
+import org.exoplatform.services.jcr.impl.core.lock.LockData;
import org.exoplatform.services.jcr.impl.dataflow.TransientItemData;
import org.exoplatform.services.jcr.impl.storage.SystemDataContainerHolder;
import org.exoplatform.services.jcr.storage.WorkspaceDataContainer;
@@ -310,6 +311,32 @@
}
}
+ public LockData getLockData(String identifier) throws RepositoryException
+ {
+ final WorkspaceStorageConnection con = dataContainer.openConnection();
+ try
+ {
+ return con.getLockData(identifier);
+ }
+ finally
+ {
+ con.close();
+ }
+ }
+
+ public List<LockData> getLocksData() throws RepositoryException
+ {
+ final WorkspaceStorageConnection con = dataContainer.openConnection();
+ try
+ {
+ return con.getLocksData();
+ }
+ finally
+ {
+ con.close();
+ }
+ }
+
/**
* {@inheritDoc}
*/
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/LocalWorkspaceStorageDataManagerProxy.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/LocalWorkspaceStorageDataManagerProxy.java 2009-11-17 09:58:24 UTC (rev 710)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/LocalWorkspaceStorageDataManagerProxy.java 2009-11-17 11:05:04 UTC (rev 711)
@@ -31,6 +31,7 @@
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
import org.exoplatform.services.jcr.datamodel.ValueData;
+import org.exoplatform.services.jcr.impl.core.lock.LockData;
import org.exoplatform.services.jcr.impl.core.value.ValueFactoryImpl;
import org.exoplatform.services.jcr.impl.dataflow.AbstractValueData;
import org.exoplatform.services.jcr.impl.dataflow.TransientItemData;
@@ -246,4 +247,20 @@
}
return copyOfChildsProperties;
}
+
+ /**
+ * @see org.exoplatform.services.jcr.dataflow.ItemDataConsumer#getLockData(java.lang.String)
+ */
+ public LockData getLockData(String identifier) throws RepositoryException
+ {
+ return storageDataManager.getLockData(identifier);
+ }
+
+ /**
+ * @see org.exoplatform.services.jcr.dataflow.ItemDataConsumer#getLocksData()
+ */
+ public List<LockData> getLocksData() throws RepositoryException
+ {
+ return storageDataManager.getLocksData();
+ }
}
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/TransactionableDataManager.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/TransactionableDataManager.java 2009-11-17 09:58:24 UTC (rev 710)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/TransactionableDataManager.java 2009-11-17 11:05:04 UTC (rev 711)
@@ -28,6 +28,7 @@
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
import org.exoplatform.services.jcr.impl.core.SessionImpl;
+import org.exoplatform.services.jcr.impl.core.lock.LockData;
import org.exoplatform.services.jcr.impl.dataflow.persistent.LocalWorkspaceDataManagerStub;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -262,4 +263,21 @@
return storageDataManager;
}
+ /**
+ * @see org.exoplatform.services.jcr.dataflow.ItemDataConsumer#getLockData(java.lang.String)
+ */
+ public LockData getLockData(String identifier) throws RepositoryException
+ {
+ return storageDataManager.getLockData(identifier);
+ }
+
+ /**
+ * @see org.exoplatform.services.jcr.dataflow.ItemDataConsumer#getLocksData()
+ */
+ public List<LockData> getLocksData() throws RepositoryException
+ {
+ // TODO Auto-generated method stub
+ return storageDataManager.getLocksData();
+ }
+
}
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/inmemory/InmemoryStorageConnection.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/inmemory/InmemoryStorageConnection.java 2009-11-17 09:58:24 UTC (rev 710)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/inmemory/InmemoryStorageConnection.java 2009-11-17 11:05:04 UTC (rev 711)
@@ -25,6 +25,7 @@
import org.exoplatform.services.jcr.datamodel.QPathEntry;
import org.exoplatform.services.jcr.datamodel.ValueData;
import org.exoplatform.services.jcr.impl.core.JCRPath;
+import org.exoplatform.services.jcr.impl.core.lock.LockData;
import org.exoplatform.services.jcr.storage.WorkspaceStorageConnection;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -259,4 +260,20 @@
}
+ /**
+ * @see org.exoplatform.services.jcr.storage.WorkspaceStorageConnection#getLockData(java.lang.String)
+ */
+ public LockData getLockData(String identifier)
+ {
+ return null;
+ }
+
+ /**
+ * @see org.exoplatform.services.jcr.storage.WorkspaceStorageConnection#getLocksData()
+ */
+ public List<LockData> getLocksData()
+ {
+ return null;
+ }
+
}
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorage.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorage.java 2009-11-17 09:58:24 UTC (rev 710)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorage.java 2009-11-17 11:05:04 UTC (rev 711)
@@ -18,7 +18,6 @@
*/
package org.exoplatform.services.jcr.impl.storage.jbosscache;
-import org.exoplatform.services.jcr.datamodel.QPath;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
import org.jboss.cache.Fqn;
import org.jboss.cache.Node;
@@ -42,7 +41,7 @@
public static final String PROPS = "$PROPS".intern();
- public static final String OBSERVATION = "$OBSERVATION".intern();
+ public static final String LOCKS = "$LOCKS".intern();
public static final String ITEM_DATA = "$data".intern();
@@ -51,21 +50,27 @@
public static final String SESSION_ID = "$sessionId".intern();
public static final String USER_ID = "$userId".intern();
+
+ public static final String LOCK_DATA = "$lock".intern();
protected final Node<Serializable, Object> nodesRoot;
protected final Node<Serializable, Object> propsRoot;
protected final Node<Serializable, Object> sessionRoot;
+
+ protected final Node<Serializable, Object> locksRoot;
protected JBossCacheStorage(Node<Serializable, Object> nodesRoot, Node<Serializable, Object> propsRoot,
- Node<Serializable, Object> sessionRoot)
+ Node<Serializable, Object> sessionRoot, Node<Serializable, Object> locksRoot)
{
this.nodesRoot = nodesRoot;
this.propsRoot = propsRoot;
this.sessionRoot = sessionRoot;
+
+ this.locksRoot = locksRoot;
}
/**
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-11-17 09:58:24 UTC (rev 710)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java 2009-11-17 11:05:04 UTC (rev 711)
@@ -21,8 +21,8 @@
import org.exoplatform.services.jcr.datamodel.ItemData;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
-import org.exoplatform.services.jcr.datamodel.QPath;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
+import org.exoplatform.services.jcr.impl.core.lock.LockData;
import org.exoplatform.services.jcr.storage.WorkspaceStorageConnection;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -72,9 +72,9 @@
* @param cache Cache<Serializable, Object>
*/
public JBossCacheStorageConnection(Cache<Serializable, Object> cache, Node<Serializable, Object> nodesRoot,
- Node<Serializable, Object> propsRoot, Node<Serializable, Object> sessionRoot)
+ Node<Serializable, Object> propsRoot, Node<Serializable, Object> sessionRoot, Node<Serializable, Object> locksRoot)
{
- super(nodesRoot, propsRoot, sessionRoot);
+ super(nodesRoot, propsRoot, sessionRoot, locksRoot);
this.cache = cache;
}
@@ -600,4 +600,38 @@
}
}
+ /**
+ * @see org.exoplatform.services.jcr.storage.WorkspaceStorageConnection#getLockData(java.lang.String)
+ */
+ public LockData getLockData(String identifier)
+ {
+ LockData lockData = null;
+ Node<Serializable, Object> node = locksRoot.getChild(makeNodeFqn(identifier));
+ if (node != null)
+ {
+ lockData = (LockData)node.get(JBossCacheStorage.LOCK_DATA);
+ }
+ return lockData;
+ }
+
+ /**
+ * @see org.exoplatform.services.jcr.storage.WorkspaceStorageConnection#getLocksData()
+ */
+ public List<LockData> getLocksData()
+ {
+ Set<Node<Serializable, Object>> lockSet = locksRoot.getChildren();
+ List<LockData> locksData = new ArrayList<LockData>();
+ for (Node<Serializable, Object> node : lockSet)
+ {
+ if (node != null)
+ {
+ LockData lockData = (LockData)node.get(JBossCacheStorage.LOCK_DATA);
+ if (lockData != null)
+ {
+ locksData.add(lockData);
+ }
+ }
+ }
+ return locksData;
+ }
}
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheTreeStorageConnection.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheTreeStorageConnection.java 2009-11-17 09:58:24 UTC (rev 710)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheTreeStorageConnection.java 2009-11-17 11:05:04 UTC (rev 711)
@@ -18,18 +18,11 @@
*/
package org.exoplatform.services.jcr.impl.storage.jbosscache;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
-import javax.jcr.InvalidItemStateException;
-import javax.jcr.RepositoryException;
-
import org.exoplatform.services.jcr.datamodel.ItemData;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
+import org.exoplatform.services.jcr.impl.core.lock.LockData;
import org.exoplatform.services.jcr.storage.WorkspaceStorageConnection;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -37,6 +30,14 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.Node;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import javax.jcr.InvalidItemStateException;
+import javax.jcr.RepositoryException;
+
/**
* DEPRECATED - DO NOT USE!
*
@@ -419,4 +420,20 @@
}
}
+ /**
+ * @see org.exoplatform.services.jcr.storage.WorkspaceStorageConnection#getLockData(java.lang.String)
+ */
+ public LockData getLockData(String identifier)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @see org.exoplatform.services.jcr.storage.WorkspaceStorageConnection#getLocksData()
+ */
+ public List<LockData> getLocksData()
+ {
+ throw new UnsupportedOperationException();
+ }
+
}
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheWorkspaceDataContainer.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheWorkspaceDataContainer.java 2009-11-17 09:58:24 UTC (rev 710)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheWorkspaceDataContainer.java 2009-11-17 11:05:04 UTC (rev 711)
@@ -73,6 +73,8 @@
private Node<Serializable, Object> session;
+ private Node<Serializable, Object> locks;
+
/**
* JBossWorkspaceDataContainer constructor.
*
@@ -128,6 +130,7 @@
this.nodes = cacheRoot.addChild(Fqn.fromElements(JBossCacheStorage.NODES));
this.properties = cacheRoot.addChild(Fqn.fromElements(JBossCacheStorage.PROPS));
this.session = cacheRoot.addChild(Fqn.fromElements(JBossCacheStorage.SESSION));
+ this.locks = cacheRoot.addChild(Fqn.fromElements(JBossCacheStorage.LOCKS));
cache.endBatch(true);
}
@@ -177,7 +180,7 @@
// throw new RepositoryException("Container is not started");
// }
- return new JBossCacheStorageConnection(cache, nodes, properties, session);
+ return new JBossCacheStorageConnection(cache, nodes, properties, session, locks);
}
/**
@@ -191,7 +194,7 @@
// throw new RepositoryException("Container is not started");
// }
- return new JBossCacheStorageConnection(cache, nodes, properties, session);
+ return new JBossCacheStorageConnection(cache, nodes, properties, session, locks);
}
/**
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java 2009-11-17 09:58:24 UTC (rev 710)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java 2009-11-17 11:05:04 UTC (rev 711)
@@ -33,6 +33,7 @@
import org.exoplatform.services.jcr.datamodel.QPathEntry;
import org.exoplatform.services.jcr.datamodel.ValueData;
import org.exoplatform.services.jcr.impl.Constants;
+import org.exoplatform.services.jcr.impl.core.lock.LockData;
import org.exoplatform.services.jcr.impl.dataflow.persistent.ByteArrayPersistedValueData;
import org.exoplatform.services.jcr.impl.dataflow.persistent.CleanableFileStreamValueData;
import org.exoplatform.services.jcr.impl.storage.JCRInvalidItemStateException;
@@ -698,6 +699,24 @@
}
/**
+ * @see org.exoplatform.services.jcr.storage.WorkspaceStorageConnection#getLockData(java.lang.String)
+ */
+ public LockData getLockData(String identifier)
+ {
+ // TODO Add logic HERE! Need to store locks some where
+ return null;
+ }
+
+ /**
+ * @see org.exoplatform.services.jcr.storage.WorkspaceStorageConnection#getLocksData()
+ */
+ public List<LockData> getLocksData()
+ {
+ // TODO Add logic HERE! Need to store locks some where
+ return null;
+ }
+
+ /**
* {@inheritDoc}
*/
public void addSessionInfo(String sessionId) throws RepositoryException
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/storage/WorkspaceStorageConnection.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/storage/WorkspaceStorageConnection.java 2009-11-17 09:58:24 UTC (rev 710)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/storage/WorkspaceStorageConnection.java 2009-11-17 11:05:04 UTC (rev 711)
@@ -22,6 +22,7 @@
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
+import org.exoplatform.services.jcr.impl.core.lock.LockData;
import java.util.List;
@@ -333,4 +334,17 @@
* @return boolean, true if connection is open and ready, false - otherwise
*/
boolean isOpened();
+
+ /**
+ * @param identifier
+ * @return
+ * LockData by given node uuid, or null if not present
+ */
+ LockData getLockData(String identifier);
+
+ /**
+ * @return
+ * List of all locks.
+ */
+ List<LockData> getLocksData();
}
Modified: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnectionTest.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnectionTest.java 2009-11-17 09:58:24 UTC (rev 710)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnectionTest.java 2009-11-17 11:05:04 UTC (rev 711)
@@ -62,6 +62,8 @@
protected Node<Serializable, Object> session;
+ protected Node<Serializable, Object> locks;
+
protected String jbcConfig;
/**
@@ -88,9 +90,10 @@
nodes = cacheRoot.addChild(Fqn.fromString(JBossCacheStorage.NODES));
props = cacheRoot.addChild(Fqn.fromString(JBossCacheStorage.PROPS));
session = cacheRoot.addChild(Fqn.fromString(JBossCacheStorage.SESSION));
+ locks = cacheRoot.addChild(Fqn.fromString(JBossCacheStorage.SESSION));
// JCR connection
- conn = new JBossCacheStorageConnection(cache, nodes, props, session);
+ conn = new JBossCacheStorageConnection(cache, nodes, props, session, locks);
}
protected void initJBCConfig()
Modified: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/ObservationCacheLoaderTest.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/ObservationCacheLoaderTest.java 2009-11-17 09:58:24 UTC (rev 710)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/ObservationCacheLoaderTest.java 2009-11-17 11:05:04 UTC (rev 711)
@@ -37,6 +37,7 @@
import org.exoplatform.services.jcr.datamodel.QPathEntry;
import org.exoplatform.services.jcr.impl.Constants;
import org.exoplatform.services.jcr.impl.core.LocationFactory;
+import org.exoplatform.services.jcr.impl.core.lock.LockData;
import org.exoplatform.services.jcr.impl.core.observation.ListenerCriteria;
import org.exoplatform.services.jcr.impl.core.observation.ObservationManagerRegistry;
import org.exoplatform.services.jcr.impl.dataflow.TransientNodeData;
@@ -555,6 +556,22 @@
{
}
+ /**
+ * @see org.exoplatform.services.jcr.storage.WorkspaceStorageConnection#getLockData(java.lang.String)
+ */
+ public LockData getLockData(String identifier)
+ {
+ return null;
+ }
+
+ /**
+ * @see org.exoplatform.services.jcr.storage.WorkspaceStorageConnection#getLocksData()
+ */
+ public List<LockData> getLocksData()
+ {
+ return null;
+ }
+
}
}
16 years, 8 months
exo-jcr SVN: r710 - in kernel/branches/mc-int-branch: org.jboss.mc-kernel-extras and 1 other directory.
by do-not-reply@jboss.org
Author: mstruk
Date: 2009-11-17 04:58:24 -0500 (Tue, 17 Nov 2009)
New Revision: 710
Removed:
kernel/branches/mc-int-branch/exo.kernel.demos/custom-pojo/
Modified:
kernel/branches/mc-int-branch/org.jboss.mc-kernel-extras/pom.xml
Log:
Incremented mc-kernel-extras version to be in sync with the rest of the project + removed uncooked custom-pojo demo
Modified: kernel/branches/mc-int-branch/org.jboss.mc-kernel-extras/pom.xml
===================================================================
--- kernel/branches/mc-int-branch/org.jboss.mc-kernel-extras/pom.xml 2009-11-17 09:23:05 UTC (rev 709)
+++ kernel/branches/mc-int-branch/org.jboss.mc-kernel-extras/pom.xml 2009-11-17 09:58:24 UTC (rev 710)
@@ -10,7 +10,7 @@
</parent>
<artifactId>mc-kernel-extras</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>2.2.0-Beta03-SNAPSHOT</version>
<name>MC Kernel 2.2.0 Selected Classes</name>
<description>MC integration classes that aren't available in mc-kernel 2.0.6.GA</description>
16 years, 8 months
exo-jcr SVN: r709 - kernel/branches/mc-int-branch.
by do-not-reply@jboss.org
Author: mstruk
Date: 2009-11-17 04:23:05 -0500 (Tue, 17 Nov 2009)
New Revision: 709
Modified:
kernel/branches/mc-int-branch/pom.xml
Log:
Incremented parent pom to release version
Modified: kernel/branches/mc-int-branch/pom.xml
===================================================================
--- kernel/branches/mc-int-branch/pom.xml 2009-11-16 17:41:46 UTC (rev 708)
+++ kernel/branches/mc-int-branch/pom.xml 2009-11-17 09:23:05 UTC (rev 709)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.exoplatform</groupId>
<artifactId>foundation-parent</artifactId>
- <version>3-SNAPSHOT</version>
+ <version>3</version>
</parent>
<groupId>org.exoplatform.kernel</groupId>
16 years, 8 months