| 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.sling.event.EventUtil
public abstract class EventUtil
The EventUtil class is an utility class for
 clustered environments.
| Nested Class Summary | |
|---|---|
static interface | 
EventUtil.JobStatusNotifier
This is a private interface which is only public for import reasons.  | 
| Field Summary | |
|---|---|
static java.lang.String | 
PROPERTY_APPLICATION
This event property specifies the application node.  | 
static java.lang.String | 
PROPERTY_DISTRIBUTE
This event property indicates, if the event should be distributed in the cluster (default false).  | 
static java.lang.String | 
PROPERTY_JOB_ID
The property for the unique event id.  | 
static java.lang.String | 
PROPERTY_JOB_PARALLEL
The property to set if a job can be run parallel to any other job.  | 
static java.lang.String | 
PROPERTY_JOB_QUEUE_NAME
The property to set to put the jobs into a separate job queue.  | 
static java.lang.String | 
PROPERTY_JOB_QUEUE_ORDERED
If this property is set with any value, the queue processes the jobs in the same order as they have arrived.  | 
static java.lang.String | 
PROPERTY_JOB_RETRIES
The property to for setting the maximum number of retries.  | 
static java.lang.String | 
PROPERTY_JOB_RETRY_COUNT
The property to track the retry count for jobs.  | 
static java.lang.String | 
PROPERTY_JOB_RETRY_DELAY
The property to set a retry delay.  | 
static java.lang.String | 
PROPERTY_JOB_RUN_LOCAL
The property to set if a job should only be run on the same app it has been created.  | 
static java.lang.String | 
PROPERTY_JOB_TOPIC
The job topic property.  | 
static java.lang.String | 
PROPERTY_TIMED_EVENT_DATE
The date for the timed event.  | 
static java.lang.String | 
PROPERTY_TIMED_EVENT_ID
The property for the unique event id.  | 
static java.lang.String | 
PROPERTY_TIMED_EVENT_PERIOD
The period for the timed event.  | 
static java.lang.String | 
PROPERTY_TIMED_EVENT_SCHEDULE
The scheduler expression for the timed event.  | 
static java.lang.String | 
PROPERTY_TIMED_EVENT_TOPIC
The real topic of the event.  | 
static java.lang.String | 
TOPIC_JOB
The topic for jobs.  | 
static java.lang.String | 
TOPIC_TIMED_EVENT
The topic for timed events.  | 
| Constructor Summary | |
|---|---|
EventUtil()
 | 
|
| Method Summary | |
|---|---|
static void | 
addProperties(javax.jcr.Node node,
              EventPropertiesMap properties,
              java.lang.String[] ignoreProps,
              java.lang.String binPropertyName)
Add all java properties as properties to the node.  | 
static void | 
addProperties(javax.jcr.Node node,
              java.util.Map<java.lang.String,java.lang.Object> properties,
              java.lang.String[] ignoreProps,
              java.lang.String binPropertyName)
Add all java properties as properties to the node.  | 
static org.osgi.service.event.Event | 
createDistributableEvent(java.lang.String topic,
                         java.util.Dictionary<java.lang.String,java.lang.Object> properties)
Create a distributable event.  | 
static void | 
finishedJob(org.osgi.service.event.Event job)
Notify a finished job.  | 
static java.lang.String | 
getApplicationId(org.osgi.service.event.Event event)
Return the application id the event was created at.  | 
static java.lang.String | 
getNodePropertyName(java.lang.String name)
Return the converted repository property name  | 
static javax.jcr.Value | 
getNodePropertyValue(javax.jcr.ValueFactory valueFactory,
                     java.lang.Object eventValue)
Return the converted repository property value  | 
static boolean | 
isJobEvent(org.osgi.service.event.Event event)
Is this a job event?  | 
static boolean | 
isLocal(org.osgi.service.event.Event event)
Is this a local event?  | 
static void | 
processJob(org.osgi.service.event.Event job,
           JobProcessor processor)
Process a job in the background and notify its success.  | 
static EventPropertiesMap | 
readProperties(javax.jcr.Node node,
               java.lang.String binPropertyName,
               java.lang.String[] ignorePrefixes)
Read properties from a repository node and create a property map.  | 
static boolean | 
rescheduleJob(org.osgi.service.event.Event job)
Notify a failed job.  | 
static boolean | 
shouldDistribute(org.osgi.service.event.Event event)
Should this event be distributed in the cluster?  | 
static java.lang.String | 
toString(org.osgi.service.event.Event e)
Improved toString method for an Event.  | 
| Methods inherited from class java.lang.Object | 
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
|---|
public static final java.lang.String PROPERTY_DISTRIBUTE
public static final java.lang.String PROPERTY_APPLICATION
public static final java.lang.String PROPERTY_JOB_TOPIC
public static final java.lang.String PROPERTY_JOB_ID
public static final java.lang.String PROPERTY_JOB_PARALLEL
public static final java.lang.String PROPERTY_JOB_RUN_LOCAL
public static final java.lang.String PROPERTY_JOB_RETRY_COUNT
public static final java.lang.String PROPERTY_JOB_RETRIES
public static final java.lang.String PROPERTY_JOB_RETRY_DELAY
public static final java.lang.String PROPERTY_JOB_QUEUE_NAME
public static final java.lang.String PROPERTY_JOB_QUEUE_ORDERED
PROPERTY_JOB_QUEUE_NAME is specified.
public static final java.lang.String TOPIC_JOB
public static final java.lang.String TOPIC_TIMED_EVENT
public static final java.lang.String PROPERTY_TIMED_EVENT_TOPIC
public static final java.lang.String PROPERTY_TIMED_EVENT_ID
public static final java.lang.String PROPERTY_TIMED_EVENT_SCHEDULE
public static final java.lang.String PROPERTY_TIMED_EVENT_PERIOD
public static final java.lang.String PROPERTY_TIMED_EVENT_DATE
| Constructor Detail | 
|---|
public EventUtil()
| Method Detail | 
|---|
public static org.osgi.service.event.Event createDistributableEvent(java.lang.String topic,
                                                                    java.util.Dictionary<java.lang.String,java.lang.Object> properties)
topic - properties - 
public static boolean shouldDistribute(org.osgi.service.event.Event event)
event - 
true if the event should be distributed.public static boolean isLocal(org.osgi.service.event.Event event)
event - 
true if this is a local eventpublic static java.lang.String getApplicationId(org.osgi.service.event.Event event)
event - 
public static boolean isJobEvent(org.osgi.service.event.Event event)
PROPERTY_JOB_TOPIC
 property.
event - The event to check.
true> if this is a job event.public static void finishedJob(org.osgi.service.event.Event job)
java.lang.IllegalArgumentException - If the event is a job event but does not have a notifier context.public static boolean rescheduleJob(org.osgi.service.event.Event job)
true if the job has been rescheduled, false otherwise.
java.lang.IllegalArgumentException - If the event is a job event but does not have a notifier context.
public static void processJob(org.osgi.service.event.Event job,
                              JobProcessor processor)
public static void addProperties(javax.jcr.Node node,
                                 java.util.Map<java.lang.String,java.lang.Object> properties,
                                 java.lang.String[] ignoreProps,
                                 java.lang.String binPropertyName)
                          throws javax.jcr.RepositoryException
node - The node where all properties are added toproperties - The map of properties.ignoreProps - optional list of property which should be ignoredbinPropertyName - The name of the binary property.
javax.jcr.RepositoryException
public static void addProperties(javax.jcr.Node node,
                                 EventPropertiesMap properties,
                                 java.lang.String[] ignoreProps,
                                 java.lang.String binPropertyName)
                          throws javax.jcr.RepositoryException
node - The node where all properties are added toproperties - The map of properties.ignoreProps - optional list of property which should be ignoredbinPropertyName - The name of the binary property.
javax.jcr.RepositoryException
public static EventPropertiesMap readProperties(javax.jcr.Node node,
                                                java.lang.String binPropertyName,
                                                java.lang.String[] ignorePrefixes)
                                         throws javax.jcr.RepositoryException,
                                                java.lang.ClassNotFoundException
javax.jcr.RepositoryException
java.lang.ClassNotFoundExceptionpublic static java.lang.String getNodePropertyName(java.lang.String name)
name - The java object property name
public static javax.jcr.Value getNodePropertyValue(javax.jcr.ValueFactory valueFactory,
                                                   java.lang.Object eventValue)
valueFactory - The value factoryeventValue - The event value
public static java.lang.String toString(org.osgi.service.event.Event e)
  | 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||