sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tomm...@apache.org
Subject svn commit: r1637825 - in /sling/trunk/contrib/extensions/distribution: api/src/main/java/org/apache/sling/distribution/event/ core/src/main/java/org/apache/sling/distribution/event/impl/ core/src/main/java/org/apache/sling/distribution/trigger/impl/
Date Mon, 10 Nov 2014 12:22:09 GMT
Author: tommaso
Date: Mon Nov 10 12:22:08 2014
New Revision: 1637825

URL: http://svn.apache.org/r1637825
Log:
SLING-4145 - removing DistributionEvent subclass of Event, moving getTopic to DistributionEventType

Removed:
    sling/trunk/contrib/extensions/distribution/api/src/main/java/org/apache/sling/distribution/event/DistributionEvent.java
Modified:
    sling/trunk/contrib/extensions/distribution/api/src/main/java/org/apache/sling/distribution/event/DistributionEventType.java
    sling/trunk/contrib/extensions/distribution/core/src/main/java/org/apache/sling/distribution/event/impl/DefaultDistributionEventFactory.java
    sling/trunk/contrib/extensions/distribution/core/src/main/java/org/apache/sling/distribution/trigger/impl/ChainDistributeDistributionTrigger.java

Modified: sling/trunk/contrib/extensions/distribution/api/src/main/java/org/apache/sling/distribution/event/DistributionEventType.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/distribution/api/src/main/java/org/apache/sling/distribution/event/DistributionEventType.java?rev=1637825&r1=1637824&r2=1637825&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/distribution/api/src/main/java/org/apache/sling/distribution/event/DistributionEventType.java
(original)
+++ sling/trunk/contrib/extensions/distribution/api/src/main/java/org/apache/sling/distribution/event/DistributionEventType.java
Mon Nov 10 12:22:08 2014
@@ -61,6 +61,20 @@ public enum DistributionEventType {
     /**
      * event for agent deleted
      */
-    AGENT_DELETED
+    AGENT_DELETED;
+
+    /**
+     * common event topic base for distribution events
+     */
+    public static final String EVENT_TOPIC = "org/apache/sling/distribution/event";
+
+    /**
+     * get the event topic for this event type
+     *
+     * @return the event topic
+     */
+    public String getTopic() {
+        return EVENT_TOPIC + "/" + name();
+    }
 
 }

Modified: sling/trunk/contrib/extensions/distribution/core/src/main/java/org/apache/sling/distribution/event/impl/DefaultDistributionEventFactory.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/distribution/core/src/main/java/org/apache/sling/distribution/event/impl/DefaultDistributionEventFactory.java?rev=1637825&r1=1637824&r2=1637825&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/distribution/core/src/main/java/org/apache/sling/distribution/event/impl/DefaultDistributionEventFactory.java
(original)
+++ sling/trunk/contrib/extensions/distribution/core/src/main/java/org/apache/sling/distribution/event/impl/DefaultDistributionEventFactory.java
Mon Nov 10 12:22:08 2014
@@ -24,8 +24,8 @@ import java.util.Dictionary;
 import org.apache.felix.scr.annotations.Component;
 import org.apache.felix.scr.annotations.Reference;
 import org.apache.felix.scr.annotations.Service;
-import org.apache.sling.distribution.event.DistributionEvent;
 import org.apache.sling.distribution.event.DistributionEventType;
+import org.osgi.service.event.Event;
 import org.osgi.service.event.EventAdmin;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -43,9 +43,8 @@ public class DefaultDistributionEventFac
     private EventAdmin eventAdmin;
 
     public void generateEvent(@Nonnull DistributionEventType distributionEventType, @Nonnull
Dictionary<?, ?> properties) {
-        DistributionEvent distributionEvent = new DistributionEvent(distributionEventType,
properties);
-        eventAdmin.postEvent(distributionEvent);
-        log.debug("distribution event posted {}", distributionEvent);
+        eventAdmin.postEvent(new Event(distributionEventType.getTopic(), properties));
+        log.debug("distribution event {} posted", distributionEventType.name());
     }
 
 }

Modified: sling/trunk/contrib/extensions/distribution/core/src/main/java/org/apache/sling/distribution/trigger/impl/ChainDistributeDistributionTrigger.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/distribution/core/src/main/java/org/apache/sling/distribution/trigger/impl/ChainDistributeDistributionTrigger.java?rev=1637825&r1=1637824&r2=1637825&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/distribution/core/src/main/java/org/apache/sling/distribution/trigger/impl/ChainDistributeDistributionTrigger.java
(original)
+++ sling/trunk/contrib/extensions/distribution/core/src/main/java/org/apache/sling/distribution/trigger/impl/ChainDistributeDistributionTrigger.java
Mon Nov 10 12:22:08 2014
@@ -27,7 +27,6 @@ import java.util.concurrent.ConcurrentHa
 import org.apache.sling.distribution.communication.DistributionActionType;
 import org.apache.sling.distribution.communication.DistributionRequest;
 import org.apache.sling.distribution.component.ManagedDistributionComponent;
-import org.apache.sling.distribution.event.DistributionEvent;
 import org.apache.sling.distribution.event.DistributionEventType;
 import org.apache.sling.distribution.trigger.DistributionRequestHandler;
 import org.apache.sling.distribution.trigger.DistributionTrigger;
@@ -64,7 +63,7 @@ public class ChainDistributeDistribution
         Dictionary<String, Object> properties = new Hashtable<String, Object>();
 
         // TODO : make it possible to configure the type of event handled here, currently
'package-installed' is hardcoded
-        properties.put(EventConstants.EVENT_TOPIC, DistributionEvent.getTopic(DistributionEventType.PACKAGE_INSTALLED));
+        properties.put(EventConstants.EVENT_TOPIC, DistributionEventType.PACKAGE_INSTALLED.getTopic());
         log.info("handler {} will chain distribute on path '{}'", requestHandler, pathPrefix);
 
 //            properties.put(EventConstants.EVENT_FILTER, "(path=" + path + "/*)");



Mime
View raw message