exo-jcr SVN: r4830 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2011-09-02 04:22:51 -0400 (Fri, 02 Sep 2011)
New Revision: 4830
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/SQLExceptionHandler.java
Log:
EXOJCR-1395: DB2 duplicate key exception handling added
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/SQLExceptionHandler.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/SQLExceptionHandler.java 2011-09-01 20:23:57 UTC (rev 4829)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/SQLExceptionHandler.java 2011-09-02 08:22:51 UTC (rev 4830)
@@ -208,6 +208,14 @@
throw new JCRInvalidItemStateException(message, item.getIdentifier(), ItemState.ADDED, e);
}
+ // DB2 violation
+ if (e.getClass().getName().indexOf("SqlIntegrityConstraintViolationException") >= 0
+ && errMessage.indexOf("SQLCODE=-803") >= 0)
+ {
+ message += "Item already exists." + itemInfo;
+ throw new JCRInvalidItemStateException(message, item.getIdentifier(), ItemState.ADDED, e);
+ }
+
message += "Error of item add. " + itemInfo;
ownException = new RepositoryException(message, e);
throw ownException;
12 years, 8 months
exo-jcr SVN: r4829 - in jcr/trunk/exo.jcr.component.core/src: main/java/org/exoplatform/services/jcr/impl/dataflow/persistent and 5 other directories.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2011-09-01 16:23:57 -0400 (Thu, 01 Sep 2011)
New Revision: 4829
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/itemfilters/AbstractNamePatternFilter.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/itemfilters/ExactQPathEntryFilter.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/itemfilters/ItemDataNamePatternFilter.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/inmemory/InmemoryStorageConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/statistics/StatisticsJDBCStorageConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/storage/WorkspaceStorageConnection.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestCacheableWorkspaceDataManager.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestMultipleListenersNotifying.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestWorkspaceStorageCacheInClusterMode.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TestJBossCacheWorkspaceStorageCache.java
Log:
EXOJCR-1508: Code Cleanup of JCR core
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/itemfilters/AbstractNamePatternFilter.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/itemfilters/AbstractNamePatternFilter.java 2011-09-01 18:04:48 UTC (rev 4828)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/itemfilters/AbstractNamePatternFilter.java 2011-09-01 20:23:57 UTC (rev 4829)
@@ -131,7 +131,6 @@
/**
* {@inheritDoc}
*/
- @Override
public boolean accept(ItemData item)
{
if (getAllItems)
@@ -181,7 +180,6 @@
/**
* {@inheritDoc}
*/
- @Override
public List<? extends ItemData> accept(List<? extends ItemData> itemData)
{
if (getAllItems)
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/itemfilters/ExactQPathEntryFilter.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/itemfilters/ExactQPathEntryFilter.java 2011-09-01 18:04:48 UTC (rev 4828)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/itemfilters/ExactQPathEntryFilter.java 2011-09-01 20:23:57 UTC (rev 4829)
@@ -56,7 +56,6 @@
/**
* {@inheritDoc}
*/
- @Override
public QPathEntry getQPathEntry()
{
return entry;
@@ -65,7 +64,6 @@
/**
* {@inheritDoc}
*/
- @Override
public boolean accept(ItemData item)
{
QPathEntry itemEntry = item.getQPath().getEntries()[item.getQPath().getDepth()];
@@ -75,7 +73,6 @@
/**
* {@inheritDoc}
*/
- @Override
public List<? extends ItemData> accept(List<? extends ItemData> itemData)
{
List<ItemData> result = new ArrayList<ItemData>();
@@ -120,7 +117,6 @@
/**
* {@inheritDoc}
*/
- @Override
public void writeExternal(ObjectOutput out) throws IOException
{
byte[] buf = entry.getNamespace().getBytes(Constants.DEFAULT_ENCODING);
@@ -137,7 +133,6 @@
/**
* {@inheritDoc}
*/
- @Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
{
byte[] buf = new byte[in.readInt()];
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/itemfilters/ItemDataNamePatternFilter.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/itemfilters/ItemDataNamePatternFilter.java 2011-09-01 18:04:48 UTC (rev 4828)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/itemfilters/ItemDataNamePatternFilter.java 2011-09-01 20:23:57 UTC (rev 4829)
@@ -101,10 +101,8 @@
/**
* @see org.exoplatform.services.jcr.impl.core.itemfilters.ItemDataFilter#accept(java.util.List)
*/
- @Override
public List<? extends ItemData> accept(List<? extends ItemData> item)
{
- // TODO Auto-generated method stub
return null;
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java 2011-09-01 18:04:48 UTC (rev 4828)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java 2011-09-01 20:23:57 UTC (rev 4829)
@@ -41,8 +41,8 @@
import org.exoplatform.services.jcr.impl.dataflow.session.TransactionableResourceManager;
import org.exoplatform.services.jcr.impl.dataflow.session.TransactionableResourceManagerListener;
import org.exoplatform.services.jcr.impl.storage.SystemDataContainerHolder;
-import org.exoplatform.services.jcr.impl.storage.jdbc.JDBCStorageConnection;
import org.exoplatform.services.jcr.storage.WorkspaceDataContainer;
+import org.exoplatform.services.jcr.storage.WorkspaceStorageConnection;
import org.exoplatform.services.rpc.RPCException;
import org.exoplatform.services.rpc.RPCService;
import org.exoplatform.services.rpc.RemoteCommand;
@@ -1772,25 +1772,25 @@
}
/**
- * Fill Property Value from persistent storage.
- *
- * @param prop PropertyData, original Property data
- * @return PropertyData
- * @throws IllegalStateException
- * @throws RepositoryException
+ * Gets the value content of the property defined by the given parameters
+ * @param propertyId the id of the property
+ * @param orderNumb the order number or the property
+ * @param persistedVersion the persisted version of the property
+ * @return the value content wrapped into a ValueData object
+ * @throws IllegalStateException if connection is already closed
+ * @throws RepositoryException if some exception occurred
*/
protected ValueData getPropertyValue(String propertyId, int orderNumb, int persistedVersion)
throws IllegalStateException, RepositoryException
{
- // TODO use interface not JDBC
- JDBCStorageConnection conn = (JDBCStorageConnection)dataContainer.openConnection();
+ final WorkspaceStorageConnection con = dataContainer.openConnection();
try
{
- return conn.getValue(propertyId, orderNumb, persistedVersion);
+ return con.getValue(propertyId, orderNumb, persistedVersion);
}
finally
{
- conn.close();
+ con.close();
}
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java 2011-09-01 18:04:48 UTC (rev 4828)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java 2011-09-01 20:23:57 UTC (rev 4829)
@@ -45,7 +45,6 @@
import org.exoplatform.services.jcr.impl.dataflow.session.TransactionableResourceManager;
import org.exoplatform.services.jcr.impl.dataflow.session.TransactionableResourceManagerListener;
import org.exoplatform.services.jcr.impl.storage.SystemDataContainerHolder;
-import org.exoplatform.services.jcr.impl.storage.jdbc.JDBCStorageConnection;
import org.exoplatform.services.jcr.storage.WorkspaceDataContainer;
import org.exoplatform.services.jcr.storage.WorkspaceStorageConnection;
import org.exoplatform.services.log.ExoLogger;
@@ -636,21 +635,13 @@
throws RepositoryException
{
final WorkspaceStorageConnection con = dataContainer.openConnection();
- if (con instanceof JDBCStorageConnection)
+ try
{
- try
- {
- return ((JDBCStorageConnection)con).getChildNodesDataByPage(nodeData, fromOrderNum, limit, childNodes);
- }
- finally
- {
- con.close();
- }
+ return con.getChildNodesDataByPage(nodeData, fromOrderNum, limit, childNodes);
}
- else
+ finally
{
- throw new UnsupportedOperationException(
- "The method getChildNodesDataLazily is supported only for JDBCStorageConnection");
+ con.close();
}
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/inmemory/InmemoryStorageConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/inmemory/InmemoryStorageConnection.java 2011-09-01 18:04:48 UTC (rev 4828)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/inmemory/InmemoryStorageConnection.java 2011-09-01 20:23:57 UTC (rev 4829)
@@ -340,4 +340,22 @@
}
}
+ /**
+ * @see org.exoplatform.services.jcr.storage.WorkspaceStorageConnection#getValue(java.lang.String, int, int)
+ */
+ public ValueData getValue(String propertyId, int orderNumb, int persistedVersion) throws IllegalStateException,
+ RepositoryException
+ {
+ return null;
+ }
+
+ /**
+ * @see org.exoplatform.services.jcr.storage.WorkspaceStorageConnection#getChildNodesDataByPage(org.exoplatform.services.jcr.datamodel.NodeData, int, int, java.util.List)
+ */
+ public boolean getChildNodesDataByPage(NodeData parent, int fromOrderNum, int limit, List<NodeData> childs)
+ throws RepositoryException
+ {
+ throw new UnsupportedOperationException(
+ "The method getChildNodesDataLazily is supported only for JDBCStorageConnection");
+ }
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/statistics/StatisticsJDBCStorageConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/statistics/StatisticsJDBCStorageConnection.java 2011-09-01 18:04:48 UTC (rev 4828)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/statistics/StatisticsJDBCStorageConnection.java 2011-09-01 20:23:57 UTC (rev 4829)
@@ -21,6 +21,7 @@
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
+import org.exoplatform.services.jcr.datamodel.ValueData;
import org.exoplatform.services.jcr.impl.core.itemfilters.QPathEntryFilter;
import org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer;
import org.exoplatform.services.jcr.statistics.JCRStatisticsManager;
@@ -79,6 +80,19 @@
/**
* The description of the statistics corresponding to the method
+ * <code>getChildNodesDataByPage(NodeData nodeData, int fromOrderNum,
+ * int limit, List<NodeData> childNodes)</code>
+ */
+ private static final String GET_CHILD_NODES_DATA_BY_PAGE_DESCR = "getChildNodesDataByPage";
+
+ /**
+ * The description of the statistics corresponding to the method
+ * <code>getValue(String propertyId, int orderNumb, int persistedVersion)</code>
+ */
+ private static final String GET_VALUE_DESCR = "getValue";
+
+ /**
+ * The description of the statistics corresponding to the method
* <code>isOpened()</code>
*/
private static final String IS_OPENED_DESCR = "isOpened";
@@ -181,6 +195,7 @@
ALL_STATISTICS.put(GET_ITEM_DATA_BY_NODE_DATA_NQ_PATH_ENTRY_DESCR, new Statistics(GLOBAL_STATISTICS,
GET_ITEM_DATA_BY_NODE_DATA_NQ_PATH_ENTRY_DESCR));
ALL_STATISTICS.put(GET_CHILD_NODES_DATA_DESCR, new Statistics(GLOBAL_STATISTICS, GET_CHILD_NODES_DATA_DESCR));
+ ALL_STATISTICS.put(GET_CHILD_NODES_DATA_BY_PAGE_DESCR, new Statistics(GLOBAL_STATISTICS, GET_CHILD_NODES_DATA_BY_PAGE_DESCR));
ALL_STATISTICS.put(GET_CHILD_NODES_DATA_PATTERN_DESCR, new Statistics(GLOBAL_STATISTICS,
GET_CHILD_NODES_DATA_PATTERN_DESCR));
ALL_STATISTICS.put(GET_CHILD_NODES_COUNT_DESCR, new Statistics(GLOBAL_STATISTICS, GET_CHILD_NODES_COUNT_DESCR));
@@ -192,6 +207,7 @@
ALL_STATISTICS.put(LIST_CHILD_PROPERTIES_DATA_DESCR, new Statistics(GLOBAL_STATISTICS,
LIST_CHILD_PROPERTIES_DATA_DESCR));
ALL_STATISTICS.put(GET_REFERENCES_DATA_DESCR, new Statistics(GLOBAL_STATISTICS, GET_REFERENCES_DATA_DESCR));
+ ALL_STATISTICS.put(GET_VALUE_DESCR, new Statistics(GLOBAL_STATISTICS, GET_VALUE_DESCR));
// Write Methods
// Commit
ALL_STATISTICS.put(COMMIT_DESCR, new Statistics(GLOBAL_STATISTICS, COMMIT_DESCR));
@@ -546,10 +562,46 @@
s.end();
}
}
+
+ /**
+ * {@inheritDoc}
+ */
+ public ValueData getValue(String propertyId, int orderNumb, int persistedVersion) throws IllegalStateException,
+ RepositoryException
+ {
+ Statistics s = ALL_STATISTICS.get(GET_VALUE_DESCR);
+ try
+ {
+ s.begin();
+ return wcs.getValue(propertyId, orderNumb, persistedVersion);
+ }
+ finally
+ {
+ s.end();
+ }
+ }
/**
* {@inheritDoc}
*/
+ public boolean getChildNodesDataByPage(NodeData parent, int fromOrderNum, int limit, List<NodeData> childs)
+ throws RepositoryException
+ {
+ Statistics s = ALL_STATISTICS.get(GET_CHILD_NODES_DATA_BY_PAGE_DESCR);
+ try
+ {
+ s.begin();
+ return wcs.getChildNodesDataByPage(parent, fromOrderNum, limit, childs);
+ }
+ finally
+ {
+ s.end();
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public void rename(NodeData data) throws RepositoryException, UnsupportedOperationException,
InvalidItemStateException, IllegalStateException
{
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/storage/WorkspaceStorageConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/storage/WorkspaceStorageConnection.java 2011-09-01 18:04:48 UTC (rev 4828)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/storage/WorkspaceStorageConnection.java 2011-09-01 20:23:57 UTC (rev 4829)
@@ -23,6 +23,7 @@
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
+import org.exoplatform.services.jcr.datamodel.ValueData;
import org.exoplatform.services.jcr.impl.core.itemfilters.QPathEntryFilter;
import java.util.List;
@@ -39,7 +40,7 @@
* should have "opened" state. The connection becomes "closed" (invalid for using) after calling
* commit() or rollback() methods. In this case methods calling will cause an IllegalStateException
*
- * Connection object intendend to be as "light" as possible i.e. connection creation SHOULD NOT be
+ * Connection object intended to be as "light" as possible i.e. connection creation SHOULD NOT be
* expensive operation, so better NOT to open/close potentially EXPENSIVE resources using by
* Connection (WorkspaceDataContainer should be responsible for that). The Connection IS NOT a
* thread-safe object and normally SHOULD NOT be pooled/cached.
@@ -58,10 +59,10 @@
* - the item's parent NodeData
* @param name
* - item's path entry (QName + index)
- * @return - stored ItemData wich has exact the same path Entry (name+index) inside the parent; or
+ * @return - stored ItemData which 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
+ * if some exception occurred
* @throws IllegalStateException
* if connection is closed
*/
@@ -78,10 +79,10 @@
* - 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
+ * @return - stored ItemData which 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
+ * if some exception occurred
* @throws IllegalStateException
* if connection is closed
*/
@@ -93,12 +94,12 @@
*
* @param identifier
* - Item identifier
- * @return stored ItemData or null if no item foudn with given id. Basically used for
+ * @return stored ItemData or null if no item found with given id. Basically used for
* Session.getNodeByUUID but not necessarily refers to jcr:uuid property (In fact, this
* identifier should not necessary be equal of referenceable node's UUID if any) thereby
* can return NodeData for not referenceable node data or PropertyData.
* @throws RepositoryException
- * if some exception occured
+ * if some exception occurred
* @throws IllegalStateException
* if connection is closed
*/
@@ -111,7 +112,7 @@
* NodeData
* @return child nodes data or empty <code>List</code>
* @throws RepositoryException
- * if some exception occured
+ * if some exception occurred
* @throws IllegalStateException
* if connection is closed
*/
@@ -125,7 +126,7 @@
* @param pattern - list of QPathEntryFilters
* @return child nodes data or empty <code>List</code>
* @throws RepositoryException
- * if some exception occured
+ * if some exception occurred
* @throws IllegalStateException
* if connection is closed
*/
@@ -158,7 +159,7 @@
* NodeData
* @return child properties data or empty <code>List</code>
* @throws RepositoryException
- * if some exception occured
+ * if some exception occurred
* @throws IllegalStateException
* if connection is closed
*/
@@ -171,10 +172,10 @@
* @param parent
* NodeData
* @param pattern
- * String[] list of wildcard names
+ * String[] list of wild card names
* @return child properties data or empty <code>List</code>
* @throws RepositoryException
- * if some exception occured
+ * if some exception occurred
* @throws IllegalStateException
* if connection is closed
*/
@@ -186,13 +187,13 @@
* storage using item's parent location.
*
* <br/>
- * This methiod specially dedicated for non-content modification operations (e.g. Items delete).
+ * This method specially dedicated for non-content modification operations (e.g. Items delete).
*
* @param parent
* NodeData
* @return child properties data (with empty data) or empty <code>List</code>
* @throws RepositoryException
- * if some exception occured
+ * if some exception occurred
* @throws IllegalStateException
* if connection is closed
*/
@@ -211,7 +212,7 @@
* of referenceable Node
* @return list of referenced property data or empty <code>List</code>
* @throws RepositoryException
- * if some exception occured
+ * if some exception occurred
* @throws IllegalStateException
* if connection is closed
* @throws UnsupportedOperationException
@@ -221,6 +222,39 @@
UnsupportedOperationException;
/**
+ * Gets the value content of the property defined by the given parameters.
+ *
+ * @param propertyId
+ * the id of the property
+ * @param orderNumb
+ * the order number or the property
+ * @param persistedVersion
+ * the persisted version of the property
+ * @return the value content wrapped into a ValueData object
+ * @throws IllegalStateException
+ * if connection is already closed
+ * @throws RepositoryException
+ * if some exception occurred
+ */
+ ValueData getValue(String propertyId, int orderNumb, int persistedVersion) throws IllegalStateException, RepositoryException;
+
+ /**
+ * Get child Nodes of the parent node.
+ *
+ * @param parent
+ * the parent data
+ * @param fromOrderNum
+ * the last order number returned in previous request
+ * @param limit
+ * the recommended amount of children nodes to return
+ * @param childs
+ * will contain the resulted children nodes
+ * @return true if there are data to retrieve for next request and false in other case
+ */
+ boolean getChildNodesDataByPage(NodeData parent, int fromOrderNum, int limit, List<NodeData> childs)
+ throws RepositoryException;
+
+ /**
* Adds single <code>NodeData</code>.
*
* @param data
@@ -230,7 +264,7 @@
* @throws UnsupportedOperationException
* if operation is not supported (it is container for level 1)
* @throws RepositoryException
- * if some exception occured
+ * if some exception occurred
* @throws IllegalStateException
* if connection is closed
*/
@@ -247,7 +281,7 @@
* @throws UnsupportedOperationException
* if operation is not supported (it is container for level 1)
* @throws RepositoryException
- * if some exception occured
+ * if some exception occurred
* @throws IllegalStateException
* if connection is closed
*/
@@ -262,12 +296,12 @@
* @throws InvalidItemStateException
* (1)if the data is already updated, i.e. persisted version value of persisted data >=
* of new data's persisted version value (2) if the persisted data is not NodeData (i.e.
- * it is PropertyData). It means that some other proccess deleted original data and
+ * it is PropertyData). It means that some other process deleted original data and
* replace it with other type of data.
* @throws UnsupportedOperationException
* if operation is not supported (it is container for level 1)
* @throws RepositoryException
- * if some exception occured
+ * if some exception occurred
* @throws IllegalStateException
* if connection is closed
*/
@@ -282,12 +316,12 @@
* @throws InvalidItemStateException
* (1)if the data is already updated, i.e. persisted version value of persisted data >=
* of new data's persisted version value (2) if the persisted data is not PropertyData
- * (i.e. it is NodeData). It means that some other proccess deleted original data and
+ * (i.e. it is NodeData). It means that some other process deleted original data and
* replace it with other type of data.
* @throws UnsupportedOperationException
* if operation is not supported (it is container for level 1)
* @throws RepositoryException
- * if some exception occured
+ * if some exception occurred
* @throws IllegalStateException
* if connection is closed
*/
@@ -302,12 +336,12 @@
* @throws InvalidItemStateException
* (1)if the data is already updated, i.e. persisted version value of persisted data >=
* of new data's persisted version value (2) if the persisted data is not PropertyData
- * (i.e. it is NodeData). It means that some other proccess deleted original data and
+ * (i.e. it is NodeData). It means that some other process deleted original data and
* replace it with other type of data.
* @throws UnsupportedOperationException
* if operation is not supported (it is container for level 1)
* @throws RepositoryException
- * if some exception occured
+ * if some exception occurred
* @throws IllegalStateException
* if connection is closed
*/
@@ -325,7 +359,7 @@
* @throws UnsupportedOperationException
* if operation is not supported (it is container for level 1)
* @throws RepositoryException
- * if some exception occured
+ * if some exception occurred
* @throws IllegalStateException
* if connection is closed
*/
@@ -343,7 +377,7 @@
* @throws UnsupportedOperationException
* if operation is not supported (it is container for level 1)
* @throws RepositoryException
- * if some exception occured
+ * if some exception occurred
* @throws IllegalStateException
* if connection is closed
*/
@@ -356,7 +390,7 @@
* @throws IllegalStateException
* if connection is already closed
* @throws RepositoryException
- * if some exception occured
+ * if some exception occurred
*/
void commit() throws IllegalStateException, RepositoryException;
@@ -367,7 +401,7 @@
* @throws IllegalStateException
* if connection is already closed
* @throws RepositoryException
- * if some exception occured
+ * if some exception occurred
*/
void rollback() throws IllegalStateException, RepositoryException;
@@ -377,7 +411,7 @@
* @throws IllegalStateException
* if connection is already closed
* @throws RepositoryException
- * if some exception occured
+ * if some exception occurred
*/
void close() throws IllegalStateException, RepositoryException;
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestCacheableWorkspaceDataManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestCacheableWorkspaceDataManager.java 2011-09-01 18:04:48 UTC (rev 4828)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestCacheableWorkspaceDataManager.java 2011-09-01 20:23:57 UTC (rev 4829)
@@ -599,6 +599,18 @@
return null;
}
+ public ValueData getValue(String propertyId, int orderNumb, int persistedVersion) throws IllegalStateException,
+ RepositoryException
+ {
+ return null;
+ }
+
+ public boolean getChildNodesDataByPage(NodeData parent, int fromOrderNum, int limit, List<NodeData> childs)
+ throws RepositoryException
+ {
+ return false;
+ }
+
};
private static class MyWorkspaceDataContainer extends WorkspaceDataContainerBase
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestMultipleListenersNotifying.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestMultipleListenersNotifying.java 2011-09-01 18:04:48 UTC (rev 4828)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestMultipleListenersNotifying.java 2011-09-01 20:23:57 UTC (rev 4829)
@@ -43,7 +43,6 @@
super(null, new SystemDataContainerHolder(null));
}
- @Override
public void save(ItemStateChangesLog changes) throws InvalidItemStateException, UnsupportedOperationException,
RepositoryException
{
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestWorkspaceStorageCacheInClusterMode.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestWorkspaceStorageCacheInClusterMode.java 2011-09-01 18:04:48 UTC (rev 4828)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestWorkspaceStorageCacheInClusterMode.java 2011-09-01 20:23:57 UTC (rev 4829)
@@ -949,8 +949,19 @@
return children;
}
+
+ public ValueData getValue(String propertyId, int orderNumb, int persistedVersion) throws IllegalStateException,
+ RepositoryException
+ {
+ return null;
+ }
+
+ public boolean getChildNodesDataByPage(NodeData parent, int fromOrderNum, int limit, List<NodeData> childs)
+ throws RepositoryException
+ {
+ return false;
+ }
-
};
private static class MyWorkspaceDataContainer extends WorkspaceDataContainerBase
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TestJBossCacheWorkspaceStorageCache.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TestJBossCacheWorkspaceStorageCache.java 2011-09-01 18:04:48 UTC (rev 4828)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/TestJBossCacheWorkspaceStorageCache.java 2011-09-01 20:23:57 UTC (rev 4829)
@@ -32,11 +32,11 @@
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
+import org.exoplatform.services.jcr.datamodel.ValueData;
import org.exoplatform.services.jcr.impl.Constants;
import org.exoplatform.services.jcr.impl.core.itemfilters.QPathEntryFilter;
import org.exoplatform.services.jcr.impl.dataflow.persistent.CacheableWorkspaceDataManager;
import org.exoplatform.services.jcr.impl.dataflow.persistent.WorkspaceStorageCacheBaseCase;
-import org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.JBossCacheWorkspaceStorageCache;
import org.exoplatform.services.jcr.impl.storage.SystemDataContainerHolder;
import org.exoplatform.services.jcr.impl.storage.WorkspaceDataContainerBase;
import org.exoplatform.services.jcr.storage.WorkspaceDataContainer;
@@ -315,6 +315,18 @@
return getChildNodesData(parent);
}
+ public ValueData getValue(String propertyId, int orderNumb, int persistedVersion) throws IllegalStateException,
+ RepositoryException
+ {
+ return null;
+ }
+
+ public boolean getChildNodesDataByPage(NodeData parent, int fromOrderNum, int limit, List<NodeData> childs)
+ throws RepositoryException
+ {
+ return false;
+ }
+
};
private static class MyWorkspaceDataContainer extends WorkspaceDataContainerBase
12 years, 8 months
exo-jcr SVN: r4828 - jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2011-09-01 14:04:48 -0400 (Thu, 01 Sep 2011)
New Revision: 4828
Removed:
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestWorkspaceStorageCacheInClusterMode.java.orig
Log:
EXOJCR-852: Removed the file added by mistake
Deleted: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestWorkspaceStorageCacheInClusterMode.java.orig
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestWorkspaceStorageCacheInClusterMode.java.orig 2011-09-01 13:04:42 UTC (rev 4827)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestWorkspaceStorageCacheInClusterMode.java.orig 2011-09-01 18:04:48 UTC (rev 4828)
@@ -1,995 +0,0 @@
-/*
- * Copyright (C) 2011 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.services.jcr.impl.dataflow.persistent;
-
-import org.exoplatform.commons.utils.QName;
-import org.exoplatform.services.jcr.JcrImplBaseTest;
-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.dataflow.persistent.PersistedNodeData;
-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.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.Constants;
-import org.exoplatform.services.jcr.impl.core.itemfilters.PatternQPathEntry;
-import org.exoplatform.services.jcr.impl.core.itemfilters.PatternQPathEntryFilter;
-import org.exoplatform.services.jcr.impl.core.itemfilters.QPathEntryFilter;
-import org.exoplatform.services.jcr.impl.storage.SystemDataContainerHolder;
-import org.exoplatform.services.jcr.impl.storage.WorkspaceDataContainerBase;
-import org.exoplatform.services.jcr.storage.WorkspaceDataContainer;
-import org.exoplatform.services.jcr.storage.WorkspaceStorageConnection;
-
-import java.io.UnsupportedEncodingException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.atomic.AtomicReference;
-
-import javax.jcr.InvalidItemStateException;
-import javax.jcr.PropertyType;
-import javax.jcr.RepositoryException;
-
-/**
- * @author <a href="mailto:nfilotto@exoplatform.com">Nicolas Filotto</a>
- * @version $Id$
- *
- */
-public abstract class TestWorkspaceStorageCacheInClusterMode<T extends WorkspaceStorageCache> extends JcrImplBaseTest
-{
- public abstract T getCacheImpl() throws Exception;
-
- public void testRaceConditionsNConsistency() throws Exception
- {
- T cache1 = null, cache2 = null;
- try
- {
- MyWorkspaceStorageConnection con = new MyWorkspaceStorageConnection();
- WorkspaceDataContainer wdc = new MyWorkspaceDataContainer(con);
- CacheableWorkspaceDataManager cwdmNode1 =
- new CacheableWorkspaceDataManager(wdc, cache1 = getCacheImpl(), new SystemDataContainerHolder(wdc));
- CacheableWorkspaceDataManager cwdmNode2 =
- new CacheableWorkspaceDataManager(wdc, cache2 = getCacheImpl(), new SystemDataContainerHolder(wdc));
- NodeData parentNode = new PersistedNodeData("parent-id", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent-node")), Constants.ROOT_UUID, 1, 0,
- Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
- // Test getChildNodesData
- Action readAction = new Action(cwdmNode2)
- {
- public void execute(NodeData parentNode) throws Exception
- {
- cwdm.getChildNodesData(parentNode);
- }
- };
- Action writeAction = new Action(cwdmNode1)
- {
- public void execute(NodeData parentNode) throws Exception
- {
- PlainChangesLog chlog = new PlainChangesLogImpl();
- cwdm.getChildNodesData(parentNode);
- chlog.add(ItemState.createAddedState(new PersistedNodeData("id-node" + parentNode.getIdentifier(), QPath.makeChildPath(parentNode.getQPath(), new InternalQName(null, "node")), parentNode.getIdentifier(), 1, 0,
- Constants.NT_UNSTRUCTURED, new InternalQName[0], null)));
- cwdm.save(chlog);
- }
- };
- executeConcurrentReadNWrite(con, readAction, writeAction, Mode.READ_FIRST, parentNode);
- assertNotNull(cwdmNode1.getChildNodesData(parentNode));
- assertEquals(2, cwdmNode1.getChildNodesData(parentNode).size());
- assertNotNull(cwdmNode2.getChildNodesData(parentNode));
- assertEquals(2, cwdmNode2.getChildNodesData(parentNode).size());
- parentNode = new PersistedNodeData("parent-id2", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent-node2")), Constants.ROOT_UUID, 1, 0,
- Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
- executeConcurrentReadNWrite(con, readAction, writeAction, Mode.WRITE_FIRST, parentNode);
- assertNotNull(cwdmNode1.getChildNodesData(parentNode));
- assertEquals(2, cwdmNode1.getChildNodesData(parentNode).size());
- assertNotNull(cwdmNode2.getChildNodesData(parentNode));
- assertEquals(2, cwdmNode2.getChildNodesData(parentNode).size());
- // Test getChildPropertiesData
- readAction = new Action(cwdmNode2)
- {
- public void execute(NodeData parentNode) throws Exception
- {
- cwdm.getChildPropertiesData(parentNode);
- }
- };
- writeAction = new Action(cwdmNode1)
- {
- public void execute(NodeData parentNode) throws Exception
- {
- PlainChangesLog chlog = new PlainChangesLogImpl();
- cwdm.getChildPropertiesData(parentNode);
- chlog.add(ItemState.createAddedState(new PersistedPropertyData("id-property" + parentNode.getIdentifier(), QPath.makeChildPath(
- parentNode.getQPath(), new InternalQName(null, "property")), parentNode.getIdentifier(), 0,
- PropertyType.STRING, false, Arrays.asList((ValueData)new ByteArrayPersistedValueData(0, "some data".getBytes("UTF-8"))))));
- cwdm.save(chlog);
- }
- };
- parentNode = new PersistedNodeData("parent-id3", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent-node3")), Constants.ROOT_UUID, 1, 0,
- Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
- executeConcurrentReadNWrite(con, readAction, writeAction, Mode.READ_FIRST, parentNode);
- assertNotNull(cwdmNode1.getChildPropertiesData(parentNode));
- assertEquals(2, cwdmNode1.getChildPropertiesData(parentNode).size());
- assertNotNull(cwdmNode2.getChildPropertiesData(parentNode));
- assertEquals(2, cwdmNode2.getChildPropertiesData(parentNode).size());
- parentNode = new PersistedNodeData("parent-id4", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent-node4")), Constants.ROOT_UUID, 1, 0,
- Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
- executeConcurrentReadNWrite(con, readAction, writeAction, Mode.WRITE_FIRST, parentNode);
- assertNotNull(cwdmNode1.getChildPropertiesData(parentNode));
- assertEquals(2, cwdmNode1.getChildPropertiesData(parentNode).size());
- assertNotNull(cwdmNode2.getChildPropertiesData(parentNode));
- assertEquals(2, cwdmNode2.getChildPropertiesData(parentNode).size());
- // Test getReferencesData
- readAction = new Action(cwdmNode2)
- {
- public void execute(NodeData parentNode) throws Exception
- {
- cwdm.getReferencesData(parentNode.getIdentifier(), false);
- }
- };
- writeAction = new Action(cwdmNode1)
- {
- public void execute(NodeData parentNode) throws Exception
- {
- PlainChangesLog chlog = new PlainChangesLogImpl();
- cwdm.getReferencesData(parentNode.getIdentifier(), false);
- chlog.add(ItemState.createAddedState(new PersistedPropertyData("id-reference" + parentNode.getIdentifier(), QPath.makeChildPath(
- parentNode.getQPath(), new InternalQName(null, "reference")), parentNode.getIdentifier(), 0,
- PropertyType.REFERENCE, false, Arrays.asList((ValueData)new ByteArrayPersistedValueData(0, parentNode.getIdentifier().getBytes("UTF-8"))))));
- cwdm.save(chlog);
- }
- };
- parentNode = new PersistedNodeData("parent-id5", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent-node5")), Constants.ROOT_UUID, 1, 0,
- Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
- executeConcurrentReadNWrite(con, readAction, writeAction, Mode.READ_FIRST, parentNode);
- assertNotNull(cwdmNode1.getReferencesData(parentNode.getIdentifier(), false));
- assertEquals(2, cwdmNode1.getReferencesData(parentNode.getIdentifier(), false).size());
- assertNotNull(cwdmNode2.getReferencesData(parentNode.getIdentifier(), false));
- assertEquals(2, cwdmNode2.getReferencesData(parentNode.getIdentifier(), false).size());
- parentNode = new PersistedNodeData("parent-id6", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent-node6")), Constants.ROOT_UUID, 1, 0,
- Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
- executeConcurrentReadNWrite(con, readAction, writeAction, Mode.WRITE_FIRST, parentNode);
- assertNotNull(cwdmNode1.getReferencesData(parentNode.getIdentifier(), false));
- assertEquals(2, cwdmNode1.getReferencesData(parentNode.getIdentifier(), false).size());
- assertNotNull(cwdmNode2.getReferencesData(parentNode.getIdentifier(), false));
- assertEquals(2, cwdmNode2.getReferencesData(parentNode.getIdentifier(), false).size());
-
- // Test getItemData by Id
- readAction = new Action(cwdmNode2)
- {
- public void execute(NodeData parentNode) throws Exception
- {
- cwdm.getItemData(parentNode.getIdentifier());
- }
- };
- writeAction = new Action(cwdmNode1)
- {
- public void execute(NodeData parentNode) throws Exception
- {
- PlainChangesLog chlog = new PlainChangesLogImpl();
- cwdm.getItemData(parentNode.getIdentifier());
- chlog.add(ItemState.createUpdatedState(new PersistedNodeData(parentNode.getIdentifier(), parentNode.getQPath(), Constants.ROOT_UUID, 2, 1,
- Constants.NT_UNSTRUCTURED, new InternalQName[0], null)));
- cwdm.save(chlog);
- }
- };
- parentNode = new PersistedNodeData("parent-id7", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent-node7")), Constants.ROOT_UUID, 1, 0,
- Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
- executeConcurrentReadNWrite(con, readAction, writeAction, Mode.READ_FIRST, parentNode);
- assertNotNull(cwdmNode1.getItemData(parentNode.getIdentifier()));
- assertEquals(2, cwdmNode1.getItemData(parentNode.getIdentifier()).getPersistedVersion());
- assertNotNull(cwdmNode2.getItemData(parentNode.getIdentifier()));
- assertEquals(2, cwdmNode2.getItemData(parentNode.getIdentifier()).getPersistedVersion());
- parentNode = new PersistedNodeData("parent-id8", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent-node8")), Constants.ROOT_UUID, 1, 0,
- Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
- executeConcurrentReadNWrite(con, readAction, writeAction, Mode.WRITE_FIRST, parentNode);
- assertNotNull(cwdmNode1.getItemData(parentNode.getIdentifier()));
- assertEquals(2, cwdmNode1.getItemData(parentNode.getIdentifier()).getPersistedVersion());
- assertNotNull(cwdmNode2.getItemData(parentNode.getIdentifier()));
- assertEquals(2, cwdmNode2.getItemData(parentNode.getIdentifier()).getPersistedVersion());
-
- // Test getItemData by Path
- final QPathEntry qpe = new QPathEntry(null, "my-property", 1);
- readAction = new Action(cwdmNode2)
- {
- public void execute(NodeData parentNode) throws Exception
- {
- cwdm.getItemData(parentNode, qpe, ItemType.PROPERTY);
- }
- };
- writeAction = new Action(cwdmNode1)
- {
- public void execute(NodeData parentNode) throws Exception
- {
- PlainChangesLog chlog = new PlainChangesLogImpl();
- cwdm.getItemData(parentNode, qpe, ItemType.PROPERTY);
- chlog.add(ItemState.createUpdatedState(new PersistedPropertyData("property-by-path"
- + parentNode.getIdentifier(), QPath.makeChildPath(parentNode.getQPath(), qpe), parentNode
- .getIdentifier(), 2, PropertyType.STRING, false, Arrays
- .asList((ValueData)new ByteArrayPersistedValueData(0, "some new data".getBytes("UTF-8"))))));
- cwdm.save(chlog);
- }
- };
- parentNode = new PersistedNodeData("parent-id9", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent-node9")), Constants.ROOT_UUID, 1, 0,
- Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
- executeConcurrentReadNWrite(con, readAction, writeAction, Mode.READ_FIRST, parentNode);
- assertNotNull(cwdmNode1.getItemData(parentNode, qpe, ItemType.PROPERTY));
- assertEquals(2, cwdmNode1.getItemData(parentNode, qpe, ItemType.PROPERTY).getPersistedVersion());
- assertNotNull(cwdmNode2.getItemData(parentNode, qpe, ItemType.PROPERTY));
- assertEquals(2, cwdmNode2.getItemData(parentNode, qpe, ItemType.PROPERTY).getPersistedVersion());
- parentNode = new PersistedNodeData("parent-id10", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent-node10")), Constants.ROOT_UUID, 1, 0,
- Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
- executeConcurrentReadNWrite(con, readAction, writeAction, Mode.WRITE_FIRST, parentNode);
- assertNotNull(cwdmNode1.getItemData(parentNode, qpe, ItemType.PROPERTY));
- assertEquals(2, cwdmNode1.getItemData(parentNode, qpe, ItemType.PROPERTY).getPersistedVersion());
- assertNotNull(cwdmNode2.getItemData(parentNode, qpe, ItemType.PROPERTY));
- assertEquals(2, cwdmNode2.getItemData(parentNode, qpe, ItemType.PROPERTY).getPersistedVersion());
-
- // Test getChildNodesData by patterns
- final List<QPathEntryFilter> nodePatterns =
- Collections.singletonList((QPathEntryFilter)new PatternQPathEntryFilter(new PatternQPathEntry("",
- "my-node", -1)));
- readAction = new Action(cwdmNode2)
- {
- public void execute(NodeData parentNode) throws Exception
- {
- cwdm.getChildNodesData(parentNode, nodePatterns);
- }
- };
- writeAction = new Action(cwdmNode1)
- {
- public void execute(NodeData parentNode) throws Exception
- {
- PlainChangesLog chlog = new PlainChangesLogImpl();
- cwdm.getChildNodesData(parentNode, nodePatterns);
- chlog.add(ItemState.createAddedState(new PersistedNodeData("my-node2" + parentNode.getIdentifier(),
- QPath.makeChildPath(parentNode.getQPath(), new QName("", "my-node"), 2), parentNode.getIdentifier(), 1, 2,
- Constants.NT_UNSTRUCTURED, new InternalQName[0], null)));
- cwdm.save(chlog);
- }
- };
- con.setCanModify(true);
- parentNode = new PersistedNodeData("parent-id11", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent-node11")), Constants.ROOT_UUID, 1, 0,
- Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
- executeConcurrentReadNWrite(con, readAction, writeAction, Mode.READ_FIRST, parentNode);
- assertNotNull(cwdmNode1.getChildNodesData(parentNode, nodePatterns));
- assertEquals(2, cwdmNode1.getChildNodesData(parentNode, nodePatterns).size());
- assertNotNull(cwdmNode2.getChildNodesData(parentNode, nodePatterns));
- assertEquals(2, cwdmNode2.getChildNodesData(parentNode, nodePatterns).size());
- parentNode = new PersistedNodeData("parent-id12", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent-node12")), Constants.ROOT_UUID, 1, 0,
- Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
- executeConcurrentReadNWrite(con, readAction, writeAction, Mode.WRITE_FIRST, parentNode);
- assertNotNull(cwdmNode1.getChildNodesData(parentNode, nodePatterns));
- assertEquals(2, cwdmNode1.getChildNodesData(parentNode, nodePatterns).size());
- assertNotNull(cwdmNode2.getChildNodesData(parentNode, nodePatterns));
- assertEquals(2, cwdmNode2.getChildNodesData(parentNode, nodePatterns).size());
-
- // Test getChildPropertiesData by patterns
- final List<QPathEntryFilter> propPatterns =
- Collections.singletonList((QPathEntryFilter)new PatternQPathEntryFilter(new PatternQPathEntry("",
- "my-property*", -1)));
- readAction = new Action(cwdmNode2)
- {
- public void execute(NodeData parentNode) throws Exception
- {
- cwdm.getChildPropertiesData(parentNode, propPatterns);
- }
- };
- writeAction = new Action(cwdmNode1)
- {
- public void execute(NodeData parentNode) throws Exception
- {
- PlainChangesLog chlog = new PlainChangesLogImpl();
- cwdm.getChildPropertiesData(parentNode, propPatterns);
- chlog.add(ItemState.createAddedState(new PersistedPropertyData("id-property" + parentNode.getIdentifier(), QPath.makeChildPath(
- parentNode.getQPath(), new InternalQName(null, "my-property1")), parentNode.getIdentifier(), 0,
- PropertyType.STRING, false, Arrays.asList((ValueData)new ByteArrayPersistedValueData(0, "some data".getBytes("UTF-8"))))));
- cwdm.save(chlog);
- }
- };
- parentNode = new PersistedNodeData("parent-id13", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent-node13")), Constants.ROOT_UUID, 1, 0,
- Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
- executeConcurrentReadNWrite(con, readAction, writeAction, Mode.READ_FIRST, parentNode);
- assertNotNull(cwdmNode1.getChildPropertiesData(parentNode, propPatterns));
- assertEquals(2, cwdmNode1.getChildPropertiesData(parentNode, propPatterns).size());
- assertNotNull(cwdmNode2.getChildPropertiesData(parentNode, propPatterns));
- assertEquals(2, cwdmNode2.getChildPropertiesData(parentNode, propPatterns).size());
- parentNode = new PersistedNodeData("parent-id14", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent-node14")), Constants.ROOT_UUID, 1, 0,
- Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
- executeConcurrentReadNWrite(con, readAction, writeAction, Mode.WRITE_FIRST, parentNode);
- assertNotNull(cwdmNode1.getChildPropertiesData(parentNode, propPatterns));
- assertEquals(2, cwdmNode1.getChildPropertiesData(parentNode, propPatterns).size());
- assertNotNull(cwdmNode2.getChildPropertiesData(parentNode, propPatterns));
- assertEquals(2, cwdmNode2.getChildPropertiesData(parentNode, propPatterns).size());
-
- // testConsistency
- con = new MyWorkspaceStorageConnection(true);
- wdc = new MyWorkspaceDataContainer(con);
- cwdmNode1 =
- new CacheableWorkspaceDataManager(wdc, cache1, new SystemDataContainerHolder(wdc));
- cwdmNode2 =
- new CacheableWorkspaceDataManager(wdc, cache2, new SystemDataContainerHolder(wdc));
- parentNode = new PersistedNodeData("parent2-id", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node")), Constants.ROOT_UUID, 1, 0,
- Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
- // Test getChildNodesData
- con.setParentNode(parentNode);
- cwdmNode2.getChildNodesData(parentNode);
- PlainChangesLog chlog = new PlainChangesLogImpl();
- chlog.add(ItemState.createAddedState(new PersistedNodeData("id-node" + parentNode.getIdentifier(), QPath.makeChildPath(parentNode.getQPath(), new InternalQName(null, "node")), parentNode.getIdentifier(), 1, 0,
- Constants.NT_UNSTRUCTURED, new InternalQName[0], null)));
- cwdmNode1.save(chlog);
- assertNotNull(cwdmNode1.getChildNodesData(parentNode));
- assertEquals(2, cwdmNode1.getChildNodesData(parentNode).size());
- assertNotNull(cwdmNode2.getChildNodesData(parentNode));
- assertEquals(2, cwdmNode2.getChildNodesData(parentNode).size());
- parentNode = new PersistedNodeData("parent2-id2", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node2")), Constants.ROOT_UUID, 1, 0,
- Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
- con.setParentNode(parentNode);
- cwdmNode2.getChildNodesData(parentNode);
- chlog = new PlainChangesLogImpl();
- chlog.add(ItemState.createDeletedState(new PersistedNodeData("id-node2" + parentNode.getIdentifier(), QPath.makeChildPath(parentNode.getQPath(), new InternalQName(null, "node2")), parentNode.getIdentifier(), 1, 0,
- Constants.NT_UNSTRUCTURED, new InternalQName[0], null)));
- cwdmNode1.save(chlog);
- assertNotNull(cwdmNode1.getChildNodesData(parentNode));
- assertEquals(0, cwdmNode1.getChildNodesData(parentNode).size());
- assertNotNull(cwdmNode2.getChildNodesData(parentNode));
- assertEquals(0, cwdmNode2.getChildNodesData(parentNode).size());
-
- // Test getChildPropertiesData
- parentNode = new PersistedNodeData("parent2-id3", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node3")), Constants.ROOT_UUID, 1, 0,
- Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
- con.setParentNode(parentNode);
- cwdmNode2.getChildPropertiesData(parentNode);
- chlog = new PlainChangesLogImpl();
- chlog.add(ItemState.createAddedState(new PersistedPropertyData("id-property" + parentNode.getIdentifier(), QPath.makeChildPath(
- parentNode.getQPath(), new InternalQName(null, "property")), parentNode.getIdentifier(), 0,
- PropertyType.STRING, false, Arrays.asList((ValueData)new ByteArrayPersistedValueData(0, "some data".getBytes("UTF-8"))))));
- cwdmNode1.save(chlog);
- assertNotNull(cwdmNode1.getChildPropertiesData(parentNode));
- assertEquals(2, cwdmNode1.getChildPropertiesData(parentNode).size());
- assertNotNull(cwdmNode2.getChildPropertiesData(parentNode));
- assertEquals(2, cwdmNode2.getChildPropertiesData(parentNode).size());
- parentNode = new PersistedNodeData("parent2-id4", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node4")), Constants.ROOT_UUID, 1, 0,
- Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
- con.setParentNode(parentNode);
- cwdmNode2.getChildPropertiesData(parentNode);
- chlog = new PlainChangesLogImpl();
- chlog.add(ItemState.createDeletedState(new PersistedPropertyData("id-property2" + parentNode.getIdentifier(), QPath.makeChildPath(
- parentNode.getQPath(), new InternalQName(null, "property2")), parentNode.getIdentifier(), 0,
- PropertyType.STRING, false, Arrays.asList((ValueData)new ByteArrayPersistedValueData(0, "some data".getBytes("UTF-8"))))));
- cwdmNode1.save(chlog);
- assertNotNull(cwdmNode1.getChildPropertiesData(parentNode));
- assertEquals(0, cwdmNode1.getChildPropertiesData(parentNode).size());
- assertNotNull(cwdmNode2.getChildPropertiesData(parentNode));
- assertEquals(0, cwdmNode2.getChildPropertiesData(parentNode).size());
-
- // Test getReferencesData
- parentNode = new PersistedNodeData("parent2-id5", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node5")), Constants.ROOT_UUID, 1, 0,
- Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
- con.setParentNode(parentNode);
- cwdmNode2.getReferencesData(parentNode.getIdentifier(), false);
- chlog = new PlainChangesLogImpl();
- chlog.add(ItemState.createAddedState(new PersistedPropertyData("id-reference" + parentNode.getIdentifier(), QPath.makeChildPath(
- parentNode.getQPath(), new InternalQName(null, "reference")), parentNode.getIdentifier(), 0,
- PropertyType.REFERENCE, false, Arrays.asList((ValueData)new ByteArrayPersistedValueData(0, parentNode.getIdentifier().getBytes("UTF-8"))))));
- cwdmNode1.save(chlog);
- assertNotNull(cwdmNode1.getReferencesData(parentNode.getIdentifier(), false));
- assertEquals(2, cwdmNode1.getReferencesData(parentNode.getIdentifier(), false).size());
- assertNotNull(cwdmNode2.getReferencesData(parentNode.getIdentifier(), false));
- assertEquals(2, cwdmNode2.getReferencesData(parentNode.getIdentifier(), false).size());
- parentNode = new PersistedNodeData("parent2-id6", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node6")), Constants.ROOT_UUID, 1, 0,
- Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
- con.setParentNode(parentNode);
- cwdmNode2.getReferencesData(parentNode.getIdentifier(), false);
- chlog = new PlainChangesLogImpl();
- chlog.add(ItemState.createDeletedState(new PersistedPropertyData("id-reference2" + parentNode.getIdentifier(), QPath.makeChildPath(
- parentNode.getQPath(), new InternalQName(null, "reference2")), parentNode.getIdentifier(), 0,
- PropertyType.REFERENCE, false, Arrays.asList((ValueData)new ByteArrayPersistedValueData(0, parentNode.getIdentifier().getBytes("UTF-8"))))));
- cwdmNode1.save(chlog);
- assertNotNull(cwdmNode1.getReferencesData(parentNode.getIdentifier(), false));
- assertEquals(0, cwdmNode1.getReferencesData(parentNode.getIdentifier(), false).size());
- assertNotNull(cwdmNode2.getReferencesData(parentNode.getIdentifier(), false));
- assertEquals(0, cwdmNode2.getReferencesData(parentNode.getIdentifier(), false).size());
-
- // Test getChildNodesData by patterns
- final List<QPathEntryFilter> patterns =
- Collections.singletonList((QPathEntryFilter)new PatternQPathEntryFilter(new PatternQPathEntry("",
- "my-node", -1)));
- parentNode = new PersistedNodeData("parent2-id11", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node11")), Constants.ROOT_UUID, 1, 0,
- Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
- con.setParentNode(parentNode);
- cwdmNode2.getChildNodesData(parentNode, patterns);
- chlog = new PlainChangesLogImpl();
- chlog.add(ItemState.createAddedState(new PersistedNodeData("my-node2" + parentNode.getIdentifier(),
- QPath.makeChildPath(parentNode.getQPath(), new QName("", "my-node"), 2), parentNode.getIdentifier(), 1, 2,
- Constants.NT_UNSTRUCTURED, new InternalQName[0], null)));
- cwdmNode1.save(chlog);
- assertNotNull(cwdmNode1.getChildNodesData(parentNode, patterns));
- assertEquals(2, cwdmNode1.getChildNodesData(parentNode, patterns).size());
- assertNotNull(cwdmNode2.getChildNodesData(parentNode, patterns));
- assertEquals(2, cwdmNode2.getChildNodesData(parentNode, patterns).size());
- parentNode = new PersistedNodeData("parent2-id12", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node12")), Constants.ROOT_UUID, 1, 0,
- Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
- con.setParentNode(parentNode);
- cwdmNode2.getChildNodesData(parentNode, patterns);
- chlog = new PlainChangesLogImpl();
- chlog.add(ItemState.createDeletedState(new PersistedNodeData("my-node" + parentNode.getIdentifier(), QPath
- .makeChildPath(parentNode.getQPath(), new QName("", "my-node"), 1), parentNode.getIdentifier(), 1, 1,
- Constants.NT_UNSTRUCTURED, new InternalQName[0], null)));
- cwdmNode1.save(chlog);
- assertNotNull(cwdmNode1.getChildNodesData(parentNode, patterns));
- assertEquals(0, cwdmNode1.getChildNodesData(parentNode, patterns).size());
- assertNotNull(cwdmNode2.getChildNodesData(parentNode, patterns));
- assertEquals(0, cwdmNode2.getChildNodesData(parentNode, patterns).size());
-
-
- // Test getChildPropertiesData by patterns
- final List<QPathEntryFilter> propPattern2s =
- Collections.singletonList((QPathEntryFilter)new PatternQPathEntryFilter(new PatternQPathEntry("",
- "my-property*", -1)));
- parentNode = new PersistedNodeData("parent2-id13", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node13")), Constants.ROOT_UUID, 1, 0,
- Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
- con.setParentNode(parentNode);
- cwdmNode2.getChildPropertiesData(parentNode, propPattern2s);
- chlog = new PlainChangesLogImpl();
- chlog.add(ItemState.createAddedState(new PersistedPropertyData("id-property" + parentNode.getIdentifier(), QPath.makeChildPath(
- parentNode.getQPath(), new InternalQName(null, "my-property1")), parentNode.getIdentifier(), 0,
- PropertyType.STRING, false, Arrays.asList((ValueData)new ByteArrayPersistedValueData(0, "some data".getBytes("UTF-8"))))));
- cwdmNode1.save(chlog);
- assertNotNull(cwdmNode1.getChildPropertiesData(parentNode, propPattern2s));
- assertEquals(2, cwdmNode1.getChildPropertiesData(parentNode, propPattern2s).size());
- assertNotNull(cwdmNode2.getChildPropertiesData(parentNode, propPattern2s));
- assertEquals(2, cwdmNode2.getChildPropertiesData(parentNode, propPattern2s).size());
- parentNode = new PersistedNodeData("parent2-id14", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node14")), Constants.ROOT_UUID, 1, 0,
- Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
- con.setParentNode(parentNode);
- cwdmNode2.getChildPropertiesData(parentNode, propPattern2s);
- chlog = new PlainChangesLogImpl();
- chlog.add(ItemState.createDeletedState(new PersistedPropertyData("id-property2" + parentNode.getIdentifier(), QPath.makeChildPath(
- parentNode.getQPath(), new InternalQName(null, "my-property2")), parentNode.getIdentifier(), 0,
- PropertyType.STRING, false, Arrays.asList((ValueData)new ByteArrayPersistedValueData(0, "some data".getBytes("UTF-8"))))));
- cwdmNode1.save(chlog);
- assertNotNull(cwdmNode1.getChildPropertiesData(parentNode, propPattern2s));
- assertEquals(0, cwdmNode1.getChildPropertiesData(parentNode, propPattern2s).size());
- assertNotNull(cwdmNode2.getChildPropertiesData(parentNode, propPattern2s));
- assertEquals(0, cwdmNode2.getChildPropertiesData(parentNode, propPattern2s).size());
- }
- finally
- {
- if (cache1 != null)
- {
- try
- {
- finalize(cache1);
- }
- catch (Exception e)
- {
- // ignore me
- }
- }
- if (cache2 != null)
- {
- try
- {
- finalize(cache2);
- }
- catch (Exception e)
- {
- // ignore me
- }
- }
- }
- }
-
- protected void finalize(T cache)
- {
- }
-
- /**
- * @param con
- * @param cwdm
- * @param mode
- * @param idNode
- * @throws InterruptedException
- */
- private void executeConcurrentReadNWrite(final MyWorkspaceStorageConnection con, final Action readAction,
- final Action writeAction, final Mode mode, final NodeData parentNode) throws InterruptedException
- {
- final CountDownLatch goSignal = con.initCountDownLatch();
- con.setParentNode(parentNode);
- final AtomicReference<Exception> ex = new AtomicReference<Exception>();
- final CountDownLatch startSignal = new CountDownLatch(1);
- final CountDownLatch doneSignal = new CountDownLatch(2);
- Thread writer = new Thread()
- {
- public void run()
- {
- try
- {
- startSignal.await();
- con.wait.set(mode != Mode.WRITE_FIRST);
- writeAction.execute(parentNode);
- }
- catch (Exception e)
- {
- e.printStackTrace();
- ex.set(e);
- }
- finally
- {
- if (mode == Mode.WRITE_FIRST) goSignal.countDown();
- doneSignal.countDown();
- con.wait.remove();
- }
- }
- };
- writer.start();
- Thread reader = new Thread()
- {
- public void run()
- {
- try
- {
- startSignal.await();
- con.wait.set(mode != Mode.READ_FIRST);
- readAction.execute(parentNode);
- }
- catch (Exception e)
- {
- e.printStackTrace();
- ex.set(e);
- }
- finally
- {
- if (mode == Mode.READ_FIRST) goSignal.countDown();
- doneSignal.countDown();
- con.wait.remove();
- }
- }
- };
- reader.start();
- startSignal.countDown();
- doneSignal.await();
- assertNull(ex.get());
- }
-
- private abstract class Action
- {
-
- protected final CacheableWorkspaceDataManager cwdm;
- public Action(CacheableWorkspaceDataManager cwdm)
- {
- this.cwdm = cwdm;
- }
- protected abstract void execute(NodeData parentNode) throws Exception;
- }
- private static enum Mode
- {
- READ_FIRST, WRITE_FIRST;
- }
- public static class MyWorkspaceStorageConnection implements WorkspaceStorageConnection
- {
- public ThreadLocal<Boolean> wait = new ThreadLocal<Boolean>();
- private NodeData parentNode;
- private CountDownLatch goSignal;
- private ItemData itemAdded;
- private boolean canModify;
- private boolean itemDeleted;
-
- public MyWorkspaceStorageConnection()
- {
- }
-
- public MyWorkspaceStorageConnection(boolean canModify)
- {
- this.canModify = canModify;
- }
-
- /**
- * @param canModify the canModify to set
- */
- public void setCanModify(boolean canModify)
- {
- this.canModify = canModify;
- }
-
- public CountDownLatch initCountDownLatch()
- {
- return this.goSignal = new CountDownLatch(1);
- }
-
- public void setParentNode(NodeData parentNode)
- {
- this.parentNode = parentNode;
- this.itemAdded = null;
- this.itemDeleted = false;
- }
-
- public void add(NodeData data) throws RepositoryException, UnsupportedOperationException,
- InvalidItemStateException, IllegalStateException
- {
- this.itemAdded = data;
- }
-
- public void add(PropertyData data) throws RepositoryException, UnsupportedOperationException,
- InvalidItemStateException, IllegalStateException
- {
- this.itemAdded = data;
- }
-
- public void close() throws IllegalStateException, RepositoryException
- {
- }
-
- public void commit() throws IllegalStateException, RepositoryException
- {
- if (wait.get() != null && wait.get())
- {
- try
- {
- goSignal.await();
- }
- catch (InterruptedException e)
- {
- Thread.currentThread().interrupt();
- }
- }
- }
-
- public void delete(NodeData data) throws RepositoryException, UnsupportedOperationException,
- InvalidItemStateException, IllegalStateException
- {
- this.itemDeleted = true;
- }
-
- public void delete(PropertyData data) throws RepositoryException, UnsupportedOperationException,
- InvalidItemStateException, IllegalStateException
- {
- this.itemDeleted = true;
- }
-
- public int getChildNodesCount(NodeData parent) throws RepositoryException
- {
- return -1;
- }
-
- public List<NodeData> getChildNodesData(NodeData parent) throws RepositoryException, IllegalStateException
- {
- if (wait.get() != null && wait.get())
- {
- try
- {
- goSignal.await();
- }
- catch (InterruptedException e)
- {
- Thread.currentThread().interrupt();
- }
- }
- List<NodeData> children = new ArrayList<NodeData>();
- if (!canModify || !itemDeleted)
- {
- children.add(new PersistedNodeData("id-node2" + parentNode.getIdentifier(), QPath.makeChildPath(parent.getQPath(), new InternalQName(null, "node2")), parent.getIdentifier(), 1, 0,
- Constants.NT_UNSTRUCTURED, new InternalQName[0], null));
- }
- if (canModify && itemAdded != null)
- {
- children.add((NodeData)itemAdded);
- }
- return children;
- }
-
- public List<PropertyData> getChildPropertiesData(NodeData parent) throws RepositoryException,
- IllegalStateException
- {
- if (wait.get() != null && wait.get())
- {
- try
- {
- goSignal.await();
- }
- catch (InterruptedException e)
- {
- Thread.currentThread().interrupt();
- }
- }
- List<PropertyData> children = new ArrayList<PropertyData>();
- try
- {
- if (!canModify || !itemDeleted)
- {
- children.add(new PersistedPropertyData("id-property2" + parentNode.getIdentifier(), QPath.makeChildPath(
- parentNode.getQPath(), new InternalQName(null, "property2")), parentNode.getIdentifier(), 0,
- PropertyType.STRING, false, Arrays.asList((ValueData)new ByteArrayPersistedValueData(0, "some data".getBytes("UTF-8")))));
- }
- if (canModify && itemAdded != null)
- {
- children.add((PropertyData)itemAdded);
- }
- }
- catch (UnsupportedEncodingException e)
- {
- e.printStackTrace();
- }
- return children;
- }
-
- public List<PropertyData> getChildPropertiesData(NodeData parent, List<QPathEntryFilter> pattern) throws RepositoryException,
- IllegalStateException
- {
- if (wait.get() != null && wait.get())
- {
- try
- {
- goSignal.await();
- }
- catch (InterruptedException e)
- {
- Thread.currentThread().interrupt();
- }
- }
- List<PropertyData> children = new ArrayList<PropertyData>();
- try
- {
- if (!canModify || !itemDeleted)
- {
- children.add(new PersistedPropertyData("id-property2" + parentNode.getIdentifier(), QPath.makeChildPath(
- parentNode.getQPath(), new InternalQName(null, "my-property2")), parentNode.getIdentifier(), 0,
- PropertyType.STRING, false, Arrays.asList((ValueData)new ByteArrayPersistedValueData(0, "some data".getBytes("UTF-8")))));
- }
- if (canModify && itemAdded != null)
- {
- children.add((PropertyData)itemAdded);
- }
- }
- catch (UnsupportedEncodingException e)
- {
- e.printStackTrace();
- }
- return children;
- }
-
- /**
- * {@inheritDoc}
- */
- 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
- {
- if (wait.get() != null && wait.get())
- {
- try
- {
- goSignal.await();
- }
- catch (InterruptedException e)
- {
- Thread.currentThread().interrupt();
- }
- }
- if (itemType == ItemType.NODE)
- {
- return new PersistedNodeData("my-node" + parentNode.getIdentifier(), QPath.makeChildPath(parentNode.getQPath(), name), Constants.ROOT_UUID, 1, 1,
- Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
- }
- try
- {
- return new PersistedPropertyData("property-by-path"
- + parentNode.getIdentifier(), QPath.makeChildPath(parentNode.getQPath(), name), parentNode
- .getIdentifier(), 1, PropertyType.STRING, false, Arrays
- .asList((ValueData)new ByteArrayPersistedValueData(0, "some new data".getBytes("UTF-8"))));
- }
- catch (UnsupportedEncodingException e)
- {
- e.printStackTrace();
- }
- return null;
- }
-
- public ItemData getItemData(String identifier) throws RepositoryException, IllegalStateException
- {
- if (wait.get() != null && wait.get())
- {
- try
- {
- goSignal.await();
- }
- catch (InterruptedException e)
- {
- Thread.currentThread().interrupt();
- }
- }
- return parentNode;
- }
-
- public List<PropertyData> getReferencesData(String nodeIdentifier) throws RepositoryException,
- IllegalStateException, UnsupportedOperationException
- {
- if (wait.get() != null && wait.get())
- {
- try
- {
- goSignal.await();
- }
- catch (InterruptedException e)
- {
- Thread.currentThread().interrupt();
- }
- }
- List<PropertyData> children = new ArrayList<PropertyData>();
- try
- {
- if (!canModify || !itemDeleted)
- {
- children.add(new PersistedPropertyData("id-reference2" + parentNode.getIdentifier(), QPath.makeChildPath(
- parentNode.getQPath(), new InternalQName(null, "reference2")), parentNode.getIdentifier(), 0,
- PropertyType.REFERENCE, false, Arrays.asList((ValueData)new ByteArrayPersistedValueData(0, parentNode.getIdentifier().getBytes("UTF-8")))));
- }
- if (canModify && itemAdded != null)
- {
- children.add((PropertyData)itemAdded);
- }
- }
- catch (UnsupportedEncodingException e)
- {
- e.printStackTrace();
- }
- return children;
- }
-
- public boolean isOpened()
- {
- return true;
- }
-
- public List<PropertyData> listChildPropertiesData(NodeData parent) throws RepositoryException,
- IllegalStateException
- {
- return null;
- }
-
- public void rename(NodeData data) throws RepositoryException, UnsupportedOperationException,
- InvalidItemStateException, IllegalStateException
- {
- }
-
- public void rollback() throws IllegalStateException, RepositoryException
- {
- }
-
- public void update(NodeData data) throws RepositoryException, UnsupportedOperationException,
- InvalidItemStateException, IllegalStateException
- {
- }
-
- public void update(PropertyData data) throws RepositoryException, UnsupportedOperationException,
- InvalidItemStateException, IllegalStateException
- {
- }
-
- /**
- * @see org.exoplatform.services.jcr.storage.WorkspaceStorageConnection#getLastOrderNumber(org.exoplatform.services.jcr.datamodel.NodeData)
- */
- public int getLastOrderNumber(NodeData parent) throws RepositoryException
- {
- return 0;
- }
-
- public List<NodeData> getChildNodesData(NodeData parent, List<QPathEntryFilter> pattern) throws RepositoryException,
- IllegalStateException
- {
- if (wait.get() != null && wait.get())
- {
- try
- {
- goSignal.await();
- }
- catch (InterruptedException e)
- {
- Thread.currentThread().interrupt();
- }
- }
- List<NodeData> children = new ArrayList<NodeData>();
- if (!canModify || !itemDeleted)
- {
- children.add(new PersistedNodeData("my-node" + parent.getIdentifier(), QPath.makeChildPath(parent.getQPath(), new QName("","my-node"), 1), parent.getIdentifier(), 1, 1,
- Constants.NT_UNSTRUCTURED, new InternalQName[0], null));
- }
- if (canModify && itemAdded != null)
- {
- children.add((NodeData)itemAdded);
- }
-
- return children;
- }
-
-
- };
-
- private static class MyWorkspaceDataContainer extends WorkspaceDataContainerBase
- {
-
- private WorkspaceStorageConnection con;
-
- public MyWorkspaceDataContainer(WorkspaceStorageConnection con)
- {
- this.con = con;
- }
-
- public boolean isCheckSNSNewConnection()
- {
- return false;
- }
-
- public boolean isSame(WorkspaceDataContainer another)
- {
- return false;
- }
-
- public WorkspaceStorageConnection openConnection() throws RepositoryException
- {
- return con;
- }
-
- public WorkspaceStorageConnection openConnection(boolean readOnly) throws RepositoryException
- {
- return con;
- }
-
- public WorkspaceStorageConnection reuseConnection(WorkspaceStorageConnection original) throws RepositoryException
- {
- return con;
- }
-
- public String getInfo()
- {
- return "MyWorkspaceDataContainer";
- }
-
- public String getName()
- {
- return "MyWorkspaceDataContainer";
- }
-
- public String getStorageVersion()
- {
- return "0";
- }
-
- /**
- * @see org.exoplatform.services.jcr.storage.DataContainer#getUniqueName()
- */
- public String getUniqueName()
- {
- return "MyWorkspaceDataContainer";
- }
- };
-}
12 years, 8 months
exo-jcr SVN: r4827 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-09-01 09:04:42 -0400 (Thu, 01 Sep 2011)
New Revision: 4827
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2MultiDbJDBCConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2SingleDbJDBCConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MSSQLMultiDbJDBCConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MSSQLSingleDbJDBCConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MultiDbJDBCConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MySQLMultiDbJDBCConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MySQLSingleDbJDBCConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/OracleMultiDbJDBCConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/OracleSingleDbJDBCConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SingleDbJDBCConnection.java
Log:
EXOJCR-1195: Improve reindexing mechanism for RDBMS
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2MultiDbJDBCConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2MultiDbJDBCConnection.java 2011-09-01 10:58:59 UTC (rev 4826)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2MultiDbJDBCConnection.java 2011-09-01 13:04:42 UTC (rev 4827)
@@ -75,7 +75,7 @@
+ " join (select A.* from"
+ " (select Row_Number() over (order by I.ID) as r__, I.ID, I.PARENT_ID, I.NAME, I.VERSION, I.I_INDEX, I.N_ORDER_NUM"
+ " from JCR_MITEM I where I.I_CLASS=1) as A where A.r__ <= ? and A.r__ > ?) J on P.PARENT_ID = J.ID"
- + " where P.I_CLASS=2 and V.PROPERTY_ID=P.ID order by J.ID";
+ + " where P.I_CLASS=2 and V.PROPERTY_ID=P.ID order by ID";
}
/**
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2SingleDbJDBCConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2SingleDbJDBCConnection.java 2011-09-01 10:58:59 UTC (rev 4826)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2SingleDbJDBCConnection.java 2011-09-01 13:04:42 UTC (rev 4827)
@@ -76,7 +76,7 @@
+ " (select Row_Number() over (order by I.ID) as r__, I.ID, I.PARENT_ID, I.NAME, I.VERSION, I.I_INDEX, I.N_ORDER_NUM"
+ " from JCR_SITEM I where I.CONTAINER_NAME=? and I.I_CLASS=1) as A where A.r__ <= ? and A.r__ > ?"
+ ") J on P.PARENT_ID = J.ID"
- + " where P.I_CLASS=2 and P.CONTAINER_NAME=? and V.PROPERTY_ID=P.ID order by J.ID";
+ + " where P.I_CLASS=2 and P.CONTAINER_NAME=? and V.PROPERTY_ID=P.ID order by ID";
}
/**
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MSSQLMultiDbJDBCConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MSSQLMultiDbJDBCConnection.java 2011-09-01 10:58:59 UTC (rev 4826)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MSSQLMultiDbJDBCConnection.java 2011-09-01 13:04:42 UTC (rev 4827)
@@ -73,7 +73,7 @@
+ " join (select A.* from"
+ " (select Row_Number() over (order by I.ID) as r__, I.ID, I.PARENT_ID, I.NAME, I.VERSION, I.I_INDEX, I.N_ORDER_NUM"
+ " from JCR_MITEM I where I.I_CLASS=1) as A where A.r__ <= ? and A.r__ > ?) J on P.PARENT_ID = J.ID"
- + " where P.I_CLASS=2 and V.PROPERTY_ID=P.ID order by J.ID";
+ + " where P.I_CLASS=2 and V.PROPERTY_ID=P.ID order by ID";
}
/**
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MSSQLSingleDbJDBCConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MSSQLSingleDbJDBCConnection.java 2011-09-01 10:58:59 UTC (rev 4826)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MSSQLSingleDbJDBCConnection.java 2011-09-01 13:04:42 UTC (rev 4827)
@@ -76,7 +76,7 @@
+ " (select Row_Number() over (order by I.ID) as r__, I.ID, I.PARENT_ID, I.NAME, I.VERSION, I.I_INDEX, I.N_ORDER_NUM"
+ " from JCR_SITEM I where I.CONTAINER_NAME=? and I.I_CLASS=1) as A where A.r__ <= ? and A.r__ > ?"
+ " ) J on P.PARENT_ID = J.ID"
- + " where P.I_CLASS=2 and P.CONTAINER_NAME=? and V.PROPERTY_ID=P.ID order by J.ID";
+ + " where P.I_CLASS=2 and P.CONTAINER_NAME=? and V.PROPERTY_ID=P.ID order by ID";
}
/**
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MultiDbJDBCConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MultiDbJDBCConnection.java 2011-09-01 10:58:59 UTC (rev 4826)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MultiDbJDBCConnection.java 2011-09-01 13:04:42 UTC (rev 4827)
@@ -202,7 +202,7 @@
+ " V.DATA, V.ORDER_NUM, V.STORAGE_DESC from JCR_MVALUE V, JCR_MITEM P"
+ " join (select I.ID, I.PARENT_ID, I.NAME, I.VERSION, I.I_INDEX, I.N_ORDER_NUM from JCR_MITEM I"
+ " where I.I_CLASS=1 AND I.ID > ? order by I.ID LIMIT ? OFFSET ?) J on P.PARENT_ID = J.ID"
- + " where P.I_CLASS=2 and V.PROPERTY_ID=P.ID order by J.ID";
+ + " where P.I_CLASS=2 and V.PROPERTY_ID=P.ID order by ID";
FIND_PROPERTY_BY_ID =
"select I.P_TYPE, V.STORAGE_DESC from JCR_MITEM I, JCR_MVALUE V where I.ID = ? and V.PROPERTY_ID = I.ID";
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MySQLMultiDbJDBCConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MySQLMultiDbJDBCConnection.java 2011-09-01 10:58:59 UTC (rev 4826)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MySQLMultiDbJDBCConnection.java 2011-09-01 13:04:42 UTC (rev 4827)
@@ -83,7 +83,7 @@
+ " V.DATA, V.ORDER_NUM, V.STORAGE_DESC from JCR_MVALUE V, JCR_MITEM P"
+ " join (select I.ID, I.PARENT_ID, I.NAME, I.VERSION, I.I_INDEX, I.N_ORDER_NUM from JCR_MITEM I force index(PRIMARY)"
+ " where I.I_CLASS=1 AND I.ID > ? order by I.ID LIMIT ? OFFSET ?) J on P.PARENT_ID = J.ID"
- + " where P.I_CLASS=2 and V.PROPERTY_ID=P.ID order by J.ID";
+ + " where P.I_CLASS=2 and V.PROPERTY_ID=P.ID order by ID";
}
/**
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MySQLSingleDbJDBCConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MySQLSingleDbJDBCConnection.java 2011-09-01 10:58:59 UTC (rev 4826)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MySQLSingleDbJDBCConnection.java 2011-09-01 13:04:42 UTC (rev 4827)
@@ -83,7 +83,7 @@
+ " V.DATA, V.ORDER_NUM, V.STORAGE_DESC from JCR_SVALUE V, JCR_SITEM P"
+ " join (select I.ID, I.PARENT_ID, I.NAME, I.VERSION, I.I_INDEX, I.N_ORDER_NUM from JCR_SITEM I force index(PRIMARY)"
+ " where I.CONTAINER_NAME=? AND I.I_CLASS=1 AND I.ID > ? order by I.ID LIMIT ? OFFSET ?) J on P.PARENT_ID = J.ID"
- + " where P.I_CLASS=2 and P.CONTAINER_NAME=? and V.PROPERTY_ID=P.ID order by J.ID";
+ + " where P.I_CLASS=2 and P.CONTAINER_NAME=? and V.PROPERTY_ID=P.ID order by ID";
}
/**
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/OracleMultiDbJDBCConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/OracleMultiDbJDBCConnection.java 2011-09-01 10:58:59 UTC (rev 4826)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/OracleMultiDbJDBCConnection.java 2011-09-01 13:04:42 UTC (rev 4827)
@@ -96,7 +96,7 @@
+ " join ( select * from ( select A.*, ROWNUM r__ from ("
+ " select I.ID, I.PARENT_ID, I.NAME, I.VERSION, I.I_INDEX, I.N_ORDER_NUM from JCR_MITEM I "
+ " where I.I_CLASS=1 order by I.ID) A where ROWNUM <= ?) where r__ > ?) J on P.PARENT_ID = J.ID"
- + " where P.I_CLASS=2 and V.PROPERTY_ID=P.ID order by J.ID";
+ + " where P.I_CLASS=2 and V.PROPERTY_ID=P.ID order by ID";
}
/**
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/OracleSingleDbJDBCConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/OracleSingleDbJDBCConnection.java 2011-09-01 10:58:59 UTC (rev 4826)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/OracleSingleDbJDBCConnection.java 2011-09-01 13:04:42 UTC (rev 4827)
@@ -97,7 +97,7 @@
+ " select I.ID, I.PARENT_ID, I.NAME, I.VERSION, I.I_INDEX, I.N_ORDER_NUM from JCR_SITEM I "
+ " where I.CONTAINER_NAME=? and I.I_CLASS=1 order by I.ID"
+ " ) A where ROWNUM <= ?) where r__ > ?) J on P.PARENT_ID = J.ID"
- + " where P.I_CLASS=2 and P.CONTAINER_NAME=? and V.PROPERTY_ID=P.ID order by J.ID";
+ + " where P.I_CLASS=2 and P.CONTAINER_NAME=? and V.PROPERTY_ID=P.ID order by ID";
}
/**
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SingleDbJDBCConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SingleDbJDBCConnection.java 2011-09-01 10:58:59 UTC (rev 4826)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SingleDbJDBCConnection.java 2011-09-01 13:04:42 UTC (rev 4827)
@@ -206,7 +206,7 @@
+ " V.DATA, V.ORDER_NUM, V.STORAGE_DESC from JCR_SVALUE V, JCR_SITEM P"
+ " join (select I.ID, I.PARENT_ID, I.NAME, I.VERSION, I.I_INDEX, I.N_ORDER_NUM from JCR_SITEM I"
+ " where I.CONTAINER_NAME=? AND I.I_CLASS=1 AND I.ID > ? order by I.ID LIMIT ? OFFSET ?) J on P.PARENT_ID = J.ID"
- + " where P.I_CLASS=2 and P.CONTAINER_NAME=? and V.PROPERTY_ID=P.ID order by J.ID";
+ + " where P.I_CLASS=2 and P.CONTAINER_NAME=? and V.PROPERTY_ID=P.ID order by ID";
FIND_PROPERTY_BY_ID =
"select I.P_TYPE, V.STORAGE_DESC from JCR_SITEM I, JCR_SVALUE V where I.CONTAINER_NAME=? and I.ID = ? and V.PROPERTY_ID = I.ID";
12 years, 8 months
exo-jcr SVN: r4826 - core/trunk/packaging/module/src/main/javascript.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2011-09-01 06:58:59 -0400 (Thu, 01 Sep 2011)
New Revision: 4826
Modified:
core/trunk/packaging/module/src/main/javascript/core.packaging.module.js
Log:
EXOJCR-1500: Add Tika dependencies to Core packaging
Modified: core/trunk/packaging/module/src/main/javascript/core.packaging.module.js
===================================================================
--- core/trunk/packaging/module/src/main/javascript/core.packaging.module.js 2011-09-01 09:40:53 UTC (rev 4825)
+++ core/trunk/packaging/module/src/main/javascript/core.packaging.module.js 2011-09-01 10:58:59 UTC (rev 4826)
@@ -32,8 +32,13 @@
addDependency(new Project("org.apache.pdfbox", "pdfbox", "jar", "1.4.0")).
addDependency(new Project("org.apache.pdfbox", "fontbox", "jar", "1.4.0")).
addDependency(new Project("org.apache.pdfbox", "jempbox", "jar", "1.4.0")).
- addDependency(new Project("bouncycastle", "bcmail-jdk14", "jar", "136")).
- addDependency(new Project("bouncycastle", "bcprov-jdk14", "jar", "136")).
+ addDependency(new Project("bouncycastle", "bcmail-jdk15", "jar", "1.45")).
+ addDependency(new Project("bouncycastle", "bcprov-jdk15", "jar", "1.45")).
+ addDependency(new Project("org.apache.commons", "commons-compress", "jar", "1.0")).
+ addDependency(new Project("org.apache.geronimo.specs", "geronimo-stax-api_1.0_spec", "jar", "1.0.1")).
+ addDependency(new Project("org.ccil.cowan.tagsoup", "tagsoup", "jar", "1.2")).
+ addDependency(new Project("asm", "asm", "jar", "3.1")).
+ addDependency(new Project("com.drewnoakes", "metadata-extractor", "jar", "2.4.0-beta-1")).
addDependency(new Project("html-parser", "html-parser", "jar", "1.6")).
addDependency(new Project("org.apache.poi", "poi", "jar", "3.6")).
addDependency(new Project("org.apache.poi", "poi-scratchpad", "jar", "3.6")).
12 years, 8 months
exo-jcr SVN: r4825 - in jcr/trunk/exo.jcr.component.core/src: test/java/org/exoplatform/services/jcr/api/core/query and 1 other directories.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2011-09-01 05:40:53 -0400 (Thu, 01 Sep 2011)
New Revision: 4825
Added:
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/core/query/TestQueryMoveNode.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/usecases/query/TestQueryChilds.java
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/ChildAxisQuery.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/FieldNames.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/FieldSelectors.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexFormatVersion.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java
Log:
EXOJCR-1239: patch from JCR-1579 committed (node path stored in lucene index)
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/ChildAxisQuery.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/ChildAxisQuery.java 2011-09-01 09:31:23 UTC (rev 4824)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/ChildAxisQuery.java 2011-09-01 09:40:53 UTC (rev 4825)
@@ -721,59 +721,69 @@
//NodeId id = new NodeId(UUID.fromString(uuid));
try
{
- long time = 0;
- if (log.isDebugEnabled())
+ if (nameTest != null && version.getVersion() >= IndexFormatVersion.V4.getVersion())
{
- time = System.currentTimeMillis();
- }
- NodeData state = (NodeData)itemMgr.getItemData(uuid);
- if (log.isDebugEnabled())
- {
- time = System.currentTimeMillis() - time;
- log.debug("got NodeState with id {} in {} ms.", uuid, new Long(time));
- }
- Iterator<NodeData> entries;
- if (nameTest != null)
- {
- //NodeData childNodeData = (NodeData)itemMgr.getItemData(state, new QPathEntry(nameTest, 1));
- // //state.getChildNodeEntries(nameTest).iterator();
- List<NodeData> childs = itemMgr.getChildNodesData(state);
-
- List<NodeData> datas = new ArrayList<NodeData>();
- if (childs != null)
+ StringBuilder path = new StringBuilder(256);
+ path.append(uuid == null ? "" : uuid).append('/').append(nameTest.getAsString());
+ TermDocs docs = reader.termDocs(new Term(FieldNames.PATH, path.toString()));
+ try
{
- for (NodeData nodeData : childs)
+ while (docs.next())
{
- if (nameTest.equals(nodeData.getQPath().getName()))
- {
- datas.add(nodeData);
- }
+ childrenHits.set(docs.doc());
}
}
- entries = datas.iterator();//itemMgr.getChildNodesData(childNodeData).iterator();
+ finally
+ {
+ docs.close();
+ }
}
else
{
- // get all children
- entries = itemMgr.getChildNodesData(state).iterator();
- }
- while (entries.hasNext())
- {
- String childId = entries.next().getIdentifier();
- Term uuidTerm = new Term(FieldNames.UUID, childId);
- TermDocs docs = reader.termDocs(uuidTerm);
- try
+ long time = System.currentTimeMillis();
+ NodeData state = (NodeData)itemMgr.getItemData(uuid);
+ time = System.currentTimeMillis() - time;
+ log.debug("got NodeState with id {} in {} ms.", uuid, new Long(time));
+ Iterator<NodeData> entries;
+ if (nameTest != null)
{
- if (docs.next())
+ //NodeData childNodeData = (NodeData)itemMgr.getItemData(state, new QPathEntry(nameTest, 1));//state.getChildNodeEntries(nameTest).iterator();
+ List<NodeData> childs = itemMgr.getChildNodesData(state);
+
+ List<NodeData> datas = new ArrayList<NodeData>();
+ if (childs != null)
{
- childrenHits.set(docs.doc());
+ for (NodeData nodeData : childs)
+ {
+ if (nameTest.equals(nodeData.getQPath().getName()))
+ datas.add(nodeData);
+ }
}
+ entries = datas.iterator();//itemMgr.getChildNodesData(childNodeData).iterator();
}
- finally
+ else
{
- docs.close();
+ // get all children
+ entries = itemMgr.getChildNodesData(state).iterator();
}
+ while (entries.hasNext())
+ {
+ String childId = entries.next().getIdentifier();
+ Term uuidTerm = new Term(FieldNames.UUID, childId);
+ TermDocs docs = reader.termDocs(uuidTerm);
+ try
+ {
+ if (docs.next())
+ {
+ childrenHits.set(docs.doc());
+ }
+ }
+ finally
+ {
+ docs.close();
+ }
+ }
}
}
catch (RepositoryException e)
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/FieldNames.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/FieldNames.java 2011-09-01 09:31:23 UTC (rev 4824)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/FieldNames.java 2011-09-01 09:40:53 UTC (rev 4825)
@@ -69,6 +69,11 @@
public static final String INDEX = "_:INDEX".intern();
/**
+ * Name of the field that contains the relative path of the item.
+ */
+ public static final String PATH = "_:PATH".intern();
+
+ /**
* Name of the field that contains the namespace URI of the node name. Terms
* are not tokenized.
*/
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/FieldSelectors.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/FieldSelectors.java 2011-09-01 09:31:23 UTC (rev 4824)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/FieldSelectors.java 2011-09-01 09:40:53 UTC (rev 4825)
@@ -84,4 +84,20 @@
}
}
};
+
+ public static final FieldSelector PATH = new FieldSelector() {
+ /**
+ * Accepts {@link FieldNames#PATH}.
+ *
+ * @param fieldName the field name to check.
+ * @return result.
+ */
+ public FieldSelectorResult accept(String fieldName) {
+ if (FieldNames.PATH == fieldName) {
+ return FieldSelectorResult.LOAD;
+ } else {
+ return FieldSelectorResult.NO_LOAD;
+ }
+ }
+ };
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexFormatVersion.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexFormatVersion.java 2011-09-01 09:31:23 UTC (rev 4824)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexFormatVersion.java 2011-09-01 09:40:53 UTC (rev 4825)
@@ -109,7 +109,7 @@
public static IndexFormatVersion getVersion(IndexReader indexReader) {
Collection fields = indexReader.getFieldNames(
IndexReader.FieldOption.ALL);
- if (fields.contains(FieldNames.INDEX) || indexReader.numDocs() == 0) {
+ if ((fields.contains(FieldNames.INDEX) && fields.contains(FieldNames.PATH))|| indexReader.numDocs() == 0) {
return IndexFormatVersion.V4;
} else if (fields.contains(FieldNames.LOCAL_NAME)) {
return IndexFormatVersion.V3;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java 2011-09-01 09:31:23 UTC (rev 4824)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java 2011-09-01 09:40:53 UTC (rev 4825)
@@ -221,6 +221,11 @@
{
doc.add(new Field(FieldNames.INDEX, Integer.toString(node.getQPath().getIndex()), Field.Store.YES,
Field.Index.NOT_ANALYZED_NO_NORMS));
+
+ StringBuilder path = new StringBuilder(256);
+ path.append(node.getParentIdentifier() == null ? "" : node.getParentIdentifier()).append('/')
+ .append(node.getQPath().getName().getAsString());
+ doc.add(new Field(FieldNames.PATH, path.toString(), Field.Store.NO, Field.Index.NOT_ANALYZED_NO_NORMS));
}
Collection<PropertyData> props = node.getChildPropertiesData();
Added: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/core/query/TestQueryMoveNode.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/core/query/TestQueryMoveNode.java (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/core/query/TestQueryMoveNode.java 2011-09-01 09:40:53 UTC (rev 4825)
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2003-2011 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.services.jcr.api.core.query;
+
+import org.exoplatform.services.jcr.usecases.BaseUsecasesTest;
+
+import javax.jcr.Node;
+import javax.jcr.NodeIterator;
+import javax.jcr.query.Query;
+import javax.jcr.query.QueryManager;
+import javax.jcr.query.QueryResult;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * <br/>Date:
+ *
+ * @author <a href="karpenko.sergiy(a)gmail.com">Karpenko Sergiy</a>
+ * @version $Id: TestQueryMoveNode.java 111 2011-28-01 11:11:11Z serg $
+ */
+public class TestQueryMoveNode extends BaseUsecasesTest
+{
+
+ public void testReordering() throws Exception
+ {
+ Node testRoot = this.root.addNode("testSameNameSiblingDelete");
+
+ Node subNode_1 = testRoot.addNode("node", "nt:unstructured"); // 1
+ subNode_1.addMixin("mix:referenceable");
+ session.save();
+
+ //check the index
+ String sqlQuery;
+ Query query;
+ QueryResult queryResult;
+ NodeIterator iterator;
+ Node node;
+ QueryManager qm = session.getWorkspace().getQueryManager();
+
+ sqlQuery = "SELECT * FROM nt:unstructured WHERE jcr:path = '/testSameNameSiblingDelete/node[1]'";
+ query = qm.createQuery(sqlQuery, Query.SQL);
+ queryResult = query.execute();
+ iterator = queryResult.getNodes();
+ assertTrue("Node expected ", iterator.getSize() == 1);
+ node = iterator.nextNode();
+ assertEquals("Wrong id ", subNode_1.getUUID(), node.getUUID());
+ assertEquals("Wrong path ", subNode_1.getPath(), node.getPath());
+
+ // move
+ testRoot.addNode("folder");
+ session.save();
+ session.move("/testSameNameSiblingDelete/node", "/testSameNameSiblingDelete/folder/node");
+ session.save();
+
+ sqlQuery = "SELECT * FROM nt:unstructured WHERE jcr:path = '/testSameNameSiblingDelete/node[1]'";
+ query = qm.createQuery(sqlQuery, Query.SQL);
+ queryResult = query.execute();
+ iterator = queryResult.getNodes();
+ assertTrue("There must be no node ", iterator.getSize() == 0);
+
+ sqlQuery = "SELECT * FROM nt:unstructured WHERE jcr:path = '/testSameNameSiblingDelete/folder/node[1]'";
+ query = qm.createQuery(sqlQuery, Query.SQL);
+ queryResult = query.execute();
+ iterator = queryResult.getNodes();
+ assertTrue("Node expected ", iterator.getSize() == 1);
+ node = iterator.nextNode();
+ assertEquals("Wrong id ", subNode_1.getUUID(), node.getUUID());
+ assertEquals("Wrong path ", subNode_1.getPath(), node.getPath());
+ }
+
+}
Added: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/usecases/query/TestQueryChilds.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/usecases/query/TestQueryChilds.java (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/usecases/query/TestQueryChilds.java 2011-09-01 09:40:53 UTC (rev 4825)
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.services.jcr.usecases.query;
+
+import org.exoplatform.services.jcr.usecases.BaseUsecasesTest;
+
+import javax.jcr.Node;
+import javax.jcr.NodeIterator;
+import javax.jcr.query.Query;
+import javax.jcr.query.QueryManager;
+import javax.jcr.query.QueryResult;
+
+/**
+ * @author <a href="mailto:skarpenko@exoplatform.com">Sergiy Karpenko</a>
+ * @version $Id: exo-jboss-codetemplates.xml 34360 16 ????. 2011 skarpenko $
+ *
+ */
+public class TestQueryChilds extends BaseUsecasesTest
+{
+ public void testGetChilds() throws Exception
+ {
+ Node testRoot = this.root.addNode("testSameNameSiblingDelete");
+
+ Node subNode_1 = testRoot.addNode("node", "nt:unstructured"); // 1
+ Node subNode_1_1 = subNode_1.addNode("node1", "nt:unstructured");
+ Node subNode_1_2 = subNode_1.addNode("node2", "nt:unstructured");
+ Node subNode_1_1_1 = subNode_1_1.addNode("node11", "nt:unstructured");
+ //Node subNode_1_1_2 = subNode_1_1.addNode("node12", "nt:unstructured");
+ Node subNode_2 = testRoot.addNode("node", "nt:unstructured"); // 2
+ Node subNode_2_1 = subNode_2.addNode("node3", "nt:unstructured");
+ Node subNode_2_2 = subNode_2.addNode("node4", "nt:unstructured");
+
+ session.save();
+
+ //check the index
+ String sqlQuery;
+ Query query;
+ QueryResult queryResult;
+ NodeIterator iterator;
+ Node node;
+ QueryManager qm = session.getWorkspace().getQueryManager();
+
+ sqlQuery = "SELECT * FROM nt:unstructured WHERE jcr:path LIKE '/testSameNameSiblingDelete/node/%'";
+ query = qm.createQuery(sqlQuery, Query.SQL);
+ queryResult = query.execute();
+ iterator = queryResult.getNodes();
+ assertTrue("Node expected ", iterator.getSize() == 3);
+ // node = iterator.nextNode();
+ // assertEquals("Wrong id ", subNode_1.getUUID(), node.getUUID());
+ // assertEquals("Wrong path ", subNode_1.getPath(), node.getPath());
+ testNames(iterator, new String[]{"node1", "node2", "node11"}); //, "node3", "node4"
+
+ // // move
+ // testRoot.addNode("folder");
+ // session.save();
+ // session.move("/testSameNameSiblingDelete/node", "/testSameNameSiblingDelete/folder/node");
+ // session.save();
+ //
+ // sqlQuery = "SELECT * FROM nt:unstructured WHERE jcr:path = '/testSameNameSiblingDelete/node[1]'";
+ // query = qm.createQuery(sqlQuery, Query.SQL);
+ // queryResult = query.execute();
+ // iterator = queryResult.getNodes();
+ // assertTrue("There must be no node ", iterator.getSize() == 0);
+ //
+ // sqlQuery = "SELECT * FROM nt:unstructured WHERE jcr:path = '/testSameNameSiblingDelete/folder/node[1]'";
+ // query = qm.createQuery(sqlQuery, Query.SQL);
+ // queryResult = query.execute();
+ // iterator = queryResult.getNodes();
+ // assertTrue("Node expected ", iterator.getSize() == 1);
+ // node = iterator.nextNode();
+ // assertEquals("Wrong id ", subNode_1.getUUID(), node.getUUID());
+ // assertEquals("Wrong path ", subNode_1.getPath(), node.getPath());
+ }
+
+}
12 years, 8 months
exo-jcr SVN: r4824 - in jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc: optimisation and 1 other directories.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-09-01 05:31:23 -0400 (Thu, 01 Sep 2011)
New Revision: 4824
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCStorageConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MultiDbJDBCConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SingleDbJDBCConnection.java
Log:
EXOJCR-1482: revert changes
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java 2011-09-01 07:12:32 UTC (rev 4823)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java 2011-09-01 09:31:23 UTC (rev 4824)
@@ -166,6 +166,8 @@
protected PreparedStatement findPropertiesByParentId;
+ protected PreparedStatement insertItem;
+
protected PreparedStatement insertNode;
protected PreparedStatement insertProperty;
@@ -174,11 +176,20 @@
protected PreparedStatement insertValue;
+ protected PreparedStatement updateItem;
+
+ protected PreparedStatement updateItemPath;
+
protected PreparedStatement updateNode;
protected PreparedStatement updateProperty;
protected PreparedStatement deleteItem;
+
+ protected PreparedStatement deleteNode;
+
+ protected PreparedStatement deleteProperty;
+
protected PreparedStatement deleteReference;
protected PreparedStatement deleteValue;
@@ -475,6 +486,11 @@
findPropertiesByParentId.close();
}
+ if (insertItem != null)
+ {
+ insertItem.close();
+ }
+
if (insertNode != null)
{
insertNode.close();
@@ -495,6 +511,16 @@
insertValue.close();
}
+ if (updateItem != null)
+ {
+ updateItem.close();
+ }
+
+ if (updateItemPath != null)
+ {
+ updateItemPath.close();
+ }
+
if (updateNode != null)
{
updateNode.close();
@@ -510,6 +536,16 @@
deleteItem.close();
}
+ if (deleteNode != null)
+ {
+ deleteNode.close();
+ }
+
+ if (deleteProperty != null)
+ {
+ deleteProperty.close();
+ }
+
if (deleteReference != null)
{
deleteReference.close();
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCStorageConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCStorageConnection.java 2011-09-01 07:12:32 UTC (rev 4823)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCStorageConnection.java 2011-09-01 09:31:23 UTC (rev 4824)
@@ -153,8 +153,6 @@
protected Statement findNodesByParentIdAndComplexPatternCQ;
- protected final boolean allowBatching;
-
/**
* JDBCStorageConnection constructor.
*
@@ -178,7 +176,6 @@
throws SQLException
{
super(dbConnection, readOnly, containerName, valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
- this.allowBatching = dbConnection.getMetaData().supportsBatchUpdates();
}
/**
@@ -508,7 +505,7 @@
{
List<ValueData> vdata = data.getValues();
- for (int i = 0, length = vdata.size(); i < length; i++)
+ for (int i = 0; i < vdata.size(); i++)
{
ValueData vd = vdata.get(i);
ValueIOChannel channel = valueStorageProvider.getApplicableChannel(data, i);
@@ -564,11 +561,11 @@
}
if (i < totalOldValues)
{
- updateValueData(cid, i, stream, streamLength, storageId, i == length - 1 || i == totalOldValues - 1);
+ updateValueData(cid, i, stream, streamLength, storageId);
}
else
{
- addValueData(cid, i, stream, streamLength, storageId, i == length - 1);
+ addValueData(cid, i, stream, streamLength, storageId);
}
}
}
@@ -1243,9 +1240,6 @@
protected abstract int deleteValueDataByOrderNum(String id, int orderNum) throws SQLException;
- protected abstract int updateValueData(String cid, int i, InputStream stream, int streamLength, String storageId,
- boolean lastValue) throws SQLException;
-
- protected abstract int addValueData(String cid, int orderNumber, InputStream stream, int streamLength,
- String storageId, boolean lastValue) throws SQLException;
+ protected abstract int updateValueData(String cid, int i, InputStream stream, int streamLength, String storageId)
+ throws SQLException;
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MultiDbJDBCConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MultiDbJDBCConnection.java 2011-09-01 07:12:32 UTC (rev 4823)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MultiDbJDBCConnection.java 2011-09-01 09:31:23 UTC (rev 4824)
@@ -667,17 +667,6 @@
protected int addValueData(String cid, int orderNumber, InputStream stream, int streamLength, String storageDesc)
throws SQLException
{
- throw new UnsupportedOperationException("This method is not supported, use the mehod of the same name with lastValue");
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected int addValueData(String cid, int orderNumber, InputStream stream, int streamLength, String storageDesc,
- boolean lastValue) throws SQLException
- {
-
if (insertValue == null)
{
insertValue = dbConnection.prepareStatement(INSERT_VALUE);
@@ -701,15 +690,6 @@
insertValue.setInt(2, orderNumber);
insertValue.setString(3, cid);
- if (allowBatching)
- {
- insertValue.addBatch();
- if (lastValue)
- {
- insertValue.executeBatch();
- }
- return 1;
- }
return insertValue.executeUpdate();
}
@@ -905,8 +885,8 @@
return findPropertyById.executeQuery();
}
- protected int updateValueData(String cid, int orderNumber, InputStream stream, int streamLength, String storageDesc,
- boolean lastValue) throws SQLException
+ protected int updateValueData(String cid, int orderNumber, InputStream stream, int streamLength, String storageDesc)
+ throws SQLException
{
if (updateValue == null)
@@ -932,15 +912,6 @@
updateValue.setString(3, cid);
updateValue.setInt(4, orderNumber);
- if (allowBatching)
- {
- updateValue.addBatch();
- if (lastValue)
- {
- updateValue.executeBatch();
- }
- return 1;
- }
return updateValue.executeUpdate();
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SingleDbJDBCConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SingleDbJDBCConnection.java 2011-09-01 07:12:32 UTC (rev 4823)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SingleDbJDBCConnection.java 2011-09-01 09:31:23 UTC (rev 4824)
@@ -520,17 +520,6 @@
protected int addValueData(String cid, int orderNumber, InputStream stream, int streamLength, String storageDesc)
throws SQLException
{
- throw new UnsupportedOperationException("This method is not supported, use the mehod of the same name with lastValue");
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected int addValueData(String cid, int orderNumber, InputStream stream, int streamLength, String storageDesc,
- boolean lastValue) throws SQLException
- {
-
if (insertValue == null)
insertValue = dbConnection.prepareStatement(INSERT_VALUE);
else
@@ -550,15 +539,6 @@
insertValue.setInt(2, orderNumber);
insertValue.setString(3, cid);
- if (allowBatching)
- {
- insertValue.addBatch();
- if (lastValue)
- {
- insertValue.executeBatch();
- }
- return 1;
- }
return insertValue.executeUpdate();
}
@@ -844,8 +824,8 @@
}
@Override
- protected int updateValueData(String cid, int orderNumber, InputStream stream, int streamLength, String storageDesc,
- boolean lastValue) throws SQLException
+ protected int updateValueData(String cid, int orderNumber, InputStream stream, int streamLength, String storageDesc)
+ throws SQLException
{
if (updateValue == null)
@@ -867,15 +847,6 @@
updateValue.setString(3, cid);
updateValue.setInt(4, orderNumber);
- if (allowBatching)
- {
- updateValue.addBatch();
- if (lastValue)
- {
- updateValue.executeBatch();
- }
- return 1;
- }
return updateValue.executeUpdate();
}
12 years, 8 months
exo-jcr SVN: r4823 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2011-09-01 03:12:32 -0400 (Thu, 01 Sep 2011)
New Revision: 4823
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/ChildAxisQuery.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/FieldNames.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/FieldSelectors.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexFormatVersion.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java
Log:
EXOJCR-1239: patch from JCR-1571 committed (node index stored in lucene index)
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/ChildAxisQuery.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/ChildAxisQuery.java 2011-09-01 06:42:18 UTC (rev 4822)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/ChildAxisQuery.java 2011-09-01 07:12:32 UTC (rev 4823)
@@ -538,15 +538,14 @@
{
if (position != LocationStepQueryNode.NONE)
{
- Document node = reader.document(i, FieldSelectors.UUID_AND_PARENT);
+ Document node = reader.document(i, FieldSelectors.UUID_AND_PARENT_AND_INDEX);
String parentId = node.get(FieldNames.PARENT);
String id = node.get(FieldNames.UUID);
try
{
- //NodeState state = (NodeState) itemMgr.getItemState(parentId);
- NodeData state = (NodeData)itemMgr.getItemData(parentId);
if (nameTest == null)
{
+ NodeData state = (NodeData)itemMgr.getItemData(parentId);
// only select this node if it is the child at
// specified position
if (position == LocationStepQueryNode.LAST)
@@ -574,6 +573,7 @@
// specified position
if (position == LocationStepQueryNode.LAST)
{
+ NodeData state = (NodeData)itemMgr.getItemData(parentId);
// only select last
if (state == null)
@@ -591,6 +591,11 @@
}
}
}
+ else if (version.getVersion() >= IndexFormatVersion.V4.getVersion())
+ {
+ if (Integer.valueOf(node.get(FieldNames.INDEX)) != position)
+ return false;
+ }
else
{
NodeData nodeData = (NodeData)itemMgr.getItemData(id);
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/FieldNames.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/FieldNames.java 2011-09-01 06:42:18 UTC (rev 4822)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/FieldNames.java 2011-09-01 07:12:32 UTC (rev 4823)
@@ -64,6 +64,11 @@
public static final String LOCAL_NAME = "_:LOCAL_NAME".intern();
/**
+ * Name of the field that contains the index of the item.
+ */
+ public static final String INDEX = "_:INDEX".intern();
+
+ /**
* Name of the field that contains the namespace URI of the node name. Terms
* are not tokenized.
*/
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/FieldSelectors.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/FieldSelectors.java 2011-09-01 06:42:18 UTC (rev 4822)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/FieldSelectors.java 2011-09-01 07:12:32 UTC (rev 4823)
@@ -63,4 +63,25 @@
}
}
};
+
+ public static final FieldSelector UUID_AND_PARENT_AND_INDEX = new FieldSelector() {
+ /**
+ * Accepts {@link FieldNames#UUID}, {@link FieldNames#PARENT}
+ * and {@link FieldNames#INDEX}.
+ *
+ * @param fieldName the field name to check.
+ * @return result.
+ */
+ public FieldSelectorResult accept(String fieldName) {
+ if (FieldNames.UUID == fieldName) {
+ return FieldSelectorResult.LOAD;
+ } else if (FieldNames.PARENT == fieldName) {
+ return FieldSelectorResult.LOAD;
+ } else if (FieldNames.INDEX == fieldName) {
+ return FieldSelectorResult.LOAD;
+ } else {
+ return FieldSelectorResult.NO_LOAD;
+ }
+ }
+ };
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexFormatVersion.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexFormatVersion.java 2011-09-01 06:42:18 UTC (rev 4822)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexFormatVersion.java 2011-09-01 07:12:32 UTC (rev 4823)
@@ -16,10 +16,10 @@
*/
package org.exoplatform.services.jcr.impl.core.query.lucene;
+import org.apache.lucene.index.IndexReader;
+
import java.util.Collection;
-import org.apache.lucene.index.IndexReader;
-
/**
* This class indicates the lucene index format that is used.
* <ul>
@@ -52,11 +52,16 @@
public static final IndexFormatVersion V2 = new IndexFormatVersion(2);
/**
- * V3 is the index format for Jackrabbit releases >= 1.5
+ * V3 is the index format for Jackrabbit releases 1.5.x
*/
public static final IndexFormatVersion V3 = new IndexFormatVersion(3);
/**
+ * V4 is the index format for Jackrabbit releases >= 1.6
+ */
+ public static final IndexFormatVersion V4 = new IndexFormatVersion(4);
+
+ /**
* The used version of the index format
*/
private final int version;
@@ -104,7 +109,9 @@
public static IndexFormatVersion getVersion(IndexReader indexReader) {
Collection fields = indexReader.getFieldNames(
IndexReader.FieldOption.ALL);
- if (fields.contains(FieldNames.LOCAL_NAME) || indexReader.numDocs() == 0) {
+ if (fields.contains(FieldNames.INDEX) || indexReader.numDocs() == 0) {
+ return IndexFormatVersion.V4;
+ } else if (fields.contains(FieldNames.LOCAL_NAME)) {
return IndexFormatVersion.V3;
} else if (fields.contains(FieldNames.PROPERTIES_SET)) {
return IndexFormatVersion.V2;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java 2011-09-01 06:42:18 UTC (rev 4822)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java 2011-09-01 07:12:32 UTC (rev 4823)
@@ -217,6 +217,12 @@
// unknown uri<->prefix mappings
}
+ if (indexFormatVersion.getVersion() >= IndexFormatVersion.V4.getVersion())
+ {
+ doc.add(new Field(FieldNames.INDEX, Integer.toString(node.getQPath().getIndex()), Field.Store.YES,
+ Field.Index.NOT_ANALYZED_NO_NORMS));
+ }
+
Collection<PropertyData> props = node.getChildPropertiesData();
if (props == null)
{
@@ -334,7 +340,7 @@
if (encProp == null)
{
encProp =
- (PropertyData)stateProvider.getItemData(node, new QPathEntry(Constants.JCR_ENCODING, 0),
+ (PropertyData)stateProvider.getItemData(node, new QPathEntry(Constants.JCR_ENCODING, 0),
ItemType.PROPERTY);
}
12 years, 8 months
exo-jcr SVN: r4822 - jcr/trunk/exo.jcr.component.core.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-09-01 02:42:18 -0400 (Thu, 01 Sep 2011)
New Revision: 4822
Modified:
jcr/trunk/exo.jcr.component.core/pom.xml
Log:
uncomment deps
Modified: jcr/trunk/exo.jcr.component.core/pom.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/pom.xml 2011-08-31 18:16:31 UTC (rev 4821)
+++ jcr/trunk/exo.jcr.component.core/pom.xml 2011-09-01 06:42:18 UTC (rev 4822)
@@ -272,7 +272,7 @@
<scope>test</scope>
</dependency>
<!-- For IBM DB2 support (local-jcr repository) -->
- <!--dependency>
+ <dependency>
<groupId>com.ibm.db2</groupId>
<artifactId>db2jcc</artifactId>
<version>9.7</version>
@@ -283,7 +283,7 @@
<artifactId>db2jcc_license_cu</artifactId>
<version>9.7</version>
<scope>test</scope>
- </dependency-->
+ </dependency>
<!-- For MS SQL 7/2000/2005 and Sybase ASE/Anywhere support (jTDS driver) -->
<!-- dependency>
<groupId>net.sourceforge.jtds</groupId>
@@ -292,12 +292,12 @@
<scope>test</scope>
</dependency -->
<!-- For MS SQL 2005 support (Microsoft JDBC driver) (local-jcr repository) -->
- <!--dependency>
+ <dependency>
<groupId>com.microsoft</groupId>
<artifactId>sqljdbc</artifactId>
<version>3.0.1301.101</version>
<scope>test</scope>
- </dependency-->
+ </dependency>
<!-- For Apache Derby support (aka JavaDB) -->
<!-- dependency>
<groupId>org.apache.derby</groupId>
12 years, 8 months