[exo-jcr-commits] exo-jcr SVN: r941 - 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
Tue Dec 8 05:18:28 EST 2009
Author: sergiykarpenko
Date: 2009-12-08 05:18:27 -0500 (Tue, 08 Dec 2009)
New Revision: 941
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java
Log:
EXOJCR-286: root Fqn ("", "/", zero size) support added to JDBCCacheLoader
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-12-08 09:08:28 UTC (rev 940)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java 2009-12-08 10:18:27 UTC (rev 941)
@@ -19,7 +19,6 @@
package org.exoplatform.services.jcr.impl.storage.jbosscache;
import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
-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;
@@ -33,7 +32,6 @@
import org.jboss.cache.CacheException;
import org.jboss.cache.Fqn;
import org.jboss.cache.Modification;
-import org.jboss.cache.Modification.ModificationType;
import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.loader.AbstractCacheLoader;
@@ -203,7 +201,7 @@
RepositoryException
{
Fqn fqn = IdTreeHelper.buildFqn(modification.getFqn());
-
+
if (fqn.size() == 2)
{
String identifier = (String)fqn.get(1);
@@ -257,7 +255,7 @@
private void doUpdate(Modification m, JDBCStorageConnection conn) throws IllegalStateException, RepositoryException
{
Fqn fqn = IdTreeHelper.buildFqn(m.getFqn());
-
+
if (fqn.size() == 2 && m.getValue() instanceof TransientItemData)
{
//Check flag it's mixin update for node, if this flag set we have node need to
@@ -304,8 +302,7 @@
*/
public Map<Object, Object> get(Fqn fqn) throws Exception
{
- Fqn name = ( fqn.size() > 1 ? IdTreeHelper.buildFqn(fqn) : fqn);
-
+ Fqn name = (fqn.size() > 1 ? IdTreeHelper.buildFqn(fqn) : fqn);
Map<Object, Object> attrs;
JDBCStorageConnection conn = (JDBCStorageConnection)dataContainer.openConnection();
@@ -437,9 +434,9 @@
}
}
}
- else if (name.equals(Fqn.ROOT) || name.get(0).equals(JBossCacheStorage.PROPS)
- || name.get(0).equals(JBossCacheStorage.NODES) || name.get(0).equals(JBossCacheStorage.LOCKS)
- || name.get(0).equals(JBossCacheStorage.REFS))
+ else if (name.isRoot() || name.equals(Fqn.ROOT) || name.getLastElementAsString().equals("/")
+ || name.get(0).equals(JBossCacheStorage.PROPS) || name.get(0).equals(JBossCacheStorage.NODES)
+ || name.get(0).equals(JBossCacheStorage.LOCKS) || name.get(0).equals(JBossCacheStorage.REFS))
{
// roots, like NODES, PROPS etc
attrs = new LinkedHashMap<Object, Object>();
@@ -465,8 +462,8 @@
{
JDBCStorageConnection conn = (JDBCStorageConnection)dataContainer.openConnection();
- Fqn name = ( fqn.size() > 1 ? IdTreeHelper.buildFqn(fqn) : fqn);
-
+ Fqn name = (fqn.size() > 1 ? IdTreeHelper.buildFqn(fqn) : fqn);
+
boolean exists;
try
@@ -567,9 +564,9 @@
}
}
}
- else if (name.equals(Fqn.ROOT) || name.get(0).equals(JBossCacheStorage.PROPS)
- || name.get(0).equals(JBossCacheStorage.NODES) || name.get(0).equals(JBossCacheStorage.LOCKS)
- || name.get(0).equals(JBossCacheStorage.REFS))
+ else if (name.isRoot() || name.equals(Fqn.ROOT) || name.getLastElementAsString().equals("/")
+ || name.get(0).equals(JBossCacheStorage.PROPS) || name.get(0).equals(JBossCacheStorage.NODES)
+ || name.get(0).equals(JBossCacheStorage.LOCKS) || name.get(0).equals(JBossCacheStorage.REFS))
{
// roots, like NODES, PROPS etc
exists = true;
@@ -594,13 +591,13 @@
public Set<?> getChildrenNames(Fqn fqn) throws Exception
{
// return child nodes names
-
+
//to sub Fqn (example /$LOCKS/5/4/3)
- if (IdTreeHelper.isSubFqn(fqn))
- return null;
-
- Fqn name = ( fqn.size() >= 2 ? IdTreeHelper.buildFqn(fqn) : fqn);
+ // if (IdTreeHelper.isSubFqn(fqn))
+ // return null;
+ Fqn name = (fqn.size() >= 2 ? IdTreeHelper.buildFqn(fqn) : fqn);
+
JDBCStorageConnection conn = (JDBCStorageConnection)dataContainer.openConnection();
try
{
@@ -625,6 +622,15 @@
return null;
}
}
+ else if (name.isRoot() || name.get(0).equals(Fqn.ROOT) || name.getLastElementAsString().equals("/"))
+ {
+ Set<String> childs = new LinkedHashSet<String>();
+ childs.add(JBossCacheStorage.NODES);
+ childs.add(JBossCacheStorage.PROPS);
+ childs.add(JBossCacheStorage.LOCKS);
+ childs.add(JBossCacheStorage.REFS);
+ return childs;
+ }
else if (name.size() > 2)
{
// seems it is fqn like /$NODES/nodeUUID/childname[/...] or /$REFS/nodeUUID/propUUUIS[/...]
@@ -653,15 +659,6 @@
{
return null/*conn.getAllRefencedNodeIdentifiers()*/;
}
- else if (name.get(0).equals(Fqn.ROOT))
- {
- Set<String> childs = new LinkedHashSet<String>();
- childs.add(JBossCacheStorage.NODES);
- childs.add(JBossCacheStorage.PROPS);
- childs.add(JBossCacheStorage.LOCKS);
- childs.add(JBossCacheStorage.REFS);
- return childs;
- }
else
{
return null;
More information about the exo-jcr-commits
mailing list