You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2011/09/05 12:01:57 UTC

svn commit: r1165228 - in /sling/trunk/bundles/extensions/event: ./ src/main/java/org/apache/sling/event/impl/ src/main/java/org/apache/sling/event/impl/jobs/ src/main/java/org/apache/sling/event/impl/jobs/config/ src/main/java/org/apache/sling/event/i...

Author: cziegeler
Date: Mon Sep  5 10:01:56 2011
New Revision: 1165228

URL: http://svn.apache.org/viewvc?rev=1165228&view=rev
Log:
SLING-2205 : Enable / disable job processing based on Sling ID

Modified:
    sling/trunk/bundles/extensions/event/pom.xml
    sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/AbstractRepositoryEventHandler.java
    sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/DistributingEventHandler.java
    sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/EventingThreadPool.java
    sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/DefaultJobManager.java
    sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/config/InternalQueueConfiguration.java
    sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/config/QueueConfigurationManager.java
    sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/jcr/LockManager.java
    sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/jcr/PersistenceHandler.java
    sling/trunk/bundles/extensions/event/src/main/resources/OSGI-INF/metatype/metatype.properties

Modified: sling/trunk/bundles/extensions/event/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/pom.xml?rev=1165228&r1=1165227&r2=1165228&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/pom.xml (original)
+++ sling/trunk/bundles/extensions/event/pom.xml Mon Sep  5 10:01:56 2011
@@ -80,7 +80,7 @@
                         </Sling-Namespaces>
                         <Embed-Dependency>
                             jackrabbit-jcr-commons;inline="org/apache/jackrabbit/util/ISO9075.*|org/apache/jackrabbit/util/ISO8601.*|org/apache/jackrabbit/util/XMLChar.*",
-                            org.apache.sling.commons.osgi;inline="org/apache/sling/commons/osgi/OsgiUtil.*"
+                            org.apache.sling.commons.osgi;inline="org/apache/sling/commons/osgi/PropertiesUtil.*"
                         </Embed-Dependency>
                     </instructions>
                 </configuration>
@@ -146,7 +146,7 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.commons.osgi</artifactId>
-            <version>2.0.6</version>
+            <version>2.1.0</version>
             <scope>provided</scope>
         </dependency>
         <dependency>

Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/AbstractRepositoryEventHandler.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/AbstractRepositoryEventHandler.java?rev=1165228&r1=1165227&r2=1165228&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/AbstractRepositoryEventHandler.java (original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/AbstractRepositoryEventHandler.java Mon Sep  5 10:01:56 2011
@@ -33,7 +33,7 @@ import org.apache.felix.scr.annotations.
 import org.apache.felix.scr.annotations.Property;
 import org.apache.felix.scr.annotations.Reference;
 import org.apache.felix.scr.annotations.Service;
-import org.apache.sling.commons.osgi.OsgiUtil;
+import org.apache.sling.commons.osgi.PropertiesUtil;
 import org.apache.sling.event.impl.jobs.jcr.JCRHelper;
 import org.apache.sling.event.impl.support.Environment;
 import org.apache.sling.event.jobs.JobUtil;
@@ -93,7 +93,7 @@ public abstract class AbstractRepository
      * @param context
      */
     protected void activate(final ComponentContext context) {
-        this.repositoryPath = OsgiUtil.toString(context.getProperties().get(
+        this.repositoryPath = PropertiesUtil.toString(context.getProperties().get(
             CONFIG_PROPERTY_REPO_PATH), DEFAULT_PROPERTY_REPO_PATH);
 
         this.running = true;

Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/DistributingEventHandler.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/DistributingEventHandler.java?rev=1165228&r1=1165227&r2=1165228&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/DistributingEventHandler.java (original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/DistributingEventHandler.java Mon Sep  5 10:01:56 2011
@@ -34,7 +34,7 @@ import org.apache.felix.scr.annotations.
 import org.apache.felix.scr.annotations.Properties;
 import org.apache.felix.scr.annotations.Property;
 import org.apache.felix.scr.annotations.Service;
-import org.apache.sling.commons.osgi.OsgiUtil;
+import org.apache.sling.commons.osgi.PropertiesUtil;
 import org.apache.sling.event.EventUtil;
 import org.apache.sling.event.impl.jobs.jcr.JCRHelper;
 import org.osgi.service.component.ComponentContext;
@@ -79,7 +79,7 @@ public class DistributingEventHandler
     protected void activate(ComponentContext context) {
         @SuppressWarnings("unchecked")
         final Dictionary<String, Object> props = context.getProperties();
-        this.cleanupPeriod = OsgiUtil.toInteger(props.get(CONFIG_PROPERTY_CLEANUP_PERIOD), DEFAULT_CLEANUP_PERIOD);
+        this.cleanupPeriod = PropertiesUtil.toInteger(props.get(CONFIG_PROPERTY_CLEANUP_PERIOD), DEFAULT_CLEANUP_PERIOD);
         super.activate(context);
     }
 

Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/EventingThreadPool.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/EventingThreadPool.java?rev=1165228&r1=1165227&r2=1165228&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/EventingThreadPool.java (original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/EventingThreadPool.java Mon Sep  5 10:01:56 2011
@@ -23,7 +23,7 @@ import org.apache.felix.scr.annotations.
 import org.apache.felix.scr.annotations.PropertyOption;
 import org.apache.felix.scr.annotations.Reference;
 import org.apache.felix.scr.annotations.Service;
-import org.apache.sling.commons.osgi.OsgiUtil;
+import org.apache.sling.commons.osgi.PropertiesUtil;
 import org.apache.sling.commons.threads.ModifiableThreadPoolConfig;
 import org.apache.sling.commons.threads.ThreadPool;
 import org.apache.sling.commons.threads.ThreadPoolConfig;
@@ -64,11 +64,11 @@ public class EventingThreadPool implemen
      */
     protected void activate(final ComponentContext ctx) {
         final ModifiableThreadPoolConfig config = new ModifiableThreadPoolConfig();
-        config.setMinPoolSize(OsgiUtil.toInteger(ctx.getProperties().get(PROPERTY_POOL_SIZE), DEFAULT_POOL_SIZE));
+        config.setMinPoolSize(PropertiesUtil.toInteger(ctx.getProperties().get(PROPERTY_POOL_SIZE), DEFAULT_POOL_SIZE));
         config.setMaxPoolSize(config.getMinPoolSize());
         config.setQueueSize(-1); // unlimited
         config.setShutdownGraceful(true);
-        config.setPriority(ThreadPriority.valueOf(OsgiUtil.toString(ctx.getProperties().get(PROPERTY_PRIORITY), "NORM")));
+        config.setPriority(ThreadPriority.valueOf(PropertiesUtil.toString(ctx.getProperties().get(PROPERTY_PRIORITY), "NORM")));
         config.setDaemon(true);
         this.threadPool = threadPoolManager.create(config, "Apache Sling Eventing Thread Pool");
     }

Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/DefaultJobManager.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/DefaultJobManager.java?rev=1165228&r1=1165227&r2=1165228&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/DefaultJobManager.java (original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/DefaultJobManager.java Mon Sep  5 10:01:56 2011
@@ -36,10 +36,10 @@ import org.apache.felix.scr.annotations.
 import org.apache.felix.scr.annotations.Properties;
 import org.apache.felix.scr.annotations.Property;
 import org.apache.felix.scr.annotations.PropertyOption;
+import org.apache.felix.scr.annotations.PropertyUnbounded;
 import org.apache.felix.scr.annotations.Reference;
 import org.apache.felix.scr.annotations.Service;
-import org.apache.felix.scr.annotations.Services;
-import org.apache.sling.commons.osgi.OsgiUtil;
+import org.apache.sling.commons.osgi.PropertiesUtil;
 import org.apache.sling.commons.scheduler.Scheduler;
 import org.apache.sling.event.EventUtil;
 import org.apache.sling.event.impl.EnvironmentComponent;
@@ -74,11 +74,7 @@ import org.slf4j.LoggerFactory;
 @Component(label="%job.events.name",
         description="%job.events.description",
         metatype=true,immediate=true)
-@Services({
-    @Service(value=Runnable.class),
-    @Service(value=JobManager.class),
-    @Service(value=EventHandler.class)
-})
+@Service(value={Runnable.class,JobManager.class,EventHandler.class})
 @Properties({
     @Property(name="scheduler.period", longValue=60, propertyPrivate=true),
     @Property(name="scheduler.concurrent", boolValue=false, propertyPrivate=true),
@@ -146,6 +142,9 @@ public class DefaultJobManager
 
     private boolean enabled = DEFAULT_ENABLED;
 
+    @Property(unbounded=PropertyUnbounded.ARRAY)
+    private static final String PROP_ENABLED_APP_IDS = "jobmanager.applicationids";
+
     /** We count the scheduler runs. */
     private long schedulerRuns;
 
@@ -174,7 +173,7 @@ public class DefaultJobManager
         queueProps.put(ConfigurationConstants.PROP_TYPE, InternalQueueConfiguration.Type.UNORDERED);
 
         // check max parallel - this should never be lower than 2!
-        final int maxParallel = OsgiUtil.toInteger(queueProps.get(ConfigurationConstants.PROP_MAX_PARALLEL),
+        final int maxParallel = PropertiesUtil.toInteger(queueProps.get(ConfigurationConstants.PROP_MAX_PARALLEL),
                 ConfigurationConstants.DEFAULT_MAX_PARALLEL);
         if ( maxParallel < 2 ) {
             this.logger.debug("Ignoring invalid setting of {} for {}. Setting to minimum value: 2",
@@ -184,7 +183,26 @@ public class DefaultJobManager
         this.mainConfiguration = InternalQueueConfiguration.fromConfiguration(queueProps);
 
         final boolean oldEnabled = this.enabled;
-        this.enabled = OsgiUtil.toBoolean(props.get(PROP_ENABLED), DEFAULT_ENABLED);
+        final boolean enabledByConfig = PropertiesUtil.toBoolean(props.get(PROP_ENABLED), DEFAULT_ENABLED);
+
+        if ( enabledByConfig ) {
+            // check application ids
+            final String[] enabledIds = PropertiesUtil.toStringArray(props.get(PROP_ENABLED_APP_IDS));
+            if ( enabledIds != null && enabledIds.length > 0 ) {
+                boolean doEnable = false;
+                for(int i=0; i<enabledIds.length; i++) {
+                    if ( Environment.APPLICATION_ID.equals(enabledIds[i]) ) {
+                        doEnable = true;
+                        break;
+                    }
+                }
+                this.enabled = doEnable;
+            } else {
+                this.enabled = true;
+            }
+        } else {
+            this.enabled = false;
+        }
 
         // if we have been disabled before and now get enabled, restart to get processing going
         if ( this.enabled != oldEnabled && this.enabled ) {

Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/config/InternalQueueConfiguration.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/config/InternalQueueConfiguration.java?rev=1165228&r1=1165227&r2=1165228&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/config/InternalQueueConfiguration.java (original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/config/InternalQueueConfiguration.java Mon Sep  5 10:01:56 2011
@@ -29,7 +29,7 @@ import org.apache.felix.scr.annotations.
 import org.apache.felix.scr.annotations.PropertyOption;
 import org.apache.felix.scr.annotations.PropertyUnbounded;
 import org.apache.felix.scr.annotations.Service;
-import org.apache.sling.commons.osgi.OsgiUtil;
+import org.apache.sling.commons.osgi.PropertiesUtil;
 import org.apache.sling.event.EventUtil;
 import org.apache.sling.event.impl.jobs.JobEvent;
 import org.apache.sling.event.impl.support.Environment;
@@ -127,15 +127,15 @@ public class InternalQueueConfiguration
      */
     @Activate
     protected void activate(final Map<String, Object> params) {
-        this.name = OsgiUtil.toString(params.get(ConfigurationConstants.PROP_NAME), null);
-        this.priority = JobUtil.JobPriority.valueOf(OsgiUtil.toString(params.get(ConfigurationConstants.PROP_PRIORITY), ConfigurationConstants.DEFAULT_PRIORITY));
-        this.type = Type.valueOf(OsgiUtil.toString(params.get(ConfigurationConstants.PROP_TYPE), ConfigurationConstants.DEFAULT_TYPE));
-        this.runLocal = OsgiUtil.toBoolean(params.get(ConfigurationConstants.PROP_RUN_LOCAL), ConfigurationConstants.DEFAULT_RUN_LOCAL);
-        this.retries = OsgiUtil.toInteger(params.get(ConfigurationConstants.PROP_RETRIES), ConfigurationConstants.DEFAULT_RETRIES);
-        this.retryDelay = OsgiUtil.toLong(params.get(ConfigurationConstants.PROP_RETRY_DELAY), ConfigurationConstants.DEFAULT_RETRY_DELAY);
-        final int maxParallel = OsgiUtil.toInteger(params.get(ConfigurationConstants.PROP_MAX_PARALLEL), ConfigurationConstants.DEFAULT_MAX_PARALLEL);
+        this.name = PropertiesUtil.toString(params.get(ConfigurationConstants.PROP_NAME), null);
+        this.priority = JobUtil.JobPriority.valueOf(PropertiesUtil.toString(params.get(ConfigurationConstants.PROP_PRIORITY), ConfigurationConstants.DEFAULT_PRIORITY));
+        this.type = Type.valueOf(PropertiesUtil.toString(params.get(ConfigurationConstants.PROP_TYPE), ConfigurationConstants.DEFAULT_TYPE));
+        this.runLocal = PropertiesUtil.toBoolean(params.get(ConfigurationConstants.PROP_RUN_LOCAL), ConfigurationConstants.DEFAULT_RUN_LOCAL);
+        this.retries = PropertiesUtil.toInteger(params.get(ConfigurationConstants.PROP_RETRIES), ConfigurationConstants.DEFAULT_RETRIES);
+        this.retryDelay = PropertiesUtil.toLong(params.get(ConfigurationConstants.PROP_RETRY_DELAY), ConfigurationConstants.DEFAULT_RETRY_DELAY);
+        final int maxParallel = PropertiesUtil.toInteger(params.get(ConfigurationConstants.PROP_MAX_PARALLEL), ConfigurationConstants.DEFAULT_MAX_PARALLEL);
         this.maxParallelProcesses = (maxParallel == -1 ? ConfigurationConstants.NUMBER_OF_PROCESSORS : maxParallel);
-        final String appIds[] = OsgiUtil.toStringArray(params.get(ConfigurationConstants.PROP_APP_IDS));
+        final String appIds[] = PropertiesUtil.toStringArray(params.get(ConfigurationConstants.PROP_APP_IDS));
         if ( appIds == null
              || appIds.length == 0
              || (appIds.length == 1 && (appIds[0] == null || appIds[0].length() == 0)) ) {
@@ -143,7 +143,7 @@ public class InternalQueueConfiguration
         } else {
             this.applicationIds = appIds;
         }
-        final String[] topicsParam = OsgiUtil.toStringArray(params.get(ConfigurationConstants.PROP_TOPICS));
+        final String[] topicsParam = PropertiesUtil.toStringArray(params.get(ConfigurationConstants.PROP_TOPICS));
         if ( topicsParam == null
              || topicsParam.length == 0
              || (topicsParam.length == 1 && (topicsParam[0] == null || topicsParam[0].length() == 0))) {
@@ -169,7 +169,7 @@ public class InternalQueueConfiguration
             matchers = newMatchers;
             this.topics = topicsParam;
         }
-        this.serviceRanking = OsgiUtil.toInteger(params.get(Constants.SERVICE_RANKING), 0);
+        this.serviceRanking = PropertiesUtil.toInteger(params.get(Constants.SERVICE_RANKING), 0);
         this.pid = (String)params.get(Constants.SERVICE_PID);
         this.valid = this.checkIsValid();
     }

Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/config/QueueConfigurationManager.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/config/QueueConfigurationManager.java?rev=1165228&r1=1165227&r2=1165228&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/config/QueueConfigurationManager.java (original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/config/QueueConfigurationManager.java Mon Sep  5 10:01:56 2011
@@ -22,7 +22,6 @@ import org.apache.felix.scr.annotations.
 import org.apache.felix.scr.annotations.Component;
 import org.apache.felix.scr.annotations.Deactivate;
 import org.apache.felix.scr.annotations.Service;
-import org.apache.felix.scr.annotations.Services;
 import org.apache.sling.event.impl.jobs.JobEvent;
 import org.apache.sling.event.jobs.JobUtil;
 import org.osgi.framework.BundleContext;
@@ -36,9 +35,7 @@ import org.osgi.util.tracker.ServiceTrac
  * obsolete events.
  */
 @Component
-@Services({
-    @Service(value=QueueConfigurationManager.class)
-})
+@Service(value=QueueConfigurationManager.class)
 public class QueueConfigurationManager {
 
     /** Configurations - ordered by service ranking. */

Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/jcr/LockManager.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/jcr/LockManager.java?rev=1165228&r1=1165227&r2=1165228&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/jcr/LockManager.java (original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/jcr/LockManager.java Mon Sep  5 10:01:56 2011
@@ -42,18 +42,14 @@ import org.apache.felix.scr.annotations.
 import org.apache.felix.scr.annotations.PropertyOption;
 import org.apache.felix.scr.annotations.Reference;
 import org.apache.felix.scr.annotations.Service;
-import org.apache.felix.scr.annotations.Services;
-import org.apache.sling.commons.osgi.OsgiUtil;
+import org.apache.sling.commons.osgi.PropertiesUtil;
 import org.apache.sling.event.impl.EnvironmentComponent;
 import org.apache.sling.event.impl.support.Environment;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 @Component(metatype=true,label="%lm.name",description="%lm.description")
-@Services({
-    @Service(value=Runnable.class),
-    @Service(value=LockManager.class)
-})
+@Service(value={Runnable.class,LockManager.class})
 @Properties({
     @Property(name="scheduler.period", longValue=60, propertyPrivate=true),
     @Property(name="scheduler.concurrent", boolValue=false, propertyPrivate=true)
@@ -134,7 +130,7 @@ public class LockManager implements Runn
      */
     @Activate
     protected void activate(final Map<String, Object> props) throws RepositoryException {
-        this.repositoryPath = OsgiUtil.toString(props.get(CONFIG_PROPERTY_REPOSITORY_PATH), DEFAULT_REPOSITORY_PATH);
+        this.repositoryPath = PropertiesUtil.toString(props.get(CONFIG_PROPERTY_REPOSITORY_PATH), DEFAULT_REPOSITORY_PATH);
         this.idNodePath = repositoryPath + '/' + Environment.APPLICATION_ID;
 
         // create the background session and register a listener
@@ -182,7 +178,7 @@ public class LockManager implements Runn
     @Modified
     protected void update(final Map<String, Object> props) {
         final LockMode oldMode = this.mode;
-        final String modeString = OsgiUtil.toString(props.get(CONFIG_PROPERTY_MODE), DEFAULT_MODE);
+        final String modeString = PropertiesUtil.toString(props.get(CONFIG_PROPERTY_MODE), DEFAULT_MODE);
         this.mode = LockMode.valueOf(modeString);
         if ( oldMode != this.mode ) {
             this.running = this.mode == LockMode.open;

Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/jcr/PersistenceHandler.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/jcr/PersistenceHandler.java?rev=1165228&r1=1165227&r2=1165228&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/jcr/PersistenceHandler.java (original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/jcr/PersistenceHandler.java Mon Sep  5 10:01:56 2011
@@ -48,8 +48,7 @@ import org.apache.felix.scr.annotations.
 import org.apache.felix.scr.annotations.Property;
 import org.apache.felix.scr.annotations.Reference;
 import org.apache.felix.scr.annotations.Service;
-import org.apache.felix.scr.annotations.Services;
-import org.apache.sling.commons.osgi.OsgiUtil;
+import org.apache.sling.commons.osgi.PropertiesUtil;
 import org.apache.sling.event.EventUtil;
 import org.apache.sling.event.impl.EnvironmentComponent;
 import org.apache.sling.event.impl.jobs.DefaultJobManager;
@@ -71,11 +70,7 @@ import org.slf4j.LoggerFactory;
 @Component(label="%job.persistence.name",
         description="%job.persistence.description",
         metatype=true,immediate=true)
-@Services({
-    @Service(value=PersistenceHandler.class),
-    @Service(value=EventHandler.class),
-    @Service(value=Runnable.class)
-})
+@Service(value={PersistenceHandler.class,EventHandler.class,Runnable.class})
 @Properties({
     @Property(name="event.topics",propertyPrivate=true,
             value={"org/osgi/framework/BundleEvent/UPDATED",
@@ -175,11 +170,11 @@ public class PersistenceHandler implemen
     protected void activate(final ComponentContext context) throws RepositoryException {
         @SuppressWarnings("unchecked")
         final Dictionary<String, Object> props = context.getProperties();
-        this.cleanupPeriod = OsgiUtil.toInteger(props.get(CONFIG_PROPERTY_CLEANUP_PERIOD), DEFAULT_CLEANUP_PERIOD);
+        this.cleanupPeriod = PropertiesUtil.toInteger(props.get(CONFIG_PROPERTY_CLEANUP_PERIOD), DEFAULT_CLEANUP_PERIOD);
         if ( this.cleanupPeriod < 1 ) {
             this.cleanupPeriod = DEFAULT_CLEANUP_PERIOD;
         }
-        this.repositoryPath = OsgiUtil.toString(props.get(CONFIG_PROPERTY_REPOSITORY_PATH), DEFAULT_REPOSITORY_PATH);
+        this.repositoryPath = PropertiesUtil.toString(props.get(CONFIG_PROPERTY_REPOSITORY_PATH), DEFAULT_REPOSITORY_PATH);
         this.running = true;
 
         // start writer background thread
@@ -192,10 +187,10 @@ public class PersistenceHandler implemen
         writerThread.start();
 
         // start background thread which loads jobs from the repository
-        final long loadThreshold = OsgiUtil.toLong(props.get(CONFIG_PROPERTY_LOAD_THREASHOLD), DEFAULT_LOAD_THRESHOLD);
-        final long backgroundLoadDelay = OsgiUtil.toLong(props.get(CONFIG_PROPERTY_BACKGROUND_LOAD_DELAY), DEFAULT_BACKGROUND_LOAD_DELAY);
-        final long backgroundCheckDelay = OsgiUtil.toLong(props.get(CONFIG_PROPERTY_BACKGROUND_CHECK_DELAY), DEFAULT_BACKGROUND_CHECK_DELAY);
-        final long maxLoadJobs = OsgiUtil.toLong(props.get(CONFIG_PROPERTY_MAX_LOAD_JOBS), DEFAULT_MAXIMUM_LOAD_JOBS);
+        final long loadThreshold = PropertiesUtil.toLong(props.get(CONFIG_PROPERTY_LOAD_THREASHOLD), DEFAULT_LOAD_THRESHOLD);
+        final long backgroundLoadDelay = PropertiesUtil.toLong(props.get(CONFIG_PROPERTY_BACKGROUND_LOAD_DELAY), DEFAULT_BACKGROUND_LOAD_DELAY);
+        final long backgroundCheckDelay = PropertiesUtil.toLong(props.get(CONFIG_PROPERTY_BACKGROUND_CHECK_DELAY), DEFAULT_BACKGROUND_CHECK_DELAY);
+        final long maxLoadJobs = PropertiesUtil.toLong(props.get(CONFIG_PROPERTY_MAX_LOAD_JOBS), DEFAULT_MAXIMUM_LOAD_JOBS);
         final Thread loaderThread = new Thread(new Runnable() {
             public void run() {
                 loadJobsInTheBackground(backgroundLoadDelay, backgroundCheckDelay, loadThreshold, maxLoadJobs);

Modified: sling/trunk/bundles/extensions/event/src/main/resources/OSGI-INF/metatype/metatype.properties
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/resources/OSGI-INF/metatype/metatype.properties?rev=1165228&r1=1165227&r2=1165228&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/resources/OSGI-INF/metatype/metatype.properties (original)
+++ sling/trunk/bundles/extensions/event/src/main/resources/OSGI-INF/metatype/metatype.properties Mon Sep  5 10:01:56 2011
@@ -109,6 +109,10 @@ jobmanager.enabled.description = This fl
  is running or is completly turned off. Turning off job processing will stop \
  all job processing and the jobs are queued up.
 
+jobmanager.applicationids.name = Application Ids
+jobmanager.applicationids.description = An optional list of application ids. If configured, \
+ the job manager is only enabled on these instances.
+
 #
 # Persistence Handler
 job.persistence.name = Apache Sling Job Persistence Manager