[exo-jcr-commits] exo-jcr SVN: r3393 - in jcr/branches/1.14-ISPN/exo.jcr.component.core/src: main/java/org/exoplatform/services/jcr/dataflow/persistent and 26 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Thu Nov 4 03:54:56 EDT 2010
Author: tolusha
Date: 2010-11-04 03:54:54 -0400 (Thu, 04 Nov 2010)
New Revision: 3393
Added:
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/ItemType.java
Modified:
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/ItemDataConsumer.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/TransactionChangesLog.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/persistent/WorkspaceStorageCache.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ItemImpl.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NamespaceDataPersister.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionImpl.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/WorkspaceImpl.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/FileSystemLockPersister.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/LockManagerImpl.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/cacheable/AbstractCacheableLockManager.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/jdbc/CacheableJDBCLockManagerImpl.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/ItemAutocreator.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/NodeTypeDataManagerImpl.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/AbstractItemDefinitionAccessProvider.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/JCRNodeTypeDataPersister.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/NodeDefinitionComparator.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/PropertyDefinitionComparator.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/AggregateRuleImpl.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/LuceneQueryBuilder.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SharedFieldSortComparator.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/FrozenNodeInitializer.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/ItemDataMergeVisitor.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/ItemDataRestoreVisitor.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/VersionHistoryImpl.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/VersionImpl.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/ACLInheritanceSupportedWorkspaceDataManager.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheQPath.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/VersionableWorkspaceDataManager.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheQPath.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/ISPNCacheWorkspaceStorageCache.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/LocalWorkspaceStorageDataManagerProxy.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/SessionChangesLog.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/TransactionableDataManager.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/version/VersionHistoryDataHelper.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/inmemory/InmemoryStorageConnection.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/SQLExceptionHandler.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/statistics/StatisticsJDBCStorageConnection.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/VersionHistoryRemover.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/importing/BaseXmlImporter.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/storage/WorkspaceStorageConnection.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestGetNode.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestSessionDataManager.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestCacheableWorkspaceDataManager.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestLinkedCacheMultithread.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspaceStorageCacheBaseCase.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/JDBCHWDCTest.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/JDBCStorageConnectionTest.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/StorageUpdateTest.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/fs/TestJCRVSReadWrite.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/jdbc/SQLBenchmarkTest.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/version/TestFrozenNodeInitializer.java
Log:
EXOJCR-1005: ISPN branch must support the ItemTypes
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/ItemDataConsumer.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/ItemDataConsumer.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/ItemDataConsumer.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -19,6 +19,7 @@
package org.exoplatform.services.jcr.dataflow;
import org.exoplatform.services.jcr.datamodel.ItemData;
+import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
@@ -44,14 +45,31 @@
/**
* Find Item by parent (id) and name (with path index).
*
- * @param parent NodeData
- * @param name QPathEntry
+ * @param parent
+ * NodeData
+ * @param name
+ * item name
* @return ItemData, data by parent and name
* @throws RepositoryException
*/
+ @Deprecated
ItemData getItemData(NodeData parent, QPathEntry name) throws RepositoryException;
/**
+ * Find Item by parent (id) and name (with path index) of define type.
+ *
+ * @param parent
+ * NodeData
+ * @param name
+ * item name
+ * @param itemType
+ * itemType
+ * @return ItemData, data by parent and name
+ * @throws RepositoryException
+ */
+ ItemData getItemData(NodeData parent, QPathEntry name, ItemType itemType) throws RepositoryException;
+
+ /**
* Find Item by identifier.
*
* @param String identifier
@@ -73,7 +91,7 @@
* @return int, child nodes count
*/
int getChildNodesCount(NodeData parent) throws RepositoryException;
-
+
/**
* Get child Properties of the parent node.
*
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/TransactionChangesLog.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/TransactionChangesLog.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/TransactionChangesLog.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -18,8 +18,8 @@
*/
package org.exoplatform.services.jcr.dataflow;
-import org.exoplatform.services.jcr.datamodel.IllegalPathException;
import org.exoplatform.services.jcr.datamodel.ItemData;
+import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
import org.exoplatform.services.jcr.impl.Constants;
@@ -139,14 +139,15 @@
return null;
}
- public ItemState getItemState(NodeData parentData, QPathEntry name)
+ public ItemState getItemState(NodeData parentData, QPathEntry name, ItemType itemType)
{
List<ItemState> allStates = getAllStates();
for (int i = allStates.size() - 1; i >= 0; i--)
{
ItemState state = allStates.get(i);
if (state.getData().getParentIdentifier().equals(parentData.getIdentifier())
- && state.getData().getQPath().getEntries()[state.getData().getQPath().getEntries().length - 1].isSame(name))
+ && state.getData().getQPath().getEntries()[state.getData().getQPath().getEntries().length - 1].isSame(name)
+ && itemType.isSuitableFor(state.getData()))
return state;
}
return null;
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/persistent/WorkspaceStorageCache.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/persistent/WorkspaceStorageCache.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/persistent/WorkspaceStorageCache.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -19,6 +19,7 @@
package org.exoplatform.services.jcr.dataflow.persistent;
import org.exoplatform.services.jcr.datamodel.ItemData;
+import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
@@ -44,12 +45,28 @@
* Get item by parent identifier and name +index.
*
* @param parentIdentifier
- * @param path
- * @return itemData by parent Identifier and item name with index or null if not found
+ * parent identifier
+ * @param name
+ * item name
+ * @return itemData by parent Identifier and item name with index or null in other case
*/
+ @Deprecated
ItemData get(String parentIdentifier, QPathEntry name);
/**
+ * Get item by parent identifier and name +index of define type.
+ *
+ * @param parentIdentifier
+ * parent identifier
+ * @param name
+ * item name
+ * @param itemType
+ * item type
+ * @return itemData by parent Identifier and item name with index of define type or null in other case
+ */
+ ItemData get(String parentIdentifier, QPathEntry name, ItemType itemType);
+
+ /**
* Get item by identifier.
*
* @param identifier
Added: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/ItemType.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/ItemType.java (rev 0)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/ItemType.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -0,0 +1,34 @@
+package org.exoplatform.services.jcr.datamodel;
+
+
+/**
+ * Class contains enumerated item types. Is used in methods to indicate what need exactly get: node or property.
+ */
+public enum ItemType {
+ UNKNOWN, NODE, PROPERTY;
+
+ /**
+ * Indicate if item type suit for ItemData.
+ *
+ * @param itemData
+ * ItemData
+ * @return true if item type is UNKNOWN type or the same as ItemData and false in other case
+ */
+ public boolean isSuitableFor(ItemData itemData)
+ {
+ boolean isNode = itemData.isNode();
+ return this == UNKNOWN || this == NODE && isNode || this == PROPERTY && !isNode;
+ }
+
+ /**
+ * Return item type based on ItemData.
+ *
+ * @param itemData
+ * item data
+ * @return ItemType
+ */
+ public static ItemType getItemType(ItemData itemData)
+ {
+ return itemData.isNode() ? ItemType.NODE : ItemType.PROPERTY;
+ }
+}
\ No newline at end of file
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ItemImpl.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ItemImpl.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ItemImpl.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -33,6 +33,7 @@
import org.exoplatform.services.jcr.datamodel.Identifier;
import org.exoplatform.services.jcr.datamodel.InternalQName;
import org.exoplatform.services.jcr.datamodel.ItemData;
+import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPath;
@@ -387,7 +388,8 @@
if (ntManager.isNodeType(Constants.MIX_VERSIONABLE, node.getPrimaryTypeName(), node.getMixinTypeNames()))
{
- ItemData vhpd = dataManager.getItemData(node, new QPathEntry(Constants.JCR_VERSIONHISTORY, 1));
+ ItemData vhpd =
+ dataManager.getItemData(node, new QPathEntry(Constants.JCR_VERSIONHISTORY, 1), ItemType.PROPERTY);
if (vhpd != null && !vhpd.isNode())
{
try
@@ -435,8 +437,8 @@
PropertyImpl prevProp;
PropertyDefinitionDatas defs;
ItemImpl prevItem =
- dataManager.getItem(parentNode.nodeData(), new QPathEntry(propertyName, 0), true, dataManager.isNew(parentNode
- .getIdentifier()));
+ dataManager.getItem(parentNode.nodeData(), new QPathEntry(propertyName, 0), true,
+ dataManager.isNew(parentNode.getIdentifier()), ItemType.PROPERTY);
NodeTypeDataManager ntm = session.getWorkspace().getNodeTypesHolder();
NodeData parentData = (NodeData)parentNode.getData();
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NamespaceDataPersister.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NamespaceDataPersister.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NamespaceDataPersister.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -31,6 +31,7 @@
import org.exoplatform.services.jcr.dataflow.TransactionChangesLog;
import org.exoplatform.services.jcr.datamodel.InternalQName;
import org.exoplatform.services.jcr.datamodel.ItemData;
+import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
@@ -185,7 +186,8 @@
}
PlainChangesLogImpl plainChangesLogImpl = new PlainChangesLogImpl();
- ItemData prefData = dataManager.getItemData(nsRoot, new QPathEntry(new InternalQName("", prefix), 0));
+ ItemData prefData =
+ dataManager.getItemData(nsRoot, new QPathEntry(new InternalQName("", prefix), 0), ItemType.NODE);
if (prefData != null && prefData.isNode())
{
@@ -220,12 +222,14 @@
if (jcrSystem != null)
{
NodeData exoNamespaces =
- (NodeData)dataManager.getItemData(jcrSystem, new QPathEntry(Constants.EXO_NAMESPACES, 1));
+ (NodeData)dataManager.getItemData(jcrSystem, new QPathEntry(Constants.EXO_NAMESPACES, 1),
+ ItemType.NODE);
if (exoNamespaces == null)
{
initStorage(jcrSystem, !repConfig.getAccessControl().equals(AccessControlPolicy.DISABLE));
this.nsRoot =
- (NodeData)dataManager.getItemData(jcrSystem, new QPathEntry(Constants.EXO_NAMESPACES, 1));
+ (NodeData)dataManager.getItemData(jcrSystem, new QPathEntry(Constants.EXO_NAMESPACES, 1),
+ ItemType.NODE);
}
else
{
@@ -264,7 +268,8 @@
{
NodeData jcrSystem = (NodeData)dataManager.getItemData(Constants.SYSTEM_UUID);
if (jcrSystem != null)
- this.nsRoot = (NodeData)dataManager.getItemData(jcrSystem, new QPathEntry(Constants.EXO_NAMESPACES, 1));
+ this.nsRoot =
+ (NodeData)dataManager.getItemData(jcrSystem, new QPathEntry(Constants.EXO_NAMESPACES, 1), ItemType.NODE);
else
throw new RepositoryException(
"/jcr:system is not found. Possible the workspace is not initialized properly");
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -36,6 +36,7 @@
import org.exoplatform.services.jcr.datamodel.IllegalPathException;
import org.exoplatform.services.jcr.datamodel.InternalQName;
import org.exoplatform.services.jcr.datamodel.ItemData;
+import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPath;
@@ -266,7 +267,8 @@
}
ItemImpl parentItem =
- dataManager.getItem(nodeData(), itemPath.makeParentPath().getInternalPath().getEntries(), false);
+ dataManager.getItem(nodeData(), itemPath.makeParentPath().getInternalPath().getEntries(), false,
+ ItemType.UNKNOWN);
if (parentItem == null)
{
@@ -325,7 +327,8 @@
}
ItemImpl parentItem =
- dataManager.getItem(nodeData(), itemPath.makeParentPath().getInternalPath().getEntries(), false);
+ dataManager.getItem(nodeData(), itemPath.makeParentPath().getInternalPath().getEntries(), false,
+ ItemType.UNKNOWN);
if (parentItem == null)
{
@@ -417,7 +420,8 @@
if (vancestor != null)
{
PropertyData isCheckedOut =
- (PropertyData)dataManager.getItemData(vancestor, new QPathEntry(Constants.JCR_ISCHECKEDOUT, 1));
+ (PropertyData)dataManager.getItemData(vancestor, new QPathEntry(Constants.JCR_ISCHECKEDOUT, 1),
+ ItemType.PROPERTY);
try
{
return ValueDataConvertor.readBoolean(isCheckedOut.getValues().get(0));
@@ -517,8 +521,8 @@
new TransientValueData(true))));
ValueData baseVersion =
- ((PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_BASEVERSION, 0))).getValues()
- .get(0);
+ ((PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_BASEVERSION, 0),
+ ItemType.PROPERTY)).getValues().get(0);
changesLog.add(ItemState.createUpdatedState(updatePropertyData(Constants.JCR_PREDECESSORS, baseVersion)));
@@ -601,7 +605,8 @@
values.add(new TransientValueData(type.getName()));
PropertyData prop =
- (PropertyData)dataManager.getItemData(((NodeData)getData()), new QPathEntry(Constants.JCR_MIXINTYPES, 0));
+ (PropertyData)dataManager.getItemData(((NodeData)getData()), new QPathEntry(Constants.JCR_MIXINTYPES, 0),
+ ItemType.PROPERTY);
ItemState state;
if (prop != null)
@@ -737,7 +742,8 @@
}
PropertyData bvProp =
- (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_BASEVERSION, 1));
+ (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_BASEVERSION, 1),
+ ItemType.PROPERTY);
try
{
return (Version)session.getNodeByUUID(ValueDataConvertor.readString(bvProp.getValues().get(0)));
@@ -781,7 +787,7 @@
NodeData ancestor = (NodeData)dataManager.getItemData(Constants.ROOT_UUID);
for (int i = 1; i < myPath.getDepth(); i++)
{
- ancestor = (NodeData)dataManager.getItemData(ancestor, myPath.getEntries()[i]);
+ ancestor = (NodeData)dataManager.getItemData(ancestor, myPath.getEntries()[i], ItemType.NODE);
if (corrSession.getWorkspace().getNodeTypesHolder().isNodeType(Constants.MIX_REFERENCEABLE,
ancestor.getPrimaryTypeName(), ancestor.getMixinTypeNames()))
{
@@ -793,7 +799,8 @@
}
NodeData corrNode =
- (NodeData)corrDataManager.getItemData(corrAncestor, myPath.getRelPath(myPath.getDepth() - i));
+ (NodeData)corrDataManager.getItemData(corrAncestor, myPath.getRelPath(myPath.getDepth() - i),
+ ItemType.NODE);
if (corrNode != null)
{
return corrNode;
@@ -969,7 +976,7 @@
JCRPath itemPath = locationFactory.parseRelPath(relPath);
- ItemImpl node = dataManager.getItem(nodeData(), itemPath.getInternalPath().getEntries(), true);
+ ItemImpl node = dataManager.getItem(nodeData(), itemPath.getInternalPath().getEntries(), true, ItemType.NODE);
if (node == null || !node.isNode())
{
throw new PathNotFoundException("Node not found " + (isRoot() ? "" : getLocation().getAsString(false)) + "/"
@@ -1113,7 +1120,8 @@
{
if (ntData.getPrimaryItemName() != null)
{
- Item primaryItem = dataManager.getItem(nodeData(), new QPathEntry(ntData.getPrimaryItemName(), 0), true);
+ Item primaryItem =
+ dataManager.getItem(nodeData(), new QPathEntry(ntData.getPrimaryItemName(), 0), true, ItemType.UNKNOWN);
if (primaryItem != null)
{
return primaryItem;
@@ -1265,7 +1273,7 @@
LOG.debug("getProperty() " + getLocation().getAsString(false) + " " + relPath);
}
- ItemImpl prop = dataManager.getItem(nodeData(), itemPath.getInternalPath().getEntries(), true);
+ ItemImpl prop = dataManager.getItem(nodeData(), itemPath.getInternalPath().getEntries(), true, ItemType.PROPERTY);
if (prop == null || prop.isNode())
{
throw new PathNotFoundException("Property not found " + itemPath.getAsString(false));
@@ -1364,7 +1372,7 @@
JCRPath itemPath = locationFactory.parseRelPath(relPath);
- ItemData node = dataManager.getItemData(nodeData(), itemPath.getInternalPath().getEntries());
+ ItemData node = dataManager.getItemData(nodeData(), itemPath.getInternalPath().getEntries(), ItemType.NODE);
return node != null && node.isNode();
}
@@ -1400,7 +1408,7 @@
JCRPath itemPath = locationFactory.parseRelPath(relPath);
- ItemData prop = dataManager.getItemData(nodeData(), itemPath.getInternalPath().getEntries());
+ ItemData prop = dataManager.getItemData(nodeData(), itemPath.getInternalPath().getEntries(), ItemType.PROPERTY);
return prop != null && !prop.isNode();
}
@@ -1765,7 +1773,8 @@
session.getActionHandler().preRemoveMixin(this, name);
PropertyData propData =
- (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_MIXINTYPES, 0));
+ (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_MIXINTYPES, 0),
+ ItemType.PROPERTY);
// create new property data with new values
TransientPropertyData prop =
@@ -1794,7 +1803,7 @@
for (PropertyDefinitionData pd : ntmanager.getAllPropertyDefinitions(removedName))
{
- ItemData p = dataManager.getItemData(nodeData(), new QPathEntry(pd.getName(), 1));
+ ItemData p = dataManager.getItemData(nodeData(), new QPathEntry(pd.getName(), 1), ItemType.PROPERTY);
if (p != null && !p.isNode())
{
// remove it
@@ -1804,7 +1813,7 @@
for (NodeDefinitionData nd : ntmanager.getAllChildNodeDefinitions(removedName))
{
- ItemData n = dataManager.getItemData(nodeData(), new QPathEntry(nd.getName(), 1));
+ ItemData n = dataManager.getItemData(nodeData(), new QPathEntry(nd.getName(), 1), ItemType.NODE);
if (n != null && n.isNode())
{
// remove node with subtree
@@ -1950,7 +1959,8 @@
}
QPath destPath = locationFactory.parseRelPath(relPath).getInternalPath();
- NodeImpl destParent = (NodeImpl)dataManager.getItem(nodeData(), destPath.makeParentPath().getEntries(), false);
+ NodeImpl destParent =
+ (NodeImpl)dataManager.getItem(nodeData(), destPath.makeParentPath().getEntries(), false, ItemType.NODE);
if (destParent == null)
{
throw new PathNotFoundException("Parent not found for " + relPath);
@@ -1963,7 +1973,7 @@
NodeImpl destNode =
(NodeImpl)dataManager.getItem(destParent.nodeData(),
- new QPathEntry(destPath.getName(), destPath.getIndex()), false);
+ new QPathEntry(destPath.getName(), destPath.getIndex()), false, ItemType.NODE);
if (destNode != null)
{
@@ -2385,7 +2395,7 @@
NodeData thisParent = (NodeData)session.getTransientNodesManager().getItemData(getParentIdentifier());
QPathEntry[] qpath = getInternalPath().getEntries();
- NodeData thisNew = (NodeData)pmanager.getItemData(thisParent, qpath[qpath.length - 1]);
+ NodeData thisNew = (NodeData)pmanager.getItemData(thisParent, qpath[qpath.length - 1], ItemType.NODE);
// reload node impl with old uuid to a new one data
session.getTransientNodesManager().getItemsPool().reload(getInternalIdentifier(), thisNew);
}
@@ -2471,7 +2481,8 @@
}
PropertyData vhProp =
- (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_VERSIONHISTORY, 1));
+ (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_VERSIONHISTORY, 1),
+ ItemType.PROPERTY);
if (vhProp == null)
{
throw new UnsupportedRepositoryOperationException("Node does not have jcr:versionHistory " + getPath());
@@ -2695,11 +2706,13 @@
PlainChangesLog changesLog =
new PlainChangesLogImpl(new ArrayList<ItemState>(), session.getId(), ExtendedEvent.UNLOCK);
- ItemData lockOwner = dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_LOCKOWNER, 0));
+ ItemData lockOwner =
+ dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_LOCKOWNER, 0), ItemType.PROPERTY);
changesLog.add(ItemState.createDeletedState(lockOwner));
- ItemData lockIsDeep = dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_LOCKISDEEP, 0));
+ ItemData lockIsDeep =
+ dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_LOCKISDEEP, 0), ItemType.PROPERTY);
changesLog.add(ItemState.createDeletedState(lockIsDeep));
@@ -2714,7 +2727,8 @@
protected PropertyImpl property(InternalQName name) throws IllegalPathException, PathNotFoundException,
RepositoryException
{
- PropertyImpl prop = (PropertyImpl)dataManager.getItem(nodeData(), new QPathEntry(name, 1), false);
+ PropertyImpl prop =
+ (PropertyImpl)dataManager.getItem(nodeData(), new QPathEntry(name, 1), false, ItemType.PROPERTY);
if (prop == null || prop.isNode())
{
throw new PathNotFoundException("Property not found " + name);
@@ -2743,7 +2757,8 @@
protected PropertyData updatePropertyData(InternalQName name, List<ValueData> values) throws RepositoryException
{
- PropertyData existed = (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(name, 0));
+ PropertyData existed =
+ (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(name, 0), ItemType.PROPERTY);
if (existed == null)
{
@@ -2766,7 +2781,8 @@
protected PropertyData updatePropertyData(InternalQName name, ValueData value) throws RepositoryException
{
- PropertyData existed = (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(name, 0));
+ PropertyData existed =
+ (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(name, 0), ItemType.PROPERTY);
if (existed == null)
{
@@ -2823,7 +2839,8 @@
EntityCollection res = new EntityCollection();
TransientPropertyData mergeFailed =
- (TransientPropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_MERGEFAILED, 0));
+ (TransientPropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_MERGEFAILED, 0),
+ ItemType.PROPERTY);
List<ValueData> mergeFailedRefs = new ArrayList<ValueData>();
int state = 0;
@@ -2900,13 +2917,13 @@
int ind = 1;
- NodeData sibling = (NodeData)dataManager.getItemData(parentNode, new QPathEntry(nameToAdd, ind));
+ NodeData sibling = (NodeData)dataManager.getItemData(parentNode, new QPathEntry(nameToAdd, ind), ItemType.NODE);
while (sibling != null)
{
if (allowSns)
{
ind++;
- sibling = (NodeData)dataManager.getItemData(parentNode, new QPathEntry(nameToAdd, ind));
+ sibling = (NodeData)dataManager.getItemData(parentNode, new QPathEntry(nameToAdd, ind), ItemType.NODE);
}
else
{
@@ -2986,7 +3003,7 @@
{
try
{
- ItemData pdata = dataManager.getItemData(nodeData(), new QPathEntry(name, 1));
+ ItemData pdata = dataManager.getItemData(nodeData(), new QPathEntry(name, 1), ItemType.PROPERTY);
if (pdata != null && !pdata.isNode())
{
@@ -3003,7 +3020,8 @@
{
PropertyData mergeFailed =
- (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_MERGEFAILED, 0));
+ (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_MERGEFAILED, 0),
+ ItemType.PROPERTY);
if (mergeFailed == null)
{
@@ -3084,7 +3102,8 @@
}
PropertyData permProp =
- (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.EXO_PERMISSIONS, 0));
+ (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.EXO_PERMISSIONS, 0),
+ ItemType.PROPERTY);
permProp =
new TransientPropertyData(permProp.getQPath(), permProp.getIdentifier(), permProp.getPersistedVersion(),
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -29,6 +29,7 @@
import org.exoplatform.services.jcr.dataflow.SharedDataManager;
import org.exoplatform.services.jcr.datamodel.IllegalPathException;
import org.exoplatform.services.jcr.datamodel.ItemData;
+import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPath;
@@ -158,9 +159,15 @@
QPathEntry[] relPathEntries = path.getRelPath(path.getDepth());
- return getItemData(parent, relPathEntries);
+ return getItemData(parent, relPathEntries, ItemType.UNKNOWN);
}
+ @Deprecated
+ public ItemData getItemData(NodeData parent, QPathEntry[] relPathEntries) throws RepositoryException
+ {
+ return getItemData(parent, relPathEntries, ItemType.UNKNOWN);
+ }
+
/**
* Return item data by parent NodeDada and relPathEntries If relpath is JCRPath.THIS_RELPATH = '.'
* it return itself
@@ -168,15 +175,25 @@
* @param parent
* @param relPath
* - array of QPathEntry which represents the relation path to the searched item
+ * @param itemType
+ * item type
* @return existed item data or null if not found
* @throws RepositoryException
*/
- public ItemData getItemData(NodeData parent, QPathEntry[] relPathEntries) throws RepositoryException
+ public ItemData getItemData(NodeData parent, QPathEntry[] relPathEntries, ItemType itemType)
+ throws RepositoryException
{
ItemData item = parent;
for (int i = 0; i < relPathEntries.length; i++)
{
- item = getItemData(parent, relPathEntries[i]);
+ if (i == relPathEntries.length - 1)
+ {
+ item = getItemData(parent, relPathEntries[i], itemType);
+ }
+ else
+ {
+ item = getItemData(parent, relPathEntries[i], ItemType.UNKNOWN);
+ }
if (item == null)
{
@@ -200,13 +217,21 @@
*/
public ItemData getItemData(NodeData parent, QPathEntry name) throws RepositoryException
{
- return getItemData(parent, name, false);
+ return getItemData(parent, name, false, ItemType.UNKNOWN);
}
/**
* {@inheritDoc}
*/
- private ItemData getItemData(NodeData parent, QPathEntry name, boolean skipCheckInPersistence)
+ public ItemData getItemData(NodeData parent, QPathEntry name, ItemType itemType) throws RepositoryException
+ {
+ return getItemData(parent, name, false, itemType);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ private ItemData getItemData(NodeData parent, QPathEntry name, boolean skipCheckInPersistence, ItemType itemType)
throws RepositoryException
{
if (name.getName().equals(JCRPath.PARENT_RELPATH) && name.getNamespace().equals(Constants.NS_DEFAULT_URI))
@@ -224,13 +249,13 @@
ItemData data = null;
// 1. Try in transient changes
- ItemState state = changesLog.getItemState(parent, name);
+ ItemState state = changesLog.getItemState(parent, name, itemType);
if (state == null)
{
// 2. Try from txdatamanager
if (!(skipCheckInPersistence))
{
- data = transactionableManager.getItemData(parent, name);
+ data = transactionableManager.getItemData(parent, name, itemType);
}
}
else if (!state.isDeleted())
@@ -265,6 +290,12 @@
return data;
}
+ @Deprecated
+ public ItemImpl getItem(NodeData parent, QPathEntry name, boolean pool) throws RepositoryException
+ {
+ return getItem(parent, name, pool, ItemType.UNKNOWN);
+ }
+
/**
* Return Item by parent NodeDada and the name of searched item.
*
@@ -274,10 +305,13 @@
* - item name
* @param pool
* - indicates does the item fall in pool
+ * @param itemType
+ * - item type
* @return existed item or null if not found
* @throws RepositoryException
*/
- public ItemImpl getItem(NodeData parent, QPathEntry name, boolean pool) throws RepositoryException
+ public ItemImpl getItem(NodeData parent, QPathEntry name, boolean pool, ItemType itemType)
+ throws RepositoryException
{
long start = System.currentTimeMillis();
if (log.isDebugEnabled())
@@ -288,7 +322,7 @@
ItemImpl item = null;
try
{
- return item = readItem(getItemData(parent, name), pool);
+ return item = readItem(getItemData(parent, name, itemType), pool);
}
finally
{
@@ -301,6 +335,12 @@
}
}
+ @Deprecated
+ public ItemImpl getItem(NodeData parent, QPathEntry[] relPath, boolean pool) throws RepositoryException
+ {
+ return getItem(parent, relPath, pool, ItemType.UNKNOWN);
+ }
+
/**
* Return Item by parent NodeDada and the name of searched item.
*
@@ -315,8 +355,8 @@
* @return existed item or null if not found
* @throws RepositoryException
*/
- public ItemImpl getItem(NodeData parent, QPathEntry name, boolean pool, boolean skipCheckInPersistence)
- throws RepositoryException
+ public ItemImpl getItem(NodeData parent, QPathEntry name, boolean pool, boolean skipCheckInPersistence,
+ ItemType itemType) throws RepositoryException
{
long start = System.currentTimeMillis();
if (log.isDebugEnabled())
@@ -327,7 +367,7 @@
ItemImpl item = null;
try
{
- return item = readItem(getItemData(parent, name, skipCheckInPersistence), pool);
+ return item = readItem(getItemData(parent, name, skipCheckInPersistence, itemType), pool);
}
finally
{
@@ -350,10 +390,13 @@
* - array of QPathEntry which represents the relation path to the searched item
* @param pool
* - indicates does the item fall in pool
+ * @param itemType
+ * item type
* @return existed item or null if not found
* @throws RepositoryException
*/
- public ItemImpl getItem(NodeData parent, QPathEntry[] relPath, boolean pool) throws RepositoryException
+ public ItemImpl getItem(NodeData parent, QPathEntry[] relPath, boolean pool, ItemType itemType)
+ throws RepositoryException
{
long start = System.currentTimeMillis();
if (log.isDebugEnabled())
@@ -369,7 +412,7 @@
ItemImpl item = null;
try
{
- return item = readItem(getItemData(parent, relPath), pool);
+ return item = readItem(getItemData(parent, relPath, itemType), pool);
}
finally
{
@@ -900,7 +943,14 @@
QPathEntry[] relPathEntries = path.getRelPath(path.getDepth());
for (int i = 0; i < relPathEntries.length; i++)
{
- item = getItemData(parent, relPathEntries[i]);
+ if (i == relPathEntries.length - 1)
+ {
+ item = getItemData(parent, relPathEntries[i], ItemType.NODE);
+ }
+ else
+ {
+ item = getItemData(parent, relPathEntries[i], ItemType.UNKNOWN);
+ }
if (item == null)
{
@@ -948,7 +998,7 @@
try
{
- ItemData item = getItemData(parent, name);
+ ItemData item = getItemData(parent, name, ItemType.NODE);
if (item != null && item.isNode())
{
// node ACL
@@ -1234,7 +1284,7 @@
NodeData nextSibling =
(NodeData)dataManager.getItemData(parentNodeData, new QPathEntry(cause.getQPath().getName(), cause.getQPath()
- .getIndex() + 1));
+ .getIndex() + 1), ItemType.NODE);
String reindexedId = null;
// repeat till next sibling exists and it's not a caused Node (deleted or moved to) or just
@@ -1266,7 +1316,7 @@
// next...
nextSibling =
(NodeData)dataManager.getItemData(parentNodeData, new QPathEntry(nextSibling.getQPath().getName(),
- nextSibling.getQPath().getIndex() + 1));
+ nextSibling.getQPath().getIndex() + 1), ItemType.NODE);
}
return changes;
@@ -1590,7 +1640,7 @@
for (ItemDefinitionData itemDefinitionData : mandatoryItemDefs)
{
- if (getItemData(nData, new QPathEntry(itemDefinitionData.getName(), 0)) == null)
+ if (getItemData(nData, new QPathEntry(itemDefinitionData.getName(), 0), ItemType.UNKNOWN) == null)
{
throw new ConstraintViolationException("Mandatory item " + itemDefinitionData.getName()
+ " not found. Node [" + nData.getQPath().getAsString() + " primary type: "
@@ -1647,7 +1697,7 @@
{
ItemData persisted =
transactionableManager.getItemData(parent, rstate.getData().getQPath().getEntries()[rstate.getData()
- .getQPath().getEntries().length - 1]);
+ .getQPath().getEntries().length - 1], ItemType.getItemType(rstate.getData()));
if (persisted != null)
{
@@ -1684,7 +1734,8 @@
if (parent != null)
{
QPathEntry[] path = item.getQPath().getEntries();
- persisted = transactionableManager.getItemData(parent, path[path.length - 1]);
+ persisted =
+ transactionableManager.getItemData(parent, path[path.length - 1], ItemType.getItemType(item));
} // else, the item has an invalid state, will be throwed on save
}
@@ -1704,7 +1755,9 @@
if (parent != null)
{
QPathEntry[] path = pooled.getData().getQPath().getEntries();
- persisted = transactionableManager.getItemData(parent, path[path.length - 1]);
+ persisted =
+ transactionableManager.getItemData(parent, path[path.length - 1],
+ ItemType.getItemType(pooled.getData()));
} // else, the item has an invalid state, will be throwed on save
}
if (persisted != null)
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionImpl.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionImpl.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionImpl.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -29,6 +29,7 @@
import org.exoplatform.services.jcr.core.SessionLifecycleListener;
import org.exoplatform.services.jcr.core.nodetype.NodeTypeDataManager;
import org.exoplatform.services.jcr.datamodel.ItemData;
+import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
import org.exoplatform.services.jcr.impl.Constants;
@@ -932,13 +933,13 @@
+ destAbsPath);
}
- destParentNode.validateChildNode(destNodePath.getName().getInternalName(), ((NodeTypeImpl)srcNode
- .getPrimaryNodeType()).getQName());
+ destParentNode.validateChildNode(destNodePath.getName().getInternalName(),
+ ((NodeTypeImpl)srcNode.getPrimaryNodeType()).getQName());
// Check for node with destAbsPath name in session
NodeImpl destNode =
(NodeImpl)dataManager.getItem((NodeData)destParentNode.getData(), new QPathEntry(destNodePath
- .getInternalPath().getName(), 0), false);
+ .getInternalPath().getName(), 0), false, ItemType.NODE);
if (destNode != null)
{
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/WorkspaceImpl.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/WorkspaceImpl.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/WorkspaceImpl.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -25,6 +25,7 @@
import org.exoplatform.services.jcr.dataflow.ItemState;
import org.exoplatform.services.jcr.dataflow.PlainChangesLog;
import org.exoplatform.services.jcr.dataflow.PlainChangesLogImpl;
+import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
import org.exoplatform.services.jcr.impl.core.nodetype.NodeTypeImpl;
@@ -197,7 +198,7 @@
NodeImpl destNode =
(NodeImpl)session.getTransientNodesManager().getItem((NodeData)destParentNode.getData(),
- new QPathEntry(destNodePath.getInternalPath().getName(), 0), false);
+ new QPathEntry(destNodePath.getInternalPath().getName(), 0), false, ItemType.NODE);
if (destNode != null)
{
@@ -427,7 +428,7 @@
// Check for node with destAbsPath name in session
NodeImpl destNode =
(NodeImpl)session.getTransientNodesManager().getItem((NodeData)destParentNode.getData(),
- new QPathEntry(destNodePath.getInternalPath().getName(), 0), false);
+ new QPathEntry(destNodePath.getInternalPath().getName(), 0), false, ItemType.NODE);
if (destNode != null)
{
@@ -522,7 +523,7 @@
// Check for node with destAbsPath name in session
NodeImpl destNode =
(NodeImpl)session.getTransientNodesManager().getItem((NodeData)destParentNode.getData(),
- new QPathEntry(destNodePath.getInternalPath().getName(), 0), false);
+ new QPathEntry(destNodePath.getInternalPath().getName(), 0), false, ItemType.NODE);
ItemState changesItemState = null;
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/FileSystemLockPersister.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/FileSystemLockPersister.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/FileSystemLockPersister.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -26,6 +26,7 @@
import org.exoplatform.services.jcr.dataflow.PlainChangesLog;
import org.exoplatform.services.jcr.dataflow.PlainChangesLogImpl;
import org.exoplatform.services.jcr.dataflow.TransactionChangesLog;
+import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPath;
@@ -183,7 +184,8 @@
if (lockedNodeData != null)
{
PropertyData dataLockIsDeep =
- (PropertyData)dataManager.getItemData(lockedNodeData, new QPathEntry(Constants.JCR_LOCKISDEEP, 0));
+ (PropertyData)dataManager.getItemData(lockedNodeData, new QPathEntry(Constants.JCR_LOCKISDEEP, 0),
+ ItemType.PROPERTY);
if (dataLockIsDeep != null)
{
@@ -193,7 +195,8 @@
}
PropertyData dataLockOwner =
- (PropertyData)dataManager.getItemData(lockedNodeData, new QPathEntry(Constants.JCR_LOCKOWNER, 0));
+ (PropertyData)dataManager.getItemData(lockedNodeData, new QPathEntry(Constants.JCR_LOCKOWNER, 0),
+ ItemType.PROPERTY);
if (dataLockOwner != null)
plainChangesLog.add(ItemState.createDeletedState(new TransientPropertyData(QPath.makeChildPath(
lockedNodeData.getQPath(), Constants.JCR_LOCKOWNER), dataLockOwner.getIdentifier(), 0,
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/LockManagerImpl.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/LockManagerImpl.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/LockManagerImpl.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -37,6 +37,7 @@
import org.exoplatform.services.jcr.dataflow.persistent.PersistedPropertyData;
import org.exoplatform.services.jcr.datamodel.InternalQName;
import org.exoplatform.services.jcr.datamodel.ItemData;
+import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
@@ -703,12 +704,14 @@
new PlainChangesLogImpl(new ArrayList<ItemState>(), SystemIdentity.SYSTEM, ExtendedEvent.UNLOCK);
ItemData lockOwner =
- copyItemData((PropertyData)dataManager.getItemData(nData, new QPathEntry(Constants.JCR_LOCKOWNER, 1)));
+ copyItemData((PropertyData)dataManager.getItemData(nData, new QPathEntry(Constants.JCR_LOCKOWNER, 1),
+ ItemType.PROPERTY));
changesLog.add(ItemState.createDeletedState(lockOwner));
ItemData lockIsDeep =
- copyItemData((PropertyData)dataManager.getItemData(nData, new QPathEntry(Constants.JCR_LOCKISDEEP, 1)));
+ copyItemData((PropertyData)dataManager.getItemData(nData, new QPathEntry(Constants.JCR_LOCKISDEEP, 1),
+ ItemType.PROPERTY));
changesLog.add(ItemState.createDeletedState(lockIsDeep));
// lock probably removed by other thread
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/cacheable/AbstractCacheableLockManager.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/cacheable/AbstractCacheableLockManager.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/cacheable/AbstractCacheableLockManager.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -30,6 +30,7 @@
import org.exoplatform.services.jcr.dataflow.TransactionChangesLog;
import org.exoplatform.services.jcr.dataflow.persistent.ItemsPersistenceListener;
import org.exoplatform.services.jcr.datamodel.ItemData;
+import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
@@ -664,7 +665,8 @@
new PlainChangesLogImpl(new ArrayList<ItemState>(), IdentityConstants.SYSTEM, ExtendedEvent.UNLOCK);
ItemData lockOwner =
- copyItemData((PropertyData)dataManager.getItemData(nData, new QPathEntry(Constants.JCR_LOCKOWNER, 1)));
+ copyItemData((PropertyData)dataManager.getItemData(nData, new QPathEntry(Constants.JCR_LOCKOWNER, 1),
+ ItemType.PROPERTY));
//TODO EXOJCR-412, should be refactored in future.
//Skip removing, because that lock was removed in other node of cluster.
@@ -676,7 +678,8 @@
changesLog.add(ItemState.createDeletedState(lockOwner));
ItemData lockIsDeep =
- copyItemData((PropertyData)dataManager.getItemData(nData, new QPathEntry(Constants.JCR_LOCKISDEEP, 1)));
+ copyItemData((PropertyData)dataManager.getItemData(nData, new QPathEntry(Constants.JCR_LOCKISDEEP, 1),
+ ItemType.PROPERTY));
//TODO EXOJCR-412, should be refactored in future.
//Skip removing, because that lock was removed in other node of cluster.
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/jdbc/CacheableJDBCLockManagerImpl.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/jdbc/CacheableJDBCLockManagerImpl.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/jdbc/CacheableJDBCLockManagerImpl.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -35,6 +35,7 @@
import org.exoplatform.services.jcr.dataflow.TransactionChangesLog;
import org.exoplatform.services.jcr.dataflow.persistent.ItemsPersistenceListener;
import org.exoplatform.services.jcr.datamodel.ItemData;
+import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
@@ -895,7 +896,7 @@
List<LockData> locksData = new ArrayList<LockData>();
for (String nodeId : nodesId)
{
- LockData lockData = (LockData)cache.get(makeLockFqn((String)nodeId), LOCK_DATA);
+ LockData lockData = (LockData)cache.get(makeLockFqn(nodeId), LOCK_DATA);
if (lockData != null)
{
locksData.add(lockData);
@@ -949,7 +950,8 @@
new PlainChangesLogImpl(new ArrayList<ItemState>(), SystemIdentity.SYSTEM, ExtendedEvent.UNLOCK);
ItemData lockOwner =
- copyItemData((PropertyData)dataManager.getItemData(nData, new QPathEntry(Constants.JCR_LOCKOWNER, 1)));
+ copyItemData((PropertyData)dataManager.getItemData(nData, new QPathEntry(Constants.JCR_LOCKOWNER, 1),
+ ItemType.PROPERTY));
//TODO EXOJCR-412, should be refactored in future.
//Skip removing, because that lock was removed in other node of cluster.
@@ -961,7 +963,8 @@
changesLog.add(ItemState.createDeletedState(lockOwner));
ItemData lockIsDeep =
- copyItemData((PropertyData)dataManager.getItemData(nData, new QPathEntry(Constants.JCR_LOCKISDEEP, 1)));
+ copyItemData((PropertyData)dataManager.getItemData(nData, new QPathEntry(Constants.JCR_LOCKISDEEP, 1),
+ ItemType.PROPERTY));
//TODO EXOJCR-412, should be refactored in future.
//Skip removing, because that lock was removed in other node of cluster.
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/ItemAutocreator.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/ItemAutocreator.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/ItemAutocreator.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -29,6 +29,7 @@
import org.exoplatform.services.jcr.dataflow.PlainChangesLogImpl;
import org.exoplatform.services.jcr.datamodel.InternalQName;
import org.exoplatform.services.jcr.datamodel.ItemData;
+import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
import org.exoplatform.services.jcr.datamodel.ValueData;
@@ -117,13 +118,13 @@
{
final ItemData pdata =
avoidCheckExistedChildItems ? null : targetDataManager.getItemData(parent, new QPathEntry(
- ndef.getName(), 0));
+ ndef.getName(), 0), ItemType.NODE);
if (pdata == null && !addedNodes.contains(ndef.getName()) || pdata != null && !pdata.isNode())
{
final TransientNodeData childNodeData =
- TransientNodeData.createNodeData(parent, ndef.getName(), ndef.getDefaultPrimaryType(), IdGenerator
- .generate());
+ TransientNodeData.createNodeData(parent, ndef.getName(), ndef.getDefaultPrimaryType(),
+ IdGenerator.generate());
changes.add(ItemState.createAddedState(childNodeData, false));
changes.addAll(makeAutoCreatedItems(childNodeData, childNodeData.getPrimaryTypeName(),
targetDataManager, owner).getAllStates());
@@ -162,7 +163,7 @@
final ItemData pdata =
avoidCheckExistedChildItems ? null : targetDataManager.getItemData(parent, new QPathEntry(
- pdef.getName(), 0));
+ pdef.getName(), 0), ItemType.PROPERTY);
if (pdata == null && !addedProperties.contains(pdef.getName()) || pdata != null && pdata.isNode())
{
@@ -171,8 +172,8 @@
if (listAutoCreateValue != null)
{
final TransientPropertyData propertyData =
- TransientPropertyData.createPropertyData(parent, pdef.getName(), pdef.getRequiredType(), pdef
- .isMultiple(), listAutoCreateValue);
+ TransientPropertyData.createPropertyData(parent, pdef.getName(), pdef.getRequiredType(),
+ pdef.isMultiple(), listAutoCreateValue);
changes.add(ItemState.createAddedState(propertyData));
addedProperties.add(pdef.getName());
}
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/NodeTypeDataManagerImpl.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/NodeTypeDataManagerImpl.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/NodeTypeDataManagerImpl.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -33,6 +33,7 @@
import org.exoplatform.services.jcr.dataflow.PlainChangesLogImpl;
import org.exoplatform.services.jcr.datamodel.InternalQName;
import org.exoplatform.services.jcr.datamodel.ItemData;
+import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
@@ -700,7 +701,8 @@
// update primary type
final PropertyData item =
- (PropertyData)this.dataManager.getItemData(nodeData, new QPathEntry(Constants.JCR_PRIMARYTYPE, 1));
+ (PropertyData)this.dataManager.getItemData(nodeData, new QPathEntry(Constants.JCR_PRIMARYTYPE, 1),
+ ItemType.PROPERTY);
final TransientPropertyData primaryTypeData =
new TransientPropertyData(item.getQPath(), item.getIdentifier(), item.getPersistedVersion(), item.getType(),
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/AbstractItemDefinitionAccessProvider.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/AbstractItemDefinitionAccessProvider.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/AbstractItemDefinitionAccessProvider.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -25,6 +25,7 @@
import org.exoplatform.services.jcr.datamodel.IllegalNameException;
import org.exoplatform.services.jcr.datamodel.InternalQName;
import org.exoplatform.services.jcr.datamodel.ItemData;
+import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
@@ -71,7 +72,7 @@
protected List<ValueData> loadPropertyValues(NodeData parentNode, InternalQName propertyName)
throws RepositoryException
{
- ItemData property = dataManager.getItemData(parentNode, new QPathEntry(propertyName, 1));
+ ItemData property = dataManager.getItemData(parentNode, new QPathEntry(propertyName, 1), ItemType.PROPERTY);
if (property != null)
{
if (property.isNode())
@@ -344,8 +345,8 @@
writeBoolean(changesLog, itemDefinition, Constants.JCR_MANDATORY, nodeDefinitionData.isMandatory());
- writeString(changesLog, itemDefinition, Constants.JCR_ONPARENTVERSION, OnParentVersionAction
- .nameFromValue(nodeDefinitionData.getOnParentVersion()));
+ writeString(changesLog, itemDefinition, Constants.JCR_ONPARENTVERSION,
+ OnParentVersionAction.nameFromValue(nodeDefinitionData.getOnParentVersion()));
}
protected void writeName(PlainChangesLog changesLog, NodeData parentNode, InternalQName propertyName,
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/JCRNodeTypeDataPersister.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/JCRNodeTypeDataPersister.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/JCRNodeTypeDataPersister.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -37,6 +37,7 @@
import org.exoplatform.services.jcr.dataflow.TransactionChangesLog;
import org.exoplatform.services.jcr.datamodel.InternalQName;
import org.exoplatform.services.jcr.datamodel.ItemData;
+import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
import org.exoplatform.services.jcr.datamodel.ValueData;
@@ -139,7 +140,8 @@
return false;
}
- NodeData nodeTypeData = (NodeData)dataManager.getItemData(nodeTypeStorageRoot, new QPathEntry(nodeTypeName, 1));
+ NodeData nodeTypeData =
+ (NodeData)dataManager.getItemData(nodeTypeStorageRoot, new QPathEntry(nodeTypeName, 1), ItemType.NODE);
return nodeTypeData != null;
}
@@ -274,7 +276,7 @@
validatate();
NodeData nodeTypeData =
- (NodeData)dataManager.getItemData(nodeTypeStorageRoot, new QPathEntry(nodeType.getName(), 1));
+ (NodeData)dataManager.getItemData(nodeTypeStorageRoot, new QPathEntry(nodeType.getName(), 1), ItemType.NODE);
ItemDataRemoveVisitor removeVisitor = new ItemDataRemoveVisitor(dataManager, nodeTypeStorageRoot.getQPath());
nodeTypeData.accept(removeVisitor);
@@ -293,7 +295,8 @@
if (jcrSystem != null)
{
NodeData jcrNodetypes =
- (NodeData)dataManager.getItemData(jcrSystem, new QPathEntry(Constants.JCR_NODETYPES, 1));
+ (NodeData)dataManager.getItemData(jcrSystem, new QPathEntry(Constants.JCR_NODETYPES, 1),
+ ItemType.NODE);
if (jcrNodetypes == null)
{
this.nodeTypeStorageRoot = initNodetypesRoot(jcrSystem, addACL);
@@ -331,7 +334,7 @@
return null;
}
//Searching nodeType root
- ItemData nodeType = dataManager.getItemData(nodeTypeStorageRoot, new QPathEntry(nodeTypeName, 1));
+ ItemData nodeType = dataManager.getItemData(nodeTypeStorageRoot, new QPathEntry(nodeTypeName, 1), ItemType.NODE);
if (nodeType == null)
throw new NoSuchNodeTypeException("Node type definition " + nodeTypeName.getAsString() + "not found");
if (!nodeType.isNode())
@@ -395,7 +398,8 @@
}
// remove first
NodeData removeNodeTypeData =
- (NodeData)dataManager.getItemData(nodeTypeStorageRoot, new QPathEntry(nodeTypeData.getName(), 1));
+ (NodeData)dataManager.getItemData(nodeTypeStorageRoot, new QPathEntry(nodeTypeData.getName(), 1),
+ ItemType.NODE);
if (removeNodeTypeData != null)
{
ItemDataRemoveVisitor removeVisitor =
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/NodeDefinitionComparator.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/NodeDefinitionComparator.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/NodeDefinitionComparator.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -26,6 +26,7 @@
import org.exoplatform.services.jcr.dataflow.PlainChangesLogImpl;
import org.exoplatform.services.jcr.datamodel.InternalQName;
import org.exoplatform.services.jcr.datamodel.ItemData;
+import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
import org.exoplatform.services.jcr.impl.Constants;
@@ -75,6 +76,7 @@
this.affectedNodes = affectedNodes;
}
+ @Override
public PlainChangesLog compare(NodeTypeData registeredNodeType, NodeDefinitionData[] ancestorDefinition,
NodeDefinitionData[] recipientDefinition) throws ConstraintViolationException, RepositoryException
{
@@ -114,7 +116,8 @@
{
for (NodeData nodeData : nodesData)
{
- ItemData child = dataConsumer.getItemData(nodeData, new QPathEntry(nodeDefinitionData.getName(), 0));
+ ItemData child =
+ dataConsumer.getItemData(nodeData, new QPathEntry(nodeDefinitionData.getName(), 0), ItemType.NODE);
if (child == null || !child.isNode())
{
throw new ConstraintViolationException("Fail to add mandatory and not auto-created "
@@ -153,8 +156,8 @@
{
for (int i = 0; i < requiredPrimaryTypes.length; i++)
{
- if (!nodeTypeDataManager.isNodeType(requiredPrimaryTypes[i], child.getPrimaryTypeName(), child
- .getMixinTypeNames()))
+ if (!nodeTypeDataManager.isNodeType(requiredPrimaryTypes[i], child.getPrimaryTypeName(),
+ child.getMixinTypeNames()))
{
StringBuffer buffer = new StringBuffer();
buffer.append("Fail to change ");
@@ -189,8 +192,8 @@
{
for (int i = 0; i < requiredPrimaryTypes.length; i++)
{
- if (!nodeTypeDataManager.isNodeType(requiredPrimaryTypes[i], child.getPrimaryTypeName(), child
- .getMixinTypeNames()))
+ if (!nodeTypeDataManager.isNodeType(requiredPrimaryTypes[i], child.getPrimaryTypeName(),
+ child.getMixinTypeNames()))
{
StringBuffer buffer = new StringBuffer();
buffer.append("Fail to change ");
@@ -388,7 +391,8 @@
{
ItemData child =
- dataConsumer.getItemData(nodeData, new QPathEntry(recipientDefinitionData.getName(), 0));
+ dataConsumer.getItemData(nodeData, new QPathEntry(recipientDefinitionData.getName(), 0),
+ ItemType.NODE);
if (child == null || !child.isNode())
{
String message =
@@ -410,7 +414,8 @@
{
ItemData child =
- dataConsumer.getItemData(nodeData, new QPathEntry(recipientDefinitionData.getName(), 0));
+ dataConsumer.getItemData(nodeData, new QPathEntry(recipientDefinitionData.getName(), 0),
+ ItemType.NODE);
if (child == null || !child.isNode())
{
String message =
@@ -423,8 +428,8 @@
}
}
}
- if (!Arrays.deepEquals(ancestorDefinitionData.getRequiredPrimaryTypes(), recipientDefinitionData
- .getRequiredPrimaryTypes()))
+ if (!Arrays.deepEquals(ancestorDefinitionData.getRequiredPrimaryTypes(),
+ recipientDefinitionData.getRequiredPrimaryTypes()))
{
checkRequiredPrimaryType(registeredNodeType, nodesData, ancestorDefinitionData.getRequiredPrimaryTypes(),
recipientDefinitionData, allRecipientDefinition);
@@ -483,7 +488,8 @@
for (NodeData nodeData : nodesData)
{
ItemData child =
- dataConsumer.getItemData(nodeData, new QPathEntry(removeNodeDefinitionData.getName(), 0));
+ dataConsumer.getItemData(nodeData, new QPathEntry(removeNodeDefinitionData.getName(), 0),
+ ItemType.NODE);
if (child != null && child.isNode())
{
throw new ConstraintViolationException("Can't remove node definition "
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/PropertyDefinitionComparator.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/PropertyDefinitionComparator.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/PropertyDefinitionComparator.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -27,6 +27,7 @@
import org.exoplatform.services.jcr.dataflow.PlainChangesLogImpl;
import org.exoplatform.services.jcr.datamodel.InternalQName;
import org.exoplatform.services.jcr.datamodel.ItemData;
+import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
@@ -84,6 +85,7 @@
this.locationFactory = locationFactory;
}
+ @Override
public PlainChangesLog compare(NodeTypeData registeredNodeType, PropertyDefinitionData[] ancestorDefinition,
PropertyDefinitionData[] recipientDefinition) throws RepositoryException
{
@@ -158,7 +160,8 @@
else
{
PropertyData propertyData =
- (PropertyData)dataConsumer.getItemData(nodeData, new QPathEntry(recipientDefinitionData.getName(), 0));
+ (PropertyData)dataConsumer.getItemData(nodeData, new QPathEntry(recipientDefinitionData.getName(), 0),
+ ItemType.PROPERTY);
if (propertyData.getValues().size() > 1)
{
throw new ConstraintViolationException("Can't change property definition "
@@ -275,7 +278,8 @@
else
{
PropertyData propertyData =
- (PropertyData)dataConsumer.getItemData(nodeData, new QPathEntry(recipientDefinitionData.getName(), 0));
+ (PropertyData)dataConsumer.getItemData(nodeData, new QPathEntry(recipientDefinitionData.getName(), 0),
+ ItemType.PROPERTY);
if (recipientDefinitionData.getRequiredType() != PropertyType.UNDEFINED
&& propertyData.getType() != recipientDefinitionData.getRequiredType())
{
@@ -329,7 +333,8 @@
else
{
PropertyData propertyData =
- (PropertyData)dataConsumer.getItemData(nodeData, new QPathEntry(recipientDefinitionData.getName(), 0));
+ (PropertyData)dataConsumer.getItemData(nodeData, new QPathEntry(recipientDefinitionData.getName(), 0),
+ ItemType.PROPERTY);
checkValueConstraints(recipientDefinitionData, propertyData);
}
}
@@ -388,7 +393,8 @@
&& newPropertyDefinitionData.isAutoCreated())
{
ItemData pdata =
- dataConsumer.getItemData(nodeData, new QPathEntry(newPropertyDefinitionData.getName(), 0));
+ dataConsumer.getItemData(nodeData, new QPathEntry(newPropertyDefinitionData.getName(), 0),
+ ItemType.UNKNOWN);
if (pdata == null || (pdata != null && pdata.isNode()))
{
PlainChangesLog autoCreatedChanges =
@@ -521,8 +527,8 @@
checkRequiredType(registeredNodeType, recipientDefinitionData, allRecipientDefinition, nodesData);
}
// ValueConstraints
- if (!Arrays.deepEquals(ancestorDefinitionData.getValueConstraints(), recipientDefinitionData
- .getValueConstraints()))
+ if (!Arrays.deepEquals(ancestorDefinitionData.getValueConstraints(),
+ recipientDefinitionData.getValueConstraints()))
{
checkValueConstraints(registeredNodeType, recipientDefinitionData, allRecipientDefinition, nodesData);
}
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/AggregateRuleImpl.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/AggregateRuleImpl.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/AggregateRuleImpl.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -21,6 +21,7 @@
import org.exoplatform.services.jcr.datamodel.IllegalPathException;
import org.exoplatform.services.jcr.datamodel.InternalQName;
import org.exoplatform.services.jcr.datamodel.ItemData;
+import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPath;
@@ -408,7 +409,7 @@
else
{
cne = new ArrayList<NodeData>();
- ItemData item = ism.getItemData(nodeState, currentName);
+ ItemData item = ism.getItemData(nodeState, currentName, ItemType.NODE);
if (item != null && item.isNode())
{
cne.add((NodeData)item);
@@ -501,7 +502,7 @@
for (Iterator it = nodeStates.iterator(); it.hasNext();)
{
NodeData state = (NodeData)it.next();
- ItemData prop = ism.getItemData(state, new QPathEntry(propertyName, 1));
+ ItemData prop = ism.getItemData(state, new QPathEntry(propertyName, 1), ItemType.PROPERTY);
if (prop != null && !prop.isNode())
{
propStates.add(prop);
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/LuceneQueryBuilder.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/LuceneQueryBuilder.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/LuceneQueryBuilder.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -20,9 +20,9 @@
import org.apache.lucene.index.Term;
import org.apache.lucene.queryParser.ParseException;
import org.apache.lucene.queryParser.QueryParser;
+import org.apache.lucene.search.BooleanClause.Occur;
import org.apache.lucene.search.BooleanQuery;
import org.apache.lucene.search.Query;
-import org.apache.lucene.search.BooleanClause.Occur;
import org.exoplatform.commons.utils.ISO8601;
import org.exoplatform.services.jcr.core.nodetype.NodeTypeDataManager;
import org.exoplatform.services.jcr.dataflow.ItemDataConsumer;
@@ -30,6 +30,7 @@
import org.exoplatform.services.jcr.datamodel.IllegalPathException;
import org.exoplatform.services.jcr.datamodel.InternalQName;
import org.exoplatform.services.jcr.datamodel.ItemData;
+import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.QPath;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
@@ -760,6 +761,7 @@
final int[] transform = new int[]{TransformConstants.TRANSFORM_NONE};
node.acceptOperands(new DefaultQueryNodeVisitor()
{
+ @Override
public Object visit(PropertyFunctionQueryNode node, Object data)
{
if (node.getFunctionName().equals(PropertyFunctionQueryNode.LOWER_CASE))
@@ -1030,7 +1032,7 @@
ItemData item = parent;
for (int i = 0; i < relPathEntries.length; i++)
{
- item = sharedItemMgr.getItemData(parent, relPathEntries[i]);
+ item = sharedItemMgr.getItemData(parent, relPathEntries[i], ItemType.UNKNOWN);
if (item == null)
break;
@@ -1314,6 +1316,6 @@
values.add(literal);
log.debug("Using literal " + literal + " as is.");
}
- return (String[])values.toArray(new String[values.size()]);
+ return values.toArray(new String[values.size()]);
}
}
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -27,6 +27,7 @@
import org.exoplatform.services.jcr.core.value.ExtendedValue;
import org.exoplatform.services.jcr.dataflow.ItemDataConsumer;
import org.exoplatform.services.jcr.datamodel.InternalQName;
+import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
@@ -34,7 +35,6 @@
import org.exoplatform.services.jcr.impl.Constants;
import org.exoplatform.services.jcr.impl.core.LocationFactory;
import org.exoplatform.services.jcr.impl.core.value.ValueFactoryImpl;
-import org.exoplatform.services.jcr.impl.util.SecurityHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -42,6 +42,8 @@
import java.io.InputStream;
import java.io.Reader;
import java.io.StringReader;
+import java.security.AccessController;
+import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import java.util.ArrayList;
import java.util.Calendar;
@@ -226,15 +228,33 @@
addPropertyName(doc, prop.getQPath().getName());
}
- SecurityHelper.doPriviledgedRepositoryExceptionAction(new PrivilegedExceptionAction<Object>()
+ try
{
- public Object run() throws Exception
+ AccessController.doPrivileged(new PrivilegedExceptionAction<Object>()
{
- addValues(doc, prop);
- return null;
+ public Object run() throws Exception
+ {
+ addValues(doc, prop);
+ return null;
+ }
+ });
+ }
+ catch (PrivilegedActionException pae)
+ {
+ Throwable cause = pae.getCause();
+ if (cause instanceof RepositoryException)
+ {
+ throw (RepositoryException)cause;
}
- });
-
+ else if (cause instanceof RuntimeException)
+ {
+ throw (RuntimeException)cause;
+ }
+ else
+ {
+ throw new RuntimeException(cause);
+ }
+ }
}
// now add fields that are not used in excerpt (must go at the end)
@@ -301,7 +321,8 @@
// seems nt:file found, try for nt:resource props
PropertyData pmime =
- (PropertyData)stateProvider.getItemData(node, new QPathEntry(Constants.JCR_MIMETYPE, 0));
+ (PropertyData)stateProvider.getItemData(node, new QPathEntry(Constants.JCR_MIMETYPE, 0),
+ ItemType.PROPERTY);
if (pmime != null)
{
// ok, have a reader
@@ -309,7 +330,7 @@
// otherwise read prop with values from DM
PropertyData propData =
prop.getValues().size() > 0 ? prop : ((PropertyData)stateProvider.getItemData(node, new QPathEntry(
- Constants.JCR_DATA, 0)));
+ Constants.JCR_DATA, 0), ItemType.PROPERTY));
// index if have jcr:mimeType sibling for this binary property only
try
@@ -326,7 +347,8 @@
// check the jcr:encoding property
PropertyData encProp =
- (PropertyData)stateProvider.getItemData(node, new QPathEntry(Constants.JCR_ENCODING, 0));
+ (PropertyData)stateProvider.getItemData(node, new QPathEntry(Constants.JCR_ENCODING, 0),
+ ItemType.PROPERTY);
if (encProp != null)
{
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SharedFieldSortComparator.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SharedFieldSortComparator.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SharedFieldSortComparator.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -16,13 +16,6 @@
*/
package org.exoplatform.services.jcr.impl.core.query.lucene;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.jcr.InvalidItemStateException;
-import javax.jcr.RepositoryException;
-
import org.apache.lucene.document.Document;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.search.ScoreDoc;
@@ -33,6 +26,7 @@
import org.exoplatform.services.jcr.datamodel.IllegalNameException;
import org.exoplatform.services.jcr.datamodel.IllegalPathException;
import org.exoplatform.services.jcr.datamodel.ItemData;
+import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPath;
@@ -42,6 +36,13 @@
import org.exoplatform.services.jcr.impl.core.JCRPath;
import org.exoplatform.services.jcr.impl.core.LocationFactory;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.jcr.InvalidItemStateException;
+import javax.jcr.RepositoryException;
+
/**
* Implements a <code>SortComparator</code> which knows how to sort on a lucene
* field that contains values for multiple properties.
@@ -96,6 +97,7 @@
* @return a <code>ScoreDocComparator</code> for the
* @throws IOException if an error occurs while reading from the index.
*/
+ @Override
public ScoreDocComparator newComparator(IndexReader reader, String relPath) throws IOException
{
@@ -126,6 +128,7 @@
/**
* @throws UnsupportedOperationException always.
*/
+ @Override
protected Comparable getComparable(String termtext)
{
throw new UnsupportedOperationException();
@@ -317,7 +320,7 @@
ItemData parent = ism.getItemData(uuid);
if (!parent.isNode())
throw new InvalidItemStateException();
- ItemData property = getItemData((NodeData)parent, relPath);
+ ItemData property = getItemData((NodeData)parent, relPath, ItemType.PROPERTY);
if (property != null)
{
if (property.isNode())
@@ -339,7 +342,7 @@
}
}
- private ItemData getItemData(NodeData parent, QPathEntry name) throws RepositoryException
+ private ItemData getItemData(NodeData parent, QPathEntry name, ItemType itemType) throws RepositoryException
{
if (name.getName().equals(JCRPath.PARENT_RELPATH) && name.getNamespace().equals(Constants.NS_DEFAULT_URI))
{
@@ -349,19 +352,26 @@
return ism.getItemData(parent.getParentIdentifier());
}
- return ism.getItemData(parent, name);
+ return ism.getItemData(parent, name, itemType);
}
- private ItemData getItemData(NodeData parent, QPath relPath) throws RepositoryException
+ private ItemData getItemData(NodeData parent, QPath relPath, ItemType itemType) throws RepositoryException
{
- QPathEntry[] relPathEntries =relPath.getEntries(); //relPath.getRelPath(relPath.getDepth());
+ QPathEntry[] relPathEntries = relPath.getEntries(); //relPath.getRelPath(relPath.getDepth());
ItemData item = parent;
for (int i = 0; i < relPathEntries.length; i++)
{
- item = getItemData(parent, relPathEntries[i]);
+ if (i == relPathEntries.length - 1)
+ {
+ item = getItemData(parent, relPathEntries[i], itemType);
+ }
+ else
+ {
+ item = getItemData(parent, relPathEntries[i], ItemType.UNKNOWN);
+ }
if (item == null)
break;
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/FrozenNodeInitializer.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/FrozenNodeInitializer.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/FrozenNodeInitializer.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -24,6 +24,7 @@
import org.exoplatform.services.jcr.dataflow.ItemState;
import org.exoplatform.services.jcr.dataflow.PlainChangesLog;
import org.exoplatform.services.jcr.datamodel.InternalQName;
+import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPath;
@@ -271,8 +272,8 @@
false, new TransientValueData(Constants.NT_VERSIONEDCHILD));
ValueData vh =
- ((PropertyData)dataManager.getItemData(node, new QPathEntry(Constants.JCR_VERSIONHISTORY, 0)))
- .getValues().get(0);
+ ((PropertyData)dataManager.getItemData(node, new QPathEntry(Constants.JCR_VERSIONHISTORY, 0),
+ ItemType.PROPERTY)).getValues().get(0);
PropertyData pd =
TransientPropertyData.createPropertyData(frozenNode, Constants.JCR_CHILDVERSIONHISTORY,
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/ItemDataMergeVisitor.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/ItemDataMergeVisitor.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/ItemDataMergeVisitor.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -22,6 +22,7 @@
import org.exoplatform.services.jcr.dataflow.DataManager;
import org.exoplatform.services.jcr.dataflow.ItemState;
import org.exoplatform.services.jcr.datamodel.InternalQName;
+import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPath;
@@ -112,6 +113,7 @@
mergeSession.getAccessManager(), mergeSession.getUserState());
}
+ @Override
protected void validateReferential(NodeData node) throws RepositoryException
{
// no REFERENCE validation here
@@ -299,7 +301,8 @@
SessionDataManager mergeDataManager = mergeSession.getTransientNodesManager();
PropertyData isCheckedOutProperty =
- (PropertyData)mergeDataManager.getItemData(mergeNode, new QPathEntry(Constants.JCR_ISCHECKEDOUT, 0));
+ (PropertyData)mergeDataManager.getItemData(mergeNode, new QPathEntry(Constants.JCR_ISCHECKEDOUT, 0),
+ ItemType.PROPERTY);
try
{
@@ -361,9 +364,9 @@
QPath mergePath = mergeNode.getQPath();
TransientNodeData mergedNode =
- new TransientNodeData(mergePath, mergeNode.getIdentifier(), mergeNode.getPersistedVersion(), corrNode
- .getPrimaryTypeName(), corrNode.getMixinTypeNames(), mergeNode.getOrderNumber(), mergeNode
- .getParentIdentifier(), mergeNode.getACL());
+ new TransientNodeData(mergePath, mergeNode.getIdentifier(), mergeNode.getPersistedVersion(),
+ corrNode.getPrimaryTypeName(), corrNode.getMixinTypeNames(), mergeNode.getOrderNumber(),
+ mergeNode.getParentIdentifier(), mergeNode.getACL());
if (!mergeNode.getIdentifier().equals(corrNode.getIdentifier()))
{
@@ -393,8 +396,8 @@
for (PropertyData cp : mergeChildProps)
{
TransientPropertyData existed =
- new TransientPropertyData(cp.getQPath(), cp.getIdentifier(), cp.getPersistedVersion(), cp.getType(), cp
- .getParentIdentifier(), cp.isMultiValued(), copyValues(cp));
+ new TransientPropertyData(cp.getQPath(), cp.getIdentifier(), cp.getPersistedVersion(), cp.getType(),
+ cp.getParentIdentifier(), cp.isMultiValued(), copyValues(cp));
changes.add(new ItemState(existed, ItemState.DELETED, true, mergedNode.getQPath(), true));
existedProps.put(existed.getQPath().getName(), existed);
@@ -405,8 +408,8 @@
PropertyData existed = existedProps.get(cp.getQPath().getName());
TransientPropertyData mcp =
new TransientPropertyData(QPath.makeChildPath(mergePath, cp.getQPath().getName()), existed != null
- ? existed.getIdentifier() : cp.getIdentifier(), existed != null ? existed.getPersistedVersion() : cp
- .getPersistedVersion(), cp.getType(), mergedNode.getIdentifier(), cp.isMultiValued(), copyValues(cp));
+ ? existed.getIdentifier() : cp.getIdentifier(), existed != null ? existed.getPersistedVersion()
+ : cp.getPersistedVersion(), cp.getType(), mergedNode.getIdentifier(), cp.isMultiValued(), copyValues(cp));
changes.add(new ItemState(mcp, ItemState.ADDED, true, mergedNode.getQPath(), true));
}
@@ -462,7 +465,7 @@
SessionDataManager dmanager = session.getTransientNodesManager();
PropertyData bvProperty =
- (PropertyData)dmanager.getItemData(node, new QPathEntry(Constants.JCR_BASEVERSION, 0));
+ (PropertyData)dmanager.getItemData(node, new QPathEntry(Constants.JCR_BASEVERSION, 0), ItemType.PROPERTY);
try
{
@@ -486,8 +489,8 @@
SessionDataManager mergeDataManager = mergeSession.getTransientNodesManager();
NodeTypeDataManager mergeNtManager = mergeSession.getWorkspace().getNodeTypesHolder();
- if (mergeNtManager.isNodeType(Constants.MIX_REFERENCEABLE, mergeNode.getPrimaryTypeName(), mergeNode
- .getMixinTypeNames()))
+ if (mergeNtManager.isNodeType(Constants.MIX_REFERENCEABLE, mergeNode.getPrimaryTypeName(),
+ mergeNode.getMixinTypeNames()))
{
// by UUID
return (NodeData)corrDataManager.getItemData(mergeNode.getIdentifier());
@@ -499,15 +502,15 @@
final QPath ancesstorPath = mergePath.makeAncestorPath(i);
NodeData mergeAncestor = (NodeData)mergeDataManager.getItemData(ancesstorPath);
if (mergeAncestor != null
- && mergeNtManager.isNodeType(Constants.MIX_REFERENCEABLE, mergeAncestor.getPrimaryTypeName(), mergeAncestor
- .getMixinTypeNames()))
+ && mergeNtManager.isNodeType(Constants.MIX_REFERENCEABLE, mergeAncestor.getPrimaryTypeName(),
+ mergeAncestor.getMixinTypeNames()))
{
NodeData corrAncestor = (NodeData)corrDataManager.getItemData(mergeAncestor.getIdentifier());
if (corrAncestor != null)
{
QPathEntry[] relPathEntries = mergePath.getRelPath(mergePath.getDepth() - i);
- return (NodeData)corrDataManager.getItemData(corrAncestor, relPathEntries);
+ return (NodeData)corrDataManager.getItemData(corrAncestor, relPathEntries, ItemType.NODE);
}
}
}
@@ -523,7 +526,8 @@
SessionDataManager mergeDataManager = mergeSession.getTransientNodesManager();
PropertyData predecessorsProperty =
- (PropertyData)mergeDataManager.getItemData(mergeVersion, new QPathEntry(Constants.JCR_PREDECESSORS, 0));
+ (PropertyData)mergeDataManager.getItemData(mergeVersion, new QPathEntry(Constants.JCR_PREDECESSORS, 0),
+ ItemType.PROPERTY);
if (predecessorsProperty != null)
for (ValueData pv : predecessorsProperty.getValues())
@@ -568,7 +572,8 @@
SessionDataManager mergeDataManager = mergeSession.getTransientNodesManager();
PropertyData successorsProperty =
- (PropertyData)mergeDataManager.getItemData(mergeVersion, new QPathEntry(Constants.JCR_SUCCESSORS, 0));
+ (PropertyData)mergeDataManager.getItemData(mergeVersion, new QPathEntry(Constants.JCR_SUCCESSORS, 0),
+ ItemType.PROPERTY);
if (successorsProperty != null)
for (ValueData sv : successorsProperty.getValues())
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/ItemDataRestoreVisitor.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/ItemDataRestoreVisitor.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/ItemDataRestoreVisitor.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -23,6 +23,7 @@
import org.exoplatform.services.jcr.datamodel.IllegalNameException;
import org.exoplatform.services.jcr.datamodel.InternalQName;
import org.exoplatform.services.jcr.datamodel.ItemData;
+import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPath;
@@ -127,6 +128,7 @@
userSession.getUserState());
}
+ @Override
protected void validateReferential(NodeData node) throws RepositoryException
{
// no REFERENCE validation here
@@ -221,7 +223,7 @@
log.debug("Restore: " + nodePath.getAsString() + ", removeExisting=" + removeExisting);
PropertyData frozenIdentifier =
- (PropertyData)dataManager.getItemData(frozen, new QPathEntry(Constants.JCR_FROZENUUID, 1));
+ (PropertyData)dataManager.getItemData(frozen, new QPathEntry(Constants.JCR_FROZENUUID, 1), ItemType.PROPERTY);
String fidentifier = null;
NodeData existing = null;
@@ -275,6 +277,7 @@
.getAccessManager(), userSession.getUserState());
}
+ @Override
protected boolean isRemoveDescendant(ItemData item) throws RepositoryException
{
return item.getQPath().isDescendantOf(removedRoot.getQPath())
@@ -310,10 +313,12 @@
}
PropertyData frozenPrimaryType =
- (PropertyData)dataManager.getItemData(frozen, new QPathEntry(Constants.JCR_FROZENPRIMARYTYPE, 0));
+ (PropertyData)dataManager.getItemData(frozen, new QPathEntry(Constants.JCR_FROZENPRIMARYTYPE, 0),
+ ItemType.PROPERTY);
PropertyData frozenMixinTypes =
- (PropertyData)dataManager.getItemData(frozen, new QPathEntry(Constants.JCR_FROZENMIXINTYPES, 0));
+ (PropertyData)dataManager.getItemData(frozen, new QPathEntry(Constants.JCR_FROZENMIXINTYPES, 0),
+ ItemType.PROPERTY);
InternalQName[] mixins = null;
if (frozenMixinTypes != null)
@@ -422,7 +427,7 @@
String vhIdentifier =
new String(((PropertyData)dataManager.getItemData(frozen, new QPathEntry(
- Constants.JCR_CHILDVERSIONHISTORY, 0))).getValues().get(0).getAsByteArray());
+ Constants.JCR_CHILDVERSIONHISTORY, 0), ItemType.PROPERTY)).getValues().get(0).getAsByteArray());
NodeData cHistory = null;
if ((cHistory = (NodeData)dataManager.getItemData(vhIdentifier)) == null)
@@ -446,7 +451,7 @@
{
versionableIdentifier =
new String(((PropertyData)dataManager.getItemData(childHistory, new QPathEntry(
- Constants.JCR_VERSIONABLEUUID, 0))).getValues().get(0).getAsByteArray());
+ Constants.JCR_VERSIONABLEUUID, 0), ItemType.PROPERTY)).getValues().get(0).getAsByteArray());
}
catch (IOException e)
@@ -477,7 +482,8 @@
// not found, gets last version (by time of creation) and restore it
NodeData lastVersionData = childHistory.getLastVersionData();
NodeData cvFrozen =
- (NodeData)dataManager.getItemData(lastVersionData, new QPathEntry(Constants.JCR_FROZENNODE, 1));
+ (NodeData)dataManager.getItemData(lastVersionData, new QPathEntry(Constants.JCR_FROZENNODE, 1),
+ ItemType.NODE);
ItemDataRestoreVisitor restoreVisitor =
new ItemDataRestoreVisitor(currentNode(), qname, childHistory, userSession, removeExisting, changes);
@@ -524,8 +530,8 @@
try
{
jcrUuid =
- new String(((PropertyData)dataManager.getItemData(frozen, new QPathEntry(Constants.JCR_UUID, 0)))
- .getValues().get(0).getAsByteArray());
+ new String(((PropertyData)dataManager.getItemData(frozen, new QPathEntry(Constants.JCR_UUID, 0),
+ ItemType.PROPERTY)).getValues().get(0).getAsByteArray());
}
catch (IOException e)
@@ -540,7 +546,7 @@
// try to use existing node uuid, otherwise to generate one new
existing =
(NodeData)dataManager.getItemData(currentNode(), new QPathEntry(frozen.getQPath().getName(), frozen
- .getQPath().getIndex()));
+ .getQPath().getIndex()), ItemType.NODE);
if (existing != null)
{
jcrUuid = existing.getIdentifier();
@@ -595,7 +601,8 @@
{
// current C in the workspace will be left unchanged,
NodeData existed =
- (NodeData)dataManager.getItemData(currentNode(), new QPathEntry(frozen.getQPath().getName(), 0));
+ (NodeData)dataManager.getItemData(currentNode(), new QPathEntry(frozen.getQPath().getName(), 0),
+ ItemType.NODE);
if (existed != null)
{
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/VersionHistoryImpl.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/VersionHistoryImpl.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/VersionHistoryImpl.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -23,6 +23,7 @@
import org.exoplatform.services.jcr.dataflow.PlainChangesLogImpl;
import org.exoplatform.services.jcr.datamodel.InternalQName;
import org.exoplatform.services.jcr.datamodel.ItemData;
+import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
@@ -109,7 +110,8 @@
checkValid();
PropertyData versionableUuid =
- (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_VERSIONABLEUUID, 0));
+ (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_VERSIONABLEUUID, 0),
+ ItemType.PROPERTY);
if (versionableUuid != null)
{
@@ -139,7 +141,8 @@
checkValid();
VersionImpl version =
- (VersionImpl)dataManager.getItem(nodeData(), new QPathEntry(Constants.JCR_ROOTVERSION, 0), true);
+ (VersionImpl)dataManager
+ .getItem(nodeData(), new QPathEntry(Constants.JCR_ROOTVERSION, 0), true, ItemType.NODE);
if (version == null)
{
throw new VersionException("There are no root version in the version history " + getPath());
@@ -187,7 +190,8 @@
JCRName jcrVersionName = locationFactory.parseJCRName(versionName);
VersionImpl version =
- (VersionImpl)dataManager.getItem(nodeData(), new QPathEntry(jcrVersionName.getInternalName(), 1), pool);
+ (VersionImpl)dataManager.getItem(nodeData(), new QPathEntry(jcrVersionName.getInternalName(), 1), pool,
+ ItemType.NODE);
if (version == null)
{
throw new VersionException("There are no version with name '" + versionName + "' in the version history "
@@ -360,13 +364,13 @@
// and point successor to predecessor directly
PropertyData successorsData =
- (PropertyData)dataManager
- .getItemData((NodeData)version.getData(), new QPathEntry(Constants.JCR_SUCCESSORS, 0));
+ (PropertyData)dataManager.getItemData((NodeData)version.getData(),
+ new QPathEntry(Constants.JCR_SUCCESSORS, 0), ItemType.PROPERTY);
// jcr:predecessors
PropertyData predecessorsData =
(PropertyData)dataManager.getItemData((NodeData)version.getData(), new QPathEntry(Constants.JCR_PREDECESSORS,
- 0));
+ 0), ItemType.PROPERTY);
try
{
@@ -538,7 +542,8 @@
InternalQName labelQName = jcrLabelName.getInternalName();
PropertyData vldata =
- (PropertyData)dataManager.getItemData(getData().getVersionLabelsData(), new QPathEntry(labelQName, 0));
+ (PropertyData)dataManager.getItemData(getData().getVersionLabelsData(), new QPathEntry(labelQName, 0),
+ ItemType.PROPERTY);
if (vldata != null)
{
@@ -592,7 +597,8 @@
// A reference to V is added to the jcr:successors property of
// each of the versions identified in Vs jcr:predecessors property.
List<ValueData> predecessors =
- ((PropertyData)dataManager.getItemData(versionableNodeData, new QPathEntry(Constants.JCR_PREDECESSORS, 0)))
+ ((PropertyData)dataManager.getItemData(versionableNodeData, new QPathEntry(Constants.JCR_PREDECESSORS, 0),
+ ItemType.PROPERTY))
.getValues();
List<ValueData> predecessorsNew = new ArrayList<ValueData>();
for (ValueData predecessorValue : predecessors)
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/VersionImpl.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/VersionImpl.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/VersionImpl.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -23,6 +23,7 @@
import org.exoplatform.services.jcr.dataflow.PlainChangesLog;
import org.exoplatform.services.jcr.datamodel.Identifier;
import org.exoplatform.services.jcr.datamodel.InternalQName;
+import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPath;
@@ -80,7 +81,8 @@
{
checkValid();
- PropertyData pdata = (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_CREATED, 0));
+ PropertyData pdata =
+ (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_CREATED, 0), ItemType.PROPERTY);
if (pdata == null)
{
@@ -99,7 +101,8 @@
checkValid();
PropertyData successorsData =
- (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_SUCCESSORS, 0));
+ (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_SUCCESSORS, 0),
+ ItemType.PROPERTY);
if (successorsData == null)
{
@@ -142,7 +145,8 @@
checkValid();
PropertyData predecessorsData =
- (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_PREDECESSORS, 0));
+ (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_PREDECESSORS, 0),
+ ItemType.PROPERTY);
if (predecessorsData == null)
{
@@ -184,7 +188,8 @@
ValueData successorRef = new TransientValueData(new Identifier(successorIdentifier));
PropertyData successorsProp =
- (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_SUCCESSORS, 0));
+ (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_SUCCESSORS, 0),
+ ItemType.PROPERTY);
if (successorsProp == null)
{
@@ -230,7 +235,8 @@
ValueData predeccessorRef = new TransientValueData(new Identifier(predeccessorIdentifier));
PropertyData predeccessorsProp =
- (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_PREDECESSORS, 0));
+ (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_PREDECESSORS, 0),
+ ItemType.PROPERTY);
if (predeccessorsProp == null)
{
@@ -271,7 +277,8 @@
void removeSuccessor(String successorIdentifier, PlainChangesLog changesLog) throws RepositoryException
{
PropertyData successorsProp =
- (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_SUCCESSORS, 0));
+ (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_SUCCESSORS, 0),
+ ItemType.PROPERTY);
if (successorsProp != null)
{
List<ValueData> newSuccessors = new ArrayList<ValueData>();
@@ -310,7 +317,8 @@
{
PropertyData successorsProp =
- (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_SUCCESSORS, 0));
+ (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_SUCCESSORS, 0),
+ ItemType.PROPERTY);
if (successorsProp != null)
{
@@ -350,7 +358,8 @@
void removePredecessor(String predecessorIdentifier, PlainChangesLog changesLog) throws RepositoryException
{
PropertyData predeccessorsProp =
- (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_PREDECESSORS, 0));
+ (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_PREDECESSORS, 0),
+ ItemType.PROPERTY);
if (predeccessorsProp != null)
{
@@ -390,7 +399,8 @@
{
PropertyData predeccessorsProp =
- (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_PREDECESSORS, 0));
+ (PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_PREDECESSORS, 0),
+ ItemType.PROPERTY);
if (predeccessorsProp != null)
{
@@ -460,7 +470,8 @@
DataManager dmanager = restoreSession.getTransientNodesManager().getTransactManager();
- NodeData frozenData = (NodeData)dmanager.getItemData(nodeData(), new QPathEntry(Constants.JCR_FROZENNODE, 1));
+ NodeData frozenData =
+ (NodeData)dmanager.getItemData(nodeData(), new QPathEntry(Constants.JCR_FROZENNODE, 1), ItemType.NODE);
ItemDataRestoreVisitor restoreVisitor =
new ItemDataRestoreVisitor(destParent, name, historyData, restoreSession, removeExisting, delegatedLog);
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/ACLInheritanceSupportedWorkspaceDataManager.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/ACLInheritanceSupportedWorkspaceDataManager.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/ACLInheritanceSupportedWorkspaceDataManager.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -22,6 +22,7 @@
import org.exoplatform.services.jcr.dataflow.ItemStateChangesLog;
import org.exoplatform.services.jcr.dataflow.SharedDataManager;
import org.exoplatform.services.jcr.datamodel.ItemData;
+import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
@@ -101,16 +102,16 @@
{
// use parent ACL
node =
- new TransientNodeData(node.getQPath(), node.getIdentifier(), node.getPersistedVersion(), node
- .getPrimaryTypeName(), node.getMixinTypeNames(), node.getOrderNumber(),
+ new TransientNodeData(node.getQPath(), node.getIdentifier(), node.getPersistedVersion(),
+ node.getPrimaryTypeName(), node.getMixinTypeNames(), node.getOrderNumber(),
node.getParentIdentifier(), parent.getACL());
}
else
{
// use nearest ancestor ACL... case of get by id
node =
- new TransientNodeData(node.getQPath(), node.getIdentifier(), node.getPersistedVersion(), node
- .getPrimaryTypeName(), node.getMixinTypeNames(), node.getOrderNumber(),
+ new TransientNodeData(node.getQPath(), node.getIdentifier(), node.getPersistedVersion(),
+ node.getPrimaryTypeName(), node.getMixinTypeNames(), node.getOrderNumber(),
node.getParentIdentifier(), getNearestACAncestorAcl(node));
}
}
@@ -120,9 +121,9 @@
AccessControlList ancestorAcl = getNearestACAncestorAcl(node);
node =
- new TransientNodeData(node.getQPath(), node.getIdentifier(), node.getPersistedVersion(), node
- .getPrimaryTypeName(), node.getMixinTypeNames(), node.getOrderNumber(), node.getParentIdentifier(),
- new AccessControlList(acl.getOwner(), ancestorAcl.getPermissionEntries()));
+ new TransientNodeData(node.getQPath(), node.getIdentifier(), node.getPersistedVersion(),
+ node.getPrimaryTypeName(), node.getMixinTypeNames(), node.getOrderNumber(),
+ node.getParentIdentifier(), new AccessControlList(acl.getOwner(), ancestorAcl.getPermissionEntries()));
}
else if (!acl.hasOwner())
{
@@ -130,9 +131,9 @@
AccessControlList ancestorAcl = getNearestACAncestorAcl(node);
node =
- new TransientNodeData(node.getQPath(), node.getIdentifier(), node.getPersistedVersion(), node
- .getPrimaryTypeName(), node.getMixinTypeNames(), node.getOrderNumber(), node.getParentIdentifier(),
- new AccessControlList(ancestorAcl.getOwner(), acl.getPermissionEntries()));
+ new TransientNodeData(node.getQPath(), node.getIdentifier(), node.getPersistedVersion(),
+ node.getPrimaryTypeName(), node.getMixinTypeNames(), node.getOrderNumber(),
+ node.getParentIdentifier(), new AccessControlList(ancestorAcl.getOwner(), acl.getPermissionEntries()));
}
}
@@ -167,7 +168,15 @@
*/
public ItemData getItemData(NodeData parent, QPathEntry name) throws RepositoryException
{
- final ItemData item = persistentManager.getItemData(parent, name);
+ return getItemData(parent, name, ItemType.UNKNOWN);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ItemData getItemData(NodeData parent, QPathEntry name, ItemType itemType) throws RepositoryException
+ {
+ final ItemData item = persistentManager.getItemData(parent, name, itemType);
return item != null && item.isNode() ? initACL(parent, (NodeData)item) : item;
}
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheQPath.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheQPath.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheQPath.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -18,6 +18,7 @@
*/
package org.exoplatform.services.jcr.impl.dataflow.persistent;
+import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.QPath;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
import org.exoplatform.services.jcr.impl.Constants;
@@ -68,37 +69,42 @@
private final String key;
+ private final ItemType itemType;
+
/**
* For CPath will be stored in cache C
*/
- CacheQPath(String parentId, QPath path)
+ CacheQPath(String parentId, QPath path, ItemType itemType)
{
this.parentId = parentId;
this.path = path;
- this.key = key(this.parentId, this.path.getEntries());
+ this.itemType = itemType;
+ this.key = key(this.parentId, this.path.getEntries(), this.itemType);
}
/**
* For CPath will be searched in cache C
*/
- CacheQPath(String parentId, QPathEntry name)
+ CacheQPath(String parentId, QPathEntry name, ItemType itemType)
{
this.parentId = parentId;
this.path = null;
- this.key = key(this.parentId, name);
+ this.itemType = itemType;
+ this.key = key(this.parentId, name, this.itemType);
}
- protected String key(final String parentId, final QPathEntry[] pathEntries)
+ protected String key(final String parentId, final QPathEntry[] pathEntries, ItemType itemType)
{
- return key(parentId, pathEntries[pathEntries.length - 1]);
+ return key(parentId, pathEntries[pathEntries.length - 1], itemType);
}
- protected String key(final String parentId, final QPathEntry name)
+ protected String key(final String parentId, final QPathEntry name, ItemType itemType)
{
StringBuilder sk = new StringBuilder();
// sk.append(BASE); for strong hash code, skip it when equals uses String.equals
sk.append(parentId != null ? parentId : Constants.ROOT_PARENT_UUID);
sk.append(name.getAsString(true));
+ sk.append(itemType.toString());
return sk.toString();
}
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -21,6 +21,7 @@
import org.exoplatform.services.jcr.dataflow.ItemStateChangesLog;
import org.exoplatform.services.jcr.dataflow.persistent.WorkspaceStorageCache;
import org.exoplatform.services.jcr.datamodel.ItemData;
+import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
@@ -337,6 +338,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public int getChildNodesCount(NodeData parent) throws RepositoryException
{
if (cache.isEnabled())
@@ -354,6 +356,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public List<NodeData> getChildNodesData(NodeData nodeData) throws RepositoryException
{
return getChildNodesData(nodeData, false);
@@ -362,6 +365,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public List<PropertyData> getChildPropertiesData(NodeData nodeData) throws RepositoryException
{
List<PropertyData> childs = getChildPropertiesData(nodeData, false);
@@ -378,9 +382,18 @@
*/
public ItemData getItemData(NodeData parentData, QPathEntry name) throws RepositoryException
{
+ return getItemData(parentData, name, ItemType.UNKNOWN);
+ }
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ItemData getItemData(NodeData parentData, QPathEntry name, ItemType itemType) throws RepositoryException
+ {
+
// 1. Try from cache
- ItemData data = getCachedItemData(parentData, name);
+ ItemData data = getCachedItemData(parentData, name, itemType);
// 2. Try from container
if (data == null)
@@ -392,10 +405,10 @@
request.start();
// Try first to get the value from the cache since a
// request could have been launched just before
- data = getCachedItemData(parentData, name);
+ data = getCachedItemData(parentData, name, itemType);
if (data == null)
{
- data = getPersistedItemData(parentData, name);
+ data = getPersistedItemData(parentData, name, itemType);
}
else if (!data.isNode())
{
@@ -418,6 +431,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public ItemData getItemData(String identifier) throws RepositoryException
{
// 2. Try from cache
@@ -459,6 +473,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public List<PropertyData> getReferencesData(String identifier, boolean skipVersionStorage)
throws RepositoryException
{
@@ -468,6 +483,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public List<PropertyData> listChildPropertiesData(NodeData nodeData) throws RepositoryException
{
return listChildPropertiesData(nodeData, false);
@@ -501,13 +517,16 @@
* parent
* @param name
* Item name
+ * @param itemType
+ * item type
* @return ItemData
* @throws RepositoryException
* error
*/
- protected ItemData getCachedItemData(NodeData parentData, QPathEntry name) throws RepositoryException
+ protected ItemData getCachedItemData(NodeData parentData, QPathEntry name, ItemType itemType)
+ throws RepositoryException
{
- return cache.get(parentData.getIdentifier(), name);
+ return cache.get(parentData.getIdentifier(), name, itemType);
}
/**
@@ -647,13 +666,16 @@
* parent
* @param name
* Item name
+ * @param itemType
+ * item type
* @return ItemData
* @throws RepositoryException
* error
*/
- protected ItemData getPersistedItemData(NodeData parentData, QPathEntry name) throws RepositoryException
+ protected ItemData getPersistedItemData(NodeData parentData, QPathEntry name, ItemType itemType)
+ throws RepositoryException
{
- ItemData data = super.getItemData(parentData, name);
+ ItemData data = super.getItemData(parentData, name, itemType);
if (data != null && cache.isEnabled())
{
cache.put(data);
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -25,6 +25,7 @@
import org.exoplatform.services.jcr.dataflow.ItemStateChangesLog;
import org.exoplatform.services.jcr.dataflow.persistent.WorkspaceStorageCache;
import org.exoplatform.services.jcr.datamodel.ItemData;
+import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPath;
@@ -41,10 +42,10 @@
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.Timer;
import java.util.TimerTask;
import java.util.WeakHashMap;
-import java.util.Map.Entry;
import java.util.concurrent.Semaphore;
import java.util.concurrent.locks.ReentrantLock;
@@ -882,11 +883,30 @@
*/
public ItemData get(final String parentId, final QPathEntry name)
{
+ return get(parentId, name, ItemType.UNKNOWN);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ItemData get(final String parentId, final QPathEntry name, ItemType itemType)
+ {
if (enabled && parentId != null && name != null)
{
try
{
- return getItem(parentId, name);
+ ItemData itemData = null;
+ if (itemType == ItemType.NODE || itemType == ItemType.UNKNOWN)
+ {
+ itemData = getItem(parentId, name, ItemType.NODE);
+ }
+
+ if (itemType == ItemType.PROPERTY || itemType == ItemType.UNKNOWN && itemData == null)
+ {
+ itemData = getItem(parentId, name, ItemType.PROPERTY);
+ }
+
+ return itemData;
}
catch (Exception e)
{
@@ -906,9 +926,8 @@
protected void putItem(final ItemData data)
{
cache.put(new CacheId(data.getIdentifier()), new CacheValue(data, System.currentTimeMillis() + liveTime));
- cache.put(new CacheQPath(data.getParentIdentifier(), data.getQPath()), new CacheValue(data, System
- .currentTimeMillis()
- + liveTime));
+ cache.put(new CacheQPath(data.getParentIdentifier(), data.getQPath(), ItemType.getItemType(data)),
+ new CacheValue(data, System.currentTimeMillis() + liveTime));
}
/**
@@ -1052,7 +1071,7 @@
{
if (enabled && parentData != null && childItems != null)
{ // TODO don't check parentData !=
- // null && childItems != null
+ // null && childItems != null
String logInfo = null;
if (LOG.isDebugEnabled())
@@ -1114,7 +1133,7 @@
{
if (enabled && parentData != null && childItems != null)
{ // TODO don't check parentData !=
- // null && childItems != null
+ // null && childItems != null
String logInfo = null;
if (LOG.isDebugEnabled())
@@ -1165,7 +1184,7 @@
{
if (enabled && parentData != null && childItems != null)
{ // TODO don't check parentData !=
- // null && childItems != null
+ // null && childItems != null
String logInfo = null;
if (LOG.isDebugEnabled())
@@ -1303,7 +1322,7 @@
cache.remove(k);
// remove by parentId + path
- cache.remove(new CacheQPath(c.getParentIdentifier(), c.getQPath()));
+ cache.remove(new CacheQPath(c.getParentIdentifier(), c.getQPath(), ItemType.getItemType(c)));
// remove cached child lists
if (c.isNode())
@@ -1333,12 +1352,12 @@
* @param key
* a InternalQPath path of item cached
*/
- protected ItemData getItem(final String parentUuid, final QPathEntry qname)
+ protected ItemData getItem(final String parentUuid, final QPathEntry qname, ItemType itemType)
{
long start = System.currentTimeMillis();
try
{
- final CacheQPath k = new CacheQPath(parentUuid, qname);
+ final CacheQPath k = new CacheQPath(parentUuid, qname, itemType);
final CacheValue v = cache.get(k);
if (v != null)
{
@@ -1643,8 +1662,7 @@
{
writeLock.unlock();
}
- LOG
- .info(name + " : set liveTime=" + liveTime + "ms. New value will be applied to items cached from this moment.");
+ LOG.info(name + " : set liveTime=" + liveTime + "ms. New value will be applied to items cached from this moment.");
}
/**
@@ -1658,7 +1676,8 @@
cache.remove(new CacheId(itemId));
- final CacheValue v2 = cache.remove(new CacheQPath(item.getParentIdentifier(), item.getQPath()));
+ final CacheValue v2 =
+ cache.remove(new CacheQPath(item.getParentIdentifier(), item.getQPath(), ItemType.getItemType(item)));
if (v2 != null && !v2.getItem().getIdentifier().equals(itemId))
// same path but diff identifier node... phantom
removeItem(v2.getItem());
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/VersionableWorkspaceDataManager.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/VersionableWorkspaceDataManager.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/VersionableWorkspaceDataManager.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -26,6 +26,7 @@
import org.exoplatform.services.jcr.dataflow.PlainChangesLogImpl;
import org.exoplatform.services.jcr.dataflow.TransactionChangesLog;
import org.exoplatform.services.jcr.datamodel.ItemData;
+import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPath;
@@ -126,18 +127,26 @@
/**
* {@inheritDoc}
*/
- @Override
public ItemData getItemData(NodeData parentData, QPathEntry name) throws RepositoryException
{
+ return getItemData(parentData, name, ItemType.UNKNOWN);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ItemData getItemData(NodeData parentData, QPathEntry name, ItemType itemType) throws RepositoryException
+ {
if (parentData != null)
{
final QPath ipath = QPath.makeChildPath(parentData.getQPath(), name);
if (isSystemDescendant(ipath) && !this.equals(versionDataManager))
{
- return versionDataManager.getItemData(parentData, name);
+ return versionDataManager.getItemData(parentData, name, itemType);
}
}
- return super.getItemData(parentData, name);
+ return super.getItemData(parentData, name, itemType);
}
/**
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -33,6 +33,7 @@
import org.exoplatform.services.jcr.dataflow.persistent.PersistedNodeData;
import org.exoplatform.services.jcr.dataflow.persistent.PersistedPropertyData;
import org.exoplatform.services.jcr.datamodel.ItemData;
+import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPath;
@@ -229,7 +230,7 @@
// if it's different container instances
? systemDataContainer.equals(dataContainer) && thisConnection != null
// but container confugrations are same and non-system connnection open
- // reuse this connection as system
+ // reuse this connection as system
? systemDataContainer.reuseConnection(thisConnection)
// or open one new system
: systemDataContainer.openConnection()
@@ -251,7 +252,7 @@
// if it's different container instances
? dataContainer.equals(systemDataContainer) && systemConnection != null
// but container confugrations are same and system connnection open
- // reuse system connection as this
+ // reuse system connection as this
? dataContainer.reuseConnection(systemConnection)
// or open one new
: dataContainer.openConnection()
@@ -290,9 +291,9 @@
{
NodeData prevData = (NodeData)prevState.getData();
newData =
- new PersistedNodeData(prevData.getIdentifier(), prevData.getQPath(), prevData
- .getParentIdentifier(), prevData.getPersistedVersion() + 1, prevData.getOrderNumber(), prevData
- .getPrimaryTypeName(), prevData.getMixinTypeNames(), prevData.getACL());
+ new PersistedNodeData(prevData.getIdentifier(), prevData.getQPath(),
+ prevData.getParentIdentifier(), prevData.getPersistedVersion() + 1, prevData.getOrderNumber(),
+ prevData.getPrimaryTypeName(), prevData.getMixinTypeNames(), prevData.getACL());
}
else
{
@@ -344,16 +345,16 @@
}
newData =
- new PersistedPropertyData(prevData.getIdentifier(), prevData.getQPath(), prevData
- .getParentIdentifier(), prevData.getPersistedVersion() + 1, prevData.getType(), prevData
- .isMultiValued(), values);
+ new PersistedPropertyData(prevData.getIdentifier(), prevData.getQPath(),
+ prevData.getParentIdentifier(), prevData.getPersistedVersion() + 1, prevData.getType(),
+ prevData.isMultiValued(), values);
}
else
{
newData =
- new PersistedPropertyData(prevData.getIdentifier(), prevData.getQPath(), prevData
- .getParentIdentifier(), prevData.getPersistedVersion() + 1, prevData.getType(), prevData
- .isMultiValued(), null);
+ new PersistedPropertyData(prevData.getIdentifier(), prevData.getQPath(),
+ prevData.getParentIdentifier(), prevData.getPersistedVersion() + 1, prevData.getType(),
+ prevData.isMultiValued(), null);
}
}
}
@@ -577,7 +578,9 @@
NodeData parent = (NodeData)acon.getItemData(node.getParentIdentifier());
QPathEntry myName = node.getQPath().getEntries()[node.getQPath().getEntries().length - 1];
ItemData sibling =
- acon.getItemData(parent, new QPathEntry(myName.getNamespace(), myName.getName(), myName.getIndex() - 1));
+ acon.getItemData(parent, new QPathEntry(myName.getNamespace(), myName.getName(), myName.getIndex() - 1),
+ ItemType.NODE);
+
if (sibling == null || !sibling.isNode())
{
throw new InvalidItemStateException("Node can't be saved " + node.getQPath().getAsString()
@@ -798,10 +801,19 @@
*/
public ItemData getItemData(final NodeData parentData, final QPathEntry name) throws RepositoryException
{
+ return getItemData(parentData, name, ItemType.UNKNOWN);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ItemData getItemData(final NodeData parentData, final QPathEntry name, ItemType itemType)
+ throws RepositoryException
+ {
final WorkspaceStorageConnection con = dataContainer.openConnection();
try
{
- return con.getItemData(parentData, name);
+ return con.getItemData(parentData, name, itemType);
}
finally
{
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheQPath.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheQPath.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheQPath.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -18,6 +18,7 @@
*/
package org.exoplatform.services.jcr.impl.dataflow.persistent.infinispan;
+import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.QPath;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
import org.exoplatform.services.jcr.impl.Constants;
@@ -39,18 +40,20 @@
private final QPath path;
- CacheQPath(String parentId, QPath path)
+ CacheQPath(String parentId, QPath path, ItemType itemType)
{
- super((parentId != null ? parentId : Constants.ROOT_PARENT_UUID)
- + path.getEntries()[path.getEntries().length - 1].getAsString(true));
+ super(new StringBuilder().append(parentId != null ? parentId : Constants.ROOT_PARENT_UUID)
+ .append(path.getEntries()[path.getEntries().length - 1].getAsString(true)).append(itemType.toString())
+ .toString());
this.parentId = parentId;
this.path = path;
}
- CacheQPath(String parentId, QPathEntry name)
+ CacheQPath(String parentId, QPathEntry name, ItemType itemType)
{
- super((parentId != null ? parentId : Constants.ROOT_PARENT_UUID) + name.getAsString(true));
+ super(new StringBuilder().append(parentId != null ? parentId : Constants.ROOT_PARENT_UUID)
+ .append(name.getAsString(true)).append(itemType.toString()).toString());
this.parentId = parentId;
this.path = null;
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/ISPNCacheWorkspaceStorageCache.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/ISPNCacheWorkspaceStorageCache.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/ISPNCacheWorkspaceStorageCache.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -29,6 +29,7 @@
import org.exoplatform.services.jcr.datamodel.IllegalPathException;
import org.exoplatform.services.jcr.datamodel.InternalQName;
import org.exoplatform.services.jcr.datamodel.ItemData;
+import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPath;
@@ -425,7 +426,27 @@
*/
public ItemData get(String parentId, QPathEntry name)
{
- String id = (String)cache.get(new CacheQPath(parentId, name));
+ return get(parentId, name, ItemType.UNKNOWN);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ItemData get(String parentIdentifier, QPathEntry name, ItemType itemType)
+ {
+ String id = null;
+ if (itemType == ItemType.NODE || itemType == ItemType.UNKNOWN)
+ {
+ // try as node first
+ id = (String)cache.get(new CacheQPath(parentIdentifier, name, ItemType.NODE));
+ }
+
+ if (itemType == ItemType.PROPERTY || itemType == ItemType.UNKNOWN && id == null)
+ {
+ // try as property
+ id = (String)cache.get(new CacheQPath(parentIdentifier, name, ItemType.PROPERTY));
+ }
+
return get(id);
}
@@ -590,7 +611,7 @@
{
if (node.getParentIdentifier() != null)
{
- cache.put(new CacheQPath(node.getParentIdentifier(), node.getQPath()), node.getIdentifier());
+ cache.put(new CacheQPath(node.getParentIdentifier(), node.getQPath(), ItemType.NODE), node.getIdentifier());
// if MODIFY and List present OR FORCE_MODIFY, then write
if ((modifyListsOfChild == ModifyChildOption.MODIFY && cache.get(new CacheNodesId(node.getParentIdentifier())) != null)
@@ -607,7 +628,7 @@
{
if (node.getParentIdentifier() != null)
{
- cache.put(new CacheQPath(node.getParentIdentifier(), node.getQPath()), node.getIdentifier());
+ cache.put(new CacheQPath(node.getParentIdentifier(), node.getQPath(), ItemType.NODE), node.getIdentifier());
// if MODIFY and List present OR FORCE_MODIFY, then write
if ((modifyListsOfChild == ModifyChildOption.MODIFY && cache.get(new CacheNodesId(node.getParentIdentifier())) != null)
@@ -635,14 +656,14 @@
cache.addToList(new CachePropsId(prop.getParentIdentifier()), prop.getIdentifier());
}
- cache.put(new CacheQPath(prop.getParentIdentifier(), prop.getQPath()), prop.getIdentifier());
+ cache.put(new CacheQPath(prop.getParentIdentifier(), prop.getQPath(), ItemType.PROPERTY), prop.getIdentifier());
return (PropertyData)cache.put(new CacheId(prop.getIdentifier()), prop, true);
}
protected void removeItem(ItemData item)
{
cache.remove(new CacheId(item.getIdentifier()));
- cache.remove(new CacheQPath(item.getParentIdentifier(), item.getQPath()));
+ cache.remove(new CacheQPath(item.getParentIdentifier(), item.getQPath(), ItemType.getItemType(item)));
if (item.getParentIdentifier() != null)
{
@@ -693,7 +714,7 @@
*/
protected void updateInBuffer(final NodeData node, final NodeData prevNode)
{
- CacheQPath prevKey = new CacheQPath(node.getParentIdentifier(), prevNode.getQPath());
+ CacheQPath prevKey = new CacheQPath(node.getParentIdentifier(), prevNode.getQPath(), ItemType.NODE);
if (node.getIdentifier().equals(cache.getFromBuffer(prevKey)))
{
cache.remove(prevKey);
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -28,6 +28,7 @@
import org.exoplatform.services.jcr.datamodel.IllegalPathException;
import org.exoplatform.services.jcr.datamodel.InternalQName;
import org.exoplatform.services.jcr.datamodel.ItemData;
+import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPath;
@@ -592,11 +593,23 @@
*/
public ItemData get(String parentId, QPathEntry name)
{
+ return get(parentId, name, ItemType.UNKNOWN);
+ }
- // get as node first
- String itemId = (String)cache.get(makeChildFqn(childNodes, parentId, name), ITEM_ID);
- if (itemId == null)
+ /**
+ * {@inheritDoc}
+ */
+ public ItemData get(String parentId, QPathEntry name, ItemType itemType)
+ {
+ String itemId = null;
+ if (itemType == ItemType.NODE || itemType == ItemType.UNKNOWN)
{
+ // try as node first
+ itemId = (String)cache.get(makeChildFqn(childNodes, parentId, name), ITEM_ID);
+ }
+
+ if (itemType == ItemType.PROPERTY || itemType == ItemType.UNKNOWN && itemId == null)
+ {
// try as property
itemId = (String)cache.get(makeChildFqn(childProps, parentId, name), ITEM_ID);
}
@@ -827,15 +840,16 @@
if (node.getParentIdentifier() != null)
{
// add in CHILD_NODES
- cache.put(makeChildFqn(childNodes, node.getParentIdentifier(), node.getQPath().getEntries()[node.getQPath()
- .getEntries().length - 1]), ITEM_ID, node.getIdentifier());
+ cache.put(
+ makeChildFqn(childNodes, node.getParentIdentifier(), node.getQPath().getEntries()[node.getQPath()
+ .getEntries().length - 1]), ITEM_ID, node.getIdentifier());
// if MODIFY and List present OR FORCE_MODIFY, then write
- if ((modifyListsOfChild == ModifyChildOption.MODIFY && cache.getNode(makeChildListFqn(childNodesList, node
- .getParentIdentifier())) != null)
+ if ((modifyListsOfChild == ModifyChildOption.MODIFY && cache.getNode(makeChildListFqn(childNodesList,
+ node.getParentIdentifier())) != null)
|| modifyListsOfChild == ModifyChildOption.FORCE_MODIFY)
{
- cache.addToList(makeChildListFqn(childNodesList, node.getParentIdentifier()), ITEM_LIST, node
- .getIdentifier());
+ cache.addToList(makeChildListFqn(childNodesList, node.getParentIdentifier()), ITEM_LIST,
+ node.getIdentifier());
}
}
@@ -849,15 +863,16 @@
if (node.getParentIdentifier() != null)
{
// add in CHILD_NODES
- cache.put(makeChildFqn(childNodes, node.getParentIdentifier(), node.getQPath().getEntries()[node.getQPath()
- .getEntries().length - 1]), ITEM_ID, node.getIdentifier());
+ cache.put(
+ makeChildFqn(childNodes, node.getParentIdentifier(), node.getQPath().getEntries()[node.getQPath()
+ .getEntries().length - 1]), ITEM_ID, node.getIdentifier());
// if MODIFY and List present OR FORCE_MODIFY, then write
- if ((modifyListsOfChild == ModifyChildOption.MODIFY && cache.getNode(makeChildListFqn(childNodesList, node
- .getParentIdentifier())) != null)
+ if ((modifyListsOfChild == ModifyChildOption.MODIFY && cache.getNode(makeChildListFqn(childNodesList,
+ node.getParentIdentifier())) != null)
|| modifyListsOfChild == ModifyChildOption.FORCE_MODIFY)
{
- cache.addToList(makeChildListFqn(childNodesList, node.getParentIdentifier()), ITEM_LIST, node
- .getIdentifier());
+ cache.addToList(makeChildListFqn(childNodesList, node.getParentIdentifier()), ITEM_LIST,
+ node.getIdentifier());
}
}
// add in ITEMS
@@ -873,11 +888,12 @@
protected PropertyData putProperty(PropertyData prop, ModifyChildOption modifyListsOfChild)
{
// add in CHILD_PROPS
- cache.put(makeChildFqn(childProps, prop.getParentIdentifier(), prop.getQPath().getEntries()[prop.getQPath()
- .getEntries().length - 1]), ITEM_ID, prop.getIdentifier());
+ cache.put(
+ makeChildFqn(childProps, prop.getParentIdentifier(),
+ prop.getQPath().getEntries()[prop.getQPath().getEntries().length - 1]), ITEM_ID, prop.getIdentifier());
// if MODIFY and List present OR FORCE_MODIFY, then write
- if ((modifyListsOfChild == ModifyChildOption.MODIFY && cache.getNode(makeChildListFqn(childPropsList, prop
- .getParentIdentifier())) != null)
+ if ((modifyListsOfChild == ModifyChildOption.MODIFY && cache.getNode(makeChildListFqn(childPropsList,
+ prop.getParentIdentifier())) != null)
|| modifyListsOfChild == ModifyChildOption.FORCE_MODIFY)
{
cache.addToList(makeChildListFqn(childPropsList, prop.getParentIdentifier()), ITEM_LIST, prop.getIdentifier());
@@ -899,8 +915,8 @@
.getQPath().getEntries().length - 1]));
// remove from CHILD_NODES_LIST of parent
- cache.removeFromList(makeChildListFqn(childNodesList, item.getParentIdentifier()), ITEM_LIST, item
- .getIdentifier());
+ cache.removeFromList(makeChildListFqn(childNodesList, item.getParentIdentifier()), ITEM_LIST,
+ item.getIdentifier());
// remove from CHILD_NODES as parent
cache.removeNode(makeChildListFqn(childNodes, item.getIdentifier()));
@@ -922,8 +938,8 @@
.getQPath().getEntries().length - 1]));
// remove from CHILD_PROPS_LIST
- cache.removeFromList(makeChildListFqn(childPropsList, item.getParentIdentifier()), ITEM_LIST, item
- .getIdentifier());
+ cache.removeFromList(makeChildListFqn(childPropsList, item.getParentIdentifier()), ITEM_LIST,
+ item.getIdentifier());
}
// remove from ITEMS
cache.removeNode(makeItemFqn(item.getIdentifier()));
@@ -1061,9 +1077,9 @@
NodeData prevNode = (NodeData)data;
TransientNodeData newNode =
- new TransientNodeData(newPath, prevNode.getIdentifier(), prevNode.getPersistedVersion(), prevNode
- .getPrimaryTypeName(), prevNode.getMixinTypeNames(), prevNode.getOrderNumber(), prevNode
- .getParentIdentifier(), inheritACL ? acl : prevNode.getACL()); // TODO check ACL
+ new TransientNodeData(newPath, prevNode.getIdentifier(), prevNode.getPersistedVersion(),
+ prevNode.getPrimaryTypeName(), prevNode.getMixinTypeNames(), prevNode.getOrderNumber(),
+ prevNode.getParentIdentifier(), inheritACL ? acl : prevNode.getACL()); // TODO check ACL
// update this node
cache.put(makeItemFqn(newNode.getIdentifier()), ITEM_DATA, newNode);
}
@@ -1081,8 +1097,8 @@
}
TransientPropertyData newProp =
- new TransientPropertyData(newPath, prevProp.getIdentifier(), prevProp.getPersistedVersion(), prevProp
- .getType(), prevProp.getParentIdentifier(), prevProp.isMultiValued(), prevProp.getValues());
+ new TransientPropertyData(newPath, prevProp.getIdentifier(), prevProp.getPersistedVersion(),
+ prevProp.getType(), prevProp.getParentIdentifier(), prevProp.isMultiValued(), prevProp.getValues());
cache.put(makeItemFqn(newProp.getIdentifier()), ITEM_DATA, newProp);
}
}
@@ -1116,8 +1132,8 @@
QPath
.makeChildPath(rootPath, prevProp.getQPath().getEntries()[prevProp.getQPath().getEntries().length - 1]);
TransientPropertyData newProp =
- new TransientPropertyData(newPath, prevProp.getIdentifier(), prevProp.getPersistedVersion(), prevProp
- .getType(), prevProp.getParentIdentifier(), prevProp.isMultiValued(), prevProp.getValues());
+ new TransientPropertyData(newPath, prevProp.getIdentifier(), prevProp.getPersistedVersion(),
+ prevProp.getType(), prevProp.getParentIdentifier(), prevProp.isMultiValued(), prevProp.getValues());
cache.put(makeItemFqn(newProp.getIdentifier()), ITEM_DATA, newProp);
}
@@ -1130,9 +1146,9 @@
QPath
.makeChildPath(rootPath, prevNode.getQPath().getEntries()[prevNode.getQPath().getEntries().length - 1]);
TransientNodeData newNode =
- new TransientNodeData(newPath, prevNode.getIdentifier(), prevNode.getPersistedVersion(), prevNode
- .getPrimaryTypeName(), prevNode.getMixinTypeNames(), prevNode.getOrderNumber(), prevNode
- .getParentIdentifier(), inheritACL ? acl : prevNode.getACL()); // TODO check ACL
+ new TransientNodeData(newPath, prevNode.getIdentifier(), prevNode.getPersistedVersion(),
+ prevNode.getPrimaryTypeName(), prevNode.getMixinTypeNames(), prevNode.getOrderNumber(),
+ prevNode.getParentIdentifier(), inheritACL ? acl : prevNode.getACL()); // TODO check ACL
// update this node
cache.put(makeItemFqn(newNode.getIdentifier()), ITEM_DATA, newNode);
// update childs recursive
@@ -1162,8 +1178,8 @@
// recreate with new path for child Nodes only
TransientNodeData newNode =
new TransientNodeData(prevNode.getQPath(), prevNode.getIdentifier(), prevNode.getPersistedVersion(),
- prevNode.getPrimaryTypeName(), prevNode.getMixinTypeNames(), prevNode.getOrderNumber(), prevNode
- .getParentIdentifier(), acl);
+ prevNode.getPrimaryTypeName(), prevNode.getMixinTypeNames(), prevNode.getOrderNumber(),
+ prevNode.getParentIdentifier(), acl);
// update this node
cache.put(makeItemFqn(newNode.getIdentifier()), ITEM_DATA, newNode);
// update childs recursive
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/LocalWorkspaceStorageDataManagerProxy.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/LocalWorkspaceStorageDataManagerProxy.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/LocalWorkspaceStorageDataManagerProxy.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -27,6 +27,7 @@
import org.exoplatform.services.jcr.dataflow.PlainChangesLogImpl;
import org.exoplatform.services.jcr.dataflow.TransactionChangesLog;
import org.exoplatform.services.jcr.datamodel.ItemData;
+import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
@@ -104,12 +105,20 @@
*/
public ItemData getItemData(NodeData parentData, QPathEntry name) throws RepositoryException
{
- return copyItemData(storageDataManager.getItemData(parentData, name));
+ return getItemData(parentData, name, ItemType.UNKNOWN);
}
/**
* {@inheritDoc}
*/
+ public ItemData getItemData(NodeData parentData, QPathEntry name, ItemType itemType) throws RepositoryException
+ {
+ return copyItemData(storageDataManager.getItemData(parentData, name, itemType));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public ItemData getItemData(String identifier) throws RepositoryException
{
return copyItemData(storageDataManager.getItemData(identifier));
@@ -186,8 +195,8 @@
+ node.getIdentifier());
}
- return new TransientNodeData(node.getQPath(), node.getIdentifier(), node.getPersistedVersion(), node
- .getPrimaryTypeName(), node.getMixinTypeNames(), node.getOrderNumber(), node.getParentIdentifier(), acl);
+ return new TransientNodeData(node.getQPath(), node.getIdentifier(), node.getPersistedVersion(),
+ node.getPrimaryTypeName(), node.getMixinTypeNames(), node.getOrderNumber(), node.getParentIdentifier(), acl);
}
// else - property
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/SessionChangesLog.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/SessionChangesLog.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/SessionChangesLog.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -23,6 +23,7 @@
import org.exoplatform.services.jcr.dataflow.PlainChangesLogImpl;
import org.exoplatform.services.jcr.datamodel.IllegalPathException;
import org.exoplatform.services.jcr.datamodel.ItemData;
+import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.QPath;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
@@ -299,13 +300,29 @@
* Get ItemState by parent and item name.
*
* @param parentData
+ * parent
* @param name
+ * item name
+ * @param itemType
+ * item type
* @return
* @throws IllegalPathException
*/
- public ItemState getItemState(NodeData parentData, QPathEntry name) throws IllegalPathException
+ public ItemState getItemState(NodeData parentData, QPathEntry name, ItemType itemType) throws IllegalPathException
{
- return index.get(new ParentIDQPathBasedKey(parentData.getIdentifier(), name));
+ if (itemType != ItemType.UNKNOWN)
+ {
+ return index.get(new ParentIDQPathBasedKey(parentData.getIdentifier(), name, itemType));
+ }
+ else
+ {
+ ItemState state = index.get(new ParentIDQPathBasedKey(parentData.getIdentifier(), name, ItemType.NODE));
+ if (state == null)
+ {
+ state = index.get(new ParentIDQPathBasedKey(parentData.getIdentifier(), name, ItemType.PROPERTY));
+ }
+ return state;
+ }
}
/**
@@ -718,6 +735,8 @@
*/
private final String parentIdentifier;
+ private final ItemType itemType;
+
/**
* KeyParentUUIDQPath constructor.
*
@@ -728,6 +747,7 @@
{
this.name = item.getData().getQPath().getEntries()[item.getData().getQPath().getEntries().length - 1];
this.parentIdentifier = item.getData().getParentIdentifier();
+ this.itemType = ItemType.getItemType(item.getData());
}
/**
@@ -738,10 +758,11 @@
* @param name
* item name
*/
- ParentIDQPathBasedKey(String parentIdentifier, QPathEntry name)
+ ParentIDQPathBasedKey(String parentIdentifier, QPathEntry name, ItemType itemType)
{
this.name = name;
this.parentIdentifier = parentIdentifier;
+ this.itemType = itemType;
}
/**
@@ -756,6 +777,7 @@
result = prime * result + name.getNamespace().hashCode();
result = prime * result + name.getIndex();
result = prime * result + (parentIdentifier == null ? 0 : parentIdentifier.hashCode());
+ result = prime * result + itemType.ordinal();
return result;
}
@@ -782,6 +804,7 @@
else if (!name.getName().equals(other.name.getName())
|| !name.getNamespace().equals(other.name.getNamespace()) || name.getIndex() != other.name.getIndex())
return false;
+
if (parentIdentifier == null)
{
if (other.parentIdentifier != null)
@@ -789,6 +812,15 @@
}
else if (!parentIdentifier.equals(other.parentIdentifier))
return false;
+
+ if (itemType == null)
+ {
+ if (other.itemType != null)
+ return false;
+ }
+ else if (!itemType.equals(other.itemType))
+ return false;
+
return true;
}
}
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/TransactionableDataManager.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/TransactionableDataManager.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/TransactionableDataManager.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -25,6 +25,7 @@
import org.exoplatform.services.jcr.dataflow.SharedDataManager;
import org.exoplatform.services.jcr.dataflow.TransactionChangesLog;
import org.exoplatform.services.jcr.datamodel.ItemData;
+import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
@@ -214,10 +215,18 @@
*/
public ItemData getItemData(NodeData parentData, QPathEntry name) throws RepositoryException
{
+ return getItemData(parentData, name, ItemType.UNKNOWN);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ItemData getItemData(NodeData parentData, QPathEntry name, ItemType itemType) throws RepositoryException
+ {
ItemData data = null;
if (txStarted())
{
- ItemState state = transactionLog.getItemState(parentData, name);
+ ItemState state = transactionLog.getItemState(parentData, name, itemType);
if (state != null)
{
data = state.getData();
@@ -229,7 +238,7 @@
}
else
{
- return storageDataManager.getItemData(parentData, name);
+ return storageDataManager.getItemData(parentData, name, itemType);
}
}
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/version/VersionHistoryDataHelper.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/version/VersionHistoryDataHelper.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/version/VersionHistoryDataHelper.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -24,6 +24,7 @@
import org.exoplatform.services.jcr.dataflow.PlainChangesLog;
import org.exoplatform.services.jcr.datamodel.Identifier;
import org.exoplatform.services.jcr.datamodel.InternalQName;
+import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPath;
@@ -139,7 +140,8 @@
NodeData vData = (NodeData)dataManager.getItemData(getIdentifier());
- NodeData rootVersion = (NodeData)dataManager.getItemData(vData, new QPathEntry(Constants.JCR_ROOTVERSION, 0));
+ NodeData rootVersion =
+ (NodeData)dataManager.getItemData(vData, new QPathEntry(Constants.JCR_ROOTVERSION, 0), ItemType.NODE);
List<NodeData> vChilds = new ArrayList<NodeData>();
@@ -165,7 +167,8 @@
for (NodeData vd : versionsData)
{
- PropertyData createdData = (PropertyData)dataManager.getItemData(vd, new QPathEntry(Constants.JCR_CREATED, 0));
+ PropertyData createdData =
+ (PropertyData)dataManager.getItemData(vd, new QPathEntry(Constants.JCR_CREATED, 0), ItemType.PROPERTY);
if (createdData == null)
throw new VersionException("jcr:created is not found, version: " + vd.getQPath().getAsString());
@@ -191,12 +194,12 @@
public NodeData getVersionData(InternalQName versionQName) throws VersionException, RepositoryException
{
- return (NodeData)dataManager.getItemData(this, new QPathEntry(versionQName, 0));
+ return (NodeData)dataManager.getItemData(this, new QPathEntry(versionQName, 0), ItemType.NODE);
}
public NodeData getVersionLabelsData() throws VersionException, RepositoryException
{
- return (NodeData)dataManager.getItemData(this, new QPathEntry(Constants.JCR_VERSIONLABELS, 0));
+ return (NodeData)dataManager.getItemData(this, new QPathEntry(Constants.JCR_VERSIONLABELS, 0), ItemType.NODE);
}
public List<PropertyData> getVersionLabels() throws VersionException, RepositoryException
@@ -242,7 +245,7 @@
NodeData rootItem = (NodeData)dataManager.getItemData(Constants.SYSTEM_UUID);
NodeData versionStorageData =
- (NodeData)dataManager.getItemData(rootItem, new QPathEntry(Constants.JCR_VERSIONSTORAGE, 1)); // Constants
+ (NodeData)dataManager.getItemData(rootItem, new QPathEntry(Constants.JCR_VERSIONSTORAGE, 1), ItemType.NODE); // Constants
// Make versionStorageData transient
if (!(versionStorageData instanceof TransientNodeData))
versionStorageData =
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/inmemory/InmemoryStorageConnection.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/inmemory/InmemoryStorageConnection.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/inmemory/InmemoryStorageConnection.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -19,12 +19,12 @@
package org.exoplatform.services.jcr.impl.storage.inmemory;
import org.exoplatform.services.jcr.datamodel.ItemData;
+import org.exoplatform.services.jcr.datamodel.ItemType;
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.datamodel.ValueData;
-import org.exoplatform.services.jcr.impl.core.JCRPath;
import org.exoplatform.services.jcr.storage.WorkspaceStorageConnection;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -64,13 +64,37 @@
public ItemData getItemData(NodeData parentData, QPathEntry name) throws RepositoryException, IllegalStateException
{
- return getItemData(QPath.makeChildPath(parentData.getQPath(), name));
+ return getItemData(parentData, name, ItemType.UNKNOWN);
}
+ public ItemData getItemData(NodeData parentData, QPathEntry name, ItemType itemType) throws RepositoryException,
+ IllegalStateException
+ {
+ ItemData itemData = null;
+ QPath qPath = QPath.makeChildPath(parentData.getQPath(), name);
+
+ if (itemType == ItemType.NODE || itemType == ItemType.UNKNOWN)
+ {
+ itemData = (ItemData)items.get(new MapKey(qPath, ItemType.NODE));
+ }
+ if (itemType == ItemType.PROPERTY || itemType == ItemType.UNKNOWN && itemData == null)
+ {
+ itemData = (ItemData)items.get(new MapKey(qPath, ItemType.PROPERTY));
+ }
+
+ return itemData;
+ }
+
public ItemData getItemData(QPath qPath) throws RepositoryException, IllegalStateException
{
log.debug("InmemoryContainer finding " + qPath.getAsString());
- Object o = items.get(qPath.getAsString());
+
+ Object o = items.get(new MapKey(qPath, ItemType.NODE));
+ if (o == null)
+ {
+ o = items.get(new MapKey(qPath, ItemType.PROPERTY));
+ }
+
log.debug("InmemoryContainer FOUND " + qPath.getAsString() + " " + o);
return (ItemData)o;
}
@@ -141,11 +165,11 @@
IllegalStateException
{
- if (items.get(item.getQPath().getAsString()) != null)
+ if (items.get(new MapKey(item.getQPath(), ItemType.getItemType(item))) != null)
throw new ItemExistsException("WorkspaceContainerImpl.add(Item) item '" + item.getQPath().getAsString()
+ "' already exists!");
- items.put(item.getQPath().getAsString(), item);
+ items.put(new MapKey(item.getQPath(), ItemType.getItemType(item)), item);
log.debug("InmemoryContainer added node " + item.getQPath().getAsString());
Iterator props = getChildProperties(item).iterator();
while (props.hasNext())
@@ -162,7 +186,7 @@
public void add(PropertyData prop) throws RepositoryException, UnsupportedOperationException,
InvalidItemStateException, IllegalStateException
{
- items.put(prop.getQPath().getAsString(), prop);
+ items.put(new MapKey(prop.getQPath(), ItemType.getItemType(prop)), prop);
log.debug("InmemoryContainer added property " + prop.getQPath().getAsString());
}
@@ -181,21 +205,21 @@
public void update(PropertyData item) throws RepositoryException, UnsupportedOperationException,
InvalidItemStateException, IllegalStateException
{
- items.put(item.getQPath().getAsString(), item);
+ items.put(new MapKey(item.getQPath(), ItemType.getItemType(item)), item);
log.debug("InmemoryContainer updated " + item);
}
public void delete(NodeData data) throws RepositoryException, UnsupportedOperationException,
InvalidItemStateException, IllegalStateException
{
- items.remove(data.getQPath().getAsString());
+ items.remove(new MapKey(data.getQPath(), ItemType.getItemType(data)));
log.debug("InmemoryContainer removed " + data.getQPath().getAsString());
}
public void delete(PropertyData data) throws RepositoryException, UnsupportedOperationException,
InvalidItemStateException, IllegalStateException
{
- items.remove(data.getQPath().getAsString());
+ items.remove(new MapKey(data.getQPath(), ItemType.getItemType(data)));
log.debug("InmemoryContainer removed " + data.getQPath().getAsString());
}
@@ -232,8 +256,8 @@
Iterator i = items.keySet().iterator();
while (i.hasNext())
{
- JCRPath d = (JCRPath)i.next();
- str += d.getInternalPath() + "\n";
+ MapKey d = (MapKey)i.next();
+ str += d.getQPath().getAsString() + '\t' + d.getItemType().toString() + "\n";
}
return str;
}
@@ -245,4 +269,54 @@
}
+ class MapKey
+ {
+
+ private final QPath path;
+
+ private final String key;
+
+ private final ItemType itemType;
+
+ MapKey(QPath path, ItemType itemType)
+ {
+ this.path = path;
+ this.itemType = itemType;
+ this.key = key(this.path, this.itemType);
+ }
+
+ protected String key(final QPath path, ItemType itemType)
+ {
+ StringBuilder sk = new StringBuilder();
+ sk.append(path.getAsString());
+ sk.append(itemType.toString());
+
+ return sk.toString();
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (key.hashCode() == obj.hashCode() && obj instanceof MapKey)
+ return key.equals(((MapKey)obj).key);
+ return false;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return key.hashCode();
+ }
+
+ QPath getQPath()
+ {
+ return path;
+ }
+
+ ItemType getItemType()
+ {
+ return itemType;
+ }
+ }
+
}
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -27,6 +27,7 @@
import org.exoplatform.services.jcr.datamodel.IllegalNameException;
import org.exoplatform.services.jcr.datamodel.InternalQName;
import org.exoplatform.services.jcr.datamodel.ItemData;
+import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPath;
@@ -1042,18 +1043,30 @@
return getItemByIdentifier(getInternalId(identifier));
}
+ /**
+ * {@inheritDoc}
+ */
public ItemData getItemData(NodeData parentData, QPathEntry name) throws RepositoryException, IllegalStateException
{
+ return getItemData(parentData, name, ItemType.UNKNOWN);
+ }
+ /**
+ * {@inheritDoc}
+ */
+ public ItemData getItemData(NodeData parentData, QPathEntry name, ItemType itemType) throws RepositoryException,
+ IllegalStateException
+ {
if (parentData != null)
{
- return getItemByName(parentData, getInternalId(parentData.getIdentifier()), name);
+ return getItemByName(parentData, getInternalId(parentData.getIdentifier()), name, itemType);
}
- // it's a root node
- return getItemByName(null, null, name);
+ // it's a root node
+ return getItemByName(null, null, name, itemType);
}
+
/**
* {@inheritDoc}
*/
@@ -1200,30 +1213,44 @@
* - parent container internal id (depends on Multi/Single DB)
* @param name
* - item name
+ * @param itemType
+ * - item type
* @return - ItemData instance
* @throws RepositoryException
* Repository error
* @throws IllegalStateException
* if connection is closed
*/
- protected ItemData getItemByName(NodeData parent, String parentId, QPathEntry name) throws RepositoryException,
+ protected ItemData getItemByName(NodeData parent, String parentId, QPathEntry name, ItemType itemType)
+ throws RepositoryException,
IllegalStateException
{
checkIfOpened();
try
{
- ResultSet item = findItemByName(parentId, name.getAsString(), name.getIndex());
+ ResultSet item = null;
try
{
- if (item.next())
- return itemData(parent.getQPath(), item, item.getInt(COLUMN_CLASS), parent.getACL());
+ item = findItemByName(parentId, name.getAsString(), name.getIndex());
+ while (item.next())
+ {
+ int columnClass = item.getInt(COLUMN_CLASS);
+ if (itemType == ItemType.UNKNOWN || columnClass == itemType.ordinal())
+ {
+ return itemData(parent.getQPath(), item, columnClass, parent.getACL());
+ }
+ }
+
return null;
}
finally
{
try
{
- item.close();
+ if (item != null)
+ {
+ item.close();
+ }
}
catch (SQLException e)
{
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/SQLExceptionHandler.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/SQLExceptionHandler.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/SQLExceptionHandler.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -20,6 +20,7 @@
import org.exoplatform.services.jcr.dataflow.ItemState;
import org.exoplatform.services.jcr.datamodel.ItemData;
+import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
import org.exoplatform.services.jcr.impl.storage.JCRInvalidItemStateException;
@@ -180,7 +181,9 @@
throw ownException;
}
- me = conn.getItemData(parent, new QPathEntry(item.getQPath().getName(), item.getQPath().getIndex()));
+ me =
+ conn.getItemData(parent, new QPathEntry(item.getQPath().getName(), item.getQPath().getIndex()),
+ ItemType.getItemType(item));
if (me != null)
{
message += "Item already exists in storage: " + itemInfo;
@@ -261,7 +264,9 @@
throw ownException;
}
- me = conn.getItemData(parent, new QPathEntry(item.getQPath().getName(), item.getQPath().getIndex()));
+ me =
+ conn.getItemData(parent, new QPathEntry(item.getQPath().getName(), item.getQPath().getIndex()),
+ ItemType.getItemType(item));
if (me != null)
{
message += "Item already exists in storage: " + itemInfo;
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/statistics/StatisticsJDBCStorageConnection.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/statistics/StatisticsJDBCStorageConnection.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/statistics/StatisticsJDBCStorageConnection.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -17,6 +17,7 @@
package org.exoplatform.services.jcr.impl.storage.jdbc.statistics;
import org.exoplatform.services.jcr.datamodel.ItemData;
+import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
@@ -40,7 +41,7 @@
* Created by The eXo Platform SAS
* Author : Nicolas Filotto
* nicolas.filotto at exoplatform.com
- * 26 fvr. 2010
+ * 26 f�vr. 2010
*/
public class StatisticsJDBCStorageConnection implements WorkspaceStorageConnection
{
@@ -204,7 +205,6 @@
}
}
-
/**
* The nested {@link WorkspaceStorageConnection}
*/
@@ -384,15 +384,24 @@
}
/**
- * @see org.exoplatform.services.jcr.storage.WorkspaceStorageConnection#getItemData(org.exoplatform.services.jcr.datamodel.NodeData, org.exoplatform.services.jcr.datamodel.QPathEntry)
+ * {@inheritDoc}
*/
public ItemData getItemData(NodeData parentData, QPathEntry name) throws RepositoryException, IllegalStateException
{
+ return getItemData(parentData, name, ItemType.UNKNOWN);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ItemData getItemData(NodeData parentData, QPathEntry name, ItemType itemType) throws RepositoryException,
+ IllegalStateException
+ {
Statistics s = ALL_STATISTICS.get(GET_ITEM_DATA_BY_NODE_DATA_NQ_PATH_ENTRY_DESCR);
try
{
s.begin();
- return wcs.getItemData(parentData, name);
+ return wcs.getItemData(parentData, name, itemType);
}
finally
{
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/VersionHistoryRemover.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/VersionHistoryRemover.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/VersionHistoryRemover.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -23,6 +23,7 @@
import org.exoplatform.services.jcr.dataflow.ItemDataConsumer;
import org.exoplatform.services.jcr.dataflow.ItemState;
import org.exoplatform.services.jcr.dataflow.PlainChangesLogImpl;
+import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPath;
@@ -217,7 +218,8 @@
if (ntManager.isNodeType(Constants.NT_VERSIONEDCHILD, vhnode.getPrimaryTypeName(), vhnode.getMixinTypeNames()))
{
PropertyData property =
- (PropertyData)dataManager.getItemData(nodeData, new QPathEntry(Constants.JCR_CHILDVERSIONHISTORY, 1));
+ (PropertyData)dataManager.getItemData(nodeData, new QPathEntry(Constants.JCR_CHILDVERSIONHISTORY, 1),
+ ItemType.PROPERTY);
if (property == null)
throw new RepositoryException("Property " + Constants.JCR_CHILDVERSIONHISTORY.getAsString()
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/importing/BaseXmlImporter.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/importing/BaseXmlImporter.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/importing/BaseXmlImporter.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -31,6 +31,7 @@
import org.exoplatform.services.jcr.datamodel.IllegalPathException;
import org.exoplatform.services.jcr.datamodel.InternalQName;
import org.exoplatform.services.jcr.datamodel.ItemData;
+import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPath;
@@ -228,7 +229,7 @@
ItemData sameNameNode = null;
try
{
- sameNameNode = dataConsumer.getItemData(parentData, new QPathEntry(name, 0));
+ sameNameNode = dataConsumer.getItemData(parentData, new QPathEntry(name, 0), ItemType.NODE);
}
catch (PathNotFoundException e)
{
@@ -723,7 +724,8 @@
try
{
PropertyData vhpd =
- (PropertyData)dataConsumer.getItemData(mixVersionableNode, new QPathEntry(Constants.JCR_VERSIONHISTORY, 1));
+ (PropertyData)dataConsumer.getItemData(mixVersionableNode, new QPathEntry(Constants.JCR_VERSIONHISTORY, 1),
+ ItemType.PROPERTY);
try
{
String vhID = new String(vhpd.getValues().get(0).getAsByteArray());
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/storage/WorkspaceStorageConnection.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/storage/WorkspaceStorageConnection.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/storage/WorkspaceStorageConnection.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -19,6 +19,7 @@
package org.exoplatform.services.jcr.storage;
import org.exoplatform.services.jcr.datamodel.ItemData;
+import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
@@ -63,9 +64,30 @@
* @throws IllegalStateException
* if connection is closed
*/
+ @Deprecated
ItemData getItemData(NodeData parentData, QPathEntry name) throws RepositoryException, IllegalStateException;
/**
+ * Reads <code>ItemData</code> from the storage using item's parent and name relative the parent
+ * location of define type.
+ *
+ * @param parentData
+ * - the item's parent NodeData
+ * @param name
+ * - item's path entry (QName + index)
+ * @param itemType
+ * item type
+ * @return - stored ItemData wich has exact the same path Entry (name+index) inside the parent; or
+ * null if not such an item data found
+ * @throws RepositoryException
+ * if some exception occured
+ * @throws IllegalStateException
+ * if connection is closed
+ */
+ ItemData getItemData(NodeData parentData, QPathEntry name, ItemType itemType) throws RepositoryException,
+ IllegalStateException;
+
+ /**
* Reads <code>ItemData</code> from the storage by item identifier.
*
* @param identifier
@@ -93,7 +115,7 @@
* if connection is closed
*/
List<NodeData> getChildNodesData(NodeData parent) throws RepositoryException, IllegalStateException;
-
+
/**
* Reads count of <code>parent<code/> child nodes.
*
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestGetNode.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestGetNode.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestGetNode.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -20,6 +20,7 @@
import org.exoplatform.services.jcr.JcrImplBaseTest;
+import javax.jcr.Node;
import javax.jcr.PathNotFoundException;
/**
@@ -48,4 +49,17 @@
}
}
+ public void testGetNodeAndPropertyWithSameName() throws Exception
+ {
+ String sameName = "sameName";
+ Node rootNode = session.getRootNode();
+ Node aNode = rootNode.addNode("a");
+ aNode.addNode(sameName);
+ aNode.setProperty(sameName, "aa");
+ session.save();
+
+ assertNotNull(aNode.getProperty(sameName));
+ assertNotNull(aNode.getNode(sameName));
+ }
+
}
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestSessionDataManager.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestSessionDataManager.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestSessionDataManager.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -22,6 +22,7 @@
import org.exoplatform.services.jcr.dataflow.ItemState;
import org.exoplatform.services.jcr.datamodel.IllegalNameException;
import org.exoplatform.services.jcr.datamodel.InternalQName;
+import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.QPath;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
@@ -34,8 +35,6 @@
import java.util.ArrayList;
import java.util.List;
-import javax.jcr.ItemNotFoundException;
-import javax.jcr.Node;
import javax.jcr.PropertyType;
import javax.jcr.RepositoryException;
@@ -314,7 +313,7 @@
{
// get non-existent data by getItemData(NodeData parent, QPathEntry name)
assertNull(modificationManager.getItemData((NodeData)((NodeImpl)root).getData(), new QPathEntry("",
- "testgetitemNode", 0)));
+ "testgetitemNode", 0), ItemType.NODE));
// get non-existent data by ItemData getItemData(QPath path)
assertNull(modificationManager.getItemData(QPath.makeChildPath(((NodeImpl)root).getData().getQPath(),
new InternalQName("", "testgetitemNode"))));
@@ -323,7 +322,7 @@
// get data by getItemData(NodeData parent, QPathEntry name)
assertNotNull(modificationManager.getItemData((NodeData)((NodeImpl)root).getData(), new QPathEntry("",
- "testgetitemNode", 0)));
+ "testgetitemNode", 0), ItemType.NODE));
// get data by ItemData getItemData(QPath path)
assertNotNull(modificationManager.getItemData(QPath.makeChildPath(((NodeImpl)root).getData().getQPath(),
new InternalQName("", "testgetitemNode"))));
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestCacheableWorkspaceDataManager.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestCacheableWorkspaceDataManager.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestCacheableWorkspaceDataManager.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -23,6 +23,7 @@
import org.exoplatform.services.jcr.dataflow.persistent.PersistedPropertyData;
import org.exoplatform.services.jcr.dataflow.persistent.WorkspaceStorageCache;
import org.exoplatform.services.jcr.datamodel.ItemData;
+import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
@@ -90,6 +91,7 @@
{
Thread thread = new Thread()
{
+ @Override
public void run()
{
try
@@ -147,7 +149,7 @@
{
public void execute() throws Exception
{
- ItemData item = cwdm.getItemData(nodeData, new QPathEntry("http://www.foo.com", "foo", 0));
+ ItemData item = cwdm.getItemData(nodeData, new QPathEntry("http://www.foo.com", "foo", 0), ItemType.NODE);
assertNotNull(item);
}
};
@@ -308,9 +310,19 @@
public ItemData get(String parentIdentifier, QPathEntry name)
{
- return itemData;
+ return get(parentIdentifier, name, ItemType.UNKNOWN);
}
+ public ItemData get(String parentIdentifier, QPathEntry name, ItemType itemType)
+ {
+ if (itemData != null && itemType.isSuitableFor(itemData))
+ {
+ return itemData;
+ }
+
+ return null;
+ }
+
public ItemData get(String identifier)
{
return itemData;
@@ -426,8 +438,8 @@
getChildPropertiesDataCalls.incrementAndGet();
return Arrays
.asList((PropertyData)new PersistedPropertyData("getChildPropertiesData", null, null, 0,
- PropertyType.STRING, false, Arrays
- .asList((ValueData)new ByteArrayPersistedValueData(1, "foo".getBytes()))));
+ PropertyType.STRING, false,
+ Arrays.asList((ValueData)new ByteArrayPersistedValueData(1, "foo".getBytes()))));
}
public AtomicInteger getItemDataByNodeDataNQPathEntryCalls = new AtomicInteger();
@@ -435,8 +447,19 @@
public ItemData getItemData(NodeData parentData, QPathEntry name) throws RepositoryException,
IllegalStateException
{
+ return getItemData(parentData, name, ItemType.UNKNOWN);
+ }
+
+ public ItemData getItemData(NodeData parentData, QPathEntry name, ItemType itemType) throws RepositoryException,
+ IllegalStateException
+ {
getItemDataByNodeDataNQPathEntryCalls.incrementAndGet();
- return new PersistedNodeData("getItemData", null, null, 0, 1, null, null, null);
+ if (itemType != ItemType.PROPERTY)
+ {
+ return new PersistedNodeData("getItemData", null, null, 0, 1, null, null, null);
+ }
+
+ return null;
}
public AtomicInteger getItemDataByIdCalls = new AtomicInteger();
@@ -471,8 +494,8 @@
listChildPropertiesDataCalls.incrementAndGet();
return Arrays
.asList((PropertyData)new PersistedPropertyData("listChildPropertiesData", null, null, 0,
- PropertyType.STRING, false, Arrays
- .asList((ValueData)new ByteArrayPersistedValueData(1, "foo".getBytes()))));
+ PropertyType.STRING, false,
+ Arrays.asList((ValueData)new ByteArrayPersistedValueData(1, "foo".getBytes()))));
}
public void rename(NodeData data) throws RepositoryException, UnsupportedOperationException,
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestLinkedCacheMultithread.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestLinkedCacheMultithread.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestLinkedCacheMultithread.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -20,6 +20,7 @@
import org.exoplatform.services.jcr.JcrImplBaseTest;
import org.exoplatform.services.jcr.datamodel.InternalQName;
+import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPath;
@@ -79,6 +80,7 @@
super.setName(name);
}
+ @Override
public void run()
{
// log.info("START");
@@ -99,7 +101,7 @@
// by parent + name
NodeData n =
(NodeData)cache.get(rndNode.getParentIdentifier(), rndNode.getQPath().getEntries()[rndNode
- .getQPath().getEntries().length - 1]);
+ .getQPath().getEntries().length - 1], ItemType.NODE);
if (n != null)
assertEquals(rndNode.getIdentifier(), n.getIdentifier());
}
@@ -142,6 +144,7 @@
super.setName(name);
}
+ @Override
public void run()
{
// log.info("START");
@@ -229,6 +232,7 @@
super.setName(name);
}
+ @Override
public void run()
{
// log.info("START");
@@ -280,6 +284,7 @@
this.timeout = timeout;
}
+ @Override
public void run()
{
synchronized (cache)
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspaceStorageCacheBaseCase.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspaceStorageCacheBaseCase.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspaceStorageCacheBaseCase.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -27,6 +27,7 @@
import org.exoplatform.services.jcr.dataflow.persistent.PersistedPropertyData;
import org.exoplatform.services.jcr.dataflow.persistent.WorkspaceStorageCache;
import org.exoplatform.services.jcr.datamodel.InternalQName;
+import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPath;
@@ -141,6 +142,7 @@
private WorkspaceStorageCache cache;
+ @Override
public void setUp() throws Exception
{
super.setUp();
@@ -251,15 +253,15 @@
throw e;
}
assertEquals("Cached node " + nodeData1.getQPath().getAsString() + " is not equals", cache.get(rootUuid,
- nodePath1.getEntries()[nodePath1.getEntries().length - 1]), nodeData1);
+ nodePath1.getEntries()[nodePath1.getEntries().length - 1], ItemType.NODE), nodeData1);
assertEquals("Cached node " + nodeData2.getQPath().getAsString() + " is not equals", cache.get(rootUuid,
- nodePath2.getEntries()[nodePath2.getEntries().length - 1]), nodeData2);
+ nodePath2.getEntries()[nodePath2.getEntries().length - 1], ItemType.NODE), nodeData2);
assertEquals("Cached node " + nodeData1.getIdentifier() + " is not equals", cache.get(nodeUuid1), nodeData1);
assertEquals("Cached node " + nodeData2.getIdentifier() + " is not equals", cache.get(nodeUuid2), nodeData2);
assertEquals("Cached property " + propertyPath12.getAsString() + " is not equals", cache.get(nodeUuid1,
- propertyPath12.getEntries()[propertyPath12.getEntries().length - 1]), propertyData12);
+ propertyPath12.getEntries()[propertyPath12.getEntries().length - 1], ItemType.PROPERTY), propertyData12);
assertEquals("Cached property " + propertyData12.getIdentifier() + " is not equals", cache.get(propertyUuid12),
propertyData12);
}
@@ -300,21 +302,21 @@
}
// prev stuff
assertEquals("Cached " + nodeData1.getQPath().getAsString() + " is not equals", cache.get(rootUuid, nodePath1
- .getEntries()[nodePath1.getEntries().length - 1]), nodeData1);
+ .getEntries()[nodePath1.getEntries().length - 1], ItemType.NODE), nodeData1);
assertEquals("Cached " + nodeData2.getQPath().getAsString() + " is not equals", cache.get(rootUuid, nodePath2
- .getEntries()[nodePath2.getEntries().length - 1]), nodeData2);
+ .getEntries()[nodePath2.getEntries().length - 1], ItemType.NODE), nodeData2);
assertEquals("Cached " + propertyData12.getQPath().getAsString() + " is not equals", cache.get(nodeUuid1,
- propertyPath12.getEntries()[propertyPath12.getEntries().length - 1]), propertyData12);
+ propertyPath12.getEntries()[propertyPath12.getEntries().length - 1], ItemType.PROPERTY), propertyData12);
// childs...
// nodes
assertEquals("Cached child node " + nodeData31.getQPath().getAsString() + " is not equals", cache.get(nodeUuid3,
- nodePath31.getEntries()[nodePath31.getEntries().length - 1]), nodeData31);
+ nodePath31.getEntries()[nodePath31.getEntries().length - 1], ItemType.NODE), nodeData31);
assertEquals("Cached child node " + nodeData31.getIdentifier() + " is not equals", cache.get(nodeUuid31),
nodeData31);
assertEquals("Cached child node " + nodeData32.getQPath().getAsString() + " is not equals", cache.get(nodeUuid3,
- nodePath32.getEntries()[nodePath32.getEntries().length - 1]), nodeData32);
+ nodePath32.getEntries()[nodePath32.getEntries().length - 1], ItemType.NODE), nodeData32);
assertEquals("Cached child node " + nodeData32.getIdentifier() + " is not equals", cache.get(nodeUuid32),
nodeData32);
@@ -327,20 +329,24 @@
// props
assertEquals("Cached child property " + propertyData11.getQPath().getAsString() + " is not equals", cache.get(
- nodeUuid1, propertyPath11.getEntries()[propertyPath11.getEntries().length - 1]), propertyData11);
+ nodeUuid1, propertyPath11.getEntries()[propertyPath11.getEntries().length - 1], ItemType.PROPERTY),
+ propertyData11);
assertEquals("Cached child property " + propertyData11.getIdentifier() + " is not equals", cache
.get(propertyUuid11), propertyData11);
assertEquals("Cached child property " + propertyData12.getQPath().getAsString() + " is not equals", cache.get(
- nodeUuid1, propertyPath12.getEntries()[propertyPath12.getEntries().length - 1]), propertyData12);
+ nodeUuid1, propertyPath12.getEntries()[propertyPath12.getEntries().length - 1], ItemType.PROPERTY),
+ propertyData12);
assertEquals("Cached child property " + propertyData12.getIdentifier() + " is not equals", cache
.get(propertyUuid12), propertyData12);
assertEquals("Cached child property " + propertyData21.getQPath().getAsString() + " is not equals", cache.get(
- nodeUuid2, propertyPath21.getEntries()[propertyPath21.getEntries().length - 1]), propertyData21);
+ nodeUuid2, propertyPath21.getEntries()[propertyPath21.getEntries().length - 1], ItemType.PROPERTY),
+ propertyData21);
assertEquals("Cached child property " + propertyData21.getIdentifier() + " is not equals", cache
.get(propertyUuid21), propertyData21);
assertEquals("Cached child property " + propertyData22.getQPath().getAsString() + " is not equals", cache.get(
- nodeUuid2, propertyPath22.getEntries()[propertyPath22.getEntries().length - 1]), propertyData22);
+ nodeUuid2, propertyPath22.getEntries()[propertyPath22.getEntries().length - 1], ItemType.PROPERTY),
+ propertyData22);
assertEquals("Cached child property " + propertyData22.getIdentifier() + " is not equals", cache
.get(propertyUuid22), propertyData22);
@@ -393,20 +399,24 @@
}
// props, prev stuff
assertEquals("Cached child property " + propertyData11.getQPath().getAsString() + " is not equals", cache.get(
- nodeUuid1, propertyPath11.getEntries()[propertyPath11.getEntries().length - 1]), propertyData11);
+ nodeUuid1, propertyPath11.getEntries()[propertyPath11.getEntries().length - 1], ItemType.PROPERTY),
+ propertyData11);
assertEquals("Cached child property " + propertyData11.getIdentifier() + " is not equals", cache
.get(propertyUuid11), propertyData11);
assertEquals("Cached child property " + propertyData12.getQPath().getAsString() + " is not equals", cache.get(
- nodeUuid1, propertyPath12.getEntries()[propertyPath12.getEntries().length - 1]), propertyData12);
+ nodeUuid1, propertyPath12.getEntries()[propertyPath12.getEntries().length - 1], ItemType.PROPERTY),
+ propertyData12);
assertEquals("Cached child property " + propertyData12.getIdentifier() + " is not equals", cache
.get(propertyUuid12), propertyData12);
assertEquals("Cached child property " + propertyData21.getQPath().getAsString() + " is not equals", cache.get(
- nodeUuid2, propertyPath21.getEntries()[propertyPath21.getEntries().length - 1]), propertyData21);
+ nodeUuid2, propertyPath21.getEntries()[propertyPath21.getEntries().length - 1], ItemType.PROPERTY),
+ propertyData21);
assertEquals("Cached child property " + propertyData21.getIdentifier() + " is not equals", cache
.get(propertyUuid21), propertyData21);
assertEquals("Cached child property " + propertyData22.getQPath().getAsString() + " is not equals", cache.get(
- nodeUuid2, propertyPath22.getEntries()[propertyPath22.getEntries().length - 1]), propertyData22);
+ nodeUuid2, propertyPath22.getEntries()[propertyPath22.getEntries().length - 1], ItemType.PROPERTY),
+ propertyData22);
assertEquals("Cached child property " + propertyData22.getIdentifier() + " is not equals", cache
.get(propertyUuid22), propertyData22);
@@ -429,22 +439,25 @@
// check
assertEquals("Cached child property " + propertyData11.getQPath().getAsString() + " is not equals", cache.get(
- nodeUuid1, propertyPath11.getEntries()[propertyPath11.getEntries().length - 1]), propertyData11);
+ nodeUuid1, propertyPath11.getEntries()[propertyPath11.getEntries().length - 1], ItemType.PROPERTY),
+ propertyData11);
assertEquals("Cached child property " + propertyData11.getIdentifier() + " is not equals", cache
.get(propertyUuid11), propertyData11);
// here
assertNull("Child property " + propertyData12.getQPath().getAsString() + " is not in the cache", cache.get(
- nodeUuid1, propertyPath12.getEntries()[propertyPath12.getEntries().length - 1]));
+ nodeUuid1, propertyPath12.getEntries()[propertyPath12.getEntries().length - 1], ItemType.PROPERTY));
assertNull("Child property " + propertyData12.getQPath().getAsString() + " is not in the cache", cache
.get(propertyUuid12));
assertEquals("Cached child property " + propertyData21.getQPath().getAsString() + " is not equals", cache.get(
- nodeUuid2, propertyPath21.getEntries()[propertyPath21.getEntries().length - 1]), propertyData21);
+ nodeUuid2, propertyPath21.getEntries()[propertyPath21.getEntries().length - 1], ItemType.PROPERTY),
+ propertyData21);
assertEquals("Cached child property " + propertyData21.getIdentifier() + " is not equals", cache
.get(propertyUuid21), propertyData21);
assertEquals("Cached child property " + propertyData22.getQPath().getAsString() + " is not equals", cache.get(
- nodeUuid2, propertyPath22.getEntries()[propertyPath22.getEntries().length - 1]), propertyData22);
+ nodeUuid2, propertyPath22.getEntries()[propertyPath22.getEntries().length - 1], ItemType.PROPERTY),
+ propertyData22);
assertEquals("Cached child property " + propertyData22.getIdentifier() + " is not equals", cache
.get(propertyUuid22), propertyData22);
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/JDBCHWDCTest.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/JDBCHWDCTest.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/JDBCHWDCTest.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -27,6 +27,7 @@
import org.exoplatform.services.jcr.dataflow.TransactionChangesLog;
import org.exoplatform.services.jcr.datamodel.InternalQName;
import org.exoplatform.services.jcr.datamodel.ItemData;
+import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.QPath;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
@@ -36,7 +37,6 @@
import org.exoplatform.services.jcr.impl.dataflow.TransientPropertyData;
import org.exoplatform.services.jcr.impl.dataflow.TransientValueData;
import org.exoplatform.services.jcr.impl.dataflow.session.TransactionableDataManager;
-import org.exoplatform.services.jcr.impl.dataflow.session.WorkspaceStorageDataManagerProxy;
import org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer;
import org.exoplatform.services.jcr.storage.WorkspaceStorageConnection;
import org.exoplatform.services.jcr.util.IdGenerator;
@@ -142,7 +142,7 @@
con = wdContainer.openConnection();
try
{
- NodeData storedNode = (NodeData)con.getItemData(rootData, new QPathEntry(nodeName, 1));
+ NodeData storedNode = (NodeData)con.getItemData(rootData, new QPathEntry(nodeName, 1), ItemType.NODE);
assertEquals(path, storedNode.getQPath());
}
catch (Exception e)
@@ -211,7 +211,7 @@
// get
try
{
- NodeData storedNode = (NodeData)wdm.getItemData(rootData, new QPathEntry(nodeName, 1));
+ NodeData storedNode = (NodeData)wdm.getItemData(rootData, new QPathEntry(nodeName, 1), ItemType.NODE);
assertEquals(path, storedNode.getQPath());
}
catch (Exception e)
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/JDBCStorageConnectionTest.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/JDBCStorageConnectionTest.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/JDBCStorageConnectionTest.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -28,6 +28,7 @@
import org.exoplatform.services.jcr.dataflow.TransactionChangesLog;
import org.exoplatform.services.jcr.datamodel.IllegalNameException;
import org.exoplatform.services.jcr.datamodel.InternalQName;
+import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
@@ -98,7 +99,7 @@
testRoot =
(NodeData)dataManager.getItemData(root,
- troot.getQPath().getEntries()[troot.getQPath().getEntries().length - 1]);
+ troot.getQPath().getEntries()[troot.getQPath().getEntries().length - 1], ItemType.NODE);
assertNotNull("Can't find test root node " + troot.getQPath().getAsString(), testRoot);
}
@@ -135,7 +136,8 @@
{
NodeData troot =
- (NodeData)dataManager.getItemData(root, new QPathEntry(InternalQName.parse("[]jdbcStorageConnectionTest"), 1));
+ (NodeData)dataManager.getItemData(root, new QPathEntry(InternalQName.parse("[]jdbcStorageConnectionTest"), 1),
+ ItemType.NODE);
assertEquals("Inherited acl should be here", root.getACL().getOwner(), troot.getACL().getOwner());
}
@@ -160,7 +162,8 @@
// test
NodeData troot =
- (NodeData)dataManager.getItemData(root, new QPathEntry(InternalQName.parse("[]jdbcStorageConnectionTest"), 1));
+ (NodeData)dataManager.getItemData(root, new QPathEntry(InternalQName.parse("[]jdbcStorageConnectionTest"), 1),
+ ItemType.NODE);
assertEquals("Owner is not valid", "exo", troot.getACL().getOwner());
}
@@ -192,7 +195,8 @@
// test
NodeData troot =
- (NodeData)dataManager.getItemData(root, new QPathEntry(InternalQName.parse("[]jdbcStorageConnectionTest"), 1));
+ (NodeData)dataManager.getItemData(root, new QPathEntry(InternalQName.parse("[]jdbcStorageConnectionTest"), 1),
+ ItemType.NODE);
List<String> iperms = troot.getACL().getPermissions(SystemIdentity.ANY);
assertEquals("Wrong permission for " + SystemIdentity.ANY, 1, iperms.size());
@@ -242,7 +246,8 @@
// test
NodeData troot =
- (NodeData)dataManager.getItemData(root, new QPathEntry(InternalQName.parse("[]jdbcStorageConnectionTest"), 1));
+ (NodeData)dataManager.getItemData(root, new QPathEntry(InternalQName.parse("[]jdbcStorageConnectionTest"), 1),
+ ItemType.NODE);
assertEquals("Owner is not valid", "exo", troot.getACL().getOwner());
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/StorageUpdateTest.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/StorageUpdateTest.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/StorageUpdateTest.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -21,6 +21,7 @@
import org.exoplatform.container.ExoContainer;
import org.exoplatform.services.jcr.JcrImplBaseTest;
import org.exoplatform.services.jcr.config.WorkspaceEntry;
+import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
@@ -71,6 +72,7 @@
private boolean isDefaultWsMultiDb;
+ @Override
public void setUp() throws Exception
{
super.setUp();
@@ -155,7 +157,8 @@
(NodeData)session.getTransientNodesManager().getTransactManager()
.getItemData(jcrUuid.getParentIdentifier());
QPathEntry[] qentry = bugData.getQPath().getEntries();
- PropertyData persistedBugData = (PropertyData)conn.getItemData(parent, qentry[qentry.length - 1]);
+ PropertyData persistedBugData =
+ (PropertyData)conn.getItemData(parent, qentry[qentry.length - 1], ItemType.PROPERTY);
log.info("node_V node BUG uuid: " + node_V.getUUID() + ", jcr:uuid: "
+ new String(persistedBugData.getValues().get(0).getAsByteArray()));
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/fs/TestJCRVSReadWrite.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/fs/TestJCRVSReadWrite.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/fs/TestJCRVSReadWrite.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -25,6 +25,7 @@
import org.exoplatform.services.jcr.datamodel.IllegalPathException;
import org.exoplatform.services.jcr.datamodel.InternalQName;
import org.exoplatform.services.jcr.datamodel.ItemData;
+import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPath;
@@ -284,13 +285,20 @@
}
// copied from SessionDataManager
- protected ItemData getItemData(DataManager manager, NodeData parent, QPathEntry[] relPathEntries)
+ protected ItemData getItemData(DataManager manager, NodeData parent, QPathEntry[] relPathEntries, ItemType itemType)
throws RepositoryException
{
ItemData item = parent;
for (int i = 0; i < relPathEntries.length; i++)
{
- item = manager.getItemData(parent, relPathEntries[i]);
+ if (i == relPathEntries.length - 1)
+ {
+ item = manager.getItemData(parent, relPathEntries[i], itemType);
+ }
+ else
+ {
+ item = manager.getItemData(parent, relPathEntries[i], ItemType.UNKNOWN);
+ }
if (item == null)
break;
@@ -356,7 +364,7 @@
Set<QPathEntry[]> caseProps = new HashSet<QPathEntry[]>(props);
for (QPathEntry[] prop : caseProps)
{
- PropertyData p = (PropertyData)getItemData(manager, parent, prop);
+ PropertyData p = (PropertyData)getItemData(manager, parent, prop, ItemType.PROPERTY);
List<ValueData> vals = p.getValues();
for (int i = 0; i < vals.size(); i++)
{
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/jdbc/SQLBenchmarkTest.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/jdbc/SQLBenchmarkTest.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/jdbc/SQLBenchmarkTest.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -1,14 +1,5 @@
package org.exoplatform.services.jcr.impl.storage.jdbc;
-import java.sql.SQLException;
-import java.util.Arrays;
-import java.util.List;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.atomic.AtomicReference;
-
-import javax.jcr.InvalidItemStateException;
-import javax.jcr.RepositoryException;
-
import org.exoplatform.container.StandaloneContainer;
import org.exoplatform.services.jcr.BaseStandaloneTest;
import org.exoplatform.services.jcr.RepositoryService;
@@ -17,6 +8,7 @@
import org.exoplatform.services.jcr.dataflow.persistent.PersistedPropertyData;
import org.exoplatform.services.jcr.datamodel.IllegalNameException;
import org.exoplatform.services.jcr.datamodel.ItemData;
+import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPath;
@@ -27,6 +19,15 @@
import org.exoplatform.services.jcr.storage.WorkspaceDataContainer;
import org.exoplatform.services.jcr.storage.WorkspaceStorageConnection;
+import java.sql.SQLException;
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.atomic.AtomicReference;
+
+import javax.jcr.InvalidItemStateException;
+import javax.jcr.RepositoryException;
+
/*
* Copyright (C) 2003-2009 eXo Platform SAS.
*
@@ -55,21 +56,21 @@
*/
public class SQLBenchmarkTest
{
-/*
- static
- {
- try
+ /*
+ static
{
- Class.forName("com.jdbmonitor.MonitorDriver");
- System.out.println("Driver Loaded");
+ try
+ {
+ Class.forName("com.jdbmonitor.MonitorDriver");
+ System.out.println("Driver Loaded");
+ }
+ catch (ClassNotFoundException e)
+ {
+ e.printStackTrace();
+ }
+
}
- catch (ClassNotFoundException e)
- {
- e.printStackTrace();
- }
-
- }
-*/
+ */
/**
* @param args
*/
@@ -307,7 +308,7 @@
{
public ItemData execute(Object... args) throws Exception
{
- return getItemData((WorkspaceDataContainer)args[0], (NodeData)args[1], (QPathEntry)args[2]);
+ return getItemData((WorkspaceDataContainer)args[0], (NodeData)args[1], (QPathEntry)args[2], ItemType.NODE);
}
};
@@ -553,13 +554,13 @@
return true;
}
- public static ItemData getItemData(WorkspaceDataContainer dataContainer, NodeData parentData, QPathEntry name)
- throws RepositoryException, IllegalStateException
+ public static ItemData getItemData(WorkspaceDataContainer dataContainer, NodeData parentData, QPathEntry name,
+ ItemType itemType) throws RepositoryException, IllegalStateException
{
final WorkspaceStorageConnection con = dataContainer.openConnection();
try
{
- return con.getItemData(parentData, name);
+ return con.getItemData(parentData, name, itemType);
}
finally
{
@@ -675,6 +676,7 @@
{
Thread t = new Thread()
{
+ @Override
public void run()
{
try
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/version/TestFrozenNodeInitializer.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/version/TestFrozenNodeInitializer.java 2010-11-04 07:34:05 UTC (rev 3392)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/version/TestFrozenNodeInitializer.java 2010-11-04 07:54:54 UTC (rev 3393)
@@ -22,6 +22,7 @@
import org.exoplatform.services.jcr.dataflow.persistent.PersistedNodeData;
import org.exoplatform.services.jcr.datamodel.InternalQName;
import org.exoplatform.services.jcr.datamodel.ItemData;
+import org.exoplatform.services.jcr.datamodel.ItemType;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPath;
@@ -217,7 +218,7 @@
PropertyData vh =
(PropertyData)session.getTransientNodesManager().getItemData((NodeData)state.getData(),
- new QPathEntry(Constants.JCR_VERSIONHISTORY, 0));
+ new QPathEntry(Constants.JCR_VERSIONHISTORY, 0), ItemType.PROPERTY);
String vhUuid = new String(vh.getValues().get(0).getAsByteArray());
More information about the exo-jcr-commits
mailing list