Author: chetanm
Date: Wed Sep 21 13:28:29 2016
New Revision: 1761730

URL: http://svn.apache.org/viewvc?rev=1761730&view=rev
Log:
SLING-5645 - Provide a Jobs API and implementation suitable for widely 
distributed job processing.

Use PropertiesUtil to coerce the service property to String[]. This enables 
working with those case where service property is single value

This is required as OSGi annotation does not allow creating array service 
property with single entry

Modified:
    sling/trunk/contrib/commons/mom/examples/jobs/core/pom.xml
    
sling/trunk/contrib/commons/mom/examples/jobs/core/src/main/java/org/apache/sling/jobs/impl/JobSubsystem.java

Modified: sling/trunk/contrib/commons/mom/examples/jobs/core/pom.xml
URL: 
http://svn.apache.org/viewvc/sling/trunk/contrib/commons/mom/examples/jobs/core/pom.xml?rev=1761730&r1=1761729&r2=1761730&view=diff
==============================================================================
--- sling/trunk/contrib/commons/mom/examples/jobs/core/pom.xml (original)
+++ sling/trunk/contrib/commons/mom/examples/jobs/core/pom.xml Wed Sep 21 
13:28:29 2016
@@ -110,6 +110,11 @@
             <!-- Use the version being used in Sling -->
             <version>15.0</version>
         </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.commons.osgi</artifactId>
+            <version>2.4.0</version>
+        </dependency>
       <!-- Testing -->
         <dependency>
             <groupId>junit</groupId>

Modified: 
sling/trunk/contrib/commons/mom/examples/jobs/core/src/main/java/org/apache/sling/jobs/impl/JobSubsystem.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/contrib/commons/mom/examples/jobs/core/src/main/java/org/apache/sling/jobs/impl/JobSubsystem.java?rev=1761730&r1=1761729&r2=1761730&view=diff
==============================================================================
--- 
sling/trunk/contrib/commons/mom/examples/jobs/core/src/main/java/org/apache/sling/jobs/impl/JobSubsystem.java
 (original)
+++ 
sling/trunk/contrib/commons/mom/examples/jobs/core/src/main/java/org/apache/sling/jobs/impl/JobSubsystem.java
 Wed Sep 21 13:28:29 2016
@@ -28,6 +28,7 @@ import org.apache.felix.scr.annotations.
 import org.apache.felix.scr.annotations.ReferenceCardinality;
 import org.apache.felix.scr.annotations.ReferencePolicy;
 import org.apache.felix.scr.annotations.Service;
+import org.apache.sling.commons.osgi.PropertiesUtil;
 import org.apache.sling.jobs.*;
 import org.apache.sling.jobs.impl.spi.JobStorage;
 import org.apache.sling.jobs.impl.storage.InMemoryJobStorage;
@@ -192,7 +193,7 @@ public class JobSubsystem  implements Jo
             if ( consumer instanceof JobTypeValve) {
                 jobTypes = ImmutableSet.of();
             } else {
-                jobTypes = Types.jobType((String[]) 
properties.get(JobConsumer.JOB_TYPES));
+                jobTypes = 
Types.jobType(PropertiesUtil.toStringArray(properties.get(JobConsumer.JOB_TYPES)));
             }
         }
 


Reply via email to