Interface WireAdmin
This service can be used to create Wire
objects connecting a Producer
service and a Consumer service. Wire
objects also have wire
properties that may be specified when a Wire
object is created. The
Producer and Consumer services may use the Wire
object's properties
to manage or control their interaction. The use of Wire
object's
properties by a Producer or Consumer services is optional.
Security Considerations. A bundle must have
ServicePermission[WireAdmin,GET]
to get the Wire Admin service to
create, modify, find, and delete Wire
objects.
- "Consumers of this API must not implement this interface"
-
Method Summary
Modifier and TypeMethodDescriptioncreateWire
(String producerPID, String consumerPID, Dictionary<String, ?> properties) Create a newWire
object that connects a Producer service to a Consumer service.void
deleteWire
(Wire wire) Delete aWire
object.Wire[]
Return theWire
objects that match the givenfilter
.void
updateWire
(Wire wire, Dictionary<String, ?> properties) Update the properties of aWire
object.
-
Method Details
-
createWire
Create a newWire
object that connects a Producer service to a Consumer service. The Producer service and Consumer service do not have to be registered when theWire
object is created.The
Wire
configuration data must be persistently stored. AllWire
connections are reestablished when theWireAdmin
service is registered. AWire
can be permanently removed by using thedeleteWire(Wire)
method.The
Wire
object's properties must have case insensitiveString
objects as keys (like the Framework). However, the case of the key must be preserved.The
WireAdmin
service must automatically add the followingWire
properties:WireConstants.WIREADMIN_PID
set to the value of theWire
object's persistent identity (PID). This value is generated by the Wire Admin service when aWire
object is created.WireConstants.WIREADMIN_PRODUCER_PID
set to the value of Producer service's PID.WireConstants.WIREADMIN_CONSUMER_PID
set to the value of Consumer service's PID.
properties
argument already contains any of these keys, then the supplied values are replaced with the values assigned by the Wire Admin service.The Wire Admin service must broadcast a
WireAdminEvent
of typeWireAdminEvent.WIRE_CREATED
after the newWire
object becomes available fromgetWires(String)
.- Parameters:
producerPID
- Theservice.pid
of the Producer service to be connected to theWire
object.consumerPID
- Theservice.pid
of the Consumer service to be connected to theWire
object.properties
- TheWire
object's properties. This argument may benull
if the caller does not wish to define anyWire
object's properties.- Returns:
- The
Wire
object for this connection. - Throws:
IllegalArgumentException
- Ifproperties
contains invalid wire types or case variants of the same key name.
-
deleteWire
Delete aWire
object.The
Wire
object representing a connection between a Producer service and a Consumer service must be removed. The persistently stored configuration data for theWire
object must destroyed. TheWire
object's methodWire.isValid()
will returnfalse
after it is deleted.The Wire Admin service must broadcast a
WireAdminEvent
of typeWireAdminEvent.WIRE_DELETED
after theWire
object becomes invalid.- Parameters:
wire
- TheWire
object which is to be deleted.
-
updateWire
Update the properties of aWire
object. The persistently stored configuration data for theWire
object is updated with the new properties and then the Consumer and Producer services will be called at the respectiveConsumer.producersConnected(Wire[])
andProducer.consumersConnected(Wire[])
methods.The Wire Admin service must broadcast a
WireAdminEvent
of typeWireAdminEvent.WIRE_UPDATED
after the updated properties are available from theWire
object.- Parameters:
wire
- TheWire
object which is to be updated.properties
- The newWire
object's properties ornull
if no properties are required.- Throws:
IllegalArgumentException
- Ifproperties
contains invalid wire types or case variants of the same key name.
-
getWires
Return theWire
objects that match the givenfilter
.The list of available
Wire
objects is matched against the specifiedfilter
.Wire
objects which match thefilter
must be returned. TheseWire
objects are not necessarily connected. The Wire Admin service should not return invalidWire
objects, but it is possible that aWire
object is deleted after it was placed in the list.The filter matches against the
Wire
object's properties includingWireConstants.WIREADMIN_PRODUCER_PID
,WireConstants.WIREADMIN_CONSUMER_PID
andWireConstants.WIREADMIN_PID
.- Parameters:
filter
- Filter string to selectWire
objects ornull
to select allWire
objects.- Returns:
- An array of
Wire
objects which match thefilter
ornull
if noWire
objects match thefilter
. - Throws:
InvalidSyntaxException
- If the specifiedfilter
has an invalid syntax.- See Also:
-