You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by fm...@apache.org on 2008/05/27 15:58:07 UTC

svn commit: r660519 - in /incubator/sling/trunk/extensions/event/src/main: java/org/apache/sling/event/impl/ resources/OSGI-INF/ resources/OSGI-INF/metatype/

Author: fmeschbe
Date: Tue May 27 06:58:03 2008
New Revision: 660519

URL: http://svn.apache.org/viewvc?rev=660519&view=rev
Log:
SLING-481 Create metatype descriptions for the extensions/event bundle

Added:
    incubator/sling/trunk/extensions/event/src/main/resources/OSGI-INF/
    incubator/sling/trunk/extensions/event/src/main/resources/OSGI-INF/metatype/
    incubator/sling/trunk/extensions/event/src/main/resources/OSGI-INF/metatype/metatype.properties
Modified:
    incubator/sling/trunk/extensions/event/src/main/java/org/apache/sling/event/impl/AbstractRepositoryEventHandler.java
    incubator/sling/trunk/extensions/event/src/main/java/org/apache/sling/event/impl/DistributingEventHandler.java
    incubator/sling/trunk/extensions/event/src/main/java/org/apache/sling/event/impl/JobEventHandler.java
    incubator/sling/trunk/extensions/event/src/main/java/org/apache/sling/event/impl/TimedJobHandler.java

Modified: incubator/sling/trunk/extensions/event/src/main/java/org/apache/sling/event/impl/AbstractRepositoryEventHandler.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/extensions/event/src/main/java/org/apache/sling/event/impl/AbstractRepositoryEventHandler.java?rev=660519&r1=660518&r2=660519&view=diff
==============================================================================
--- incubator/sling/trunk/extensions/event/src/main/java/org/apache/sling/event/impl/AbstractRepositoryEventHandler.java (original)
+++ incubator/sling/trunk/extensions/event/src/main/java/org/apache/sling/event/impl/AbstractRepositoryEventHandler.java Tue May 27 06:58:03 2008
@@ -35,6 +35,7 @@
 import javax.jcr.Session;
 import javax.jcr.observation.EventListener;
 
+import org.apache.sling.commons.osgi.OsgiUtil;
 import org.apache.sling.commons.threads.ThreadPool;
 import org.apache.sling.commons.threads.ThreadPoolConfig;
 import org.apache.sling.commons.threads.ThreadPoolManager;
@@ -51,7 +52,7 @@
 /**
  * Abstract base class for all event handlers in this package.
  *
- * @scr.component abstract="true"
+ * @scr.component abstract="true" metatype="no"
  * @scr.service interface="org.osgi.service.event.EventHandler"
  */
 public abstract class AbstractRepositoryEventHandler
@@ -60,9 +61,12 @@
     /** Default log. */
     protected final Logger logger = LoggerFactory.getLogger(this.getClass());
 
-    /** @scr.property value="/sling/events" */
+    /** @scr.property valueRef="DEFAULT_PROPERTY_REPO_PATH" */
     protected static final String CONFIG_PROPERTY_REPO_PATH = "repository.path";
 
+    /** Default path for the {@link #CONFIG_PROPERTY_REPO_PATH} */
+    private static final String DEFAULT_PROPERTY_REPO_PATH = "/sling/events";
+    
     /** @scr.reference */
     protected SlingRepository repository;
 
@@ -105,7 +109,8 @@
     protected void activate(final ComponentContext context)
     throws Exception {
         this.applicationId = this.settingsService.getSlingId();
-        this.repositoryPath = (String)context.getProperties().get(CONFIG_PROPERTY_REPO_PATH);
+        this.repositoryPath = OsgiUtil.toString(context.getProperties().get(
+            CONFIG_PROPERTY_REPO_PATH), DEFAULT_PROPERTY_REPO_PATH);
 
         // start background threads
         if ( this.threadPoolManager == null ) {
@@ -117,7 +122,7 @@
         config.setQueueSize(-1);
         config.setShutdownGraceful(true);
         threadPoolManager.create(EventHelper.THREAD_POOL_NAME, config);
-                                 ;
+
         this.threadPool = threadPoolManager.get(EventHelper.THREAD_POOL_NAME);
         if ( this.threadPool == null ) {
             throw new Exception("No thread pool found.");

Modified: incubator/sling/trunk/extensions/event/src/main/java/org/apache/sling/event/impl/DistributingEventHandler.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/extensions/event/src/main/java/org/apache/sling/event/impl/DistributingEventHandler.java?rev=660519&r1=660518&r2=660519&view=diff
==============================================================================
--- incubator/sling/trunk/extensions/event/src/main/java/org/apache/sling/event/impl/DistributingEventHandler.java (original)
+++ incubator/sling/trunk/extensions/event/src/main/java/org/apache/sling/event/impl/DistributingEventHandler.java Tue May 27 06:58:03 2008
@@ -36,16 +36,16 @@
 
 /**
  * This event handler distributes events across an application cluster.
- * @scr.component inherit="true"
- * @scr.property name="event.topics" value="*"
- * @scr.property name="event.filter" value="(event.distribute=*)"
- * @scr.property name="repository.path" value="/var/eventing/distribution"
+ * @scr.component inherit="true" label="%dist.events.name" description="%dist.events.description"
+ * @scr.property name="event.topics" value="*" private="true"
+ * @scr.property name="event.filter" value="(event.distribute=*)" private="true"
+ * @scr.property name="repository.path" value="/var/eventing/distribution" private="true"
  *
  * We schedule this event handler to run in the background and clean up
  * obsolete events.
  * @scr.service interface="java.lang.Runnable"
  * @scr.property name="scheduler.period" value="1800" type="Long"
- * @scr.property name="scheduler.concurrent" value="false" type="Boolean"
+ * @scr.property name="scheduler.concurrent" value="false" type="Boolean" private="true"
  */
 public class DistributingEventHandler
     extends AbstractRepositoryEventHandler

Modified: incubator/sling/trunk/extensions/event/src/main/java/org/apache/sling/event/impl/JobEventHandler.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/extensions/event/src/main/java/org/apache/sling/event/impl/JobEventHandler.java?rev=660519&r1=660518&r2=660519&view=diff
==============================================================================
--- incubator/sling/trunk/extensions/event/src/main/java/org/apache/sling/event/impl/JobEventHandler.java (original)
+++ incubator/sling/trunk/extensions/event/src/main/java/org/apache/sling/event/impl/JobEventHandler.java Tue May 27 06:58:03 2008
@@ -51,17 +51,18 @@
 /**
  * An event handler handling special job events.
  *
- * @scr.component
+ * @scr.component label="%job.events.name" description="%job.events.description"
  * @scr.service interface="org.apache.sling.event.JobStatusProvider"
  * @scr.property name="event.topics" refValues="EventUtil.TOPIC_JOB"
  *               values.updated="org/osgi/framework/BundleEvent/UPDATED"
  *               values.started="org/osgi/framework/BundleEvent/STARTED"
- * @scr.property name="repository.path" value="/var/eventing/jobs"
+ *               private="true"
+ * @scr.property name="repository.path" value="/var/eventing/jobs" private="true"
  * We schedule this event handler to run in the background and clean up
  * obsolete events.
  * @scr.service interface="java.lang.Runnable"
  * @scr.property name="scheduler.period" value="600" type="Long"
- * @scr.property name="scheduler.concurrent" value="false" type="Boolean"
+ * @scr.property name="scheduler.concurrent" value="false" type="Boolean" private="true"
  */
 public class JobEventHandler
     extends AbstractRepositoryEventHandler

Modified: incubator/sling/trunk/extensions/event/src/main/java/org/apache/sling/event/impl/TimedJobHandler.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/extensions/event/src/main/java/org/apache/sling/event/impl/TimedJobHandler.java?rev=660519&r1=660518&r2=660519&view=diff
==============================================================================
--- incubator/sling/trunk/extensions/event/src/main/java/org/apache/sling/event/impl/TimedJobHandler.java (original)
+++ incubator/sling/trunk/extensions/event/src/main/java/org/apache/sling/event/impl/TimedJobHandler.java Tue May 27 06:58:03 2008
@@ -51,7 +51,7 @@
 /**
  * An event handler for timed events.
  *
- * @scr.component
+ * @scr.component metatype="no"
  * @scr.property name="event.topics" refValues="EventUtil.TOPIC_TIMED_EVENT"
  *               values.updated="org/osgi/framework/BundleEvent/UPDATED"
  *               values.started="org/osgi/framework/BundleEvent/STARTED"

Added: incubator/sling/trunk/extensions/event/src/main/resources/OSGI-INF/metatype/metatype.properties
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/extensions/event/src/main/resources/OSGI-INF/metatype/metatype.properties?rev=660519&view=auto
==============================================================================
--- incubator/sling/trunk/extensions/event/src/main/resources/OSGI-INF/metatype/metatype.properties (added)
+++ incubator/sling/trunk/extensions/event/src/main/resources/OSGI-INF/metatype/metatype.properties Tue May 27 06:58:03 2008
@@ -0,0 +1,72 @@
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+#
+
+
+#
+# This file contains localization strings for configuration labels and
+# descriptions as used in the metatype.xml descriptor generated by the
+# the Sling SCR plugin
+
+#
+# Distribution Event Handler
+dist.events.name = Distribution Event Handler 
+dist.events.description = Distributes local OSGi Event Admin events to \
+ other nodes of the same cluster. The events are written to the JCR \
+ repository for distribution to other nodes while events written to the \
+ repository are picked up and distributed locally through the OSGi Event Admin \
+ Service.   
+
+#
+# Job Event Handler
+job.events.name = Job Event Handler 
+job.events.description = Manages job scheduling on a single system as well \
+ as a cluster to enable running jobs on a single node only or on all nodes. \
+ The respective scheduling is persisted in the repository and distributed \
+ amongst the cluster nodes through Repository Events and locally in the nodes \
+ through the OSGi Event Admin.
+
+sleep.time.name = Retry Interval
+sleep.time.description = The number of milliseconds to sleep between two \
+ consecutive retries of a Job which failed and was set to be retried. The \
+ default value is 20 seconds. This value is only relevant if there is a single \
+ failed job in the queue. If there are multiple failed jobs, each job is \
+ retried in turn without and intervening delay.
+max.job.retries.name = Maximum Retries
+max.job.retries.description = The maximum number of times a failed job slated \
+ for retries is actually retried. If a job has been retried this number of \
+ times and still fails, it is not rescheduled and assumed to have failed. The \
+ default value is 10.
+
+#
+# Shared labels
+scheduler.period.name = Event Cleanup Internal
+scheduler.period.description = Interval in seconds in which events older than \
+ a specific age (see Event Cleanup Age) are purged from the repository. \
+ The default value is 30 minutes (1800 seconds).
+
+cleanup.period.name = Event Cleanup Age
+cleanup.period.description = The maximum age in minutes of persisted events to \
+ be purged from the repository during the cleanup run. The default is 15 \
+ minutes. Note that this setting defines the minimum time an event remains \
+ in the repository. 
+ 
+repository.path.name = Persistent Event Location
+repository.path.description = Absolute Path of the Repository location where \
+ events are persisted to be picked up by the event distribution mechanism. \
+ The default value is "/sling/events".