org.ops4j.pax.radman.service.event.repeater.message
Class EventMessage
java.lang.Object
org.ops4j.pax.radman.service.event.repeater.message.EventMessage
- All Implemented Interfaces:
- java.io.Serializable
@Immutable
public class EventMessage
- extends java.lang.Object
- implements java.io.Serializable
A POJO representing the submission of an Event to the Gateway
An EventMessage is not a carbon-copy of an Event.
That is,
Event origEvent = ...;
EventMessage mesg = EventMessage.valueOf( origEvent, "192.168.1.31:50008" );
assertFalse( mesg.toEvent.equals( event ); // test succeeds
- Since:
- 0.1.0
- Author:
- Gavin Bong
- See Also:
- Serialized Form
|
Constructor Summary |
EventMessage(java.lang.String topic,
java.lang.String sourceContainer)
|
|
Method Summary |
java.lang.String |
getSourceContainer()
|
java.lang.String |
getTopic()
|
java.util.Map<java.lang.String,java.lang.Object> |
properties()
|
org.osgi.service.event.Event |
toEvent()
|
org.osgi.service.event.Event |
toEvent(java.lang.String... keysToBeRemoved)
Example: |
java.lang.String |
toString()
|
static EventMessage |
valueOf(org.osgi.service.event.Event event,
java.lang.String sourceContainer)
Returns a Serializable representation of the supplied Event. |
static EventMessage |
valueOf(java.util.List<java.lang.String> lines)
This is invoked on the Gateway |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
END_OF_DATA
public static final java.lang.String END_OF_DATA
- See Also:
- Constant Field Values
SEPARATOR
public static final java.lang.String SEPARATOR
- See Also:
- Constant Field Values
COMMAND_EVENT
public static final java.lang.String COMMAND_EVENT
- See Also:
- Constant Field Values
COMMAND_PING
public static final java.lang.String COMMAND_PING
- See Also:
- Constant Field Values
CHARSET
public static final java.lang.String CHARSET
- See Also:
- Constant Field Values
EMPTYSTRING
public static final java.lang.String EMPTYSTRING
- See Also:
- Constant Field Values
EventMessage
public EventMessage(java.lang.String topic,
java.lang.String sourceContainer)
toEvent
public org.osgi.service.event.Event toEvent(java.lang.String... keysToBeRemoved)
- Example:
If you supplied key "FOO", and internally this EventMessage contains
elements with keys "FOOBAR", "FOO camp 2007" & "FOO", the returned Event
will be missing these 3 elements.
- Parameters:
keysToBeRemoved - list of keys of elements which you want to be removed to
to prevent them from appearing in the returned Event
toEvent
public org.osgi.service.event.Event toEvent()
- Throws:
java.lang.IllegalArgumentException - if this EventMessage has an invalid topic name
getTopic
public java.lang.String getTopic()
getSourceContainer
public java.lang.String getSourceContainer()
properties
public java.util.Map<java.lang.String,java.lang.Object> properties()
valueOf
public static EventMessage valueOf(java.util.List<java.lang.String> lines)
- This is invoked on the Gateway
valueOf
public static EventMessage valueOf(org.osgi.service.event.Event event,
java.lang.String sourceContainer)
- Returns a
Serializable representation of the supplied Event.
Only a subset of the properties are retained in the returned value. This is invoked
on the managed-Host.
TODO serialize the throwable item (key="exception")
- Parameters:
event - the OSGi EventsourceContainer - an identifier for the OSGi container that generated the event
- Returns:
toString
public java.lang.String toString()
- Overrides:
toString in class java.lang.Object
Copyright © 2008. All Rights Reserved.