incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r619050 - /incubator/sling/trunk/sling/event/src/main/java/org/apache/sling/event/impl/AbstractRepositoryEventHandler.java
Date Wed, 06 Feb 2008 16:19:40 GMT
Author: cziegeler
Date: Wed Feb  6 08:19:38 2008
New Revision: 619050

URL: http://svn.apache.org/viewvc?rev=619050&view=rev
Log:
Move node name creating into separate method.

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

Modified: incubator/sling/trunk/sling/event/src/main/java/org/apache/sling/event/impl/AbstractRepositoryEventHandler.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sling/event/src/main/java/org/apache/sling/event/impl/AbstractRepositoryEventHandler.java?rev=619050&r1=619049&r2=619050&view=diff
==============================================================================
--- incubator/sling/trunk/sling/event/src/main/java/org/apache/sling/event/impl/AbstractRepositoryEventHandler.java
(original)
+++ incubator/sling/trunk/sling/event/src/main/java/org/apache/sling/event/impl/AbstractRepositoryEventHandler.java
Wed Feb  6 08:19:38 2008
@@ -237,6 +237,15 @@
         return EventHelper.EVENT_NODE_TYPE;
     }
 
+    protected String getNodeName(Event e) {
+        final Calendar now = Calendar.getInstance();
+        final String nodeType = this.getEventNodeType();
+        final int sepPos = nodeType.indexOf(':');
+        final String nodeName = nodeType.substring(sepPos+1) + "-" + this.applicationId +
"-" + now.getTime().getTime();
+
+        return nodeName;
+    }
+
     /**
      * Write an event to the repository.
      * @param e
@@ -248,10 +257,8 @@
         // create new node with name of topic
         final Node rootNode = (Node) this.session.getItem(this.repositoryPath);
 
-        final Calendar now = Calendar.getInstance();
         final String nodeType = this.getEventNodeType();
-        final int sepPos = nodeType.indexOf(':');
-        final String nodeName = nodeType.substring(sepPos+1) + "-" + this.applicationId +
"-" + now.getTime().getTime();
+        final String nodeName = this.getNodeName(e);
         final Node eventNode = rootNode.addNode(nodeName, nodeType);
 
         eventNode.setProperty(EventHelper.NODE_PROPERTY_CREATED, Calendar.getInstance());



Mime
View raw message