com.opencms.flex
Class CmsEvent

java.lang.Object
  |
  +--java.util.EventObject
        |
        +--com.opencms.flex.CmsEvent
All Implemented Interfaces:
Serializable

public class CmsEvent
extends EventObject

Event class for OpenCms for system wide events that are thrown by various operations (e.g. publishing) and can be catched and processed by classes that implement the I_CmsEventListener interface.

Since:
FLEX alpha 1
Version:
$Revision: 1.5 $
Author:
Alexander Kandzior (a.kandzior@alkacon.com)
See Also:
I_CmsEventListener, Serialized Form

Field Summary
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
CmsEvent(CmsObject cms, int type, Map data)
          Construct a new CmsEvent with the specified parameters, this constructor just calls this(cms, type, data, false).
CmsEvent(CmsObject cms, int type, Map data, boolean isClusterEvent)
          Construct a new CmsEvent with the specified parameters.
 
Method Summary
 CmsObject getCmsObject()
          Provides access to the CmsObject that was passed with this event.
 Map getData()
          Provides access to the event data that was passed with this event.
 int getType()
          Provides access to the event type that was passed with this event.
 boolean isClusterEvent()
          Check whether this event should be forwarded to the other servers in the cluster or not.
 void setClusterEvent(boolean value)
          Set the boolean flag whether this event should be forwarded to the other servers in the cluster.
 String toString()
          Return a String representation of this CmsEvent.
 
Methods inherited from class java.util.EventObject
getSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CmsEvent

public CmsEvent(CmsObject cms,
                int type,
                Map data)
Construct a new CmsEvent with the specified parameters, this constructor just calls this(cms, type, data, false).

Parameters:
cms - CmsObject on which this event occurred
type - event type
data - event data

CmsEvent

public CmsEvent(CmsObject cms,
                int type,
                Map data,
                boolean isClusterEvent)
Construct a new CmsEvent with the specified parameters.

The event data Map provides a facility to pass objects with the event that contain information about the event environment. For example, if the event is of type I_CmsEventListener.EVENT_LOGIN_USER the Map contains a single object with the key "data" and a value that is the OpenCms user object that represents the user that just logged in.

If isClusterEvent is true, the event should be forwarded to all servers in the OpenCms cluster. If it is false, is is important only for server running this instance of OpenCms.

Parameters:
cms - CmsObject on which this event occurred
type - event type
data - event data
isClusterEvent - must be true if this event should be forwarded to the other servers in the cluster
See Also:
I_CmsEventListener
Method Detail

getData

public Map getData()
Provides access to the event data that was passed with this event.

Returns:
the event data of this event

getCmsObject

public CmsObject getCmsObject()
Provides access to the CmsObject that was passed with this event.

Returns:
the CmsObject on which this event occurred

getType

public int getType()
Provides access to the event type that was passed with this event.

Event types of the core OpenCms classes are defined in I_CmsEventListener. For your extensions, you should define them in a central class or interface as public member variables. Make sure the integer values do not confict with the values from the core classes.

Returns:
the event type of this event
See Also:
I_CmsEventListener

toString

public String toString()
Return a String representation of this CmsEvent.

Overrides:
toString in class EventObject
Returns:
a String representation of this event

setClusterEvent

public void setClusterEvent(boolean value)
Set the boolean flag whether this event should be forwarded to the other servers in the cluster.

Parameters:
value - true if this event should be forwarded to the other servers in the cluster, false otherwise

isClusterEvent

public boolean isClusterEvent()
Check whether this event should be forwarded to the other servers in the cluster or not.

Returns:
true if this event should be forwarded to the other servers in the cluster, false otherwise