[exo-jcr-commits] exo-jcr SVN: r595 - in jcr/branches/1.12.0-JBC/component/core/src: main/java/org/exoplatform/services/jcr/impl/storage/jbosscache and 1 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Thu Nov 12 08:18:53 EST 2009
Author: nzamosenchuk
Date: 2009-11-12 08:18:52 -0500 (Thu, 12 Nov 2009)
New Revision: 595
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/observation/ActionLauncher.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/observation/ObservationManagerRegistry.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/ObservationCacheLoader.java
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/ObservationCacheLoaderTest.java
Log:
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/observation/ActionLauncher.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/observation/ActionLauncher.java 2009-11-12 11:20:31 UTC (rev 594)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/observation/ActionLauncher.java 2009-11-12 13:18:52 UTC (rev 595)
@@ -18,8 +18,6 @@
*/
package org.exoplatform.services.jcr.impl.core.observation;
-import org.exoplatform.services.jcr.core.NamespaceAccessor;
-import org.exoplatform.services.jcr.core.nodetype.NodeTypeData;
import org.exoplatform.services.jcr.core.nodetype.NodeTypeDataManager;
import org.exoplatform.services.jcr.dataflow.ChangesLogIterator;
import org.exoplatform.services.jcr.dataflow.CompositeChangesLog;
@@ -31,7 +29,6 @@
import org.exoplatform.services.jcr.datamodel.ItemData;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.QPath;
-import org.exoplatform.services.jcr.impl.core.LocationFactory;
import org.exoplatform.services.jcr.impl.core.SessionImpl;
import org.exoplatform.services.jcr.impl.core.SessionRegistry;
import org.exoplatform.services.jcr.impl.dataflow.persistent.WorkspacePersistentDataManager;
@@ -66,7 +63,6 @@
private final SessionRegistry sessionRegistry;
private final NodeTypeDataManager ntManager;
-
public ActionLauncher(ObservationManagerRegistry registry, WorkspacePersistentDataManager workspaceDataManager,
NodeTypeDataManager ntManager, SessionRegistry sessionRegistry)
@@ -130,8 +126,14 @@
}
if (events.size() > 0)
{
- // TCK says, no events - no onEvent() action
- listener.onEvent(events);
+ try
+ {
+ listener.onEvent(events);
+ }
+ catch (RuntimeException e)
+ {
+ log.warn("Listener is in error, skipping", e);
+ }
}
}
}
@@ -157,7 +159,6 @@
// 8.3.3 Only events whose associated parent node is at absPath (or
// within its subtree, if isDeep is true) will be received.
QPath itemPath = item.getQPath();
-
return itemPath.isDescendantOf(criteria.getAbsPath(), !criteria.isDeep());
}
@@ -208,20 +209,9 @@
}
}
- for (int i = 0; i < criteria.getNodeTypeName().length; i++)
+ for (InternalQName typeName : criteria.getNodeTypeName())
{
- NodeTypeData criteriaNT = ntManager.getNodeType(criteria.getNodeTypeName()[i]);
- InternalQName[] testQNames;
- if (criteriaNT.isMixin())
- {
- testQNames = node.getMixinTypeNames();
- }
- else
- {
- testQNames = new InternalQName[1];
- testQNames[0] = node.getPrimaryTypeName();
- }
- if (ntManager.isNodeType(criteriaNT.getName(), testQNames))
+ if (ntManager.isNodeType(typeName, node.getPrimaryTypeName(), node.getMixinTypeNames()))
return true;
}
return false;
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/observation/ObservationManagerRegistry.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/observation/ObservationManagerRegistry.java 2009-11-12 11:20:31 UTC (rev 594)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/observation/ObservationManagerRegistry.java 2009-11-12 13:18:52 UTC (rev 595)
@@ -20,7 +20,6 @@
import org.exoplatform.services.jcr.core.NamespaceAccessor;
import org.exoplatform.services.jcr.core.nodetype.NodeTypeDataManager;
-import org.exoplatform.services.jcr.impl.core.LocationFactory;
import org.exoplatform.services.jcr.impl.core.SessionImpl;
import org.exoplatform.services.jcr.impl.core.SessionRegistry;
import org.exoplatform.services.jcr.impl.dataflow.persistent.WorkspacePersistentDataManager;
@@ -67,7 +66,7 @@
this.listenersMap = new HashMap<EventListener, ListenerCriteria>();
this.nodeTypeDataManager = nodeTypeDataManager;
this.workspaceDataManager = workspaceDataManager;
- //this.launcher = new ActionLauncher(this, workspaceDataManager, nodeTypeDataManager, sessionRegistry);
+ this.launcher = new ActionLauncher(this, workspaceDataManager, nodeTypeDataManager, sessionRegistry);
}
public ObservationManagerImpl createObservationManager(SessionImpl session)
@@ -115,9 +114,13 @@
}
// TODO: remove hardcode
+ /**
+ * Was created only for ObservationCacheLoader. For lab-purposes only
+ */
+ @Deprecated
public NodeTypeDataManager getNodeTypeDataManager()
{
return nodeTypeDataManager;
}
-
+
}
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/ObservationCacheLoader.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/ObservationCacheLoader.java 2009-11-12 11:20:31 UTC (rev 594)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/ObservationCacheLoader.java 2009-11-12 13:18:52 UTC (rev 595)
@@ -45,10 +45,13 @@
import javax.jcr.observation.EventListenerIterator;
/**
+ * This class is for lab-purposes only!
+ *
* @author <a href="mailto:nikolazius at gmail.com">Nikolay Zamosenchuk</a>
* @version $Id: ObservationCacheLoader.java 34360 2009-07-22 23:58:59Z aheritier $
*
*/
+ at Deprecated
public class ObservationCacheLoader extends AbstractWriteOnlyCacheLoader
{
public final int SKIP_EVENT = Integer.MIN_VALUE;
Modified: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/ObservationCacheLoaderTest.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/ObservationCacheLoaderTest.java 2009-11-12 11:20:31 UTC (rev 594)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/ObservationCacheLoaderTest.java 2009-11-12 13:18:52 UTC (rev 595)
@@ -120,7 +120,7 @@
loader.injectDependencies(registry, new DummyWorkspaceDataContainer(workspaceStorageConnection), accessor);
}
- public void testFilterByUUID() throws Exception
+ public void _testFilterByUUID() throws Exception
{
QPath node1path = QPath.parse("[]:1[]node:1");
NodeData newNode =
@@ -141,7 +141,7 @@
assertEquals("admin", event.getUserID());
}
- public void testAddNode() throws Exception
+ public void _testAddNode() throws Exception
{
QPath node1path = QPath.parse("[]:1[]node:1");
NodeData newNode =
@@ -159,7 +159,7 @@
assertEvent(Event.NODE_ADDED, node1path, listener, "admin");
}
- public void testRemoveNode() throws Exception
+ public void _testRemoveNode() throws Exception
{
QPath node1path = QPath.parse("[]:1[]node:1");
NodeData newNode =
@@ -177,7 +177,7 @@
assertEvent(Event.NODE_REMOVED, node1path, listener, "admin");
}
- public void testAddProperty() throws Exception
+ public void _testAddProperty() throws Exception
{
QPath prop1path = QPath.parse("[]:1[]node:1[]property:1");
PropertyData newProperty =
@@ -195,7 +195,7 @@
assertEvent(Event.PROPERTY_ADDED, prop1path, listener, "admin");
}
- public void testUpdateProperty() throws Exception
+ public void _testUpdateProperty() throws Exception
{
QPath prop1path = QPath.parse("[]:1[]node:1[]property:1");
PropertyData newProperty =
@@ -213,7 +213,7 @@
assertEvent(Event.PROPERTY_CHANGED, prop1path, listener, "admin");
}
- public void testRemoveProperty() throws Exception
+ public void _testRemoveProperty() throws Exception
{
QPath prop1path = QPath.parse("[]:1[]node:1[]property:1");
PropertyData newProperty =
@@ -231,18 +231,8 @@
assertEvent(Event.PROPERTY_REMOVED, prop1path, listener, "admin");
}
- protected void assertEvent(int eventType, QPath prop1path, DummyListener listener, String userId)
- throws RepositoryException
+ public void _testFilterByNodeType() throws Exception
{
- assertEquals(1, listener.eventList.size());
- Event event = listener.eventList.get(0);
- assertEquals(eventType, event.getType());
- assertEquals(lf.createJCRPath(prop1path).getAsString(false), event.getPath());
- assertEquals(userId, event.getUserID());
- }
-
- public void testFilterByNodeType() throws Exception
- {
String parent1uuid = "uuid1";
String parent2uuid = "uuid2";
@@ -283,6 +273,16 @@
assertEvent(Event.NODE_ADDED, child2path, listener, "admin");
}
+ protected void assertEvent(int eventType, QPath prop1path, DummyListener listener, String userId)
+ throws RepositoryException
+ {
+ assertEquals(1, listener.eventList.size());
+ Event event = listener.eventList.get(0);
+ assertEquals(eventType, event.getType());
+ assertEquals(lf.createJCRPath(prop1path).getAsString(false), event.getPath());
+ assertEquals(userId, event.getUserID());
+ }
+
@Override
protected void tearDown() throws Exception
{
More information about the exo-jcr-commits
mailing list