[exo-jcr-commits] exo-jcr SVN: r647 - 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
Fri Nov 13 08:51:51 EST 2009
Author: areshetnyak
Date: 2009-11-13 08:51:51 -0500 (Fri, 13 Nov 2009)
New Revision: 647
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java
Log:
EXOJCR-201 : The JDBCCacheLoader was changed.
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-13 13:49:45 UTC (rev 646)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java 2009-11-13 13:51:51 UTC (rev 647)
@@ -87,10 +87,8 @@
*/
public void put(List<Modification> modifications) throws Exception
{
- LOG.info(modifications);
-
// Prepare modifications list.
- // Will be changed Modification to ModificationEx and set operation type (ADD or UPDATE).
+ // Will be added oldValueData to modification for UPDATE.
prepareModifications(modifications);
JDBCStorageConnection jdbcConnection = (JDBCStorageConnection)dataContainer.openConnection();
@@ -102,13 +100,10 @@
switch (m.getType())
{
case PUT_DATA:
- LOG.info(m);
break;
case PUT_DATA_ERASE:
- LOG.info(m);
break;
case PUT_KEY_VALUE:
- LOG.info(m);
if (m.getOldValue() != null)
doUpdate(m, jdbcConnection);
@@ -117,17 +112,14 @@
break;
case REMOVE_DATA:
- LOG.info(m);
break;
case REMOVE_KEY_VALUE:
- LOG.info(m);
break;
case REMOVE_NODE:
- LOG.info(m);
+
doRemove(m, jdbcConnection);
break;
case MOVE:
- LOG.info(m);
break;
default:
throw new CacheException("Unknown modification " + m.getType());
@@ -278,7 +270,8 @@
modifications.get(i).setOldValue(itemData);
}
}
- else if (m.getType() == ModificationType.REMOVE_NODE)
+ //TODO for REMOVE is not need removed ItemData
+ /*else if (m.getType() == ModificationType.REMOVE_NODE)
{
if (m.getFqn().size() == 2
&& (m.getFqn().get(0).equals(JBossCacheStorage.NODES)
@@ -291,7 +284,7 @@
if (removedItemData != null)
modifications.get(i).setValue(removedItemData);
}
- }
+ }*/
}
}
@@ -398,67 +391,6 @@
}
return (attrs.size() == 0 ? null : attrs);
- /*if (name.size() > 1)
- {
- if (name.get(1).equals(JBossCacheStorage.NODES))
- {
- // return Node
- if (name.size() > 3)
- {
- QPathEntry nodeName = QPathEntry.parse(name.getLastElementAsString());
-
- // 1) all subtree will be cached
- // 2) all subtree will be read from DB (with allprops) for only Ids.
- // The effective way DON NOT use calls to cache and use special SQLs for Ids only read.
- String parentId = (String)cache.get(name.getParent(), JBossCacheStorage.ITEM_ID);
-
- WorkspaceStorageConnection conn = dataContainer.openConnection();
- try
- {
- NodeData parent = (NodeData)conn.getItemData(parentId);
-
- ItemData item = conn.getItemData(parent, nodeName);
-
- // item Id
- attrs.put(JBossCacheStorage.ITEM_ID, item.getIdentifier());
-
- // if Node (Property cannot due to logic of StorageConnection) add props
- for (PropertyData prop : conn.getChildPropertiesData(parent))
- {
- attrs.put(prop.getQPath().getName().getAsString(), prop.getIdentifier());
- }
- }
- finally
- {
- conn.close();
- }
- }
- else
- {
- // root Node (/$TREE/[]:1)
- attrs.put(JBossCacheStorage.ITEM_ID, Constants.ROOT_UUID);
- }
- }
- else if (name.get(1).equals(JBossCacheStorage.NODES))
- {
- // we have all data on thrid level
- if (name.size() == 3)
- {
- // return Node or Property
- String itemId = name.getLastElementAsString();
-
- WorkspaceStorageConnection conn = dataContainer.openConnection();
- try
- {
- attrs.put(JBossCacheStorage.ITEM_DATA, conn.getItemData(itemId));
- }
- finally
- {
- conn.close();
- }
- }
- }
- }*/
}
/**
@@ -508,76 +440,6 @@
}
return (childs.size() == 0 ? null : childs);
-
-/* Set<String> childs = new LinkedHashSet<String>();
- if (fqn.size() > 2)
- {
- if (fqn.get(2).equals(JBossCacheStorage.NODES))
- {
- // return Node
- if (fqn.size() > 3)
- {
- QPathEntry nodeName = QPathEntry.parse(fqn.getLastElementAsString());
-
- // TODO non effective, in this way 1) all subtree will be cached
- // 2) all subtree will be read from DB (with allprops) for only Ids.
- // The effective way DON NOT use calls to cache and use special SQLs for Ids only read.
- String parentId = (String)cache.get(fqn.getParent(), JBossCacheStorage.ITEM_ID);
-
- WorkspaceStorageConnection conn = dataContainer.openConnection();
- try
- {
- NodeData parent = (NodeData)conn.getItemData(parentId);
-
- NodeData node = (NodeData)conn.getItemData(parent, nodeName);
-
- // get child nodes by parent Id
- for (NodeData prop : conn.getChildNodesData(node))
- {
- childs
- .add(node.getQPath().getEntries()[node.getQPath().getEntries().length - 1].getAsString(true));
- }
- }
- finally
- {
- conn.close();
- }
- }
- else
- {
- // root Node (/$TREE/[]:1)
- childs.add(Constants.ROOT_PATH.getEntries()[Constants.ROOT_PATH.getEntries().length - 1]
- .getAsString(true));
- }
- }
- else if (fqn.get(2).equals(JBossCacheStorage.NODES))
- {
- // we have all data on thrid level
- if (fqn.size() == 3)
- {
- // return all Nodes and Properties Ids
-
-// WorkspaceStorageConnection conn = dataContainer.openConnection();
-// try
-// {
-// for (String itemId : conn.getAllItemIdentifiers())
-// {
-// childs.add(itemId);
-// }
-// }
-// finally
-// {
-// conn.close();
-// }
- }
- }
- }
- else if (fqn.equals(Fqn.ROOT))
- {
- childs.add(JBossCacheStorage.NODES);
- childs.add(JBossCacheStorage.PROPS);
- }
- return childs;*/
}
/**
More information about the exo-jcr-commits
mailing list