org.alfresco.bm.event
Class Event

java.lang.Object
  extended by org.alfresco.bm.event.Event

public class Event
extends Object

An event that is persisted and retrieved for processing.

Since:
1.0
Author:
Derek Hulley

Field Summary
static String EVENT_BEAN_PREFIX
           
static String EVENT_NAME_START
           
static String EVENT_NAME_STOP
           
static String FIELD_DATA_OWNER
           
static String FIELD_ID
           
static String FIELD_LOCK_OWNER
           
static String FIELD_LOCK_TIME
           
static String FIELD_NAME
           
static String FIELD_QUEUE_TIME
           
static String FIELD_SCHEDULED_TIME
           
static String INDEX_NAME
           
static String INDEX_NEXT_AVAILABLE_EVENT
           
 
Constructor Summary
Event(String name, long scheduledTime, Object data)
          Construct a scheduled event with some data.
Event(String name, long scheduledTime, Object data, boolean forceInMemoryDataStorage)
          Construct a scheduled event with some data, optionally forcing the data to be stored in memory.
 
Method Summary
static void checkIndexes(org.springframework.data.mongodb.core.MongoTemplate mongo, String collection)
          Ensure that the MongoDB collection has the required indexes for events.
 void cleanData()
          Ensure that any locally-stored data is cleaned up
 boolean equals(Object obj)
           
 String getDataKey()
           
 Object getDataObject()
          Client-safe method to retrieve data based on in-memory or persisted storage
 String getDataOwner()
           
 String getId()
           
 String getLockOwner()
           
 long getLockTime()
           
 String getName()
           
 long getQueueTime()
           
 long getScheduledTime()
           
 int hashCode()
           
 void setDataOwner(String dataOwner)
           
 void setId(String id)
           
 void setLockOwner(String lockOwner)
           
 void setLockTime(long lockTime)
           
 void setName(String name)
           
 void setQueueTime(long queueTime)
           
 void setScheduledTime(long scheduledTime)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

FIELD_ID

public static final String FIELD_ID
See Also:
Constant Field Values

FIELD_NAME

public static final String FIELD_NAME
See Also:
Constant Field Values

FIELD_SCHEDULED_TIME

public static final String FIELD_SCHEDULED_TIME
See Also:
Constant Field Values

FIELD_QUEUE_TIME

public static final String FIELD_QUEUE_TIME
See Also:
Constant Field Values

FIELD_LOCK_OWNER

public static final String FIELD_LOCK_OWNER
See Also:
Constant Field Values

FIELD_LOCK_TIME

public static final String FIELD_LOCK_TIME
See Also:
Constant Field Values

FIELD_DATA_OWNER

public static final String FIELD_DATA_OWNER
See Also:
Constant Field Values

INDEX_NEXT_AVAILABLE_EVENT

public static final String INDEX_NEXT_AVAILABLE_EVENT
See Also:
Constant Field Values

INDEX_NAME

public static final String INDEX_NAME
See Also:
Constant Field Values

EVENT_NAME_START

public static final String EVENT_NAME_START
See Also:
Constant Field Values

EVENT_NAME_STOP

public static final String EVENT_NAME_STOP
See Also:
Constant Field Values

EVENT_BEAN_PREFIX

public static final String EVENT_BEAN_PREFIX
See Also:
Constant Field Values
Constructor Detail

Event

public Event(String name,
             long scheduledTime,
             Object data)
Construct a scheduled event with some data. The data, if Serializable, will be persisted directly with this event.

Events that keep their data in memory cannot be executed by any other running service and will therefore be lost if the server goes down.

Parameters:
name - the event name
scheduledTime - when the event should be processed
data - the event data

Event

public Event(String name,
             long scheduledTime,
             Object data,
             boolean forceInMemoryDataStorage)
Construct a scheduled event with some data, optionally forcing the data to be stored in memory. If the option is selected to force in-memory storage or if the data is not Serializable, then the data will be stored in local memory and a unique look-up key will be persisted.

Events that keep their data in memory cannot be executed by any other running service and will therefore be lost if the server goes down.

Parameters:
name - the event name
scheduledTime - when the event should be processed
data - the event data
Method Detail

checkIndexes

public static void checkIndexes(org.springframework.data.mongodb.core.MongoTemplate mongo,
                                String collection)
Ensure that the MongoDB collection has the required indexes for events.

Parameters:
mongo - connection to MongoDB
collection - name of DB collection containing events

toString

public String toString()
Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

getId

public String getId()

setId

public void setId(String id)

getName

public String getName()

setName

public void setName(String name)

getScheduledTime

public long getScheduledTime()

setScheduledTime

public void setScheduledTime(long scheduledTime)

getQueueTime

public long getQueueTime()

setQueueTime

public void setQueueTime(long queueTime)

getLockOwner

public String getLockOwner()

setLockOwner

public void setLockOwner(String lockOwner)

getLockTime

public long getLockTime()

setLockTime

public void setLockTime(long lockTime)

getDataObject

public Object getDataObject()
Client-safe method to retrieve data based on in-memory or persisted storage


getDataKey

public String getDataKey()
Returns:
the data key in the event that data is stored in the VM only

cleanData

public void cleanData()
Ensure that any locally-stored data is cleaned up


getDataOwner

public String getDataOwner()

setDataOwner

public void setDataOwner(String dataOwner)


Copyright © 2012. All Rights Reserved.