sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mpet...@apache.org
Subject svn commit: r1656509 - in /sling/trunk/contrib/extensions/distribution/core/src/main/java/org/apache/sling/distribution: event/impl/DefaultDistributionEventFactory.java packaging/impl/importer/LocalDistributionPackageImporterFactory.java
Date Mon, 02 Feb 2015 16:16:51 GMT
Author: mpetria
Date: Mon Feb  2 16:16:51 2015
New Revision: 1656509

URL: http://svn.apache.org/r1656509
Log:
SLING-4367: fixing package imported event after distribution

Modified:
    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/packaging/impl/importer/LocalDistributionPackageImporterFactory.java

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=1656509&r1=1656508&r2=1656509&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 Feb  2 16:16:51 2015
@@ -51,12 +51,18 @@ public class DefaultDistributionEventFac
     }
 
     public void generatePackageEvent(@Nonnull DistributionEventType distributionEventType,
DistributionComponentKind kind, @Nonnull String name, @Nonnull DistributionPackageInfo info)
{
-        Dictionary<String, Object> dictionary = new Hashtable<String, Object>();
-        dictionary.put(DistributionEventType.PROPERTY_DISTRIBUTION_COMPONENT_NAME, name);
-        dictionary.put(DistributionEventType.PROPERTY_DISTRIBUTION_COMPONENT_KIND, kind.name());
-        dictionary.put(DistributionEventType.PROPERTY_DISTRIBUTION_TYPE, info.getRequestType());
-        dictionary.put(DistributionEventType.PROPERTY_DISTRIBUTION_PATHS, info.getPaths());
-        generateEvent(distributionEventType, dictionary);
+        try {
+            Dictionary<String, Object> dictionary = new Hashtable<String, Object>();
+            dictionary.put(DistributionEventType.PROPERTY_DISTRIBUTION_COMPONENT_NAME, name);
+            dictionary.put(DistributionEventType.PROPERTY_DISTRIBUTION_COMPONENT_KIND, kind.name());
+            dictionary.put(DistributionEventType.PROPERTY_DISTRIBUTION_TYPE, info.getRequestType());
+            dictionary.put(DistributionEventType.PROPERTY_DISTRIBUTION_PATHS, info.getPaths());
+            generateEvent(distributionEventType, dictionary);
+
+        } catch (Throwable e) {
+            log.error("Cannot generate package event", e);
+        }
+
     }
 
 }

Modified: sling/trunk/contrib/extensions/distribution/core/src/main/java/org/apache/sling/distribution/packaging/impl/importer/LocalDistributionPackageImporterFactory.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/distribution/core/src/main/java/org/apache/sling/distribution/packaging/impl/importer/LocalDistributionPackageImporterFactory.java?rev=1656509&r1=1656508&r2=1656509&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/distribution/core/src/main/java/org/apache/sling/distribution/packaging/impl/importer/LocalDistributionPackageImporterFactory.java
(original)
+++ sling/trunk/contrib/extensions/distribution/core/src/main/java/org/apache/sling/distribution/packaging/impl/importer/LocalDistributionPackageImporterFactory.java
Mon Feb  2 16:16:51 2015
@@ -86,7 +86,14 @@ public class LocalDistributionPackageImp
     }
 
     public DistributionPackage importStream(@Nonnull ResourceResolver resourceResolver, @Nonnull
InputStream stream) throws DistributionPackageImportException {
-        return importer.importStream(resourceResolver, stream);
+        DistributionPackage distributionPackage = importer.importStream(resourceResolver,
stream);
+
+
+        if (distributionPackage != null) {
+            eventFactory.generatePackageEvent(DistributionEventType.IMPORTER_PACKAGE_IMPORTED,
DistributionComponentKind.IMPORTER, name, distributionPackage.getInfo());
+        }
+
+        return distributionPackage;
     }
 
 }



Mime
View raw message