Class WireAdminEvent
WireAdminEvent objects are delivered to all registered
WireAdminListener service objects which specify an interest in the
WireAdminEvent type. Events must be delivered in chronological order
with respect to each listener. For example, a WireAdminEvent of type
WIRE_CONNECTED must be delivered before a WireAdminEvent of
type WIRE_DISCONNECTED for a particular Wire object.
A type code is used to identify the type of event. The following event types are defined:
WIRE_CREATEDWIRE_CONNECTEDWIRE_UPDATEDWIRE_TRACEWIRE_DISCONNECTEDWIRE_DELETEDPRODUCER_EXCEPTIONCONSUMER_EXCEPTION
Event type values must be unique and disjoint bit values. Event types must be defined as a bit in a 32 bit integer and can thus be bitwise ORed together.
Security Considerations. WireAdminEvent objects contain Wire
objects. Care must be taken in the sharing of Wire objects with other
bundles.
- See Also:
- "Immutable"
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intA Consumer service method has thrown an exception.static final intA Producer service method has thrown an exception.static final intTheWireAdminEventtype that indicates that an existingWireobject has become connected.static final intAWirehas been created.static final intAWirehas been deleted.static final intTheWireAdminEventtype that indicates that an existingWireobject has become disconnected.static final intTheWireAdminEventtype that indicates that a new value is transferred over theWireobject.static final intAWirehas been updated. -
Constructor Summary
ConstructorsConstructorDescriptionWireAdminEvent(ServiceReference<WireAdmin> reference, int type, Wire wire, Throwable exception) Constructs aWireAdminEventobject from the givenServiceReferenceobject, event type,Wireobject and exception. -
Method Summary
-
Field Details
-
PRODUCER_EXCEPTION
public static final int PRODUCER_EXCEPTIONA Producer service method has thrown an exception.This
WireAdminEventtype indicates that a Producer service method has thrown an exception. ThegetThrowable()method will return the exception that the Producer service method raised.The value of
PRODUCER_EXCEPTIONis 0x00000001.- See Also:
-
CONSUMER_EXCEPTION
public static final int CONSUMER_EXCEPTIONA Consumer service method has thrown an exception.This
WireAdminEventtype indicates that a Consumer service method has thrown an exception. ThegetThrowable()method will return the exception that the Consumer service method raised.The value of
CONSUMER_EXCEPTIONis 0x00000002.- See Also:
-
WIRE_CREATED
public static final int WIRE_CREATEDAWirehas been created.This
WireAdminEventtype that indicates that a newWireobject has been created. An event is broadcast whenWireAdmin.createWire(String, String, java.util.Dictionary)is called. ThegetWire()method will return theWireobject that has just been created.The value of
WIRE_CREATEDis 0x00000004.- See Also:
-
WIRE_UPDATED
public static final int WIRE_UPDATEDAWirehas been updated.This
WireAdminEventtype that indicates that an existingWireobject has been updated with new properties. An event is broadcast whenWireAdmin.updateWire(Wire, java.util.Dictionary)is called with a valid wire. ThegetWire()method will return theWireobject that has just been updated.The value of
WIRE_UPDATEDis 0x00000008.- See Also:
-
WIRE_DELETED
public static final int WIRE_DELETEDAWirehas been deleted.This
WireAdminEventtype that indicates that an existing wire has been deleted. An event is broadcast whenWireAdmin.deleteWire(Wire)is called with a valid wire.getWire()will return theWireobject that has just been deleted.The value of
WIRE_DELETEDis 0x00000010.- See Also:
-
WIRE_CONNECTED
public static final int WIRE_CONNECTEDTheWireAdminEventtype that indicates that an existingWireobject has become connected. The Consumer object and the Producer object that are associated with theWireobject have both been registered and theWireobject is connected. SeeWire.isConnected()for a description of the connected state. This event may come before theproducersConnectedandconsumersConnectedmethod have returned or called to allow synchronous delivery of the events. Both methods can cause otherWireAdminEvents to take place and requiring this event to be send before these methods are returned would mandate asynchronous delivery.The value of
WIRE_CONNECTEDis 0x00000020.- See Also:
-
WIRE_DISCONNECTED
public static final int WIRE_DISCONNECTEDTheWireAdminEventtype that indicates that an existingWireobject has become disconnected. The Consumer object or/and Producer object is/are unregistered breaking the connection between the two. SeeWire.isConnected()for a description of the connected state.The value of
WIRE_DISCONNECTEDis 0x00000040.- See Also:
-
WIRE_TRACE
public static final int WIRE_TRACETheWireAdminEventtype that indicates that a new value is transferred over theWireobject. This event is sent after the Consumer service has been notified by calling theConsumer.updated(Wire, Object)method or the Consumer service requested a new value with theWire.poll()method. This is an advisory event meaning that when this event is received, another update may already have occurred and this theWire.getLastValue()method returns a newer value then the value that was communicated for this event.The value of
WIRE_TRACEis 0x00000080.- See Also:
-
-
Constructor Details
-
WireAdminEvent
public WireAdminEvent(ServiceReference<WireAdmin> reference, int type, Wire wire, Throwable exception) Constructs aWireAdminEventobject from the givenServiceReferenceobject, event type,Wireobject and exception.- Parameters:
reference- TheServiceReferenceobject of the Wire Admin service that created this event.type- The event type. SeegetType().wire- TheWireobject associated with this event.exception- An exception associated with this event. This may benullif no exception is associated with this event.
-
-
Method Details
-
getServiceReference
Return theServiceReferenceobject of the Wire Admin service that created this event.- Returns:
- The
ServiceReferenceobject for the Wire Admin service that created this event.
-
getWire
Return theWireobject associated with this event.- Returns:
- The
Wireobject associated with this event ornullwhen noWireobject is associated with the event.
-
getType
public int getType()Return the type of this event.The type values are:
- Returns:
- The type of this event.
-
getThrowable
Returns the exception associated with the event, if any.- Returns:
- An exception or
nullif no exception is associated with this event.
-