sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r653696 - /incubator/sling/trunk/extensions/event/src/main/java/org/apache/sling/event/impl/TimedJobHandler.java
Date Tue, 06 May 2008 07:17:42 GMT
Author: cziegeler
Date: Tue May  6 00:17:42 2008
New Revision: 653696

URL: http://svn.apache.org/viewvc?rev=653696&view=rev
Log:
SLING-423: Correct node name handling for timed jobs; applied a slightly modified patch from
Philipp Koch.

Modified:
    incubator/sling/trunk/extensions/event/src/main/java/org/apache/sling/event/impl/TimedJobHandler.java

Modified: incubator/sling/trunk/extensions/event/src/main/java/org/apache/sling/event/impl/TimedJobHandler.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/extensions/event/src/main/java/org/apache/sling/event/impl/TimedJobHandler.java?rev=653696&r1=653695&r2=653696&view=diff
==============================================================================
--- incubator/sling/trunk/extensions/event/src/main/java/org/apache/sling/event/impl/TimedJobHandler.java
(original)
+++ incubator/sling/trunk/extensions/event/src/main/java/org/apache/sling/event/impl/TimedJobHandler.java
Tue May  6 00:17:42 2008
@@ -39,6 +39,7 @@
 import javax.jcr.query.Query;
 import javax.jcr.query.QueryManager;
 
+import org.apache.jackrabbit.util.Text;
 import org.apache.sling.event.EventUtil;
 import org.apache.sling.scheduler.Job;
 import org.apache.sling.scheduler.JobContext;
@@ -125,8 +126,8 @@
     /**
      * Create a unique node name for this timed job.
      */
-    protected String getNodeName(String jobTopic, String jobId) {
-        return jobTopic.replace('/', '.') + " " + jobId.replace('/', '.');
+    protected String getNodeName(final ScheduleInfo info) {
+        return Text.escapeIllegalJcrChars(info.jobId);
     }
 
     /**
@@ -186,9 +187,7 @@
         try {
             // get parent node
             final Node parentNode = (Node)this.writerSession.getItem(this.repositoryPath);
-            final String jobTopic = ((String)event.getProperty(EventUtil.PROPERTY_JOB_TOPIC));
-            final String jobId = (String)event.getProperty(EventUtil.PROPERTY_JOB_ID);
-            final String nodeName = this.getNodeName(jobTopic, jobId);
+            final String nodeName = this.getNodeName(scheduleInfo);
             // is there already a node?
             final Node foundNode = parentNode.hasNode(nodeName) ? parentNode.getNode(nodeName)
: null;
             Lock lock = null;
@@ -460,7 +459,7 @@
             try {
                 s = this.createSession();
                 final Node parentNode = (Node)s.getItem(this.repositoryPath);
-                final String nodeName = this.getNodeName(topic, info.jobId);
+                final String nodeName = this.getNodeName(info);
                 final Node eventNode = parentNode.hasNode(nodeName) ? parentNode.getNode(nodeName)
: null;
                 if ( eventNode != null ) {
                     try {
@@ -550,14 +549,14 @@
     }
 
     /**
-     * @see org.apache.sling.core.event.impl.JobPersistenceHandler#getContainerNodeType()
+     * @see org.apache.sling.event.impl.AbstractRepositoryEventHandler#getContainerNodeType()
      */
     protected String getContainerNodeType() {
         return EventHelper.TIMED_EVENTS_NODE_TYPE;
     }
 
     /**
-     * @see org.apache.sling.core.event.impl.JobPersistenceHandler#getEventNodeType()
+     * @see org.apache.sling.event.impl.AbstractRepositoryEventHandler#getEventNodeType()
      */
     protected String getEventNodeType() {
         return EventHelper.TIMED_EVENT_NODE_TYPE;



Mime
View raw message