exo-jcr SVN: r944 - in jcr/branches/1.12.0-JBC/component/core/src: test/resources/conf/standalone and 1 other directory.
by do-not-reply@jboss.org
Author: nzamosenchuk
Date: 2009-12-08 08:31:21 -0500 (Tue, 08 Dec 2009)
New Revision: 944
Added:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/ChangesFilterListsWrapper.java
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexerCacheLoader.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JbossCacheIndexChangesFilter.java
jcr/branches/1.12.0-JBC/component/core/src/test/resources/conf/standalone/test-jbosscache-indexer-config-exoloader_db1_ws.xml
Log:
EXOJCR-291: Experimentally Indexer cache is reused without batching
Added: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/ChangesFilterListsWrapper.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/ChangesFilterListsWrapper.java (rev 0)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/ChangesFilterListsWrapper.java 2009-12-08 13:31:21 UTC (rev 944)
@@ -0,0 +1,35 @@
+package org.exoplatform.services.jcr.impl.core.query.jbosscache;
+
+import java.io.Serializable;
+import java.util.Set;
+
+/**
+ * FOR TESTING PURPOSES ONLY
+ *
+ * @author <a href="mailto:nikolazius@gmail.com">Nikolay Zamosenchuk</a>
+ * @version $Id: ChangesFilterListsWrapper.java 34360 2009-07-22 23:58:59Z nzamosenchuk $
+ *
+ */
+public class ChangesFilterListsWrapper implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ public Set<String> addedNodes;
+
+ public Set<String> removedNodes;
+
+ public Set<String> parentAddedNodes;
+
+ public Set<String> parentRemovedNodes;
+
+ public ChangesFilterListsWrapper(Set<String> addedNodes, Set<String> removedNodes, Set<String> parentAddedNodes,
+ Set<String> parentRemovedNodes)
+ {
+ super();
+ this.addedNodes = addedNodes;
+ this.removedNodes = removedNodes;
+ this.parentAddedNodes = parentAddedNodes;
+ this.parentRemovedNodes = parentRemovedNodes;
+ }
+
+}
Property changes on: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/ChangesFilterListsWrapper.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexerCacheLoader.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexerCacheLoader.java 2009-12-08 11:01:23 UTC (rev 943)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexerCacheLoader.java 2009-12-08 13:31:21 UTC (rev 944)
@@ -21,11 +21,9 @@
import org.exoplatform.services.jcr.impl.storage.jbosscache.AbstractWriteOnlyCacheLoader;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
+import org.jboss.cache.Fqn;
import org.jboss.cache.Modification;
-import org.jboss.cache.Modification.ModificationType;
-import org.jboss.cache.factories.annotations.Inject;
-import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -52,48 +50,77 @@
@Override
public void put(List<Modification> modifications) throws Exception
{
- if (log.isDebugEnabled())
- {
- log.info("Received list of modifications");
- }
- final Set<String> addedNodes = new HashSet<String>();
- final Set<String> removedNodes = new HashSet<String>();
-
- final Set<String> parentAddedNodes = new HashSet<String>();
- final Set<String> parentRemovedNodes = new HashSet<String>();
+ // FOR TESTING PURPOSES
for (Modification m : modifications)
{
-
- if (m.getType() == ModificationType.PUT_KEY_VALUE && m.getFqn().size() == 1)
+ switch (m.getType())
{
- if (m.getKey().equals(JbossCacheIndexChangesFilter.ADDED) && m.getValue() instanceof Set<?>)
- {
- addedNodes.addAll((Set<String>)m.getValue());
- }
- else if (m.getKey().equals(JbossCacheIndexChangesFilter.REMOVED) && m.getValue() instanceof Set<?>)
- {
- removedNodes.addAll((Set<String>)m.getValue());
- }
- if (m.getKey().equals(JbossCacheIndexChangesFilter.PARENT_ADDED) && m.getValue() instanceof Set<?>)
- {
- parentAddedNodes.addAll((Set<String>)m.getValue());
- }
- else if (m.getKey().equals(JbossCacheIndexChangesFilter.PARENT_REMOVED) && m.getValue() instanceof Set<?>)
- {
- parentRemovedNodes.addAll((Set<String>)m.getValue());
- }
+ case PUT_KEY_VALUE :
+ put(m.getFqn(), m.getKey(), m.getValue());
+ break;
+ case REMOVE_DATA :
}
- else
- {
- if (log.isDebugEnabled())
- {
- log.info("Received " + m.getType() + " modification, skipping...");
- }
- }
}
- new StubSearchManager().updateIndex(addedNodes, removedNodes);
- if (searchManager != null)
+
+ // if (log.isDebugEnabled())
+ // {
+ // log.info("Received list of modifications");
+ // }
+ // final Set<String> addedNodes = new HashSet<String>();
+ // final Set<String> removedNodes = new HashSet<String>();
+ //
+ // final Set<String> parentAddedNodes = new HashSet<String>();
+ // final Set<String> parentRemovedNodes = new HashSet<String>();
+ // for (Modification m : modifications)
+ // {
+ //
+ // if (m.getType() == ModificationType.PUT_KEY_VALUE && m.getFqn().size() == 1)
+ // {
+ // if (m.getKey().equals(JbossCacheIndexChangesFilter.ADDED) && m.getValue() instanceof Set<?>)
+ // {
+ // addedNodes.addAll((Set<String>)m.getValue());
+ // }
+ // else if (m.getKey().equals(JbossCacheIndexChangesFilter.REMOVED) && m.getValue() instanceof Set<?>)
+ // {
+ // removedNodes.addAll((Set<String>)m.getValue());
+ // }
+ // if (m.getKey().equals(JbossCacheIndexChangesFilter.PARENT_ADDED) && m.getValue() instanceof Set<?>)
+ // {
+ // parentAddedNodes.addAll((Set<String>)m.getValue());
+ // }
+ // else if (m.getKey().equals(JbossCacheIndexChangesFilter.PARENT_REMOVED) && m.getValue() instanceof Set<?>)
+ // {
+ // parentRemovedNodes.addAll((Set<String>)m.getValue());
+ // }
+ // }
+ // else
+ // {
+ // if (log.isDebugEnabled())
+ // {
+ // log.info("Received " + m.getType() + " modification, skipping...");
+ // }
+ // }
+ // }
+ // updateIndex(addedNodes, removedNodes, parentAddedNodes, parentRemovedNodes);
+
+ }
+
+ @Override
+ public Object put(Fqn arg0, Object key, Object val) throws Exception
+ {
+ if (key.equals("key"))
{
+ ChangesFilterListsWrapper wrapper = (ChangesFilterListsWrapper)val;
+ updateIndex(wrapper.addedNodes, wrapper.removedNodes, wrapper.parentAddedNodes, wrapper.parentRemovedNodes);
+ }
+ return null;
+ }
+
+ protected void updateIndex(Set<String> addedNodes, Set<String> removedNodes, Set<String> parentAddedNodes,
+ Set<String> parentRemovedNodes)
+ {
+ if (searchManager != null && addedNodes.size() + removedNodes.size() > 0)
+ {
try
{
searchManager.updateIndex(removedNodes, addedNodes);
@@ -103,7 +130,7 @@
e.printStackTrace();
}
}
- if (parentSearchManager != null)
+ if (parentSearchManager != null && addedNodes.size() + removedNodes.size() > 0)
{
try
{
@@ -114,21 +141,5 @@
e.printStackTrace();
}
}
-
}
-
- class StubSearchManager
- {
- public void updateIndex(Set<String> added, Set<String> removed)
- {
- for (String uuid : added)
- {
- System.out.println("A\t" + uuid);
- }
- for (String uuid : removed)
- {
- System.out.println("D\t" + uuid);
- }
- }
- }
}
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JbossCacheIndexChangesFilter.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JbossCacheIndexChangesFilter.java 2009-12-08 11:01:23 UTC (rev 943)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JbossCacheIndexChangesFilter.java 2009-12-08 13:31:21 UTC (rev 944)
@@ -101,7 +101,6 @@
this.cache.getConfiguration().setCacheLoaderConfig(cacheLoaderConfig);
this.cache.create();
this.cache.start();
-
}
/**
@@ -111,8 +110,10 @@
protected void doUpdateIndex(Set<String> removedNodes, Set<String> addedNodes, Set<String> parentRemovedNodes,
Set<String> parentAddedNodes)
{
- cache.startBatch();
String id = IdGenerator.generate();
+ cache.put(id, "key", new ChangesFilterListsWrapper(addedNodes, removedNodes, parentAddedNodes, parentRemovedNodes));
+/* cache.startBatch();
+ String id = IdGenerator.generate();
cache.put(id, ADDED, addedNodes);
cache.put(id, PARENT_ADDED, parentAddedNodes);
@@ -120,7 +121,7 @@
cache.put(id, REMOVED, removedNodes);
cache.put(id, PARENT_REMOVED, parentRemovedNodes);
- cache.endBatch(true);
+ cache.endBatch(true);*/
}
}
Modified: jcr/branches/1.12.0-JBC/component/core/src/test/resources/conf/standalone/test-jbosscache-indexer-config-exoloader_db1_ws.xml
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/test/resources/conf/standalone/test-jbosscache-indexer-config-exoloader_db1_ws.xml 2009-12-08 11:01:23 UTC (rev 943)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/resources/conf/standalone/test-jbosscache-indexer-config-exoloader_db1_ws.xml 2009-12-08 13:31:21 UTC (rev 944)
@@ -54,7 +54,7 @@
<loaders passivation="false" shared="false">
loader class="org.jboss.cache.loader.FileCacheLoader" async="false"
- fetchPersistentState="true" ignoreModifications="false"
+ fetchPersistentState="false" ignoreModifications="false"
purgeOnStartup="false">
<properties>
location=/tmp/test-jboss-cache/proxy
@@ -62,7 +62,7 @@
</loader
loader class="org.exoplatform.services.jcr.impl.storage.jbosscache.JDBCCacheLoader"
- async="false" fetchPersistentState="true" ignoreModifications="false" purgeOnStartup="false">
+ async="false" fetchPersistentState="false" ignoreModifications="false" purgeOnStartup="false">
<properties>
</properties>
</loader
@@ -76,5 +76,5 @@
</loaders>
--><!-- Enable batching -->
- <invocationBatching enabled="true"/>
+ <invocationBatching enabled="false"/>
</jbosscache>
16 years, 7 months
exo-jcr SVN: r943 - jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow.
by do-not-reply@jboss.org
Author: pnedonosko
Date: 2009-12-08 06:01:23 -0500 (Tue, 08 Dec 2009)
New Revision: 943
Modified:
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/TransientValueData.java
Log:
EXOJCR-221: cleanup
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/TransientValueData.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/TransientValueData.java 2009-12-08 10:38:29 UTC (rev 942)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/TransientValueData.java 2009-12-08 11:01:23 UTC (rev 943)
@@ -177,7 +177,7 @@
if (this.tmpStream != null)
{
this.tmpStream.close();
- this.tmpStream = null; // 05.02.2009 release stream if file exists
+ this.tmpStream = null;
}
this.spooled = true;
16 years, 7 months
exo-jcr SVN: r942 - in jcr/branches/1.12.0-JBC/component/core/src: test/resources/conf/standalone and 1 other directory.
by do-not-reply@jboss.org
Author: nzamosenchuk
Date: 2009-12-08 05:38:29 -0500 (Tue, 08 Dec 2009)
New Revision: 942
Added:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexerSingletonStoreCacheLoader.java
Removed:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexerSingleStoreCacheLoader.java
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexerCacheLoader.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JbossCacheIndexChangesFilter.java
jcr/branches/1.12.0-JBC/component/core/src/test/resources/conf/standalone/test-jbosscache-indexer-config-exoloader_db1_ws.xml
Log:
EXOJCR-291: Indexer CacheLoader hierarchy updated to new cache usage scheme.
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexerCacheLoader.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexerCacheLoader.java 2009-12-08 10:18:27 UTC (rev 941)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexerCacheLoader.java 2009-12-08 10:38:29 UTC (rev 942)
@@ -38,16 +38,15 @@
{
private final Log log = ExoLogger.getLogger(this.getClass().getName());
- public static String ADDED = "$add".intern();
+ private SearchManager searchManager;
- public static String REMOVED = "$remove".intern();
+ private SearchManager parentSearchManager;
- private SearchManager searchManager;
-
- @Inject
- public void init(SearchManager searchManager) throws RepositoryConfigurationException
+ public void init(SearchManager searchManager, SearchManager parentSearchManager)
+ throws RepositoryConfigurationException
{
this.searchManager = searchManager;
+ this.parentSearchManager = parentSearchManager;
}
@Override
@@ -57,21 +56,32 @@
{
log.info("Received list of modifications");
}
+ final Set<String> addedNodes = new HashSet<String>();
final Set<String> removedNodes = new HashSet<String>();
- final Set<String> addedNodes = new HashSet<String>();
+
+ final Set<String> parentAddedNodes = new HashSet<String>();
+ final Set<String> parentRemovedNodes = new HashSet<String>();
for (Modification m : modifications)
{
if (m.getType() == ModificationType.PUT_KEY_VALUE && m.getFqn().size() == 1)
{
- if (m.getKey().equals(ADDED) && m.getValue() instanceof Set<?>)
+ if (m.getKey().equals(JbossCacheIndexChangesFilter.ADDED) && m.getValue() instanceof Set<?>)
{
addedNodes.addAll((Set<String>)m.getValue());
}
- else if (m.getKey().equals(REMOVED) && m.getValue() instanceof Set<?>)
+ else if (m.getKey().equals(JbossCacheIndexChangesFilter.REMOVED) && m.getValue() instanceof Set<?>)
{
removedNodes.addAll((Set<String>)m.getValue());
}
+ if (m.getKey().equals(JbossCacheIndexChangesFilter.PARENT_ADDED) && m.getValue() instanceof Set<?>)
+ {
+ parentAddedNodes.addAll((Set<String>)m.getValue());
+ }
+ else if (m.getKey().equals(JbossCacheIndexChangesFilter.PARENT_REMOVED) && m.getValue() instanceof Set<?>)
+ {
+ parentRemovedNodes.addAll((Set<String>)m.getValue());
+ }
}
else
{
@@ -82,10 +92,29 @@
}
}
new StubSearchManager().updateIndex(addedNodes, removedNodes);
- if (searchManager!=null)
+ if (searchManager != null)
{
- searchManager.updateIndex(removedNodes, addedNodes);
+ try
+ {
+ searchManager.updateIndex(removedNodes, addedNodes);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
}
+ if (parentSearchManager != null)
+ {
+ try
+ {
+ parentSearchManager.updateIndex(parentRemovedNodes, parentAddedNodes);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
}
class StubSearchManager
Deleted: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexerSingleStoreCacheLoader.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexerSingleStoreCacheLoader.java 2009-12-08 10:18:27 UTC (rev 941)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexerSingleStoreCacheLoader.java 2009-12-08 10:38:29 UTC (rev 942)
@@ -1,101 +0,0 @@
-/*
- * Copyright (C) 2009 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.core.query.jbosscache;
-
-import org.exoplatform.services.log.ExoLogger;
-import org.exoplatform.services.log.Log;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.NodeSPI;
-import org.jboss.cache.loader.SingletonStoreCacheLoader;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.concurrent.Callable;
-
-/**
- * @author <a href="mailto:nikolazius@gmail.com">Nikolay Zamosenchuk</a>
- * @version $Id: IndexerSingleStoraCacheLoader.java 34360 2009-07-22 23:58:59Z nzamosenchuk $
- *
- */
-public class IndexerSingleStoreCacheLoader extends SingletonStoreCacheLoader
-{
-
- private final Log log = ExoLogger.getLogger(this.getClass().getName());
-
- @Override
- protected void activeStatusChanged(boolean newActiveState) throws PushStateException
- {
- // at first change indexer mode
- modeChanged(newActiveState);
- // and them push states if needed
- super.activeStatusChanged(newActiveState);
-
- }
-
- /**
- * Changes indexer mode RO->RW, RW->RO
- *
- * @param enableWrite
- * true when this node of cluster is coordinator, means that indexer is RW
- * false means that indexer is read only, and this node of cluster is no a coordinator
- */
- protected void modeChanged(boolean enableWrite)
- {
- }
-
- @Override
- protected Callable<?> createPushStateTask()
- {
- return new Callable()
- {
- public Object call() throws Exception
- {
- final boolean debugEnabled = log.isDebugEnabled();
-
- if (debugEnabled)
- log.debug("start pushing in-memory state to cache cacheLoader collection");
-
- final Set<String> removedNodes = new HashSet<String>();
- final Set<String> addedNodes = new HashSet<String>();
-
- // merging all lists stored in memory
- Collection<NodeSPI> children = cache.getRoot().getChildrenDirect();
- for (NodeSPI aChildren : children)
- {
- Fqn fqn = aChildren.getFqn();
- Object value = cache.get(fqn, IndexerCacheLoader.ADDED);
- if (value != null && value instanceof Set<?>)
- {
- addedNodes.addAll((Set<String>)value);
- };
- value = cache.get(fqn, IndexerCacheLoader.REMOVED);
- if (value != null && value instanceof Set<?>)
- {
- removedNodes.addAll((Set<String>)value);
- };
- }
- //TODO: recover logic is here, lists are: removedNodes and addedNodes
- if (debugEnabled)
- log.debug("in-memory state passed to cache cacheLoader successfully");
- return null;
- }
- };
- }
-}
Copied: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexerSingletonStoreCacheLoader.java (from rev 936, jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexerSingleStoreCacheLoader.java)
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexerSingletonStoreCacheLoader.java (rev 0)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexerSingletonStoreCacheLoader.java 2009-12-08 10:38:29 UTC (rev 942)
@@ -0,0 +1,113 @@
+/*
+ * Copyright (C) 2009 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.core.query.jbosscache;
+
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.NodeSPI;
+import org.jboss.cache.loader.SingletonStoreCacheLoader;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.concurrent.Callable;
+
+/**
+ * @author <a href="mailto:nikolazius@gmail.com">Nikolay Zamosenchuk</a>
+ * @version $Id: IndexerSingleStoraCacheLoader.java 34360 2009-07-22 23:58:59Z nzamosenchuk $
+ *
+ */
+public class IndexerSingletonStoreCacheLoader extends SingletonStoreCacheLoader
+{
+
+ private final Log log = ExoLogger.getLogger(this.getClass().getName());
+
+ @Override
+ protected void activeStatusChanged(boolean newActiveState) throws PushStateException
+ {
+ // at first change indexer mode
+ modeChanged(newActiveState);
+ // and them push states if needed
+ super.activeStatusChanged(newActiveState);
+
+ }
+
+ /**
+ * Changes indexer mode RO->RW, RW->RO
+ *
+ * @param enableWrite
+ * true when this node of cluster is coordinator, means that indexer is RW
+ * false means that indexer is read only, and this node of cluster is no a coordinator
+ */
+ protected void modeChanged(boolean enableWrite)
+ {
+ }
+
+ @Override
+ protected Callable<?> createPushStateTask()
+ {
+ return new Callable()
+ {
+ public Object call() throws Exception
+ {
+ final boolean debugEnabled = log.isDebugEnabled();
+
+ if (debugEnabled)
+ log.debug("start pushing in-memory state to cache cacheLoader collection");
+
+ final Set<String> removedNodes = new HashSet<String>();
+ final Set<String> addedNodes = new HashSet<String>();
+ final Set<String> parentRemovedNodes = new HashSet<String>();
+ final Set<String> parentAddedNodes = new HashSet<String>();
+ // merging all lists stored in memory
+ Collection<NodeSPI> children = cache.getRoot().getChildrenDirect();
+ for (NodeSPI aChildren : children)
+ {
+ Fqn fqn = aChildren.getFqn();
+ Object value = cache.get(fqn, JbossCacheIndexChangesFilter.ADDED);
+ if (value != null && value instanceof Set<?>)
+ {
+ addedNodes.addAll((Set<String>)value);
+ };
+ value = cache.get(fqn, JbossCacheIndexChangesFilter.REMOVED);
+ if (value != null && value instanceof Set<?>)
+ {
+ removedNodes.addAll((Set<String>)value);
+ };
+ value = cache.get(fqn, JbossCacheIndexChangesFilter.PARENT_ADDED);
+ if (value != null && value instanceof Set<?>)
+ {
+ parentAddedNodes.addAll((Set<String>)value);
+ };
+ value = cache.get(fqn, JbossCacheIndexChangesFilter.PARENT_REMOVED);
+ if (value != null && value instanceof Set<?>)
+ {
+ parentRemovedNodes.addAll((Set<String>)value);
+ };
+ }
+ //TODO: recover logic is here, lists are: removedNodes and addedNodes
+ if (debugEnabled)
+ log.debug("in-memory state passed to cache cacheLoader successfully");
+ return null;
+ }
+ };
+ }
+}
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JbossCacheIndexChangesFilter.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JbossCacheIndexChangesFilter.java 2009-12-08 10:18:27 UTC (rev 941)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JbossCacheIndexChangesFilter.java 2009-12-08 10:38:29 UTC (rev 942)
@@ -24,11 +24,16 @@
import org.exoplatform.services.jcr.impl.core.query.IndexerChangesFilter;
import org.exoplatform.services.jcr.impl.core.query.IndexingTree;
import org.exoplatform.services.jcr.impl.core.query.SearchManager;
+import org.exoplatform.services.jcr.util.IdGenerator;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.jboss.cache.Cache;
import org.jboss.cache.CacheFactory;
+import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
+import org.jboss.cache.config.CacheLoaderConfig;
+import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
+import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig.SingletonStoreConfig;
import java.io.Serializable;
import java.util.Set;
@@ -47,6 +52,14 @@
private final Cache<Serializable, Object> cache;
+ public static String ADDED = "$add".intern();
+
+ public static String REMOVED = "$remove".intern();
+
+ public static String PARENT_ADDED = "$padd".intern();
+
+ public static String PARENT_REMOVED = "$premove".intern();
+
/**
* @param searchManager
* @param config
@@ -62,6 +75,30 @@
CacheFactory<Serializable, Object> factory = new DefaultCacheFactory<Serializable, Object>();
log.info("JBoss Cache configuration used: " + jbcConfig);
this.cache = factory.createCache(jbcConfig, false);
+ ((CacheSPI<Serializable, Object>)cache).getComponentRegistry().registerComponent(searchManager,
+ SearchManager.class);
+
+ // initialize IndexerCacheLoader
+ IndexerCacheLoader indexerCacheLoader = new IndexerCacheLoader();
+ // inject dependencies
+ indexerCacheLoader.init(searchManager, parentSearchManager);
+ // set SingltonStoreCacheLoader
+ SingletonStoreConfig singletonStoreConfig = new SingletonStoreConfig();
+ singletonStoreConfig.setClassName(IndexerSingletonStoreCacheLoader.class.getName());
+ // create CacheLoaderConfig
+ IndividualCacheLoaderConfig individualCacheLoaderConfig = new IndividualCacheLoaderConfig();
+ // set SingletonStoreConfig
+ individualCacheLoaderConfig.setSingletonStoreConfig(singletonStoreConfig);
+ // set CacheLoader
+ individualCacheLoaderConfig.setCacheLoader(indexerCacheLoader);
+ // set parameters
+ individualCacheLoaderConfig.setFetchPersistentState(false);
+ individualCacheLoaderConfig.setAsync(false);
+ // create CacheLoaderConfig
+ CacheLoaderConfig cacheLoaderConfig = new CacheLoaderConfig();
+ cacheLoaderConfig.addIndividualCacheLoaderConfig(individualCacheLoaderConfig);
+ // insert CacheLoaderConfig
+ this.cache.getConfiguration().setCacheLoaderConfig(cacheLoaderConfig);
this.cache.create();
this.cache.start();
@@ -74,8 +111,16 @@
protected void doUpdateIndex(Set<String> removedNodes, Set<String> addedNodes, Set<String> parentRemovedNodes,
Set<String> parentAddedNodes)
{
- // TODO Auto-generated method stub
+ cache.startBatch();
+ String id = IdGenerator.generate();
+ cache.put(id, ADDED, addedNodes);
+ cache.put(id, PARENT_ADDED, parentAddedNodes);
+
+ cache.put(id, REMOVED, removedNodes);
+ cache.put(id, PARENT_REMOVED, parentRemovedNodes);
+
+ cache.endBatch(true);
}
}
Modified: jcr/branches/1.12.0-JBC/component/core/src/test/resources/conf/standalone/test-jbosscache-indexer-config-exoloader_db1_ws.xml
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/test/resources/conf/standalone/test-jbosscache-indexer-config-exoloader_db1_ws.xml 2009-12-08 10:18:27 UTC (rev 941)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/resources/conf/standalone/test-jbosscache-indexer-config-exoloader_db1_ws.xml 2009-12-08 10:38:29 UTC (rev 942)
@@ -7,7 +7,7 @@
transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup" />
<clustering mode="replication" clusterName="JBoss-Cache-Indexer-Cluster_db1_ws">
-
+ <stateRetrieval timeout="20000" fetchInMemoryState="false"/>
<jgroupsConfig>
<!--UDP discard_incompatible_packets="true" enable_bundling="false" enable_diagnostics="false" ip_ttl="2"
loopback="false" max_bundle_size="64000" max_bundle_timeout="30" mcast_addr="228.10.10.10"
@@ -50,31 +50,31 @@
<sync />
<!-- Alternatively, to use async replication, comment out the element above and uncomment the element below. -->
<!-- <async /> -->
- </clustering>
+ </clustering><!--
<loaders passivation="false" shared="false">
- <loader class="org.jboss.cache.loader.FileCacheLoader" async="false"
+ loader class="org.jboss.cache.loader.FileCacheLoader" async="false"
fetchPersistentState="true" ignoreModifications="false"
purgeOnStartup="false">
<properties>
location=/tmp/test-jboss-cache/proxy
</properties>
- </loader>
+ </loader
- <!-- loader class="org.exoplatform.services.jcr.impl.storage.jbosscache.JDBCCacheLoader"
+ loader class="org.exoplatform.services.jcr.impl.storage.jbosscache.JDBCCacheLoader"
async="false" fetchPersistentState="true" ignoreModifications="false" purgeOnStartup="false">
<properties>
</properties>
- </loader-->
+ </loader
- <!-- loader class="org.exoplatform.services.jcr.impl.core.query.cacheloader.IndexerCacheLoader"
+ <loader class="org.exoplatform.services.jcr.impl.core.query.jbosscache.IndexerCacheLoader"
async="false" fetchPersistentState="false" ignoreModifications="false" purgeOnStartup="false">
<properties>
</properties>
- </loader-->
+ </loader>
</loaders>
- <!-- Enable batching -->
+ --><!-- Enable batching -->
<invocationBatching enabled="true"/>
</jbosscache>
16 years, 7 months
exo-jcr SVN: r941 - jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2009-12-08 05:18:27 -0500 (Tue, 08 Dec 2009)
New Revision: 941
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java
Log:
EXOJCR-286: root Fqn ("", "/", zero size) support added to JDBCCacheLoader
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java 2009-12-08 09:08:28 UTC (rev 940)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java 2009-12-08 10:18:27 UTC (rev 941)
@@ -19,7 +19,6 @@
package org.exoplatform.services.jcr.impl.storage.jbosscache;
import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
-import org.exoplatform.services.jcr.datamodel.ItemData;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
@@ -33,7 +32,6 @@
import org.jboss.cache.CacheException;
import org.jboss.cache.Fqn;
import org.jboss.cache.Modification;
-import org.jboss.cache.Modification.ModificationType;
import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.loader.AbstractCacheLoader;
@@ -203,7 +201,7 @@
RepositoryException
{
Fqn fqn = IdTreeHelper.buildFqn(modification.getFqn());
-
+
if (fqn.size() == 2)
{
String identifier = (String)fqn.get(1);
@@ -257,7 +255,7 @@
private void doUpdate(Modification m, JDBCStorageConnection conn) throws IllegalStateException, RepositoryException
{
Fqn fqn = IdTreeHelper.buildFqn(m.getFqn());
-
+
if (fqn.size() == 2 && m.getValue() instanceof TransientItemData)
{
//Check flag it's mixin update for node, if this flag set we have node need to
@@ -304,8 +302,7 @@
*/
public Map<Object, Object> get(Fqn fqn) throws Exception
{
- Fqn name = ( fqn.size() > 1 ? IdTreeHelper.buildFqn(fqn) : fqn);
-
+ Fqn name = (fqn.size() > 1 ? IdTreeHelper.buildFqn(fqn) : fqn);
Map<Object, Object> attrs;
JDBCStorageConnection conn = (JDBCStorageConnection)dataContainer.openConnection();
@@ -437,9 +434,9 @@
}
}
}
- else if (name.equals(Fqn.ROOT) || name.get(0).equals(JBossCacheStorage.PROPS)
- || name.get(0).equals(JBossCacheStorage.NODES) || name.get(0).equals(JBossCacheStorage.LOCKS)
- || name.get(0).equals(JBossCacheStorage.REFS))
+ else if (name.isRoot() || name.equals(Fqn.ROOT) || name.getLastElementAsString().equals("/")
+ || name.get(0).equals(JBossCacheStorage.PROPS) || name.get(0).equals(JBossCacheStorage.NODES)
+ || name.get(0).equals(JBossCacheStorage.LOCKS) || name.get(0).equals(JBossCacheStorage.REFS))
{
// roots, like NODES, PROPS etc
attrs = new LinkedHashMap<Object, Object>();
@@ -465,8 +462,8 @@
{
JDBCStorageConnection conn = (JDBCStorageConnection)dataContainer.openConnection();
- Fqn name = ( fqn.size() > 1 ? IdTreeHelper.buildFqn(fqn) : fqn);
-
+ Fqn name = (fqn.size() > 1 ? IdTreeHelper.buildFqn(fqn) : fqn);
+
boolean exists;
try
@@ -567,9 +564,9 @@
}
}
}
- else if (name.equals(Fqn.ROOT) || name.get(0).equals(JBossCacheStorage.PROPS)
- || name.get(0).equals(JBossCacheStorage.NODES) || name.get(0).equals(JBossCacheStorage.LOCKS)
- || name.get(0).equals(JBossCacheStorage.REFS))
+ else if (name.isRoot() || name.equals(Fqn.ROOT) || name.getLastElementAsString().equals("/")
+ || name.get(0).equals(JBossCacheStorage.PROPS) || name.get(0).equals(JBossCacheStorage.NODES)
+ || name.get(0).equals(JBossCacheStorage.LOCKS) || name.get(0).equals(JBossCacheStorage.REFS))
{
// roots, like NODES, PROPS etc
exists = true;
@@ -594,13 +591,13 @@
public Set<?> getChildrenNames(Fqn fqn) throws Exception
{
// return child nodes names
-
+
//to sub Fqn (example /$LOCKS/5/4/3)
- if (IdTreeHelper.isSubFqn(fqn))
- return null;
-
- Fqn name = ( fqn.size() >= 2 ? IdTreeHelper.buildFqn(fqn) : fqn);
+ // if (IdTreeHelper.isSubFqn(fqn))
+ // return null;
+ Fqn name = (fqn.size() >= 2 ? IdTreeHelper.buildFqn(fqn) : fqn);
+
JDBCStorageConnection conn = (JDBCStorageConnection)dataContainer.openConnection();
try
{
@@ -625,6 +622,15 @@
return null;
}
}
+ else if (name.isRoot() || name.get(0).equals(Fqn.ROOT) || name.getLastElementAsString().equals("/"))
+ {
+ Set<String> childs = new LinkedHashSet<String>();
+ childs.add(JBossCacheStorage.NODES);
+ childs.add(JBossCacheStorage.PROPS);
+ childs.add(JBossCacheStorage.LOCKS);
+ childs.add(JBossCacheStorage.REFS);
+ return childs;
+ }
else if (name.size() > 2)
{
// seems it is fqn like /$NODES/nodeUUID/childname[/...] or /$REFS/nodeUUID/propUUUIS[/...]
@@ -653,15 +659,6 @@
{
return null/*conn.getAllRefencedNodeIdentifiers()*/;
}
- else if (name.get(0).equals(Fqn.ROOT))
- {
- Set<String> childs = new LinkedHashSet<String>();
- childs.add(JBossCacheStorage.NODES);
- childs.add(JBossCacheStorage.PROPS);
- childs.add(JBossCacheStorage.LOCKS);
- childs.add(JBossCacheStorage.REFS);
- return childs;
- }
else
{
return null;
16 years, 7 months
exo-jcr SVN: r940 - jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2009-12-08 04:08:28 -0500 (Tue, 08 Dec 2009)
New Revision: 940
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/IdTreeHelper.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java
Log:
EXOJCR-293 : The JDBCCacheLoader was changed.
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/IdTreeHelper.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/IdTreeHelper.java 2009-12-08 08:46:54 UTC (rev 939)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/IdTreeHelper.java 2009-12-08 09:08:28 UTC (rev 940)
@@ -42,16 +42,6 @@
* @return String[]
* the tree id
*/
- /*public static String[] buildPath(String id)
- {
- String tree[] = new String[id.length()];
-
- for (int i = 1; i < id.length() + 1; i++)
- tree[i-1] = id.substring(i - 1, i);
-
- return tree;
- }*/
-
public static String[] buildPath(String id)
{
String tree[] = new String[X_LENGTH +1];
@@ -68,11 +58,11 @@
/**
* Create that transformation
*
- * /$NODES/0/0/e/x/o/0/j/c/r/0/r/o/o/t/0/u/u/i/d/0/0/0/0/0/0/0/0/0/0/0/0/0
+ * /$NODES/0/0/e/x/o/0/j/c/r0root0uuid0000000000000
* -->
* /$NODES/00exo0jcr0root0uuid0000000000000
*
- * /$NODES/0/0/e/x/o/0/j/c/r/0/r/o/o/t/0/u/u/i/d/0/0/0/0/0/0/0/0/0/0/0/0/0/subNodeName:1
+ * /$NODES/0/0/e/x/o/0/j/c/r0root0uuid0000000000000/subNodeName:1
* -->
* /$NODES/00exo0jcr0root0uuid0000000000000/subNodeName:1
*
@@ -80,60 +70,6 @@
* the tree Fqn
* @return Fqn
*/
- /*public static Fqn buildFqn(Fqn treeFqn)
- {
- String id = treeFqn.getSubFqn(1, IdGenerator.IDENTIFIER_LENGTH + 1).toString();
-
- id = id.replaceAll(Fqn.SEPARATOR, "");
-
- String[] sArray = new String[treeFqn.size() - IdGenerator.IDENTIFIER_LENGTH + 1];
-
- sArray[0] = (String) treeFqn.get(0);
- sArray[1] = id;
-
- int sArrayIndex = 2;
-
- for (int i=(IdGenerator.IDENTIFIER_LENGTH + 1); i < treeFqn.size(); i++)
- {
- sArray[sArrayIndex++] = (String) treeFqn.get(i);
- }
-
- return Fqn.fromElements(sArray);
- } */
-
- /*public static Fqn buildFqn(Fqn treeFqn)
- {
- String id = "";
-
- int index = 1;
-
- for (;index < treeFqn.size(); index++)
- {
- if (((String) treeFqn.get(index)).length() == 1)
- {
- id += (String) treeFqn.get(index);
- } else
- {
- break;
- }
- }
-
- String[] sArray = new String[treeFqn.size() - (index - 2)];
-
- sArray[0] = (String) treeFqn.get(0);
- sArray[1] = id;
-
- int sArrayIndex = 2;
-
- for (int i=index; i < treeFqn.size(); i++)
- {
- sArray[sArrayIndex++] = (String) treeFqn.get(i);
- }
-
- return Fqn.fromElements(sArray);
- }*/
-
-
public static Fqn buildFqn(Fqn treeFqn)
{
String oldId = treeFqn.getSubFqn(1, X_LENGTH + 2).toString();
@@ -170,14 +106,4 @@
}
}
-
- public static void main(String[] args)
- {
- System.out.println(Fqn.fromElements(buildPath("00exo0jcr0root0uuid0000000000000")));
- System.out.println(buildFqn(Fqn.fromString("/$NODES/0/0/e/x/o/0/j/c/r/0/r/o/o/t/0/u/u/i/d/0/0/0/0/0/0/0/0/0/0/0/0/0")));
- System.out.println(buildFqn(Fqn.fromString("/$NODES/0/0/e/x/o/0/j/c/r/0/r/o/o/t/0/u/u/i/d/0/0/0/0/0/0/0/0/0/0/0/0/0/[]subNodeName:1")));
- System.out.println(buildFqn(Fqn.fromString("/$NODES/f/a/l/s/e/[]dsds:1")));
-
- }
-
}
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java 2009-12-08 08:46:54 UTC (rev 939)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java 2009-12-08 09:08:28 UTC (rev 940)
@@ -1412,4 +1412,20 @@
}
locksRoot.removeChild(makeNodeFqn(identifier));
}
+
+ /**
+ * Will be removed empty tree.
+ *
+ * @param parent
+ * FQN of tree
+ */
+ private void removeEmptyTree(Node<Serializable, Object> node, Fqn<String> parent)
+ {
+ if (parent.size() != 0 && node.getChild(parent).getChildrenNames().size() == 0)
+ {
+ node.removeChild(parent);
+
+ removeEmptyTree(node, parent.getParent());
+ }
+ }
}
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java 2009-12-08 08:46:54 UTC (rev 939)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java 2009-12-08 09:08:28 UTC (rev 940)
@@ -636,14 +636,13 @@
{
// TODO should never be called
LOG.warn("conn.getAllNodeIdentifiers()");
- return conn.getAllNodeIdentifiers();
-
+ return null/*conn.getAllNodeIdentifiers()*/;
}
else if (name.get(0).equals(JBossCacheStorage.PROPS))
{
// TODO should never be called
LOG.warn("conn.getAllPropertyIdentifiers()");
- return conn.getAllPropertyIdentifiers();
+ return null/*conn.getAllPropertyIdentifiers()*/;
}
else if (name.get(0).equals(JBossCacheStorage.LOCKS))
{
@@ -652,7 +651,7 @@
}
else if (name.get(0).equals(JBossCacheStorage.REFS))
{
- return conn.getAllRefencedNodeIdentifiers();
+ return null/*conn.getAllRefencedNodeIdentifiers()*/;
}
else if (name.get(0).equals(Fqn.ROOT))
{
16 years, 7 months
exo-jcr SVN: r939 - in jcr/branches/1.12.0-OPT/exo.jcr.component.core/src: main/java/org/exoplatform/services/jcr/impl/core and 17 other directories.
by do-not-reply@jboss.org
Author: tolusha
Date: 2009-12-08 03:46:54 -0500 (Tue, 08 Dec 2009)
New Revision: 939
Modified:
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/persistent/PersistedPropertyData.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ItemImpl.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NamespaceDataPersister.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ScratchWorkspaceInitializer.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/LockManagerImpl.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/NodeTypeDataManagerImpl.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/AbstractItemDefinitionAccessProvider.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/JcrNodeTypeDataPersister.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/ItemDataMergeVisitor.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/VersionImpl.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/DefaultItemDataCopyVisitor.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/ItemDataCopyVisitor.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/ItemDataMoveVisitor.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/ItemDataRemoveVisitor.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/TransientNodeData.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/TransientPropertyData.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/serialization/TransientPropertyDataReader.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/LocalWorkspaceStorageDataManagerProxy.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/version/VersionHistoryDataHelper.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/util/VersionHistoryImporter.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/importing/TestSystemViewCollision.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestSessionDataManager.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestLinkedCacheMultithread.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspaceStorageCacheBaseCase.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/session/SessionChangesLogTest.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/JDBCWDCTest.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/StorageUpdateTest.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/version/BaseVersionImplTest.java
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/usecases/TestRollbackBigFiles.java
Log:
EXOJCR-299: remove setters from code
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/persistent/PersistedPropertyData.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/persistent/PersistedPropertyData.java 2009-12-08 08:46:46 UTC (rev 938)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/persistent/PersistedPropertyData.java 2009-12-08 08:46:54 UTC (rev 939)
@@ -45,10 +45,11 @@
protected final boolean multiValued;
- public PersistedPropertyData(String id, QPath qpath, String parentId, int version, int type, boolean multiValued)
+ public PersistedPropertyData(String id, QPath qpath, String parentId, int version, int type, boolean multiValued,
+ List<ValueData> values)
{
super(id, qpath, parentId, version);
- this.values = null;
+ this.values = values;
this.type = type;
this.multiValued = multiValued;
}
@@ -99,25 +100,4 @@
{
visitor.visit(this);
}
-
- /**
- * @param type
- */
- public void setType(int type)
- {
- throw new RuntimeException("DO NOT call setType! ");
- }
-
- /**
- * @param values
- * @throws RepositoryException
- */
- public void setValues(List values) throws RepositoryException
- {
- if (this.values == null)
- this.values = values;
- else
- throw new RuntimeException("The values can not be changed ");
- }
-
}
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ItemImpl.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ItemImpl.java 2009-12-08 08:46:46 UTC (rev 938)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ItemImpl.java 2009-12-08 08:46:54 UTC (rev 939)
@@ -524,9 +524,6 @@
// Check value constraints
checkValueConstraints(def, valueDataList, propType);
- TransientPropertyData newData =
- new TransientPropertyData(qpath, identifier, version, propType, parentNode.getInternalIdentifier(), multiValue);
-
if (requiredType != PropertyType.UNDEFINED && expectedType != PropertyType.UNDEFINED
&& requiredType != expectedType)
{
@@ -538,7 +535,10 @@
PropertyImpl prop = null;
if (state != ItemState.DELETED)
{
- newData.setValues(valueDataList);
+ TransientPropertyData newData =
+ new TransientPropertyData(qpath, identifier, version, propType, parentNode.getInternalIdentifier(),
+ multiValue, valueDataList);
+
ItemState itemState = new ItemState(newData, state, true, qpath, false);
prop = (PropertyImpl)dataManager.update(itemState, true);
// launch event
@@ -552,6 +552,10 @@
throw new ConstraintViolationException("Can not remove (by setting null value) mandatory property "
+ locationFactory.createJCRPath(qpath).getAsString(false));
}
+ TransientPropertyData newData =
+ new TransientPropertyData(qpath, identifier, version, propType, parentNode.getInternalIdentifier(),
+ multiValue);
+
// launch event
session.getActionHandler().preRemoveItem(oldProp);
dataManager.delete(newData);
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NamespaceDataPersister.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NamespaceDataPersister.java 2009-12-08 08:46:46 UTC (rev 938)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NamespaceDataPersister.java 2009-12-08 08:46:54 UTC (rev 939)
@@ -97,8 +97,8 @@
{
if (!started)
{
- if(log.isDebugEnabled())
- log.debug("Unable save namespace " + uri + "=" + prefix + " in to the storage. Storage not initialized");
+ if (log.isDebugEnabled())
+ log.debug("Unable save namespace " + uri + "=" + prefix + " in to the storage. Storage not initialized");
return;
}
PlainChangesLog changesLog = new PlainChangesLogImpl();
@@ -114,16 +114,16 @@
TransientNodeData.createNodeData(nsRoot, new InternalQName("", prefix), Constants.EXO_NAMESPACE);
TransientPropertyData primaryType =
- TransientPropertyData.createPropertyData(nsNode, Constants.JCR_PRIMARYTYPE, PropertyType.NAME, false);
- primaryType.setValue(new TransientValueData(nsNode.getPrimaryTypeName()));
+ TransientPropertyData.createPropertyData(nsNode, Constants.JCR_PRIMARYTYPE, PropertyType.NAME, false,
+ new TransientValueData(nsNode.getPrimaryTypeName()));
TransientPropertyData exoUri =
- TransientPropertyData.createPropertyData(nsNode, Constants.EXO_URI_NAME, PropertyType.STRING, false);
- exoUri.setValue(new TransientValueData(uri));
+ TransientPropertyData.createPropertyData(nsNode, Constants.EXO_URI_NAME, PropertyType.STRING, false,
+ new TransientValueData(uri));
TransientPropertyData exoPrefix =
- TransientPropertyData.createPropertyData(nsNode, Constants.EXO_PREFIX, PropertyType.STRING, false);
- exoPrefix.setValue(new TransientValueData(prefix));
+ TransientPropertyData.createPropertyData(nsNode, Constants.EXO_PREFIX, PropertyType.STRING, false,
+ new TransientValueData(prefix));
changesLog.add(ItemState.createAddedState(nsNode)).add(ItemState.createAddedState(primaryType)).add(
ItemState.createAddedState(exoUri)).add(ItemState.createAddedState(exoPrefix));
@@ -158,7 +158,7 @@
internallAdd(changesLog, prefix, uri);
}
}
- dataManager.save(new TransactionChangesLog(changesLog));
+ dataManager.save(new TransactionChangesLog(changesLog));
}
@@ -182,7 +182,7 @@
if (!started)
{
- log.warn("Unable remove namspace "+prefix+" from the storage. Storage not initialized");
+ log.warn("Unable remove namspace " + prefix + " from the storage. Storage not initialized");
return;
}
@@ -205,7 +205,7 @@
}
- dataManager.save(new TransactionChangesLog(plainChangesLogImpl));
+ dataManager.save(new TransactionChangesLog(plainChangesLogImpl));
}
@@ -313,7 +313,6 @@
log.warn("Namespace storage (/jcr:system/exo:namespaces node) is not initialized. No namespaces loaded.");
}
-
/**
* Copy <code>PropertyData prop<code> to new TransientItemData
*
@@ -327,13 +326,8 @@
if (prop == null)
return null;
- // make a copy
- TransientPropertyData newData =
- new TransientPropertyData(prop.getQPath(), prop.getIdentifier(), prop.getPersistedVersion(), prop.getType(),
- prop.getParentIdentifier(), prop.isMultiValued());
-
+ // make a copy, value may be null for deleting items
List<ValueData> values = null;
- // null is possible for deleting items
if (prop.getValues() != null)
{
values = new ArrayList<ValueData>();
@@ -342,7 +336,10 @@
values.add(((AbstractValueData)val).createTransientCopy());
}
}
- newData.setValues(values);
+ TransientPropertyData newData =
+ new TransientPropertyData(prop.getQPath(), prop.getIdentifier(), prop.getPersistedVersion(), prop.getType(),
+ prop.getParentIdentifier(), prop.isMultiValued(), values);
+
return newData;
}
@@ -361,8 +358,8 @@
TransientNodeData.createNodeData(nsSystem, Constants.EXO_NAMESPACES, Constants.NT_UNSTRUCTURED);
TransientPropertyData primaryType =
- TransientPropertyData.createPropertyData(exoNamespaces, Constants.JCR_PRIMARYTYPE, PropertyType.NAME, false);
- primaryType.setValue(new TransientValueData(exoNamespaces.getPrimaryTypeName()));
+ TransientPropertyData.createPropertyData(exoNamespaces, Constants.JCR_PRIMARYTYPE, PropertyType.NAME, false,
+ new TransientValueData(exoNamespaces.getPrimaryTypeName()));
changesLog.add(ItemState.createAddedState(exoNamespaces)).add(ItemState.createAddedState(primaryType));
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java 2009-12-08 08:46:46 UTC (rev 938)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java 2009-12-08 08:46:54 UTC (rev 939)
@@ -586,10 +586,8 @@
{// there was mixin prop
prop =
new TransientPropertyData(prop.getQPath(), prop.getIdentifier(), prop.getPersistedVersion(),
- prop.getType(), prop.getParentIdentifier(), prop.isMultiValued());
+ prop.getType(), prop.getParentIdentifier(), prop.isMultiValued(), values);
- prop.setValues(values);
-
state = ItemState.createUpdatedState(prop);
}
else
@@ -2506,14 +2504,13 @@
throw new RepositoryException("Property data is not found " + name.getAsString() + " for node "
+ nodeData().getQPath().getAsString());
- TransientPropertyData tdata =
- new TransientPropertyData(QPath.makeChildPath(getInternalPath(), name), existed.getIdentifier(), existed
- .getPersistedVersion(), existed.getType(), existed.getParentIdentifier(), existed.isMultiValued());
-
if (!existed.isMultiValued())
throw new ValueFormatException("An existed property is single-valued " + name.getAsString());
- tdata.setValues(values);
+ TransientPropertyData tdata =
+ new TransientPropertyData(QPath.makeChildPath(getInternalPath(), name), existed.getIdentifier(), existed
+ .getPersistedVersion(), existed.getType(), existed.getParentIdentifier(), existed.isMultiValued(), values);
+
return tdata;
}
@@ -2528,9 +2525,7 @@
TransientPropertyData tdata =
new TransientPropertyData(QPath.makeChildPath(getInternalPath(), name), existed.getIdentifier(), existed
- .getPersistedVersion(), existed.getType(), existed.getParentIdentifier(), existed.isMultiValued());
-
- tdata.setValue(value);
+ .getPersistedVersion(), existed.getType(), existed.getParentIdentifier(), existed.isMultiValued(), value);
return tdata;
}
@@ -2890,10 +2885,8 @@
permProp =
new TransientPropertyData(permProp.getQPath(), permProp.getIdentifier(), permProp.getPersistedVersion(),
- permProp.getType(), permProp.getParentIdentifier(), permProp.isMultiValued());
+ permProp.getType(), permProp.getParentIdentifier(), permProp.isMultiValued(), permValues);
- permProp.setValues(permValues);
-
dataManager.update(new ItemState(data, ItemState.MIXIN_CHANGED, false, null, true), false);
dataManager.update(ItemState.createUpdatedState(permProp, true), false);
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ScratchWorkspaceInitializer.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ScratchWorkspaceInitializer.java 2009-12-08 08:46:46 UTC (rev 938)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ScratchWorkspaceInitializer.java 2009-12-08 08:46:54 UTC (rev 939)
@@ -199,8 +199,7 @@
TransientPropertyData primaryType =
new TransientPropertyData(QPath.makeChildPath(rootNode.getQPath(), Constants.JCR_PRIMARYTYPE), IdGenerator
- .generate(), -1, PropertyType.NAME, rootNode.getIdentifier(), false);
- primaryType.setValue(new TransientValueData(rootNodeType));
+ .generate(), -1, PropertyType.NAME, rootNode.getIdentifier(), false, new TransientValueData(rootNodeType));
changesLog.add(new ItemState(primaryType, ItemState.ADDED, false, null)); //
@@ -264,8 +263,8 @@
TransientNodeData.createNodeData(root, Constants.JCR_SYSTEM, Constants.NT_UNSTRUCTURED, Constants.SYSTEM_UUID);
TransientPropertyData primaryType =
- TransientPropertyData.createPropertyData(jcrSystem, Constants.JCR_PRIMARYTYPE, PropertyType.NAME, false);
- primaryType.setValue(new TransientValueData(jcrSystem.getPrimaryTypeName()));
+ TransientPropertyData.createPropertyData(jcrSystem, Constants.JCR_PRIMARYTYPE, PropertyType.NAME, false,
+ new TransientValueData(jcrSystem.getPrimaryTypeName()));
changesLog.add(ItemState.createAddedState(jcrSystem)).add(ItemState.createAddedState(primaryType));
@@ -314,8 +313,7 @@
TransientPropertyData vsPrimaryType =
TransientPropertyData.createPropertyData(versionStorageNodeData, Constants.JCR_PRIMARYTYPE, PropertyType.NAME,
- false);
- vsPrimaryType.setValue(new TransientValueData(versionStorageNodeData.getPrimaryTypeName()));
+ false, new TransientValueData(versionStorageNodeData.getPrimaryTypeName()));
changesLog.add(ItemState.createAddedState(versionStorageNodeData)).add(ItemState.createAddedState(vsPrimaryType));
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/LockManagerImpl.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/LockManagerImpl.java 2009-12-08 08:46:46 UTC (rev 938)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/LockManagerImpl.java 2009-12-08 08:46:54 UTC (rev 939)
@@ -575,13 +575,8 @@
if (prop == null)
return null;
- // make a copy
- TransientPropertyData newData =
- new TransientPropertyData(prop.getQPath(), prop.getIdentifier(), prop.getPersistedVersion(), prop.getType(),
- prop.getParentIdentifier(), prop.isMultiValued());
-
+ // make a copy, value may be null for deleting items
List<ValueData> values = null;
- // null is possible for deleting items
if (prop.getValues() != null)
{
values = new ArrayList<ValueData>();
@@ -590,7 +585,11 @@
values.add(((AbstractValueData)val).createTransientCopy());
}
}
- newData.setValues(values);
+
+ TransientPropertyData newData =
+ new TransientPropertyData(prop.getQPath(), prop.getIdentifier(), prop.getPersistedVersion(), prop.getType(),
+ prop.getParentIdentifier(), prop.isMultiValued(), values);
+
return newData;
}
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/NodeTypeDataManagerImpl.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/NodeTypeDataManagerImpl.java 2009-12-08 08:46:46 UTC (rev 938)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/NodeTypeDataManagerImpl.java 2009-12-08 08:46:54 UTC (rev 939)
@@ -665,8 +665,7 @@
final TransientPropertyData primaryTypeData =
new TransientPropertyData(item.getQPath(), item.getIdentifier(), item.getPersistedVersion(), item.getType(),
- item.getParentIdentifier(), item.isMultiValued());
- primaryTypeData.setValue(new TransientValueData(nodeTypeName));
+ item.getParentIdentifier(), item.isMultiValued(), new TransientValueData(nodeTypeName));
changesLog.add(ItemState.createUpdatedState(primaryTypeData, true));
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/AbstractItemDefinitionAccessProvider.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/AbstractItemDefinitionAccessProvider.java 2009-12-08 08:46:46 UTC (rev 938)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/AbstractItemDefinitionAccessProvider.java 2009-12-08 08:46:54 UTC (rev 939)
@@ -325,8 +325,8 @@
boolean value)
{
TransientPropertyData propertyData =
- TransientPropertyData.createPropertyData(parentNode, propertyName, PropertyType.BOOLEAN, false);
- propertyData.setValue(new TransientValueData(value));
+ TransientPropertyData.createPropertyData(parentNode, propertyName, PropertyType.BOOLEAN, false,
+ new TransientValueData(value));
changesLog.add(ItemState.createAddedState(propertyData));
}
@@ -352,38 +352,35 @@
InternalQName value)
{
TransientPropertyData propertyData =
- TransientPropertyData.createPropertyData(parentNode, propertyName, PropertyType.NAME, false);
- propertyData.setValue(new TransientValueData(value));
+ TransientPropertyData.createPropertyData(parentNode, propertyName, PropertyType.NAME, false,
+ new TransientValueData(value));
changesLog.add(ItemState.createAddedState(propertyData));
}
protected void writeNames(PlainChangesLog changesLog, NodeData parentNode, InternalQName propertyName,
InternalQName[] value)
{
- TransientPropertyData propertyData =
- TransientPropertyData.createPropertyData(parentNode, propertyName, PropertyType.NAME, true);
-
List<ValueData> parents = new ArrayList<ValueData>();
for (InternalQName nt : value)
parents.add(new TransientValueData(nt));
- propertyData.setValues(parents);
+ TransientPropertyData propertyData =
+ TransientPropertyData.createPropertyData(parentNode, propertyName, PropertyType.NAME, true, parents);
+
changesLog.add(ItemState.createAddedState(propertyData));
}
protected void writeString(PlainChangesLog changesLog, NodeData parentNode, InternalQName propertyName, String value)
{
TransientPropertyData propertyData =
- TransientPropertyData.createPropertyData(parentNode, propertyName, PropertyType.STRING, false);
- propertyData.setValue(new TransientValueData(value));
+ TransientPropertyData.createPropertyData(parentNode, propertyName, PropertyType.STRING, false,
+ new TransientValueData(value));
changesLog.add(ItemState.createAddedState(propertyData));
}
protected void writeStrings(PlainChangesLog changesLog, NodeData parentNode, InternalQName propertyName,
String[] value)
{
- TransientPropertyData propertyData =
- TransientPropertyData.createPropertyData(parentNode, propertyName, PropertyType.STRING, true);
List<ValueData> valueDatas = new ArrayList<ValueData>();
for (String vc : value)
{
@@ -391,7 +388,9 @@
valueDatas.add(new TransientValueData(vc));
}
- propertyData.setValues(valueDatas);
+ TransientPropertyData propertyData =
+ TransientPropertyData.createPropertyData(parentNode, propertyName, PropertyType.STRING, true, valueDatas);
+
changesLog.add(ItemState.createAddedState(propertyData));
}
}
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/JcrNodeTypeDataPersister.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/JcrNodeTypeDataPersister.java 2009-12-08 08:46:46 UTC (rev 938)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/JcrNodeTypeDataPersister.java 2009-12-08 08:46:54 UTC (rev 939)
@@ -161,8 +161,8 @@
Constants.NODETYPESROOT_UUID);
TransientPropertyData primaryType =
- TransientPropertyData.createPropertyData(jcrNodetypes, Constants.JCR_PRIMARYTYPE, PropertyType.NAME, false);
- primaryType.setValue(new TransientValueData(jcrNodetypes.getPrimaryTypeName()));
+ TransientPropertyData.createPropertyData(jcrNodetypes, Constants.JCR_PRIMARYTYPE, PropertyType.NAME, false,
+ new TransientValueData(jcrNodetypes.getPrimaryTypeName()));
changesLog.add(ItemState.createAddedState(jcrNodetypes)).add(ItemState.createAddedState(primaryType));
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/ItemDataMergeVisitor.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/ItemDataMergeVisitor.java 2009-12-08 08:46:46 UTC (rev 938)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/ItemDataMergeVisitor.java 2009-12-08 08:46:54 UTC (rev 939)
@@ -408,8 +408,7 @@
TransientPropertyData mcp =
new TransientPropertyData(QPath.makeChildPath(mergePath, cp.getQPath().getName()), existed != null
? existed.getIdentifier() : cp.getIdentifier(), existed != null ? existed.getPersistedVersion() : cp
- .getPersistedVersion(), cp.getType(), mergedNode.getIdentifier(), cp.isMultiValued());
- mcp.setValues(cp.getValues());
+ .getPersistedVersion(), cp.getType(), mergedNode.getIdentifier(), cp.isMultiValued(), cp.getValues());
changes.add(new ItemState(mcp, ItemState.ADDED, true, mergedNode.getQPath(), true));
}
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/VersionImpl.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/VersionImpl.java 2009-12-08 08:46:46 UTC (rev 938)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/VersionImpl.java 2009-12-08 08:46:54 UTC (rev 939)
@@ -245,8 +245,7 @@
TransientPropertyData newSuccessorsProp =
new TransientPropertyData(QPath.makeChildPath(nodeData().getQPath(), Constants.JCR_SUCCESSORS,
successorsProp.getQPath().getIndex()), successorsProp.getIdentifier(), successorsProp
- .getPersistedVersion(), PropertyType.REFERENCE, nodeData().getIdentifier(), true);
- newSuccessorsProp.setValues(newSuccessors);
+ .getPersistedVersion(), PropertyType.REFERENCE, nodeData().getIdentifier(), true, newSuccessors);
changesLog.add(ItemState.createUpdatedState(newSuccessorsProp));
}
else
@@ -284,8 +283,7 @@
TransientPropertyData newSuccessorsProp =
new TransientPropertyData(QPath.makeChildPath(nodeData().getQPath(), Constants.JCR_SUCCESSORS,
successorsProp.getQPath().getIndex()), successorsProp.getIdentifier(), successorsProp
- .getPersistedVersion(), PropertyType.REFERENCE, nodeData().getIdentifier(), true);
- newSuccessorsProp.setValues(newSuccessors);
+ .getPersistedVersion(), PropertyType.REFERENCE, nodeData().getIdentifier(), true, newSuccessors);
changesLog.add(ItemState.createUpdatedState(newSuccessorsProp));
}
else
@@ -319,8 +317,7 @@
TransientPropertyData newPredecessorsProp =
new TransientPropertyData(QPath.makeChildPath(nodeData().getQPath(), Constants.JCR_PREDECESSORS,
predeccessorsProp.getQPath().getIndex()), predeccessorsProp.getIdentifier(), predeccessorsProp
- .getPersistedVersion(), PropertyType.REFERENCE, nodeData().getIdentifier(), true);
- newPredecessorsProp.setValues(newPredeccessors);
+ .getPersistedVersion(), PropertyType.REFERENCE, nodeData().getIdentifier(), true, newPredeccessors);
changesLog.add(ItemState.createUpdatedState(newPredecessorsProp));
}
else
@@ -358,8 +355,7 @@
TransientPropertyData newPredecessorsProp =
new TransientPropertyData(QPath.makeChildPath(nodeData().getQPath(), Constants.JCR_PREDECESSORS,
predeccessorsProp.getQPath().getIndex()), predeccessorsProp.getIdentifier(), predeccessorsProp
- .getPersistedVersion(), PropertyType.REFERENCE, nodeData().getIdentifier(), true);
- newPredecessorsProp.setValues(newPredeccessors);
+ .getPersistedVersion(), PropertyType.REFERENCE, nodeData().getIdentifier(), true, newPredeccessors);
changesLog.add(ItemState.createUpdatedState(newPredecessorsProp));
}
else
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/DefaultItemDataCopyVisitor.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/DefaultItemDataCopyVisitor.java 2009-12-08 08:46:46 UTC (rev 938)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/DefaultItemDataCopyVisitor.java 2009-12-08 08:46:54 UTC (rev 939)
@@ -131,9 +131,8 @@
TransientPropertyData newProperty =
new TransientPropertyData(QPath.makeChildPath(curParent().getQPath(), qname), keepIdentifiers ? property
.getIdentifier() : IdGenerator.generate(), -1, property.getType(), curParent().getIdentifier(), property
- .isMultiValued());
+ .isMultiValued(), values);
- newProperty.setValues(values);
itemAddStates.add(new ItemState(newProperty, ItemState.ADDED, true, ancestorToSave, level != 0));
}
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/ItemDataCopyVisitor.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/ItemDataCopyVisitor.java 2009-12-08 08:46:46 UTC (rev 938)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/ItemDataCopyVisitor.java 2009-12-08 08:46:54 UTC (rev 939)
@@ -158,10 +158,8 @@
TransientPropertyData newProperty =
new TransientPropertyData(QPath.makeChildPath(curParent().getQPath(), qname), keepIdentifiers ? property
.getIdentifier() : IdGenerator.generate(), -1, property.getType(), curParent().getIdentifier(), property
- .isMultiValued());
+ .isMultiValued(), values);
- newProperty.setValues(values);
-
if (log.isDebugEnabled())
log.debug("entering COPY " + newProperty.getQPath().getAsString() + "; pidentifier: "
+ newProperty.getParentIdentifier() + "; identifier: " + newProperty.getIdentifier());
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/ItemDataMoveVisitor.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/ItemDataMoveVisitor.java 2009-12-08 08:46:46 UTC (rev 938)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/ItemDataMoveVisitor.java 2009-12-08 08:46:54 UTC (rev 939)
@@ -236,9 +236,8 @@
TransientPropertyData newProperty =
new TransientPropertyData(QPath.makeChildPath(curParent().getQPath(), qname), keepIdentifiers ? property
.getIdentifier() : IdGenerator.generate(), -1, property.getType(), curParent().getIdentifier(), property
- .isMultiValued());
+ .isMultiValued(), values);
- newProperty.setValues(values);
addStates.add(new ItemState(newProperty, ItemState.RENAMED, false, ancestorToSave, false, false));
// get last from super.entering(property, level)
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/ItemDataRemoveVisitor.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/ItemDataRemoveVisitor.java 2009-12-08 08:46:46 UTC (rev 938)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/ItemDataRemoveVisitor.java 2009-12-08 08:46:54 UTC (rev 939)
@@ -319,13 +319,12 @@
// else - property
final PropertyData prop = (PropertyData)item;
- // make a copy
+
+ // make a copy, value wil be null for deleting items
TransientPropertyData newData =
new TransientPropertyData(prop.getQPath(), prop.getIdentifier(), prop.getPersistedVersion(), prop.getType(),
prop.getParentIdentifier(), prop.isMultiValued());
- // set null as it's delete state, was set list of createTransientCopy()
- newData.setValues(null);
return newData;
}
}
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/TransientNodeData.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/TransientNodeData.java 2009-12-08 08:46:46 UTC (rev 938)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/TransientNodeData.java 2009-12-08 08:46:54 UTC (rev 939)
@@ -185,6 +185,25 @@
* @param primaryTypeName
* @return
*/
+ public static TransientNodeData createNodeData(NodeData parent, InternalQName name, InternalQName primaryTypeName,
+ InternalQName[] mixinTypeNames, String identifier)
+ {
+ TransientNodeData nodeData = null;
+ QPath path = QPath.makeChildPath(parent.getQPath(), name);
+ nodeData =
+ new TransientNodeData(path, identifier, -1, primaryTypeName, mixinTypeNames, 0, parent.getIdentifier(), parent
+ .getACL());
+ return nodeData;
+ }
+
+ /**
+ * Factory method
+ *
+ * @param parent
+ * @param name
+ * @param primaryTypeName
+ * @return
+ */
public static TransientNodeData createNodeData(NodeData parent, InternalQName name, InternalQName primaryTypeName)
{
TransientNodeData nodeData = null;
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/TransientPropertyData.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/TransientPropertyData.java 2009-12-08 08:46:46 UTC (rev 938)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/TransientPropertyData.java 2009-12-08 08:46:54 UTC (rev 939)
@@ -70,8 +70,44 @@
super(path, identifier, version, parentIdentifier);
this.type = type;
this.multiValued = multiValued;
+ this.values = null;
}
+ /**
+ * @param path qpath
+ * @param identifier id
+ * @param version persisted version
+ * @param type property type
+ * @param parentIdentifier parentId
+ * @param multiValued multi-valued state
+ */
+ public TransientPropertyData(QPath path, String identifier, int version, int type, String parentIdentifier,
+ boolean multiValued, List<ValueData> values)
+ {
+ super(path, identifier, version, parentIdentifier);
+ this.type = type;
+ this.multiValued = multiValued;
+ this.values = values;
+ }
+
+ /**
+ * @param path qpath
+ * @param identifier id
+ * @param version persisted version
+ * @param type property type
+ * @param parentIdentifier parentId
+ * @param multiValued multi-valued state
+ */
+ public TransientPropertyData(QPath path, String identifier, int version, int type, String parentIdentifier,
+ boolean multiValued, ValueData value)
+ {
+ super(path, identifier, version, parentIdentifier);
+ this.type = type;
+ this.multiValued = multiValued;
+ this.values = new ArrayList<ValueData>();
+ values.add(value);
+ }
+
/*
* (non-Javadoc)
*
@@ -146,9 +182,9 @@
public static TransientPropertyData createPropertyData(NodeData parent, InternalQName name, int type,
boolean multiValued)
{
- TransientPropertyData propData = null;
QPath path = QPath.makeChildPath(parent.getQPath(), name);
- propData = new TransientPropertyData(path, IdGenerator.generate(), -1, type, parent.getIdentifier(), multiValued);
+ TransientPropertyData propData =
+ new TransientPropertyData(path, IdGenerator.generate(), -1, type, parent.getIdentifier(), multiValued);
return propData;
}
@@ -156,16 +192,20 @@
public static TransientPropertyData createPropertyData(NodeData parent, InternalQName name, int type,
boolean multiValued, ValueData value)
{
- TransientPropertyData propData = createPropertyData(parent, name, type, multiValued);
- propData.setValue(value);
+ QPath path = QPath.makeChildPath(parent.getQPath(), name);
+ TransientPropertyData propData =
+ new TransientPropertyData(path, IdGenerator.generate(), -1, type, parent.getIdentifier(), multiValued, value);
+
return propData;
}
public static TransientPropertyData createPropertyData(NodeData parent, InternalQName name, int type,
boolean multiValued, List<ValueData> values)
{
- TransientPropertyData propData = createPropertyData(parent, name, type, multiValued);
- propData.setValues(values);
+ QPath path = QPath.makeChildPath(parent.getQPath(), name);
+ TransientPropertyData propData =
+ new TransientPropertyData(path, IdGenerator.generate(), -1, type, parent.getIdentifier(), multiValued, values);
+
return propData;
}
@@ -182,10 +222,6 @@
@Override
public TransientPropertyData clone()
{
- TransientPropertyData dataCopy =
- new TransientPropertyData(getQPath(), getIdentifier(), getPersistedVersion(), getType(),
- getParentIdentifier(), isMultiValued());
-
List<ValueData> copyValues = new ArrayList<ValueData>();
try
{
@@ -198,8 +234,11 @@
{
throw new RuntimeException(e);
}
- dataCopy.setValues(copyValues);
+ TransientPropertyData dataCopy =
+ new TransientPropertyData(getQPath(), getIdentifier(), getPersistedVersion(), getType(),
+ getParentIdentifier(), isMultiValued(), copyValues);
+
return dataCopy;
}
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/serialization/TransientPropertyDataReader.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/serialization/TransientPropertyDataReader.java 2009-12-08 08:46:46 UTC (rev 938)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/serialization/TransientPropertyDataReader.java 2009-12-08 08:46:54 UTC (rev 939)
@@ -114,8 +114,7 @@
int type = in.readInt();
boolean multiValued = in.readBoolean();
- TransientPropertyData prop =
- new TransientPropertyData(qpath, identifier, persistedVersion, type, parentIdentifier, multiValued);
+ TransientPropertyData prop;
if (in.readByte() == SerializationConstants.NOT_NULL_DATA)
{
@@ -127,8 +126,14 @@
{
values.add(rdr.read(in));
}
- prop.setValues(values);
+
+ prop =
+ new TransientPropertyData(qpath, identifier, persistedVersion, type, parentIdentifier, multiValued, values);
}
+ else
+ {
+ prop = new TransientPropertyData(qpath, identifier, persistedVersion, type, parentIdentifier, multiValued);
+ }
return prop;
}
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/LocalWorkspaceStorageDataManagerProxy.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/LocalWorkspaceStorageDataManagerProxy.java 2009-12-08 08:46:46 UTC (rev 938)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/LocalWorkspaceStorageDataManagerProxy.java 2009-12-08 08:46:54 UTC (rev 939)
@@ -120,14 +120,14 @@
{
return copyNodes(storageDataManager.getChildNodesData(parent));
}
-
+
/**
* {@inheritDoc}
*/
- public int getChildNodesCount(final NodeData parent) throws RepositoryException
+ public int getChildNodesCount(final NodeData parent) throws RepositoryException
{
return storageDataManager.getChildNodesCount(parent);
- }
+ }
/**
* {@inheritDoc}
@@ -187,13 +187,9 @@
// else - property
final PropertyData prop = (PropertyData)item;
- // make a copy
- TransientPropertyData newData =
- new TransientPropertyData(prop.getQPath(), prop.getIdentifier(), prop.getPersistedVersion(), prop.getType(),
- prop.getParentIdentifier(), prop.isMultiValued());
+ // make a copy, value may be null for deleting items
List<ValueData> values = null;
- // null is possible for deleting items
if (prop.getValues() != null)
{
values = new ArrayList<ValueData>();
@@ -202,7 +198,10 @@
values.add(((AbstractValueData)val).createTransientCopy());
}
}
- newData.setValues(values);
+ TransientPropertyData newData =
+ new TransientPropertyData(prop.getQPath(), prop.getIdentifier(), prop.getPersistedVersion(), prop.getType(),
+ prop.getParentIdentifier(), prop.isMultiValued(), values);
+
return newData;
}
@@ -215,9 +214,8 @@
// make a copy
TransientPropertyData newData =
new TransientPropertyData(property.getQPath(), property.getIdentifier(), property.getPersistedVersion(),
- property.getType(), property.getParentIdentifier(), property.isMultiValued());
+ property.getType(), property.getParentIdentifier(), property.isMultiValued(), new ArrayList<ValueData>());
- newData.setValues(new ArrayList<ValueData>());
return newData;
}
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/version/VersionHistoryDataHelper.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/version/VersionHistoryDataHelper.java 2009-12-08 08:46:46 UTC (rev 938)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/version/VersionHistoryDataHelper.java 2009-12-08 08:46:54 UTC (rev 939)
@@ -256,24 +256,25 @@
InternalQName vhName = new InternalQName(null, versionHistoryIdentifier);
TransientNodeData versionHistory =
- TransientNodeData.createNodeData(versionStorageData, vhName, Constants.NT_VERSIONHISTORY);
- versionHistory.setIdentifier(versionHistoryIdentifier);
+ TransientNodeData.createNodeData(versionStorageData, vhName, Constants.NT_VERSIONHISTORY,
+ versionHistoryIdentifier);
// jcr:primaryType
TransientPropertyData vhPrimaryType =
- TransientPropertyData.createPropertyData(versionHistory, Constants.JCR_PRIMARYTYPE, PropertyType.NAME, false);
- vhPrimaryType.setValue(new TransientValueData(versionHistory.getPrimaryTypeName()));
+ TransientPropertyData.createPropertyData(versionHistory, Constants.JCR_PRIMARYTYPE, PropertyType.NAME, false,
+ new TransientValueData(versionHistory.getPrimaryTypeName()));
// jcr:uuid
TransientPropertyData vhUuid =
- TransientPropertyData.createPropertyData(versionHistory, Constants.JCR_UUID, PropertyType.STRING, false);
- vhUuid.setValue(new TransientValueData(versionHistoryIdentifier));
+ TransientPropertyData.createPropertyData(versionHistory, Constants.JCR_UUID, PropertyType.STRING, false,
+ new TransientValueData(versionHistoryIdentifier));
// jcr:versionableUuid
- TransientPropertyData vhVersionableUuid = TransientPropertyData
- // [PN] 10.04.07 VERSIONABLEUUID isn't referenceable!!!
- .createPropertyData(versionHistory, Constants.JCR_VERSIONABLEUUID, PropertyType.STRING, false);
- vhVersionableUuid.setValue(new TransientValueData(new Identifier(versionable.getIdentifier())));
+ TransientPropertyData vhVersionableUuid =
+ TransientPropertyData
+ // [PN] 10.04.07 VERSIONABLEUUID isn't referenceable!!!
+ .createPropertyData(versionHistory, Constants.JCR_VERSIONABLEUUID, PropertyType.STRING, false,
+ new TransientValueData(new Identifier(versionable.getIdentifier())));
// ------ jcr:versionLabels ------
NodeData vhVersionLabels =
@@ -281,8 +282,8 @@
// jcr:primaryType
TransientPropertyData vlPrimaryType =
- TransientPropertyData.createPropertyData(vhVersionLabels, Constants.JCR_PRIMARYTYPE, PropertyType.NAME, false);
- vlPrimaryType.setValue(new TransientValueData(vhVersionLabels.getPrimaryTypeName()));
+ TransientPropertyData.createPropertyData(vhVersionLabels, Constants.JCR_PRIMARYTYPE, PropertyType.NAME, false,
+ new TransientValueData(vhVersionLabels.getPrimaryTypeName()));
// ------ jcr:rootVersion ------
NodeData rootVersionData =
@@ -291,47 +292,43 @@
// jcr:primaryType
TransientPropertyData rvPrimaryType =
- TransientPropertyData.createPropertyData(rootVersionData, Constants.JCR_PRIMARYTYPE, PropertyType.NAME, false);
- rvPrimaryType.setValue(new TransientValueData(rootVersionData.getPrimaryTypeName()));
+ TransientPropertyData.createPropertyData(rootVersionData, Constants.JCR_PRIMARYTYPE, PropertyType.NAME, false,
+ new TransientValueData(rootVersionData.getPrimaryTypeName()));
// jcr:uuid
TransientPropertyData rvUuid =
- TransientPropertyData.createPropertyData(rootVersionData, Constants.JCR_UUID, PropertyType.STRING, false);
- rvUuid.setValue(new TransientValueData(baseVersionIdentifier));
+ TransientPropertyData.createPropertyData(rootVersionData, Constants.JCR_UUID, PropertyType.STRING, false,
+ new TransientValueData(baseVersionIdentifier));
// jcr:mixinTypes
TransientPropertyData rvMixinTypes =
- TransientPropertyData.createPropertyData(rootVersionData, Constants.JCR_MIXINTYPES, PropertyType.NAME, true);
- rvMixinTypes.setValue(new TransientValueData(Constants.MIX_REFERENCEABLE));
+ TransientPropertyData.createPropertyData(rootVersionData, Constants.JCR_MIXINTYPES, PropertyType.NAME, true,
+ new TransientValueData(Constants.MIX_REFERENCEABLE));
// jcr:created
- TransientPropertyData rvCreated =
- TransientPropertyData.createPropertyData(rootVersionData, Constants.JCR_CREATED, PropertyType.DATE, false);
-
// TODO Current time source was
// rvCreated.setValue(new
// TransientValueData(dataManager.getTransactManager().getStorageDataManager
// ().getCurrentTime()));
- rvCreated.setValue(new TransientValueData(Calendar.getInstance()));
+ TransientPropertyData rvCreated =
+ TransientPropertyData.createPropertyData(rootVersionData, Constants.JCR_CREATED, PropertyType.DATE, false,
+ new TransientValueData(Calendar.getInstance()));
// ----- VERSIONABLE properties -----
// jcr:versionHistory
TransientPropertyData vh =
TransientPropertyData.createPropertyData(versionable, Constants.JCR_VERSIONHISTORY, PropertyType.REFERENCE,
- false);
- vh.setValue(new TransientValueData(new Identifier(versionHistoryIdentifier)));
+ false, new TransientValueData(new Identifier(versionHistoryIdentifier)));
// jcr:baseVersion
TransientPropertyData bv =
- TransientPropertyData
- .createPropertyData(versionable, Constants.JCR_BASEVERSION, PropertyType.REFERENCE, false);
- bv.setValue(new TransientValueData(new Identifier(baseVersionIdentifier)));
+ TransientPropertyData.createPropertyData(versionable, Constants.JCR_BASEVERSION, PropertyType.REFERENCE,
+ false, new TransientValueData(new Identifier(baseVersionIdentifier)));
// jcr:predecessors
TransientPropertyData pd =
- TransientPropertyData
- .createPropertyData(versionable, Constants.JCR_PREDECESSORS, PropertyType.REFERENCE, true);
- pd.setValue(new TransientValueData(new Identifier(baseVersionIdentifier)));
+ TransientPropertyData.createPropertyData(versionable, Constants.JCR_PREDECESSORS, PropertyType.REFERENCE,
+ true, new TransientValueData(new Identifier(baseVersionIdentifier)));
// update all
QPath vpath = versionable.getQPath();
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java 2009-12-08 08:46:46 UTC (rev 938)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java 2009-12-08 08:46:54 UTC (rev 939)
@@ -600,16 +600,17 @@
throw new RepositoryException(e);
}
}
-
+
/**
* {@inheritDoc}
*/
- public int getChildNodesCount(NodeData parent) throws RepositoryException {
+ public int getChildNodesCount(NodeData parent) throws RepositoryException
+ {
checkIfOpened();
try
{
ResultSet count = findChildNodesCountByParentIdentifier(getInternalId(parent.getIdentifier()));
- if (count.next())
+ if (count.next())
{
return count.getInt(1);
}
@@ -622,7 +623,7 @@
{
throw new RepositoryException(e);
}
- }
+ }
/**
* {@inheritDoc}
@@ -1198,9 +1199,9 @@
QPath qpath = QPath.makeChildPath(parentPath == null ? traverseQPath(cpid) : parentPath, qname);
PersistedPropertyData pdata =
- new PersistedPropertyData(getIdentifier(cid), qpath, getIdentifier(cpid), cversion, cptype, cpmultivalued);
+ new PersistedPropertyData(getIdentifier(cid), qpath, getIdentifier(cpid), cversion, cptype, cpmultivalued,
+ new ArrayList<ValueData>());
- pdata.setValues(new ArrayList<ValueData>());
return pdata;
}
catch (InvalidItemStateException e)
@@ -1606,10 +1607,11 @@
QPath qpath =
QPath.makeChildPath(parentPath == null ? traverseQPath(cpid) : parentPath, InternalQName.parse(cname));
+ String identifier = getIdentifier(cid);
+ List<ValueData> values = readValues(cid, identifier, cversion);
PersistedPropertyData pdata =
- new PersistedPropertyData(getIdentifier(cid), qpath, getIdentifier(cpid), cversion, cptype, cpmultivalued);
+ new PersistedPropertyData(identifier, qpath, getIdentifier(cpid), cversion, cptype, cpmultivalued, values);
- pdata.setValues(readValues(cid, pdata));
return pdata;
}
catch (IllegalNameException e)
@@ -1687,7 +1689,7 @@
* @throws ValueStorageNotFoundException
* if no such storage found with Value storageId
*/
- private List<ValueData> readValues(String cid, PropertyData pdata) throws IOException, SQLException,
+ private List<ValueData> readValues(String cid, String identifier, int cversion) throws IOException, SQLException,
ValueStorageNotFoundException
{
@@ -1701,8 +1703,8 @@
final int orderNum = valueRecords.getInt(COLUMN_VORDERNUM);
final String storageId = valueRecords.getString(COLUMN_VSTORAGE_DESC);
ValueData vdata =
- valueRecords.wasNull() ? readValueData(cid, orderNum, pdata.getPersistedVersion(), valueRecords
- .getBinaryStream(COLUMN_VDATA)) : readValueData(pdata, orderNum, storageId);
+ valueRecords.wasNull() ? readValueData(cid, orderNum, cversion, valueRecords
+ .getBinaryStream(COLUMN_VDATA)) : readValueData(identifier, orderNum, storageId);
data.add(vdata);
}
}
@@ -1731,13 +1733,13 @@
* @throws ValueStorageNotFoundException
* if no such storage found with Value storageId
*/
- protected ValueData readValueData(PropertyData pdata, int orderNumber, String storageId) throws SQLException,
+ protected ValueData readValueData(String identifier, int orderNumber, String storageId) throws SQLException,
IOException, ValueStorageNotFoundException
{
ValueIOChannel channel = valueStorageProvider.getChannel(storageId);
try
{
- return channel.read(pdata.getIdentifier(), orderNumber, maxBufferSize);
+ return channel.read(identifier, orderNumber, maxBufferSize);
}
finally
{
@@ -1894,7 +1896,7 @@
protected abstract ResultSet findItemByName(String parentId, String name, int index) throws SQLException;
protected abstract ResultSet findChildNodesByParentIdentifier(String parentIdentifier) throws SQLException;
-
+
protected abstract ResultSet findChildNodesCountByParentIdentifier(String parentIdentifier) throws SQLException;
protected abstract ResultSet findChildPropertiesByParentIdentifier(String parentIdentifier) throws SQLException;
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/util/VersionHistoryImporter.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/util/VersionHistoryImporter.java 2009-12-08 08:46:46 UTC (rev 938)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/util/VersionHistoryImporter.java 2009-12-08 08:46:54 UTC (rev 939)
@@ -24,6 +24,7 @@
import org.exoplatform.services.jcr.dataflow.PlainChangesLogImpl;
import org.exoplatform.services.jcr.datamodel.Identifier;
import org.exoplatform.services.jcr.datamodel.NodeData;
+import org.exoplatform.services.jcr.datamodel.ValueData;
import org.exoplatform.services.jcr.impl.Constants;
import org.exoplatform.services.jcr.impl.core.NodeImpl;
import org.exoplatform.services.jcr.impl.core.PropertyImpl;
@@ -37,6 +38,8 @@
import java.io.IOException;
import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
import javax.jcr.PropertyType;
import javax.jcr.RepositoryException;
@@ -134,23 +137,22 @@
// jcr:versionHistory
TransientPropertyData vh =
TransientPropertyData.createPropertyData(versionable, Constants.JCR_VERSIONHISTORY, PropertyType.REFERENCE,
- false);
- vh.setValue(new TransientValueData(new Identifier(versionHistory)));
+ false, new TransientValueData(new Identifier(versionHistory)));
// jcr:baseVersion
TransientPropertyData bv =
- TransientPropertyData
- .createPropertyData(versionable, Constants.JCR_BASEVERSION, PropertyType.REFERENCE, false);
- bv.setValue(new TransientValueData(new Identifier(baseVersionUuid)));
+ TransientPropertyData.createPropertyData(versionable, Constants.JCR_BASEVERSION, PropertyType.REFERENCE,
+ false, new TransientValueData(new Identifier(baseVersionUuid)));
// jcr:predecessors
- TransientPropertyData pd =
- TransientPropertyData
- .createPropertyData(versionable, Constants.JCR_PREDECESSORS, PropertyType.REFERENCE, true);
+ List<ValueData> values = new ArrayList<ValueData>();
for (int i = 0; i < predecessors.length; i++)
{
- pd.setValue(new TransientValueData(new Identifier(predecessors[i])));
+ values.add(new TransientValueData(new Identifier(predecessors[i])));
}
+ TransientPropertyData pd =
+ TransientPropertyData.createPropertyData(versionable, Constants.JCR_PREDECESSORS, PropertyType.REFERENCE,
+ true, values);
PlainChangesLog changesLog = new PlainChangesLogImpl();
RemoveVisitor rv = new RemoveVisitor();
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/importing/TestSystemViewCollision.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/importing/TestSystemViewCollision.java 2009-12-08 08:46:46 UTC (rev 938)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/importing/TestSystemViewCollision.java 2009-12-08 08:46:54 UTC (rev 939)
@@ -119,8 +119,8 @@
"nodeWithPredefUuid"), Constants.NT_UNSTRUCTURED, "id_uuidNode1");
changesLog.add(ItemState.createAddedState(testNodeData));
TransientPropertyData primaryType =
- TransientPropertyData.createPropertyData(testNodeData, Constants.JCR_PRIMARYTYPE, PropertyType.NAME, false);
- primaryType.setValue(new TransientValueData(testNodeData.getPrimaryTypeName()));
+ TransientPropertyData.createPropertyData(testNodeData, Constants.JCR_PRIMARYTYPE, PropertyType.NAME, false,
+ new TransientValueData(testNodeData.getPrimaryTypeName()));
changesLog.add(ItemState.createAddedState(primaryType));
session.getTransientNodesManager().getTransactManager().save(changesLog);
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestSessionDataManager.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestSessionDataManager.java 2009-12-08 08:46:46 UTC (rev 938)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestSessionDataManager.java 2009-12-08 08:46:54 UTC (rev 939)
@@ -70,8 +70,7 @@
testRoot = (NodeImpl)modificationManager.update(ItemState.createAddedState(data), false);
TransientPropertyData prop =
TransientPropertyData.createPropertyData(data, new InternalQName(Constants.NS_JCR_URI, "primaryType"),
- PropertyType.NAME, false);
- prop.setValue(new TransientValueData(new InternalQName(Constants.NS_NT_URI, "unstructured")));
+ PropertyType.NAME, false, new TransientValueData(new InternalQName(Constants.NS_NT_URI, "unstructured")));
PropertyImpl prop1 = (PropertyImpl)modificationManager.update(ItemState.createAddedState(prop), false);
// System.out.println("Test root >>>>>> "+testRoot+" "+prop1);
@@ -152,7 +151,6 @@
List<PropertyImpl> testProps = pool.getProperties(props);
assertEquals(1, testProps.size());
assertEquals(prop1, testProps.get(0));
- prop.setValue(new TransientValueData(new InternalQName(Constants.NS_NT_URI, "unstructured")));
pool.remove(uuid);
// in case for GC
@@ -212,9 +210,7 @@
// ... add property to the node1
TransientPropertyData prop =
TransientPropertyData.createPropertyData((NodeData)node1.getData(), new InternalQName(null,
- "testSessionChangesLogP1"), PropertyType.STRING, false);
- TransientValueData vData = new TransientValueData(false);
- prop.setValue(vData);
+ "testSessionChangesLogP1"), PropertyType.STRING, false, new TransientValueData(false));
PropertyImpl prop1 = (PropertyImpl)modificationManager.update(ItemState.createAddedState(prop), true);
assertTrue(changesLog.getItemState(node1.getInternalIdentifier()).isAdded());
@@ -247,9 +243,7 @@
// ... add property
TransientPropertyData prop =
TransientPropertyData.createPropertyData(parent, new InternalQName(null, "testReadMethodsP1"),
- PropertyType.STRING, false);
- TransientValueData vData = new TransientValueData(false);
- prop.setValue(vData);
+ PropertyType.STRING, false, new TransientValueData(false));
PropertyImpl prop1 = (PropertyImpl)modificationManager.update(ItemState.createAddedState(prop), true);
assertNotNull(modificationManager.getItemData(data.getQPath()));
@@ -294,8 +288,7 @@
NodeImpl node1 = (NodeImpl)modificationManager.update(ItemState.createAddedState(data1), true);
TransientPropertyData nt =
TransientPropertyData.createPropertyData(data1, new InternalQName(Constants.NS_JCR_URI, "primaryType"),
- PropertyType.NAME, false);
- nt.setValue(new TransientValueData(new InternalQName(Constants.NS_NT_URI, "unstructured")));
+ PropertyType.NAME, false, new TransientValueData(new InternalQName(Constants.NS_NT_URI, "unstructured")));
modificationManager.update(ItemState.createAddedState(nt), true);
assertEquals(1, modificationManager.getChildPropertiesData(data1).size());
@@ -311,8 +304,7 @@
// ... add property
TransientPropertyData prop =
TransientPropertyData.createPropertyData(parent, new InternalQName(null, "testCommitAndRefreshP1"),
- PropertyType.STRING, false);
- prop.setValue(new TransientValueData("test"));
+ PropertyType.STRING, false, new TransientValueData("test"));
modificationManager.update(ItemState.createAddedState(prop), true);
assertEquals("test", ((PropertyImpl)modificationManager.getItem(prop.getQPath(), true)).getString());
}
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestLinkedCacheMultithread.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestLinkedCacheMultithread.java 2009-12-08 08:46:46 UTC (rev 938)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestLinkedCacheMultithread.java 2009-12-08 08:46:54 UTC (rev 939)
@@ -166,8 +166,7 @@
TransientPropertyData pd =
new TransientPropertyData(QPath.makeChildPath(rndNode.getQPath(), InternalQName
.parse("[]property-" + next)), IdGenerator.generate(), 1, PropertyType.STRING, rndNode
- .getIdentifier(), false);
- pd.setValue(new TransientValueData("prop data"));
+ .getIdentifier(), false, new TransientValueData("prop data"));
cache.put(pd);
}
itemsProcessed++;
@@ -347,8 +346,8 @@
{
TransientPropertyData pd =
new TransientPropertyData(QPath.makeChildPath(parent.getQPath(), InternalQName.parse("[]property-" + i)),
- IdGenerator.generate(), 1, PropertyType.STRING, parent.getIdentifier(), false);
- pd.setValue(new TransientValueData("prop data"));
+ IdGenerator.generate(), 1, PropertyType.STRING, parent.getIdentifier(), false, new TransientValueData(
+ "prop data"));
props.add(pd);
}
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspaceStorageCacheBaseCase.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspaceStorageCacheBaseCase.java 2009-12-08 08:46:46 UTC (rev 938)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspaceStorageCacheBaseCase.java 2009-12-08 08:46:54 UTC (rev 939)
@@ -192,95 +192,43 @@
private void initDataAsPersisted()
{
- propertyData11 =
- new PersistedPropertyData(propertyUuid11, propertyPath11, nodeUuid1, 1, PropertyType.STRING, false);
List<ValueData> stringData = new ArrayList<ValueData>();
stringData.add(new ByteArrayPersistedValueData("property data 1".getBytes(), 0));
stringData.add(new ByteArrayPersistedValueData("property data 2".getBytes(), 1));
stringData.add(new ByteArrayPersistedValueData("property data 3".getBytes(), 2));
- try
- {
- ((PersistedPropertyData)propertyData11).setValues(stringData);
- }
- catch (RepositoryException e)
- {
- e.printStackTrace();
- fail(e.getMessage());
- }
+ propertyData11 =
+ new PersistedPropertyData(propertyUuid11, propertyPath11, nodeUuid1, 1, PropertyType.STRING, false, stringData);
- propertyData12 =
- new PersistedPropertyData(propertyUuid12, propertyPath12, nodeUuid1, 1, PropertyType.BINARY, false);
List<ValueData> binData = new ArrayList<ValueData>();
binData.add(new ByteArrayPersistedValueData("property data bin 1".getBytes(), 0));
- try
- {
- ((PersistedPropertyData)propertyData12).setValues(binData);
- }
- catch (RepositoryException e)
- {
- e.printStackTrace();
- fail(e.getMessage());
- }
+ propertyData12 =
+ new PersistedPropertyData(propertyUuid12, propertyPath12, nodeUuid1, 1, PropertyType.BINARY, false, binData);
- propertyData21 =
- new PersistedPropertyData(propertyUuid21, propertyPath21, nodeUuid2, 1, PropertyType.STRING, true);
List<ValueData> stringData1 = new ArrayList<ValueData>();
stringData1.add(new ByteArrayPersistedValueData("property data 1".getBytes(), 0));
stringData1.add(new ByteArrayPersistedValueData("property data 2".getBytes(), 1));
stringData1.add(new ByteArrayPersistedValueData("property data 3".getBytes(), 2));
- try
- {
- ((PersistedPropertyData)propertyData21).setValues(stringData1);
- }
- catch (RepositoryException e)
- {
- e.printStackTrace();
- fail(e.getMessage());
- }
+ propertyData21 =
+ new PersistedPropertyData(propertyUuid21, propertyPath21, nodeUuid2, 1, PropertyType.STRING, true, stringData);
- propertyData22 =
- new PersistedPropertyData(propertyUuid22, propertyPath22, nodeUuid2, 1, PropertyType.BOOLEAN, false);
List<ValueData> booleanData = new ArrayList<ValueData>();
booleanData.add(new ByteArrayPersistedValueData("true".getBytes(), 0));
- try
- {
- ((PersistedPropertyData)propertyData22).setValues(booleanData);
- }
- catch (RepositoryException e)
- {
- e.printStackTrace();
- fail(e.getMessage());
- }
+ propertyData22 =
+ new PersistedPropertyData(propertyUuid22, propertyPath22, nodeUuid2, 1, PropertyType.BOOLEAN, false,
+ booleanData);
- propertyData311 =
- new PersistedPropertyData(propertyUuid311, propertyPath311, nodeUuid31, 1, PropertyType.LONG, false);
List<ValueData> longData = new ArrayList<ValueData>();
longData.add(new ByteArrayPersistedValueData(new Long(123456).toString().getBytes(), 0));
- try
- {
- ((PersistedPropertyData)propertyData311).setValues(longData);
- }
- catch (RepositoryException e)
- {
- e.printStackTrace();
- fail(e.getMessage());
- }
+ propertyData311 =
+ new PersistedPropertyData(propertyUuid311, propertyPath311, nodeUuid31, 1, PropertyType.LONG, false, longData);
- propertyData312 =
- new PersistedPropertyData(propertyUuid312, propertyPath312, nodeUuid31, 1, PropertyType.REFERENCE, true);
List<ValueData> refData = new ArrayList<ValueData>();
refData.add(new ByteArrayPersistedValueData(nodeUuid1.getBytes(), 0));
refData.add(new ByteArrayPersistedValueData(nodeUuid2.getBytes(), 1));
refData.add(new ByteArrayPersistedValueData(nodeUuid3.getBytes(), 2));
- try
- {
- ((PersistedPropertyData)propertyData312).setValues(refData);
- }
- catch (RepositoryException e)
- {
- e.printStackTrace();
- fail(e.getMessage());
- }
+ propertyData312 =
+ new PersistedPropertyData(propertyUuid312, propertyPath312, nodeUuid31, 1, PropertyType.REFERENCE, true,
+ refData);
}
public void testGetItem_Persisted() throws Exception
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/session/SessionChangesLogTest.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/session/SessionChangesLogTest.java 2009-12-08 08:46:46 UTC (rev 938)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/session/SessionChangesLogTest.java 2009-12-08 08:46:54 UTC (rev 939)
@@ -205,8 +205,8 @@
// jcr:primaryType
TransientPropertyData ndpt =
- TransientPropertyData.createPropertyData(ndata, Constants.JCR_PRIMARYTYPE, PropertyType.NAME, false);
- ndpt.setValue(new TransientValueData(ndata.getPrimaryTypeName()));
+ TransientPropertyData.createPropertyData(ndata, Constants.JCR_PRIMARYTYPE, PropertyType.NAME, false,
+ new TransientValueData(ndata.getPrimaryTypeName()));
slog.add(ItemState.createAddedState(ndata));
slog.add(ItemState.createAddedState(ndpt));
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/JDBCWDCTest.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/JDBCWDCTest.java 2009-12-08 08:46:46 UTC (rev 938)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/JDBCWDCTest.java 2009-12-08 08:46:54 UTC (rev 939)
@@ -163,11 +163,12 @@
NodeData node =
new TransientNodeData(rootPath, Constants.ROOT_UUID, 1, nt, new InternalQName[0], 0, null,
new AccessControlList());
+
+ ValueData vd = new TransientValueData(Constants.NT_UNSTRUCTURED.getAsString());
TransientPropertyData ntProp =
new TransientPropertyData(QPath.makeChildPath(rootPath, Constants.JCR_PRIMARYTYPE), "1", 1, PropertyType.NAME,
- Constants.ROOT_UUID, false);
- ValueData vd = new TransientValueData(Constants.NT_UNSTRUCTURED.getAsString());
- ntProp.setValue(vd);
+ Constants.ROOT_UUID, false, vd);
+
conn.add(node);
conn.add(ntProp);
conn.commit();
@@ -176,5 +177,4 @@
// assertEquals("nt:unstructured",
// locationFactory.createJCRName(root.getPrimaryTypeName()).getAsString());
}
-
}
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/StorageUpdateTest.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/StorageUpdateTest.java 2009-12-08 08:46:46 UTC (rev 938)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/StorageUpdateTest.java 2009-12-08 08:46:54 UTC (rev 939)
@@ -137,11 +137,11 @@
// =============================================================
PropertyData jcrUuid = (PropertyData)((PropertyImpl)node_V.getProperty("jcr:uuid")).getData();
+ // Set a uuid of source node in Workspace.copy()
TransientPropertyData bugData =
new TransientPropertyData(jcrUuid.getQPath(), jcrUuid.getIdentifier(), jcrUuid.getPersistedVersion(), jcrUuid
- .getType(), jcrUuid.getParentIdentifier(), jcrUuid.isMultiValued());
- // Set a uuid of source node in Workspace.copy()
- bugData.setValue(new TransientValueData(node_R.getProperty("jcr:uuid").getString()));
+ .getType(), jcrUuid.getParentIdentifier(), jcrUuid.isMultiValued(), new TransientValueData(node_R
+ .getProperty("jcr:uuid").getString()));
WorkspaceStorageConnection conn = dataContainer.openConnection();
if (conn instanceof JDBCStorageConnection)
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/version/BaseVersionImplTest.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/version/BaseVersionImplTest.java 2009-12-08 08:46:46 UTC (rev 938)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/version/BaseVersionImplTest.java 2009-12-08 08:46:54 UTC (rev 939)
@@ -270,8 +270,8 @@
versionableLog = new SessionChangesLog(session.getId());
// target node
- versionable = TransientNodeData.createNodeData(testRoot, nodeName1, Constants.NT_UNSTRUCTURED, nodeUuid1);
- ((TransientNodeData)versionable).setMixinTypeNames(mixVersionable);
+ versionable =
+ TransientNodeData.createNodeData(testRoot, nodeName1, Constants.NT_UNSTRUCTURED, mixVersionable, nodeUuid1);
versionableLog.add(ItemState.createAddedState(versionable));
PropertyData vChildProperty1 =
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/usecases/TestRollbackBigFiles.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/usecases/TestRollbackBigFiles.java 2009-12-08 08:46:46 UTC (rev 938)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/usecases/TestRollbackBigFiles.java 2009-12-08 08:46:54 UTC (rev 939)
@@ -80,14 +80,11 @@
// added big file property
JCRPath propPath = session.getLocationFactory().parseRelPath("bigProp");
+ File f = this.createBLOBTempFile(1024);
TransientPropertyData newProperty =
new TransientPropertyData(propPath.getInternalPath(), IdGenerator.generate(), -1, PropertyType.BINARY, newNode
- .getIdentifier(), false);
+ .getIdentifier(), false, new TransientValueData(new FileInputStream(f)));
- File f = this.createBLOBTempFile(1024);
- TransientValueData value = new TransientValueData(new FileInputStream(f));
- newProperty.setValue(value);
-
list.add(new ItemState(newProperty, ItemState.ADDED, false, parent.getQPath()));
// crate broken node;
@@ -119,5 +116,4 @@
assertNull("Item should not be found", dm.getItemData(id));
}
-
}
16 years, 7 months
exo-jcr SVN: r938 - jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache.
by do-not-reply@jboss.org
Author: pnedonosko
Date: 2009-12-08 03:46:46 -0500 (Tue, 08 Dec 2009)
New Revision: 938
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheWorkspaceDataContainer.java
Log:
EXOJCR-119: cleanup and TODO
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java 2009-12-07 16:59:09 UTC (rev 937)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java 2009-12-08 08:46:46 UTC (rev 938)
@@ -589,12 +589,11 @@
}
else
{
- // TODO move usecase: re-load on demand, try cache.evict(node.getFqn());
throw new RepositoryException("FATAL NodeData empty " + identifier);
}
}
- // only Nodes by Id
+ // TODO only Nodes by Id
// else
// {
// Node<Serializable, Object> prop = propsRoot.getChild(makePropFqn(identifier));
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheWorkspaceDataContainer.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheWorkspaceDataContainer.java 2009-12-07 16:59:09 UTC (rev 937)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheWorkspaceDataContainer.java 2009-12-08 08:46:46 UTC (rev 938)
@@ -160,12 +160,6 @@
*/
public WorkspaceStorageConnection openConnection() throws RepositoryException
{
- // TODO
- // if (nodes == null || properties == null)
- // {
- // throw new RepositoryException("Container is not started");
- // }
-
return new JBossCacheStorageConnection(cache, nodes, properties, locks, refs);
}
@@ -174,12 +168,6 @@
*/
public WorkspaceStorageConnection openConnection(boolean readOnly) throws RepositoryException
{
- // TODO
- // if (nodes == null || properties == null)
- // {
- // throw new RepositoryException("Container is not started");
- // }
-
return new JBossCacheStorageConnection(cache, nodes, properties, locks, refs);
}
16 years, 7 months
exo-jcr SVN: r937 - jcr/branches/1.12.0-JBC/component/core/src/test/resources/conf/test.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2009-12-07 11:59:09 -0500 (Mon, 07 Dec 2009)
New Revision: 937
Modified:
jcr/branches/1.12.0-JBC/component/core/src/test/resources/conf/test/nodetypes-usecase.xml
Log:
EXOJCR-293 : The property with type reference should not have default value.
Modified: jcr/branches/1.12.0-JBC/component/core/src/test/resources/conf/test/nodetypes-usecase.xml
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/test/resources/conf/test/nodetypes-usecase.xml 2009-12-07 16:07:05 UTC (rev 936)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/resources/conf/test/nodetypes-usecase.xml 2009-12-07 16:59:09 UTC (rev 937)
@@ -98,9 +98,6 @@
<propertyDefinition name="rma:superseded" requiredType="Reference" autoCreated="true" mandatory="false" onParentVersion="COPY"
protected="false" multiple="false">
<valueConstraints />
- <defaultValues>
- <defaultValue>false</defaultValue>
- </defaultValues>
</propertyDefinition>
<propertyDefinition name="rma:recordNote" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="COPY"
protected="false" multiple="false">
@@ -220,38 +217,38 @@
</propertyDefinition>
</propertyDefinitions>
</nodeType -->
-
- <nodeType name="exo:myType" isMixin="false" hasOrderableChildNodes="true" primaryItemName="">
- <supertypes>
- <supertype>nt:base</supertype>
- </supertypes>
- <propertyDefinitions>
- <propertyDefinition name="prop1" requiredType="undefined" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false"
- multiple="true">
- <valueConstraints />
- </propertyDefinition>
- </propertyDefinitions>
- </nodeType>
-
- <nodeType name="exo:archiveable" isMixin="true" hasOrderableChildNodes="false" primaryItemName="">
- <propertyDefinitions>
- <propertyDefinition name="exo:restorePath" requiredType="String" autoCreated="false" mandatory="true" onParentVersion="COPY"
- protected="false" multiple="false">
- <valueConstraints />
- </propertyDefinition>
- </propertyDefinitions>
- </nodeType>
- <nodeType name="exo:rss-enable" isMixin="true" hasOrderableChildNodes="false" primaryItemName="">
- <propertyDefinitions>
- <propertyDefinition name="exo:title" requiredType="String" autoCreated="false" mandatory="true" onParentVersion="COPY" protected="false"
- multiple="false">
- <valueConstraints />
- </propertyDefinition>
- <propertyDefinition name="exo:summary" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false"
- multiple="false">
- <valueConstraints />
- </propertyDefinition>
- </propertyDefinitions>
+
+ <nodeType name="exo:myType" isMixin="false" hasOrderableChildNodes="true" primaryItemName="">
+ <supertypes>
+ <supertype>nt:base</supertype>
+ </supertypes>
+ <propertyDefinitions>
+ <propertyDefinition name="prop1" requiredType="undefined" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false"
+ multiple="true">
+ <valueConstraints />
+ </propertyDefinition>
+ </propertyDefinitions>
</nodeType>
+ <nodeType name="exo:archiveable" isMixin="true" hasOrderableChildNodes="false" primaryItemName="">
+ <propertyDefinitions>
+ <propertyDefinition name="exo:restorePath" requiredType="String" autoCreated="false" mandatory="true" onParentVersion="COPY"
+ protected="false" multiple="false">
+ <valueConstraints />
+ </propertyDefinition>
+ </propertyDefinitions>
+ </nodeType>
+ <nodeType name="exo:rss-enable" isMixin="true" hasOrderableChildNodes="false" primaryItemName="">
+ <propertyDefinitions>
+ <propertyDefinition name="exo:title" requiredType="String" autoCreated="false" mandatory="true" onParentVersion="COPY" protected="false"
+ multiple="false">
+ <valueConstraints />
+ </propertyDefinition>
+ <propertyDefinition name="exo:summary" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false"
+ multiple="false">
+ <valueConstraints />
+ </propertyDefinition>
+ </propertyDefinitions>
+ </nodeType>
+
</nodeTypes>
16 years, 7 months
exo-jcr SVN: r936 - jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query.
by do-not-reply@jboss.org
Author: skabashnyuk
Date: 2009-12-07 11:07:05 -0500 (Mon, 07 Dec 2009)
New Revision: 936
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/DefaultChangesFilter.java
Log:
EXOJCR-283: Removed code duplication
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/DefaultChangesFilter.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/DefaultChangesFilter.java 2009-12-07 16:03:16 UTC (rev 935)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/DefaultChangesFilter.java 2009-12-07 16:07:05 UTC (rev 936)
@@ -66,7 +66,6 @@
try
{
searchManager.updateIndex(removedNodes, addedNodes);
- parentSearchManager.updateIndex(parentRemovedNodes, parentAddedNodes);
}
catch (RepositoryException e)
{
16 years, 7 months
exo-jcr SVN: r935 - in jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query: jbosscache and 1 other directory.
by do-not-reply@jboss.org
Author: skabashnyuk
Date: 2009-12-07 11:03:16 -0500 (Mon, 07 Dec 2009)
New Revision: 935
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/DefaultChangesFilter.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/IndexerChangesFilter.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/QueryHandlerContext.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SystemSearchManager.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JbossCacheIndexChangesFilter.java
Log:
EXOJCR-283: System indexer logic changed
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/DefaultChangesFilter.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/DefaultChangesFilter.java 2009-12-07 14:27:08 UTC (rev 934)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/DefaultChangesFilter.java 2009-12-07 16:03:16 UTC (rev 935)
@@ -35,32 +35,38 @@
public class DefaultChangesFilter extends IndexerChangesFilter
{
/**
- * Logger instance for this class
- */
- private static final Log log = ExoLogger.getLogger(DefaultChangesFilter.class);
-
- /**
* @param searchManager
- * @param handler
+ * @param parentSearchManager
+ * @param config
* @param indexingTree
+ * @param parentIndexingTree
*/
- public DefaultChangesFilter(SearchManager searchManager, QueryHandlerEntry config, IndexingTree indexingTree)
+ public DefaultChangesFilter(SearchManager searchManager, SearchManager parentSearchManager,
+ QueryHandlerEntry config, IndexingTree indexingTree, IndexingTree parentIndexingTree)
{
- super(searchManager, config, indexingTree);
+ super(searchManager, parentSearchManager, config, indexingTree, parentIndexingTree);
+ // TODO Auto-generated constructor stub
}
/**
+ * Logger instance for this class
+ */
+ private static final Log log = ExoLogger.getLogger(DefaultChangesFilter.class);
+
+ /**
* @param removedNodes
* @param addedNodes
* @see org.exoplatform.services.jcr.impl.core.query.IndexerChangesFilter#doUpdateIndex()
*/
@Override
- protected void doUpdateIndex(Set<String> removedNodes, Set<String> addedNodes)
+ protected void doUpdateIndex(Set<String> removedNodes, Set<String> addedNodes, Set<String> parentRemovedNodes,
+ Set<String> parentAddedNodes)
{
try
{
searchManager.updateIndex(removedNodes, addedNodes);
+ parentSearchManager.updateIndex(parentRemovedNodes, parentAddedNodes);
}
catch (RepositoryException e)
{
@@ -79,6 +85,27 @@
}
}
+ try
+ {
+ parentSearchManager.updateIndex(parentRemovedNodes, parentAddedNodes);
+ }
+ catch (RepositoryException e)
+ {
+ log.error("Error indexing changes " + e, e);
+ }
+ catch (IOException e)
+ {
+ log.error("Error indexing changes " + e, e);
+ try
+ {
+ parentHandler.logErrorChanges(removedNodes, addedNodes);
+ }
+ catch (IOException ioe)
+ {
+ log.warn("Exception occure when errorLog writed. Error log is not complete. " + ioe, ioe);
+ }
+ }
+
}
}
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/IndexerChangesFilter.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/IndexerChangesFilter.java 2009-12-07 14:27:08 UTC (rev 934)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/IndexerChangesFilter.java 2009-12-07 16:03:16 UTC (rev 935)
@@ -51,19 +51,28 @@
protected QueryHandler handler;
+ protected QueryHandler parentHandler;
+
protected final IndexingTree indexingTree;
+ protected final SearchManager parentSearchManager;
+
+ protected final IndexingTree parentIndexingTree;
+
/**
* @param searchManager
+ * @param isSystem
* @param handler
* @param indexingTree
*/
- public IndexerChangesFilter(SearchManager searchManager, QueryHandlerEntry config, IndexingTree indexingTree)
+ public IndexerChangesFilter(SearchManager searchManager, SearchManager parentSearchManager,
+ QueryHandlerEntry config, IndexingTree indexingTree, IndexingTree parentIndexingTree)
{
super();
this.searchManager = searchManager;
+ this.parentSearchManager = parentSearchManager;
this.config = config;
-
+ this.parentIndexingTree = parentIndexingTree;
this.indexingTree = indexingTree;
}
@@ -76,11 +85,11 @@
}
/**
- * @param handler the handler to set
+ * @return the indexingTree
*/
- public void setHandler(QueryHandler handler)
+ public IndexingTree getIndexingTree()
{
- this.handler = handler;
+ return indexingTree;
}
/**
@@ -92,14 +101,6 @@
}
/**
- * @return the indexingTree
- */
- public IndexingTree getIndexingTree()
- {
- return indexingTree;
- }
-
- /**
* @see org.exoplatform.services.jcr.dataflow.persistent.ItemsPersistenceListener#onSaveItems(org.exoplatform.services.jcr.dataflow.ItemStateChangesLog)
*/
public void onSaveItems(ItemStateChangesLog itemStates)
@@ -111,85 +112,139 @@
final Set<String> removedNodes = new HashSet<String>();
// nodes that need to be added to the index.
final Set<String> addedNodes = new HashSet<String>();
-
+ //updated
final Map<String, List<ItemState>> updatedNodes = new HashMap<String, List<ItemState>>();
+ final Set<String> parentRemovedNodes = new HashSet<String>();
+ // nodes that need to be added to the index.
+ final Set<String> parentAddedNodes = new HashSet<String>();
+ //updated
+ final Map<String, List<ItemState>> parentUpdatedNodes = new HashMap<String, List<ItemState>>();
+
for (Iterator<ItemState> iter = itemStates.getAllStates().iterator(); iter.hasNext();)
{
ItemState itemState = iter.next();
if (!indexingTree.isExcluded(itemState))
{
- String uuid =
- itemState.isNode() ? itemState.getData().getIdentifier() : itemState.getData().getParentIdentifier();
+ acceptChanges(removedNodes, addedNodes, updatedNodes, itemState);
+ }
+ else if (parentIndexingTree != null && !parentIndexingTree.isExcluded(itemState))
+ {
+ acceptChanges(parentRemovedNodes, parentAddedNodes, parentUpdatedNodes, itemState);
+ }
+ }
- if (itemState.isAdded())
+ for (String uuid : updatedNodes.keySet())
+ {
+ removedNodes.add(uuid);
+ addedNodes.add(uuid);
+ }
+
+ for (String uuid : parentUpdatedNodes.keySet())
+ {
+ parentRemovedNodes.add(uuid);
+ parentAddedNodes.add(uuid);
+ }
+
+ doUpdateIndex(removedNodes, addedNodes, parentRemovedNodes, parentAddedNodes);
+ }
+
+ /**
+ * @param removedNodes
+ * @param addedNodes
+ * @param updatedNodes
+ * @param itemState
+ */
+ private void acceptChanges(final Set<String> removedNodes, final Set<String> addedNodes,
+ final Map<String, List<ItemState>> updatedNodes, ItemState itemState)
+ {
+ {
+ String uuid =
+ itemState.isNode() ? itemState.getData().getIdentifier() : itemState.getData().getParentIdentifier();
+
+ if (itemState.isAdded())
+ {
+ if (itemState.isNode())
{
- if (itemState.isNode())
- {
- addedNodes.add(uuid);
- }
- else
- {
- if (!addedNodes.contains(uuid))
- {
- createNewOrAdd(uuid, itemState, updatedNodes);
- }
- }
+ addedNodes.add(uuid);
}
- else if (itemState.isRenamed())
+ else
{
- if (itemState.isNode())
+ if (!addedNodes.contains(uuid))
{
- addedNodes.add(uuid);
- }
- else
- {
createNewOrAdd(uuid, itemState, updatedNodes);
}
}
- else if (itemState.isUpdated())
+ }
+ else if (itemState.isRenamed())
+ {
+ if (itemState.isNode())
{
- createNewOrAdd(uuid, itemState, updatedNodes);
+ addedNodes.add(uuid);
}
- else if (itemState.isMixinChanged())
+ else
{
createNewOrAdd(uuid, itemState, updatedNodes);
}
- else if (itemState.isDeleted())
+ }
+ else if (itemState.isUpdated())
+ {
+ createNewOrAdd(uuid, itemState, updatedNodes);
+ }
+ else if (itemState.isMixinChanged())
+ {
+ createNewOrAdd(uuid, itemState, updatedNodes);
+ }
+ else if (itemState.isDeleted())
+ {
+ if (itemState.isNode())
{
- if (itemState.isNode())
+ if (addedNodes.contains(uuid))
{
- if (addedNodes.contains(uuid))
- {
- addedNodes.remove(uuid);
- removedNodes.remove(uuid);
- }
- else
- {
- removedNodes.add(uuid);
- }
- // remove all changes after node remove
- updatedNodes.remove(uuid);
+ addedNodes.remove(uuid);
+ removedNodes.remove(uuid);
}
else
{
- if (!removedNodes.contains(uuid) && !addedNodes.contains(uuid))
- {
- createNewOrAdd(uuid, itemState, updatedNodes);
- }
+ removedNodes.add(uuid);
}
+ // remove all changes after node remove
+ updatedNodes.remove(uuid);
}
+ else
+ {
+ if (!removedNodes.contains(uuid) && !addedNodes.contains(uuid))
+ {
+ createNewOrAdd(uuid, itemState, updatedNodes);
+ }
+ }
}
}
+ }
- for (String uuid : updatedNodes.keySet())
- {
- removedNodes.add(uuid);
- addedNodes.add(uuid);
- }
+ /**
+ * @param handler the handler to set
+ */
+ public void setHandler(QueryHandler handler)
+ {
+ this.handler = handler;
+ }
- doUpdateIndex(removedNodes, addedNodes);
+ /**
+ * Update index.
+ * @param removedNodes
+ * @param addedNodes
+ */
+ protected abstract void doUpdateIndex(Set<String> removedNodes, Set<String> addedNodes,
+ Set<String> parentRemovedNodes, Set<String> parentAddedNodes);
+
+ /**
+ * @param parentHandler the parentHandler to set
+ */
+ protected void setParentHandler(QueryHandler parentHandler)
+ {
+ this.parentHandler = parentHandler;
}
private void createNewOrAdd(String key, ItemState state, Map<String, List<ItemState>> updatedNodes)
@@ -204,11 +259,4 @@
}
- /**
- * Update index.
- * @param removedNodes
- * @param addedNodes
- */
- protected abstract void doUpdateIndex(Set<String> removedNodes, Set<String> addedNodes);
-
}
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/QueryHandlerContext.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/QueryHandlerContext.java 2009-12-07 14:27:08 UTC (rev 934)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/QueryHandlerContext.java 2009-12-07 16:03:16 UTC (rev 935)
@@ -28,175 +28,184 @@
* stable. This class provides access to the environment where the query handler
* is running in.
*/
-public class QueryHandlerContext {
- /**
- * The persistent <code>ItemStateManager</code>
- */
- private final ItemDataConsumer stateMgr;
+public class QueryHandlerContext
+{
+ /**
+ * The persistent <code>ItemStateManager</code>
+ */
+ private final ItemDataConsumer stateMgr;
- /**
- * The node type registry of the repository
- */
- private final NodeTypeDataManager nodeTypeDataManager;
+ /**
+ * The node type registry of the repository
+ */
+ private final NodeTypeDataManager nodeTypeDataManager;
- /**
- * The namespace registry of the repository.
- */
- private final NamespaceRegistryImpl nsRegistry;
+ /**
+ * The namespace registry of the repository.
+ */
+ private final NamespaceRegistryImpl nsRegistry;
- /**
- * The id of the root node.
- */
- private final IndexingTree indexingTree;
+ /**
+ * The id of the root node.
+ */
+ private final IndexingTree indexingTree;
- /**
- * PropertyType registry to look up the type of a property with a given
- * name.
- */
- private final PropertyTypeRegistry propRegistry;
+ /**
+ * PropertyType registry to look up the type of a property with a given
+ * name.
+ */
+ private final PropertyTypeRegistry propRegistry;
- /**
- * The query handler for the jcr:system tree
- */
- private final QueryHandler parentHandler;
+ /**
+ * The query handler for the jcr:system tree
+ */
+ private final QueryHandler parentHandler;
- /**
- * Text extractor for extracting text content of binary properties.
- */
- private final DocumentReaderService extractor;
+ /**
+ * Text extractor for extracting text content of binary properties.
+ */
+ private final DocumentReaderService extractor;
- private final String indexDirectory;
+ private final String indexDirectory;
- private final boolean createInitialIndex;
+ private final boolean createInitialIndex;
- private final LuceneVirtualTableResolver virtualTableResolver;
+ private final LuceneVirtualTableResolver virtualTableResolver;
- /**
- * Creates a new context instance.
- *
- * @param fs
- * a this <code>QueryHandler</code> may use to store its index.
- * If no <code>FileSystem</code> has been configured
- * <code>fs</code> is <code>null</code>.
- * @param stateMgr
- * provides persistent item states.
- * @param rootId
- * the id of the root node.
- * @param ntRegistry
- * the node type registry.
- * @param nsRegistry
- * the namespace registry.
- * @param parentHandler
- * the parent query handler or <code>null</code> it there is no
- * parent handler.
- * @param virtualTableResolver
- * @param excludedNodeId
- * id of the node that should be excluded from indexing. Any
- * descendant of that node is also excluded from indexing.
- */
- public QueryHandlerContext(ItemDataConsumer stateMgr,
- IndexingTree indexingTree, NodeTypeDataManager nodeTypeDataManager,
- NamespaceRegistryImpl nsRegistry, QueryHandler parentHandler,
- String indexDirectory, DocumentReaderService extractor,
- boolean createInitialIndex,
- LuceneVirtualTableResolver virtualTableResolver) {
- this.stateMgr = stateMgr;
- this.indexingTree = indexingTree;
- this.nodeTypeDataManager = nodeTypeDataManager;
- this.nsRegistry = nsRegistry;
- this.indexDirectory = indexDirectory;
- this.extractor = extractor;
- this.createInitialIndex = createInitialIndex;
- this.virtualTableResolver = virtualTableResolver;
- this.propRegistry = new PropertyTypeRegistry(nodeTypeDataManager);
- this.parentHandler = parentHandler;
- ((NodeTypeDataManagerImpl) this.nodeTypeDataManager)
- .addListener(propRegistry);
- }
+ /**
+ * Creates a new context instance.
+ *
+ * @param fs
+ * a this <code>QueryHandler</code> may use to store its index.
+ * If no <code>FileSystem</code> has been configured
+ * <code>fs</code> is <code>null</code>.
+ * @param stateMgr
+ * provides persistent item states.
+ * @param rootId
+ * the id of the root node.
+ * @param ntRegistry
+ * the node type registry.
+ * @param nsRegistry
+ * the namespace registry.
+ * @param parentHandler
+ * the parent query handler or <code>null</code> it there is no
+ * parent handler.
+ * @param virtualTableResolver
+ * @param excludedNodeId
+ * id of the node that should be excluded from indexing. Any
+ * descendant of that node is also excluded from indexing.
+ */
+ public QueryHandlerContext(ItemDataConsumer stateMgr, IndexingTree indexingTree,
+ NodeTypeDataManager nodeTypeDataManager, NamespaceRegistryImpl nsRegistry, QueryHandler parentHandler,
+ String indexDirectory, DocumentReaderService extractor, boolean createInitialIndex,
+ LuceneVirtualTableResolver virtualTableResolver)
+ {
+ this.stateMgr = stateMgr;
+ this.indexingTree = indexingTree;
+ this.nodeTypeDataManager = nodeTypeDataManager;
+ this.nsRegistry = nsRegistry;
+ this.indexDirectory = indexDirectory;
+ this.extractor = extractor;
+ this.createInitialIndex = createInitialIndex;
+ this.virtualTableResolver = virtualTableResolver;
+ this.propRegistry = new PropertyTypeRegistry(nodeTypeDataManager);
+ this.parentHandler = parentHandler;
+ ((NodeTypeDataManagerImpl)this.nodeTypeDataManager).addListener(propRegistry);
+ }
- /**
- * @return the virtualTableResolver
- */
- public LuceneVirtualTableResolver getVirtualTableResolver() {
- return virtualTableResolver;
- }
+ /**
+ * @return the virtualTableResolver
+ */
+ public LuceneVirtualTableResolver getVirtualTableResolver()
+ {
+ return virtualTableResolver;
+ }
- /**
- * @return the createInitialIndex
- */
- public boolean isCreateInitialIndex() {
- return createInitialIndex;
- }
+ /**
+ * @return the createInitialIndex
+ */
+ public boolean isCreateInitialIndex()
+ {
+ return createInitialIndex;
+ }
- /**
- * Returns the persistent {@link ItemStateManager} of the workspace this
- * <code>QueryHandler</code> is based on.
- *
- * @return the persistent <code>ItemStateManager</code> of the current
- * workspace.
- */
- public ItemDataConsumer getItemStateManager() {
- return stateMgr;
- }
+ /**
+ * Returns the persistent {@link ItemStateManager} of the workspace this
+ * <code>QueryHandler</code> is based on.
+ *
+ * @return the persistent <code>ItemStateManager</code> of the current
+ * workspace.
+ */
+ public ItemDataConsumer getItemStateManager()
+ {
+ return stateMgr;
+ }
- /**
- * Returns the id of the root node.
- *
- * @return the idof the root node.
- */
- public IndexingTree getIndexingTree() {
- return indexingTree;
- }
+ /**
+ * Returns the id of the root node.
+ *
+ * @return the idof the root node.
+ */
+ public IndexingTree getIndexingTree()
+ {
+ return indexingTree;
+ }
- /**
- * Returns the PropertyTypeRegistry for this repository.
- *
- * @return the PropertyTypeRegistry for this repository.
- */
- public PropertyTypeRegistry getPropertyTypeRegistry() {
- return propRegistry;
- }
+ /**
+ * Returns the PropertyTypeRegistry for this repository.
+ *
+ * @return the PropertyTypeRegistry for this repository.
+ */
+ public PropertyTypeRegistry getPropertyTypeRegistry()
+ {
+ return propRegistry;
+ }
- /**
- * Returns the NodeTypeRegistry for this repository.
- *
- * @return the NodeTypeRegistry for this repository.
- */
- public NodeTypeDataManager getNodeTypeDataManager() {
- return nodeTypeDataManager;
- }
+ /**
+ * Returns the NodeTypeRegistry for this repository.
+ *
+ * @return the NodeTypeRegistry for this repository.
+ */
+ public NodeTypeDataManager getNodeTypeDataManager()
+ {
+ return nodeTypeDataManager;
+ }
- /**
- * Returns the NamespaceRegistryImpl for this repository.
- *
- * @return the NamespaceRegistryImpl for this repository.
- */
- public NamespaceRegistryImpl getNamespaceRegistry() {
- return nsRegistry;
- }
+ /**
+ * Returns the NamespaceRegistryImpl for this repository.
+ *
+ * @return the NamespaceRegistryImpl for this repository.
+ */
+ public NamespaceRegistryImpl getNamespaceRegistry()
+ {
+ return nsRegistry;
+ }
- /**
- * Returns the parent query handler.
- *
- * @return the parent query handler.
- */
- public QueryHandler getParentHandler() {
- return parentHandler;
- }
+ /**
+ * Returns the parent query handler.
+ *
+ * @return the parent query handler.
+ */
+ public QueryHandler getParentHandler()
+ {
+ return parentHandler;
+ }
- /**
- * Destroys this context and releases resources.
- */
- public void destroy() {
- ((NodeTypeDataManagerImpl) this.nodeTypeDataManager)
- .removeListener(propRegistry);
- }
+ /**
+ * Destroys this context and releases resources.
+ */
+ public void destroy()
+ {
+ ((NodeTypeDataManagerImpl)this.nodeTypeDataManager).removeListener(propRegistry);
+ }
- public DocumentReaderService getExtractor() {
- return extractor;
- }
+ public DocumentReaderService getExtractor()
+ {
+ return extractor;
+ }
- public String getIndexDirectory() {
- return indexDirectory;
- }
+ public String getIndexDirectory()
+ {
+ return indexDirectory;
+ }
}
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java 2009-12-07 14:27:08 UTC (rev 934)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java 2009-12-07 16:03:16 UTC (rev 935)
@@ -130,19 +130,20 @@
*/
protected final SearchManager parentSearchManager;
- // protected QPath indexingRoot;
- //
- // protected List<QPath> excludedPaths = new ArrayList<QPath>();
-
protected IndexingTree indexingTree;
private final ConfigurationManager cfm;
protected LuceneVirtualTableResolver virtualTableResolver;
- private IndexerChangesFilter changesFilter;
+ protected IndexerChangesFilter changesFilter;
/**
+ * ChangesLog Buffer (used for saves before start).
+ */
+ private List<ItemStateChangesLog> changesLogBuffer = new ArrayList<ItemStateChangesLog>();
+
+ /**
* Creates a new <code>SearchManager</code>.
*
* @param config
@@ -181,8 +182,10 @@
this.cfm = cfm;
this.virtualTableResolver = new LuceneVirtualTableResolver(nodeTypeDataManager, nsReg);
this.parentSearchManager = parentSearchManager != null ? parentSearchManager.get() : null;
- //indexInterceptor.addIndexInterceptorListener(this);
- ((WorkspacePersistentDataManager)this.itemMgr).addItemPersistenceListener(this);
+ if (parentSearchManager != null)
+ {
+ ((WorkspacePersistentDataManager)this.itemMgr).addItemPersistenceListener(this);
+ }
}
public void createNewOrAdd(String key, ItemState state, Map<String, List<ItemState>> updatedNodes)
@@ -376,8 +379,13 @@
{
//Check if SearchManager started
if (changesFilter == null)
- return;
- changesFilter.onSaveItems(itemStates);
+ {
+ changesLogBuffer.add(itemStates);
+ }
+ else
+ {
+ changesFilter.onSaveItems(itemStates);
+ }
}
@@ -487,6 +495,17 @@
}
initializeChangesFilter();
initializeQueryHandler();
+
+ if (changesLogBuffer.size() > 0)
+ {
+ for (ItemStateChangesLog bufferedChangesLog : changesLogBuffer)
+ {
+ onSaveItems(bufferedChangesLog);
+ }
+ changesLogBuffer.clear();
+ changesLogBuffer = null;
+ }
+
}
catch (RepositoryException e)
{
@@ -653,6 +672,14 @@
}
/**
+ * @return the indexingTree
+ */
+ protected IndexingTree getIndexingTree()
+ {
+ return indexingTree;
+ }
+
+ /**
* Initialize changes filter.
* @throws RepositoryException
* @throws RepositoryConfigurationException
@@ -674,8 +701,19 @@
.getClassLoader());
}
Constructor<? extends IndexerChangesFilter> constuctor =
- changesFilterClass.getConstructor(SearchManager.class, QueryHandlerEntry.class, IndexingTree.class);
- changesFilter = constuctor.newInstance(this, config, indexingTree);
+ changesFilterClass.getConstructor(SearchManager.class, SearchManager.class, QueryHandlerEntry.class,
+ IndexingTree.class, IndexingTree.class);
+ if (parentSearchManager != null)
+ {
+ changesFilter =
+ constuctor.newInstance(this, parentSearchManager, config, indexingTree, parentSearchManager
+ .getIndexingTree());
+ }
+ else
+ {
+ changesFilter = constuctor.newInstance(this, null, config, indexingTree, null);
+ }
+
}
catch (SecurityException e)
{
@@ -731,6 +769,10 @@
QueryHandlerContext context = createQueryHandlerContext(parentHandler);
handler.init(context);
changesFilter.setHandler(handler);
+ if (parentSearchManager != null)
+ {
+ changesFilter.setParentHandler(parentSearchManager.getHandler());
+ }
}
catch (SecurityException e)
{
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SystemSearchManager.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SystemSearchManager.java 2009-12-07 14:27:08 UTC (rev 934)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SystemSearchManager.java 2009-12-07 16:03:16 UTC (rev 935)
@@ -21,7 +21,6 @@
import org.exoplatform.services.jcr.config.QueryHandlerEntry;
import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
import org.exoplatform.services.jcr.core.nodetype.NodeTypeDataManager;
-import org.exoplatform.services.jcr.dataflow.ItemStateChangesLog;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.QPath;
import org.exoplatform.services.jcr.impl.Constants;
@@ -29,7 +28,6 @@
import org.exoplatform.services.jcr.impl.dataflow.persistent.WorkspacePersistentDataManager;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
-import org.jboss.cache.commands.WriteCommand;
import java.util.ArrayList;
import java.util.List;
@@ -56,16 +54,17 @@
*/
private boolean isStarted = false;
- /**
- * ChangesLog Buffer (used for saves before start).
- */
- private List<ItemStateChangesLog> changesLogBuffer = new ArrayList<ItemStateChangesLog>();
+ //
+ // /**
+ // * ChangesLog Buffer (used for saves before start).
+ // */
+ // private List<ItemStateChangesLog> changesLogBuffer = new ArrayList<ItemStateChangesLog>();
+ //
+ // /**
+ // * ChangesLog Buffer (used for saves before start).
+ // */
+ // private List<List<WriteCommand>> writeCommandBuffer = new ArrayList<List<WriteCommand>>();
- /**
- * ChangesLog Buffer (used for saves before start).
- */
- private List<List<WriteCommand>> writeCommandBuffer = new ArrayList<List<WriteCommand>>();
-
public static final String INDEX_DIR_SUFFIX = "system";
public SystemSearchManager(QueryHandlerEntry config, NamespaceRegistryImpl nsReg, NodeTypeDataManager ntReg,
@@ -75,114 +74,167 @@
super(config, nsReg, ntReg, itemMgr, null, service, cfm, indexSearcherHolder);
}
+ // @Override
+ // public void onSaveItems(ItemStateChangesLog changesLog)
+ // {
+ // if (!isStarted)
+ // {
+ // changesLogBuffer.add(changesLog);
+ // }
+ // else
+ // {
+ // super.onSaveItems(changesLog);
+ // }
+ // }
+
@Override
- public void onSaveItems(ItemStateChangesLog changesLog)
+ public void start()
{
if (!isStarted)
{
- changesLogBuffer.add(changesLog);
- }
- else
- {
- super.onSaveItems(changesLog);
- }
- }
- @Override
- public void start()
- {
-
- isStarted = true;
- try
- {
- if (indexingTree == null)
+ try
{
- List<QPath> excludedPaths = new ArrayList<QPath>();
+ if (indexingTree == null)
+ {
+ List<QPath> excludedPaths = new ArrayList<QPath>();
- NodeData indexingRootNodeData = (NodeData)itemMgr.getItemData(Constants.SYSTEM_UUID);
+ NodeData indexingRootNodeData = (NodeData)itemMgr.getItemData(Constants.SYSTEM_UUID);
- indexingTree = new IndexingTree(indexingRootNodeData, excludedPaths);
- }
- initializeChangesFilter();
- initializeQueryHandler();
+ indexingTree = new IndexingTree(indexingRootNodeData, excludedPaths);
+ }
+ initializeChangesFilter();
+ initializeQueryHandler();
- }
-
- catch (RepositoryException e)
- {
- log.error(e.getLocalizedMessage());
- handler = null;
- freeBuffers();
- throw new RuntimeException(e);
- }
- catch (RepositoryConfigurationException e)
- {
- log.error(e.getLocalizedMessage());
- handler = null;
- freeBuffers();
- throw new RuntimeException(e);
- }
- if (changesLogBuffer.size() > 0)
- {
- for (ItemStateChangesLog bufferedChangesLog : changesLogBuffer)
- {
- super.onSaveItems(bufferedChangesLog);
}
- }
-
- if (writeCommandBuffer.size() > 0)
- {
- try
+ catch (RepositoryException e)
{
- for (List<WriteCommand> bufferedWriteLog : writeCommandBuffer)
- {
- super.onSaveItems(bufferedWriteLog);
- }
+ log.error(e.getLocalizedMessage());
+ handler = null;
+ //freeBuffers();
+ throw new RuntimeException(e);
}
- catch (RepositoryException e)
+ catch (RepositoryConfigurationException e)
{
- freeBuffers();
+ log.error(e.getLocalizedMessage());
+ handler = null;
+ //freeBuffers();
throw new RuntimeException(e);
-
}
+ isStarted = true;
}
- freeBuffers();
+ // if (changesLogBuffer.size() > 0)
+ // {
+ // for (ItemStateChangesLog bufferedChangesLog : changesLogBuffer)
+ // {
+ // super.onSaveItems(bufferedChangesLog);
+ // }
+ //
+ // }
+ //
+ // if (writeCommandBuffer.size() > 0)
+ // {
+ // try
+ // {
+ // for (List<WriteCommand> bufferedWriteLog : writeCommandBuffer)
+ // {
+ // super.onSaveItems(bufferedWriteLog);
+ // }
+ // }
+ // catch (RepositoryException e)
+ // {
+ // freeBuffers();
+ // throw new RuntimeException(e);
+ //
+ // }
+ // }
+ // freeBuffers();
}
- private void freeBuffers()
- {
- changesLogBuffer.clear();
- changesLogBuffer = null;
- writeCommandBuffer.clear();
- writeCommandBuffer = null;
- }
+ // /**
+ // * @see org.exoplatform.services.jcr.impl.core.query.SearchManager#initializeChangesFilter()
+ // */
+ // @Override
+ // protected void initializeChangesFilter() throws RepositoryException, RepositoryConfigurationException
+ // {
+ // Class<? extends IndexerChangesFilter> changesFilterClass = DefaultChangesFilter.class;
+ // String changesFilterClassName = config.getParameterValue(QueryHandlerParams.PARAM_CHANGES_FILTER_CLASS, null);
+ // try
+ // {
+ // if (changesFilterClassName != null)
+ // {
+ // changesFilterClass =
+ // (Class<? extends IndexerChangesFilter>)Class.forName(changesFilterClassName, true, this.getClass()
+ // .getClassLoader());
+ // }
+ // Constructor<? extends IndexerChangesFilter> constuctor =
+ // changesFilterClass.getConstructor(SearchManager.class, QueryHandlerEntry.class, Boolean.class,
+ // IndexingTree.class);
+ // changesFilter = constuctor.newInstance(this, config, true, indexingTree);
+ // }
+ // catch (SecurityException e)
+ // {
+ // throw new RepositoryException(e.getMessage(), e);
+ // }
+ // catch (IllegalArgumentException e)
+ // {
+ // throw new RepositoryException(e.getMessage(), e);
+ // }
+ // catch (ClassNotFoundException e)
+ // {
+ // throw new RepositoryException(e.getMessage(), e);
+ // }
+ // catch (NoSuchMethodException e)
+ // {
+ // throw new RepositoryException(e.getMessage(), e);
+ // }
+ // catch (InstantiationException e)
+ // {
+ // throw new RepositoryException(e.getMessage(), e);
+ // }
+ // catch (IllegalAccessException e)
+ // {
+ // throw new RepositoryException(e.getMessage(), e);
+ // }
+ // catch (InvocationTargetException e)
+ // {
+ // throw new RepositoryException(e.getMessage(), e);
+ // }
+ // }
+ // private void freeBuffers()
+ // {
+ // changesLogBuffer.clear();
+ // changesLogBuffer = null;
+ // writeCommandBuffer.clear();
+ // writeCommandBuffer = null;
+ // }
+
@Override
protected QueryHandlerContext createQueryHandlerContext(QueryHandler parentHandler)
throws RepositoryConfigurationException
{
QueryHandlerContext context =
new QueryHandlerContext(itemMgr, indexingTree, nodeTypeDataManager, nsReg, parentHandler, getIndexDir() + "_"
- + INDEX_DIR_SUFFIX, extractor,
- (changesLogBuffer.size() > 0 || writeCommandBuffer.size() > 0) && !isStarted, virtualTableResolver);
+ + INDEX_DIR_SUFFIX, extractor, true, virtualTableResolver);
return context;
}
-
- /* (non-Javadoc)
- * @see org.exoplatform.services.jcr.impl.core.query.SearchManager#onSaveItems(java.util.List)
- */
- @Override
- public void onSaveItems(List<WriteCommand> modifications) throws RepositoryException
- {
- if (!isStarted)
- {
- writeCommandBuffer.add(modifications);
- }
- else
- {
- super.onSaveItems(modifications);
- }
-
- }
+ //
+ // /* (non-Javadoc)
+ // * @see org.exoplatform.services.jcr.impl.core.query.SearchManager#onSaveItems(java.util.List)
+ // */
+ // @Override
+ // public void onSaveItems(List<WriteCommand> modifications) throws RepositoryException
+ // {
+ // if (!isStarted)
+ // {
+ // writeCommandBuffer.add(modifications);
+ // }
+ // else
+ // {
+ // super.onSaveItems(modifications);
+ // }
+ //
+ // }
}
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JbossCacheIndexChangesFilter.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JbossCacheIndexChangesFilter.java 2009-12-07 14:27:08 UTC (rev 934)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JbossCacheIndexChangesFilter.java 2009-12-07 16:03:16 UTC (rev 935)
@@ -53,10 +53,11 @@
* @param indexingTree
* @throws RepositoryConfigurationException
*/
- public JbossCacheIndexChangesFilter(SearchManager searchManager, QueryHandlerEntry config, IndexingTree indexingTree)
+ public JbossCacheIndexChangesFilter(SearchManager searchManager, SearchManager parentSearchManager,
+ QueryHandlerEntry config, IndexingTree indexingTree, IndexingTree parentIndexingTree)
throws RepositoryConfigurationException
{
- super(searchManager, config, indexingTree);
+ super(searchManager, parentSearchManager, config, indexingTree, parentIndexingTree);
String jbcConfig = config.getParameterValue(QueryHandlerParams.PARAM_CHANGES_FILTER_CONFIG_PATH);
CacheFactory<Serializable, Object> factory = new DefaultCacheFactory<Serializable, Object>();
log.info("JBoss Cache configuration used: " + jbcConfig);
@@ -67,12 +68,13 @@
}
/**
- * @see org.exoplatform.services.jcr.impl.core.query.IndexerChangesFilter#doUpdateIndex(java.util.Set, java.util.Set)
+ * @see org.exoplatform.services.jcr.impl.core.query.IndexerChangesFilter#doUpdateIndex(java.util.Set, java.util.Set, java.util.Set, java.util.Set)
*/
@Override
- protected void doUpdateIndex(Set<String> removedNodes, Set<String> addedNodes)
+ protected void doUpdateIndex(Set<String> removedNodes, Set<String> addedNodes, Set<String> parentRemovedNodes,
+ Set<String> parentAddedNodes)
{
- //write changes
+ // TODO Auto-generated method stub
}
16 years, 7 months