incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Sling Website > Managing events
Date Mon, 16 Aug 2010 12:07:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1810/9/1/_/styles/combined.css?spaceKey=SLINGxSITE&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://cwiki.apache.org/confluence/display/SLINGxSITE/Managing+events">Managing
events</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~jck">Jean-Christophe
KAUTZMANN</a>
    </h4>
        <br/>
                         <h4>Changes (1)</h4>
                                 
    
<div id="page-diffs">
            <table class="diff" cellpadding="0" cellspacing="0">
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" > <br>The first part of the code
looks as follows: <br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-changed-words">{code<span
class="diff-added-chars"style="background-color: #dfd;">:java</span>}</span>
<br></td></tr>
            <tr><td class="diff-unchanged" >/** <br> * The &lt;code&gt;OsgiDropBoxService&lt;/code&gt;
is listening content added to /tmp/dropbox by using OSGI events <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
        </table>
</div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <p>Apache Sling provides some mechanisms and support for managing events. This
page describes ...</p>

<p>Sling distinguishes between 2 types of events:<br/>
&#45; standard events: no garantee of processing<br/>
&#45; job events: garantee of processing. Someone has to do something with the event (do
the job).</p>

<p>The event mechanism is leveraging the OSGi Event Admin Specification (OSGi Compendium
113).<br/>
The OSGi API is very simple and leightweight - sending an event is just generating the event
object and calling the event admin. Receiving the event is implementing a single interface
and declaring through properties which topics one is interested in. For more details please
refer to the following javadocs:<br/>
&#45; package org.osgi.service.event of the OSGI API (<a href="http://www.osgi.org/javadoc/r4v42/org/osgi/service/event/package-summary.html"
class="external-link" rel="nofollow">http://www.osgi.org/javadoc/r4v42/org/osgi/service/event/package-summary.html</a>).<br/>
&#45; package org.apache.sling.event of the Sling API (<a href="http://sling.apache.org/apidocs/sling5/org/apache/sling/event/package-summary.html"
class="external-link" rel="nofollow">http://sling.apache.org/apidocs/sling5/org/apache/sling/event/package-summary.html</a>)</p>

<p>You can learn more in the "Eventing, Jobs and Scheduling" section (<a href="http://sling.apache.org/site/eventing-and-jobs.html"
class="external-link" rel="nofollow">http://sling.apache.org/site/eventing-and-jobs.html</a>).</p>

<p>To get started with the Sling eventing API, you will implement here a service that
listens to files posted to /tmp/dropbox and moves them to the appropriate locations depending
on the mime-type:<br/>
&nbsp;&#42; images (.png) are moved to /dropbox/images/<br/>
&nbsp;&#42; music (.mp3) are moved to /dropbox/music/<br/>
&nbsp;&#42; movies (.avi) are moved to /dropbox/movies/<br/>
&nbsp;&#42; otherwise the files are moved to /dropbox/other/</p>

<p>To do that, you will implement 2 services. The first one, called OsgiDropBoxService:<br/>
&#45; listens to osgi event "resource added"<br/>
&#45; sends a job event<br/>
The second one, called DropBoxEventHandler:<br/>
&#45; listens to job event "file added to /tmp/dropbox"<br/>
&#45; moves the file according to its extension</p>

<p>Listening to osgi event "resource added"</p>

<p>To listen to the specific osgi event "resource added":<br/>
&#45; The service needs to implement the interface org.osgi.service.event.EventHandler
and its handleEvent(Event event) method.<br/>
&#45; The property "event.topics" needs to be set to "org.apache.sling.api.SlingConstants.TOPIC_RESOURCE_ADDED"
in the class annotations.<br/>
To get a list of possible events available in Sling (resource added, removed or changed),
refer to the javadocs for org.apache.sling.api.SlingConstants.</p>

<p>To send a job event:<br/>
&#45; The service needs to implement the interface org.apache.sling.event.JobProcessor
and its process(org.osgi.service.event.Event job) method.</p>

<p>The first part of the code looks as follows:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
/**
 * The &lt;code&gt;OsgiDropBoxService&lt;/code&gt; is listening content added
to /tmp/dropbox by using OSGI events
 * 
 * @scr.component  immediate=<span class="code-quote">"<span class="code-keyword">true</span>"</span>
 * @scr.service <span class="code-keyword">interface</span>=<span class="code-quote">"org.osgi.service.event.EventHandler"</span>
 * @scr.property name=<span class="code-quote">"event.topics"</span> valueRef=<span
class="code-quote">"org.apache.sling.api.SlingConstants.TOPIC_RESOURCE_ADDED"</span>
 */
</pre>
</div></div>

<p>The Event Admin service is needed to send the job event:<br/>
&nbsp;&nbsp; &nbsp;/*&#42;<br/>
&nbsp;&nbsp; &nbsp; * The OSGI event admin used for sending events<br/>
&nbsp;&nbsp;&nbsp;&nbsp; * @scr.reference<br/>
&nbsp;&nbsp; &nbsp; &#42;/<br/>
&nbsp;&nbsp; &nbsp;private EventAdmin eventAdmin;<br/>
&nbsp;&nbsp; &nbsp;<br/>
The job topic for dropbox job events needs to be defined:<br/>
&nbsp;&nbsp;&nbsp; /*&#42; The job topic for dropbox job events. &#42;/<br/>
&nbsp;&nbsp;&nbsp; public static final String JOB_TOPIC = "com/sling/eventing/dropbox/job";</p>

<p>The org.osgi.service.event.EventHandler#handleEvent(Event event) method needs to
be implemented:<br/>
&nbsp;&nbsp; &nbsp;public void handleEvent(Event event) {<br/>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; if (EventUtil.isLocal(event))
</p>
<div class="error"><span class="error">Unknown macro: {
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
EventUtil.processJob(event, this);
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; }</span> 
<p>&nbsp;&nbsp; &nbsp;}</p>

<p>The org.apache.sling.event.JobProcessor#process(Event event) method needs to be implemented.<br/>
The logic is as follows:<br/>
&#45; the OSGI event is analyzed<br/>
&#45; if the event is a file that has been added to "/tmp/dropbox":<br/>
&nbsp;&nbsp; &nbsp;&#45; an event is created with 2 properties:<br/>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&#45; one to flag the event
as a job event<br/>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&#45; the file path<br/>
&nbsp;&nbsp; &nbsp;&#45; the job event is sent to all the listeners that subscribe
to the topic of the event.</p>

<p>&nbsp;&nbsp; &nbsp;public boolean process(Event event) {<br/>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;String propPath = (String) event.getProperty(SlingConstants.PROPERTY_PATH);<br/>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;String propResType = (String)
event.getProperty(SlingConstants.PROPERTY_RESOURCE_TYPE);<br/>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;// an event is sent if a file
is added to /tmp/dropbox<br/>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;if (propPath.startsWith("/tmp/dropbox")
&amp;&amp; propResType.equals("nt:file")) {<br/>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;final
Dictionary&lt;String, Object&gt; props = new Hashtable&lt;String, Object&gt;();<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
props.put(EventUtil.PROPERTY_JOB_TOPIC, JOB_TOPIC);<br/>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;props.put("resourcePath",
propPath);<br/>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;Event
dropboxJobEvent = new Event(EventUtil.TOPIC_JOB, props);<br/>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;eventAdmin.sendEvent(dropboxJobEvent);<br/>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;log.info("the
dropbox job has been sent: {}", propPath);<br/>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;}<br/>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;return true;<br/>
&nbsp;&nbsp; &nbsp;}</p>

<p>The whole service looks now as follows:<br/>
...</p>

<p>Now that you have a service that sends job events whenever a file is uploaded to
"/tmp/dropbox",<br/>
you will create the service DropBoxEventHandler that listens to those job events and moves
the files to a location<br/>
corresponding to their mime-types.</p>

<p>Listening to job events</p>

<p>To listen to the job events that have been defined before:<br/>
&#45; The service also needs to implement the interface org.osgi.service.event.EventHandler
and its handleEvent(Event event) method.<br/>
&#45; The property "event.topics" needs to be set to "com.jck.sling.eventing.osgi.OsgiDropBoxService.JOB_TOPIC"
in the class annotations.</p>

<p>To move the files:<br/>
&#45; The service needs to implement the interface org.apache.sling.event.JobProcessor
and its process(org.osgi.service.event.Event job) method.</p>

<p>The first part of the code looks as follows:<br/>
/*&#42;<br/>
&nbsp;&#42; @scr.component&nbsp; immediate="true"<br/>
&nbsp;&#42; @scr.service interface="org.osgi.service.event.EventHandler"<br/>
&nbsp;&#42; @scr.property name="event.topics" valueRef="com.jck.sling.eventing.osgi.OsgiDropBoxService.JOB_TOPIC"<br/>
&nbsp;*/</p>

<p>public class DropBoxEventHandler implements JobProcessor, EventHandler {</p>



<p>Several class fields are defined:<br/>
&#45; for logging<br/>
&#45; to reference the SlingRepository and the JcrResourceResolverFactory services, which
are used in the implementation<br/>
&#45; to define the destination path of the files</p>

<p>&nbsp;&nbsp;&nbsp; /*&#42; Default log. &#42;/<br/>
&nbsp;&nbsp;&nbsp; protected final Logger log = LoggerFactory.getLogger(this.getClass());</p>

<p>&nbsp;&nbsp;&nbsp; private Session adminSession;<br/>
&nbsp;&nbsp; &nbsp;<br/>
&nbsp;&nbsp;&nbsp; /*&#42; @scr.reference &#42;/<br/>
&nbsp;&nbsp;&nbsp; private SlingRepository repository;<br/>
&nbsp;&nbsp; &nbsp;<br/>
&nbsp;&nbsp;&nbsp; /*&#42;<br/>
&nbsp;&nbsp;&nbsp;&nbsp; * @scr.reference<br/>
&nbsp;&nbsp;&nbsp;&nbsp; &#42;/<br/>
&nbsp;&nbsp;&nbsp; private JcrResourceResolverFactory resolverFactory;<br/>
&nbsp;&nbsp; &nbsp;<br/>
&nbsp;&nbsp;&nbsp; private final static String IMAGES_PATH = "/dropbox/images/";<br/>
&nbsp;&nbsp;&nbsp; private final static String MUSIC_PATH = "/dropbox/music/";<br/>
&nbsp;&nbsp;&nbsp; private final static String MOVIES_PATH = "/dropbox/movies/";<br/>
&nbsp;&nbsp;&nbsp; private final static String OTHER_PATH = "/dropbox/other/";</p>

<p>The org.osgi.service.event.EventHandler#handleEvent(Event event) method needs to
be implemented:<br/>
&nbsp;&nbsp; &nbsp;public void handleEvent(Event event) {<br/>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; if (EventUtil.isLocal(event))
</p></div>
<p>&nbsp;&nbsp; &nbsp;}</p>

<p>The org.apache.sling.event.JobProcessor#process(Event event) method needs to be implemented.<br/>
The logic is as follows:<br/>
&#45; the resource path is extracted from the job event property<br/>
&#45; the resource is obtained from the file path<br/>
&#45; if the resource is a file, the destination path is defined based on the file mime-type<br/>
&#45; the file is moved to the new location</p>

<p>&nbsp;&nbsp; &nbsp;public boolean process(Event event) {<br/>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;try {<br/>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;String
resourcePath = (String) event.getProperty("resourcePath");<br/>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;String
resourceName = resourcePath.substring(resourcePath.lastIndexOf("/") + 1);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;adminSession = repository.loginAdministrative(null);<br/>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
ResourceResolver resourceResolver = resolverFactory.getResourceResolver(adminSession);<br/>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Resource res = resourceResolver.getResource(resourcePath);<br/>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if (ResourceUtil.isA(res, "nt:file")) {<br/>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;String mimeType = res.getResourceMetadata().getContentType();<br/>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;String destDir;<br/>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;if (mimeType.equals("image/png")) </p>
<div class="error"><span class="error">Unknown macro: {
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;destDir = IMAGES_PATH;
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;}</span> </div>
<p>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;else if (mimeType.equals("audio/mpeg")) </p>
<div class="error"><span class="error">Unknown macro: {
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;destDir = MUSIC_PATH;
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;}</span> </div>
<p>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;else if (mimeType.equals("video/x-msvideo")) </p>
<div class="error"><span class="error">Unknown macro: {
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;destDir = MOVIES_PATH;
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;}</span> </div>
<p>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;else </p>
<div class="error"><span class="error">Unknown macro: {
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;destDir = OTHER_PATH;
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;}</span> </div>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;adminSession.move(resourcePath, destDir + resourceName);<br/>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;adminSession.save();<br/>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;log.info("The file {} has been moved to {}", resourceName,
destDir);<br/>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}<br/>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
return true;<br/>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;} catch (RepositoryException
e) </p>
<div class="error"><span class="error">Unknown macro: {
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;log.error(&quot;RepositoryException}</span>
</div>
<p> finally {<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if (adminSession &#33;= null &amp;&amp; adminSession.isLive()) </p>
<div class="error"><span class="error">Unknown macro: {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;adminSession.logout();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &nbsp;adminSession = null;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}</span> </div>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br/>
&nbsp;&nbsp; &nbsp;}</p>

<p>The complete code for the service looks as follows:<br/>
...</p>


<p>2 services</p>

<p>Sling sends OSGi events when resources are added, removed or changed<br/>
&nbsp;&nbsp; &nbsp;org.apache.sling.api.SlingConstants:<br/>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;TOPIC_RESOURCE_ADDED<br/>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;TOPIC_RESOURCE_REMOVED<br/>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;TOPIC_RESOURCE_CHANGED</p>

<p>Web console: see all the events sent<br/>
&nbsp;&nbsp; &nbsp;<a href="http://localhost:4502/system/console/events" class="external-link"
rel="nofollow">http://localhost:4502/system/console/events</a></p>


<p>How to listen to osgi events:<br/>
&nbsp;&nbsp; &nbsp;subscribe to the event<br/>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; * @scr.property name="event.topics"
valueRef="org.apache.sling.api.SlingConstants.TOPIC_RESOURCE_ADDED"<br/>
&nbsp;&nbsp; &nbsp;the service needs to implement JobProcessor and EventHandler
(org.osgi.service.event.EventHandler, listener for events)<br/>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;process(org.osgi.service.event.Event
job) from JobProcessor<br/>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;handleEvent(Event event) from
EventHandler<br/>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<br/>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<br/>
Send a job event</p>

<p>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;reference the osgi
EventAdmin<br/>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;define the JOB_TOPIC<br/>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;define the job and send it:<br/>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;final
Dictionary&lt;String, Object&gt; props = new Hashtable&lt;String, Object&gt;();<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
props.put(EventUtil.PROPERTY_JOB_TOPIC, JOB_TOPIC);<br/>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;props.put("nodePath",
propPath);<br/>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;Event
dropboxJobEvent = new Event(EventUtil.TOPIC_JOB, props);<br/>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;eventAdmin.sendEvent(dropboxJobEvent);</p>


<p>Listen to a Job event<br/>
same as listening to an event, except:<br/>
&nbsp;&#42; @scr.property name="event.topics" valueRef="com.jck.sling.eventing.osgi.OsgiDropBoxService.JOB_TOPIC"</p>

<p>Complete code sample<br/>
...</p>
    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;">
            <a href="https://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
        </div>
        <a href="https://cwiki.apache.org/confluence/display/SLINGxSITE/Managing+events">View
Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=23335037&revisedVersion=5&originalVersion=4">View
Changes</a>
                |
        <a href="https://cwiki.apache.org/confluence/display/SLINGxSITE/Managing+events?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message