Author: trang_vu
Date: 2011-10-19 05:10:57 -0400 (Wed, 19 Oct 2011)
New Revision: 5070
Added:
jcr/branches/1.12.x/patch/1.12.11-GA/JCR-1677/readme.txt
Modified:
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionImpl.java
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/ext/action/SessionActionInterceptor.java
Log:
JCR-1677: Could not intercept any jcr action listener only in the trunk of a predefined
workspace
Fix description
* Workspace name wasn't handled when generating condition list. That's why
this condition was skipped when broadcasting events, so Listeners registered on one
workspace, received events from another one.
* Pass the workspace name to SessionActionInterceptor via constructor argument and set
it into condition's map.
Modified:
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionImpl.java
===================================================================
---
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionImpl.java 2011-10-19
08:55:25 UTC (rev 5069)
+++
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionImpl.java 2011-10-19
09:10:57 UTC (rev 5070)
@@ -197,7 +197,7 @@
SessionActionCatalog catalog =
(SessionActionCatalog)container.getComponentInstanceOfType(SessionActionCatalog.class);
- actionHandler = new SessionActionInterceptor(catalog, container);
+ actionHandler = new SessionActionInterceptor(catalog, container, workspaceName);
sessionRegistry =
(SessionRegistry)container.getComponentInstanceOfType(SessionRegistry.class);
Modified:
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/ext/action/SessionActionInterceptor.java
===================================================================
---
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/ext/action/SessionActionInterceptor.java 2011-10-19
08:55:25 UTC (rev 5069)
+++
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/ext/action/SessionActionInterceptor.java 2011-10-19
09:10:57 UTC (rev 5070)
@@ -52,17 +52,21 @@
private final ExoContainer container;
+ private final String workspaceName;
+
private static Log log =
ExoLogger.getLogger("exo.jcr.component.core.SessionActionInterceptor");
/**
* SessionActionInterceptor is per session, and only one action per session/time can
be active.
*/
private ItemImpl activeItem = null;
+
- public SessionActionInterceptor(ActionCatalog catalog, ExoContainer container)
+ public SessionActionInterceptor(ActionCatalog catalog, ExoContainer container, String
workspaceName)
{
this.catalog = catalog;
this.container = container;
+ this.workspaceName = workspaceName;
}
/**
@@ -88,7 +92,8 @@
conditions.put(SessionEventMatcher.EVENTTYPE_KEY, ExtendedEvent.ADD_MIXIN);
conditions.put(SessionEventMatcher.PATH_KEY, node.getInternalPath());
conditions.put(SessionEventMatcher.NODETYPES_KEY, new
InternalQName[]{mixinType});
-
+ conditions.put(SessionEventMatcher.WORKSPACE_KEY, workspaceName);
+
InvocationContext ctx = new InvocationContext();
ctx.put(InvocationContext.CURRENT_ITEM, node);
ctx.put(InvocationContext.EVENT, ExtendedEvent.ADD_MIXIN);
@@ -117,6 +122,7 @@
conditions.put(SessionEventMatcher.EVENTTYPE_KEY, ExtendedEvent.NODE_ADDED);
conditions.put(SessionEventMatcher.PATH_KEY, node.getInternalPath());
conditions.put(SessionEventMatcher.NODETYPES_KEY,
readNodeTypeNames((NodeData)node.getData()));
+ conditions.put(SessionEventMatcher.WORKSPACE_KEY, workspaceName);
InvocationContext ctx = new InvocationContext();
ctx.put(InvocationContext.CURRENT_ITEM, node);
@@ -146,6 +152,7 @@
conditions.put(SessionEventMatcher.EVENTTYPE_KEY, ExtendedEvent.CHECKIN);
conditions.put(SessionEventMatcher.PATH_KEY, node.getInternalPath());
conditions.put(SessionEventMatcher.NODETYPES_KEY,
readNodeTypeNames((NodeData)node.getData()));
+ conditions.put(SessionEventMatcher.WORKSPACE_KEY, workspaceName);
InvocationContext ctx = new InvocationContext();
ctx.put(InvocationContext.CURRENT_ITEM, node);
@@ -175,6 +182,7 @@
conditions.put(SessionEventMatcher.EVENTTYPE_KEY, ExtendedEvent.CHECKOUT);
conditions.put(SessionEventMatcher.PATH_KEY, node.getInternalPath());
conditions.put(SessionEventMatcher.NODETYPES_KEY,
readNodeTypeNames((NodeData)node.getData()));
+ conditions.put(SessionEventMatcher.WORKSPACE_KEY, workspaceName);
InvocationContext ctx = new InvocationContext();
ctx.put(InvocationContext.CURRENT_ITEM, node);
@@ -204,6 +212,7 @@
conditions.put(SessionEventMatcher.EVENTTYPE_KEY, ExtendedEvent.LOCK);
conditions.put(SessionEventMatcher.PATH_KEY, node.getInternalPath());
conditions.put(SessionEventMatcher.NODETYPES_KEY,
readNodeTypeNames((NodeData)node.getData()));
+ conditions.put(SessionEventMatcher.WORKSPACE_KEY, workspaceName);
InvocationContext ctx = new InvocationContext();
ctx.put(InvocationContext.CURRENT_ITEM, node);
@@ -232,6 +241,7 @@
Condition conditions = new Condition();
conditions.put(SessionEventMatcher.EVENTTYPE_KEY, ExtendedEvent.READ);
conditions.put(SessionEventMatcher.PATH_KEY, item.getInternalPath());
+ conditions.put(SessionEventMatcher.WORKSPACE_KEY, workspaceName);
if (item.isNode())
{
@@ -286,6 +296,7 @@
conditions.put(SessionEventMatcher.EVENTTYPE_KEY, event);
conditions.put(SessionEventMatcher.PATH_KEY, property.getInternalPath());
conditions.put(SessionEventMatcher.NODETYPES_KEY,
readNodeTypeNames(property.parentData()));
+ conditions.put(SessionEventMatcher.WORKSPACE_KEY, workspaceName);
InvocationContext ctx = new InvocationContext();
ctx.put(InvocationContext.CURRENT_ITEM, property);
@@ -315,6 +326,7 @@
conditions.put(SessionEventMatcher.EVENTTYPE_KEY, ExtendedEvent.UNLOCK);
conditions.put(SessionEventMatcher.PATH_KEY, node.getInternalPath());
conditions.put(SessionEventMatcher.NODETYPES_KEY,
readNodeTypeNames((NodeData)node.getData()));
+ conditions.put(SessionEventMatcher.WORKSPACE_KEY, workspaceName);
InvocationContext ctx = new InvocationContext();
ctx.put(InvocationContext.CURRENT_ITEM, node);
@@ -344,6 +356,7 @@
int event = item.isNode() ? ExtendedEvent.NODE_REMOVED :
ExtendedEvent.PROPERTY_REMOVED;
conditions.put(SessionEventMatcher.EVENTTYPE_KEY, event);
conditions.put(SessionEventMatcher.PATH_KEY, item.getInternalPath());
+ conditions.put(SessionEventMatcher.WORKSPACE_KEY, workspaceName);
if (item.isNode())
{
conditions.put(SessionEventMatcher.NODETYPES_KEY,
readNodeTypeNames((NodeData)item.getData()));
@@ -381,6 +394,7 @@
conditions.put(SessionEventMatcher.EVENTTYPE_KEY, ExtendedEvent.REMOVE_MIXIN);
conditions.put(SessionEventMatcher.PATH_KEY, node.getInternalPath());
conditions.put(SessionEventMatcher.NODETYPES_KEY, new
InternalQName[]{mixinType});
+ conditions.put(SessionEventMatcher.WORKSPACE_KEY, workspaceName);
InvocationContext ctx = new InvocationContext();
ctx.put(InvocationContext.CURRENT_ITEM, node);
Added: jcr/branches/1.12.x/patch/1.12.11-GA/JCR-1677/readme.txt
===================================================================
--- jcr/branches/1.12.x/patch/1.12.11-GA/JCR-1677/readme.txt (rev
0)
+++ jcr/branches/1.12.x/patch/1.12.11-GA/JCR-1677/readme.txt 2011-10-19 09:10:57 UTC (rev
5070)
@@ -0,0 +1,69 @@
+Summary
+
+ * Status: Could not intercept any jcr action listener only in the trunk of a
predefined workspace
+ * CCP Issue: CCP-1120, Product Jira Issue: JCR-1677.
+ * Complexity: N/A
+
+The Proposal
+Problem description
+
+What is the problem to fix?
+* When removing a node using the File Explorer contextual menu, the component
org.exoplatform.ecm.webui.component.explorer.rightclick.manager.DeleteManageComponent
would be executed to remove a node or to move it to Trash if it's in the same
workspace. Removing nodes from "collaboration" workspace using UI does not
execute a JCR node remove event, but it just moves the node to Trash folder, that means it
changes the Path of the node to collaboration:/Trash folder.
+* However, if i configure my listener to be triggered on the workspace collaboration, and
i delete a document from another workspace, the listner will be triggered.
+
+Fix description
+Problem analysis
+ * Workspace name wasn't handled when generating condition list. That's why
this condition was skipped when broadcasting events, so Listeners registered on one
workspace, received events from another one.
+
+How is the problem fixed?
+ * Pass the workspace name to SessionActionInterceptor via constructor argument and
set it into condition's map.
+
+Patch file: JCR-1677.patch
+
+Tests to perform
+
+Reproduction test
+ * Manual, given in issue description.
+
+Tests performed at DevLevel
+
+ * Manual testing, mentioned in the description of the issue.
+
+Tests performed at QA/Support Level
+*
+Documentation changes
+
+Documentation changes:
+
+ * none
+
+Configuration changes
+
+Configuration changes:
+
+ * none
+
+Will previous configuration continue to work?
+
+ * yes
+
+Risks and impacts
+
+Can this bug fix have any side effects on current client projects?
+
+ * The signature of SessionActionInterceptor's constructor changed: new argument
added. Doesn't influence on compatibly with other projects because
SessionActionInterceptor is an internal component and not the part of public API. But fix
in general may influence some projects because condition for workspace name is now
properly handled and events with non-matching names won't be broadcasted.
+
+Is there a performance risk/cost?
+* No
+
+Validation (PM/Support/QA)
+
+PM Comment
+* Patch validated
+
+Support Comment
+* Patch validated
+
+QA Feedbacks
+*
+