Author: pnedonosko
Date: 2009-11-19 05:56:39 -0500 (Thu, 19 Nov 2009)
New Revision: 764
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/JDBCCacheLoader.java
Log:
EXOJCR-248: get childs optimization (some fixes)
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-19
09:25:25 UTC (rev 763)
+++
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java 2009-11-19
10:56:39 UTC (rev 764)
@@ -190,40 +190,46 @@
*/
public List<NodeData> getChildNodesData(NodeData parent) throws
RepositoryException, IllegalStateException
{
+ List<NodeData> childs = new ArrayList<NodeData>();
Node<Serializable, Object> parentNode =
nodesRoot.getChild(makeNodeFqn(parent.getIdentifier()));
- if (parentNode == null)
+ if (parentNode != null)
{
- throw new IllegalStateException("FATAL Get child Nodes: parent not found
" + parent.getQPath().getAsString());
- }
- Set<Node<Serializable, Object>> childNodes = parentNode.getChildren();
-
- List<NodeData> childs = new ArrayList<NodeData>();
- for (Node<Serializable, Object> child : childNodes)
- {
- String nodeId = (String)child.get(ITEM_ID);
- if (nodeId == null)
+ Set<Node<Serializable, Object>> childNodes =
parentNode.getChildren();
+ for (Node<Serializable, Object> child : childNodes)
{
- throw new RepositoryException("FATAL Child Node Id key is null. Parent
" + parent.getQPath().getAsString());
- }
+ String nodeId = (String)child.get(ITEM_ID);
+ if (nodeId == null)
+ {
+ throw new RepositoryException("FATAL Child Node Id key is null.
Parent "
+ + parent.getQPath().getAsString());
+ }
- // TODO NodeData or PropertyData? As ItemData check then and cast.
- Node<Serializable, Object> node =
nodesRoot.getChild(makeNodeFqn(nodeId));
- if (node == null)
- {
- throw new RepositoryException("FATAL Node record not found(" +
nodeId + "), but listed in proprties of "
- + parent.getQPath().getAsString());
+ // TODO NodeData or PropertyData? As ItemData check then and cast.
+ Node<Serializable, Object> node =
nodesRoot.getChild(makeNodeFqn(nodeId));
+ if (node == null)
+ {
+ throw new RepositoryException("FATAL Node record not found(" +
nodeId + "), but listed in proprties of "
+ + parent.getQPath().getAsString());
+ }
+ NodeData nodeData = (NodeData)node.get(ITEM_DATA);
+ if (nodeData == null)
+ {
+ // TODO should not occurs by contract
+ throw new RepositoryException("Child node data is null. Parent "
+ parent.getQPath().getAsString());
+ }
+ childs.add(nodeData);
}
- NodeData nodeData = (NodeData)node.get(ITEM_DATA);
- if (nodeData == null)
- {
- // TODO should not occurs by contract
- throw new RepositoryException("Child node data is null. Parent " +
parent.getQPath().getAsString());
- }
- childs.add(nodeData);
}
+ else
+ {
+ LOG.warn("FATAL Get child Nodes: parent not found " +
parent.getQPath().getAsString());
+ // TODO should be Exception, but after OPT branch optimization merge, current
impl requires it as null returned
+ // throw new RepositoryException("FATAL Get child Nodes: parent not found
" + parent.getQPath().getAsString());
+ }
+
return childs;
}
@@ -248,43 +254,50 @@
*/
public List<PropertyData> getChildPropertiesData(NodeData parent) throws
RepositoryException, IllegalStateException
{
+ List<PropertyData> childs = new ArrayList<PropertyData>();
+
Node<Serializable, Object> parentNode =
nodesRoot.getChild(makeNodeFqn(parent.getIdentifier()));
- if (parentNode == null)
+ if (parentNode != null)
{
- throw new IllegalStateException("FATAL Get child Properties: parent not
found "
- + parent.getQPath().getAsString());
- }
- List<PropertyData> childs = new ArrayList<PropertyData>();
-
- for (Serializable key : parentNode.getKeys())
- {
- if (!key.equals(ITEM_DATA))
+ for (Serializable key : parentNode.getKeys())
{
- String propId = (String)parentNode.get(key);
- if (propId == null)
+ if (!key.equals(ITEM_DATA))
{
- throw new RepositoryException("FATAL Child Property Id key is null.
Parent "
- + parent.getQPath().getAsString());
- }
+ String propId = (String)parentNode.get(key);
+ if (propId == null)
+ {
+ throw new RepositoryException("FATAL Child Property Id key is
null. Parent "
+ + parent.getQPath().getAsString());
+ }
- Node<Serializable, Object> prop =
propsRoot.getChild(makePropFqn(propId));
- if (prop == null)
- {
- throw new RepositoryException("FATAL Property record not found("
+ propId
- + "), but listed in proprties of " +
parent.getQPath().getAsString());
- }
+ Node<Serializable, Object> prop =
propsRoot.getChild(makePropFqn(propId));
+ if (prop == null)
+ {
+ throw new RepositoryException("FATAL Property record not
found(" + propId
+ + "), but listed in proprties of " +
parent.getQPath().getAsString());
+ }
- PropertyData propData = (PropertyData)prop.get(ITEM_DATA);
- if (propData == null)
- {
- throw new RepositoryException("FATAL Property data is null. Parent
" + parent.getQPath().getAsString());
+ PropertyData propData = (PropertyData)prop.get(ITEM_DATA);
+ if (propData == null)
+ {
+ throw new RepositoryException("FATAL Property data is null. Parent
"
+ + parent.getQPath().getAsString());
+ }
+
+ childs.add(propData);
}
-
- childs.add(propData);
}
}
+ else
+ {
+ LOG.warn("FATAL Get child Properties: parent not found " +
parent.getQPath().getAsString());
+ // TODO should be Exception, but after OPT branch optimization merge, current
impl requires it as null returned
+ //throw new IllegalStateException("FATAL Get child Properties: parent not
found "
+ // + parent.getQPath().getAsString());
+ }
+
return childs;
}
@@ -369,8 +382,12 @@
}
else
{
- throw new RepositoryException("FATAL Parent not found " +
parentData.getQPath().getAsString() + " for "
- + name.getAsString(true));
+ LOG
+ .warn("FATAL Parent not found " +
parentData.getQPath().getAsString() + " for " + name.getAsString(true));
+
+ // TODO should be Exception, but after OPT branch optimization merge, current
impl requires it as null returned
+ //throw new RepositoryException("FATAL Parent not found " +
parentData.getQPath().getAsString() + " for "
+ // + name.getAsString(true));
}
}
@@ -448,7 +465,7 @@
NodeData oldNodeData = (NodeData)node.put(ITEM_DATA, data);
if (oldNodeData == null)
{
- throw new RepositoryException("FATAL NodeData is empty " +
data.getQPath().getAsString());
+ throw new RepositoryException("FATAL NodeData is empty " +
data.getQPath().getAsString());
}
// 2. remove renamed node from child list of previous parent node
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-19
09:25:25 UTC (rev 763)
+++
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java 2009-11-19
10:56:39 UTC (rev 764)
@@ -107,7 +107,7 @@
switch (m.getType())
{
case PUT_DATA :
- LOG.warn("PUT_DATA modification");
+ //LOG.warn("PUT_DATA modification");
break;
case PUT_DATA_ERASE :
LOG.warn("PUT_DATA_ERASE modification");
Show replies by date