Author: skabashnyuk
Date: 2009-12-15 05:44:57 -0500 (Tue, 15 Dec 2009)
New Revision: 1054
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java
Log:
EXOJCR-199: Nicolas suggestion applied in getItemData(String uuid) method. Direct cache
access
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-12-15
09:27:30 UTC (rev 1053)
+++
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java 2009-12-15
10:44:57 UTC (rev 1054)
@@ -78,7 +78,7 @@
private final Cache<Serializable, Object> cache;
private final WorkspaceDataContainer dataContainer;
-
+
/**
* Start batching flag. 'true' if batching was started, 'false' if
batching is not start.
*/
@@ -104,8 +104,9 @@
* @param cache Cache<Serializable, Object>
* @param refs
*/
- public JBossCacheStorageConnection(WorkspaceDataContainer dataContainer,
Cache<Serializable, Object> cache, Node<Serializable, Object> nodesRoot,
- Node<Serializable, Object> propsRoot, Node<Serializable, Object>
locksRoot, Node<Serializable, Object> refsRoot)
+ public JBossCacheStorageConnection(WorkspaceDataContainer dataContainer,
Cache<Serializable, Object> cache,
+ Node<Serializable, Object> nodesRoot, Node<Serializable, Object>
propsRoot, Node<Serializable, Object> locksRoot,
+ Node<Serializable, Object> refsRoot)
{
super(nodesRoot, propsRoot, locksRoot, refsRoot);
@@ -220,7 +221,7 @@
throw new InvalidItemStateException("Property's parent doesn't
exist or removed by another Session "
+ data.getQPath().getAsString());
}
-
+
String propName = data.getQPath().getName().getAsString();
Object value =
cache.put(Fqn.fromRelativeFqn(Fqn.fromElements(JBossCacheStorage.NODES),
makeNodeFqn(data
@@ -242,7 +243,8 @@
}
// REFERENCEs hadnling
- if (data.getType() == PropertyType.REFERENCE) {
+ if (data.getType() == PropertyType.REFERENCE)
+ {
addReferences(data);
}
}
@@ -543,39 +545,14 @@
public ItemData getItemData(String identifier) throws RepositoryException,
IllegalStateException
{
- Node<Serializable, Object> node =
nodesRoot.getChild(makeNodeFqn(identifier));
- if (node != null)
+ ItemData object =
+
(ItemData)cache.get(Fqn.fromRelativeFqn(Fqn.fromElements(JBossCacheStorage.NODES),
makeNodeFqn(identifier)),
+ ITEM_DATA);
+ if (object != null && !object.isNode())
{
- NodeData itemData = (NodeData)node.get(ITEM_DATA);
- if (itemData != null)
- {
- return itemData;
- }
- else
- {
- throw new RepositoryException("FATAL NodeData empty " +
identifier);
- }
+ throw new RepositoryException("FATAL NodeData empty " + identifier);
}
-
- // TODO only Nodes by Id
- // else
- // {
- // Node<Serializable, Object> prop =
propsRoot.getChild(makePropFqn(identifier));
- // if (prop != null)
- // {
- // Object itemData = prop.get(ITEM_DATA);
- // if (itemData != null)
- // {
- // return (PropertyData)itemData;
- // }
- // else
- // {
- // throw new RepositoryException("FATAL PropertyData empty
" + identifier);
- // }
- // }
- // }
-
- return null;
+ return object;
}
/**