Interface WireAdmin
-
public interface WireAdmin
Wire Administration service.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 aWire
object is created. The Producer and Consumer services may use theWire
object's properties to manage or control their interaction. The use ofWire
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 deleteWire
objects.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Wire
createWire(java.lang.String producerPID, java.lang.String consumerPID, java.util.Dictionary<java.lang.String,?> properties)
Create a newWire
object that connects a Producer service to a Consumer service.void
deleteWire(Wire wire)
Delete aWire
object.Wire[]
getWires(java.lang.String filter)
Return theWire
objects that match the givenfilter
.void
updateWire(Wire wire, java.util.Dictionary<java.lang.String,?> properties)
Update the properties of aWire
object.
-
-
-
Method Detail
-
createWire
Wire createWire(java.lang.String producerPID, java.lang.String consumerPID, java.util.Dictionary<java.lang.String,?> properties)
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:
java.lang.IllegalArgumentException
- Ifproperties
contains invalid wire types or case variants of the same key name.
-
deleteWire
void deleteWire(Wire wire)
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
void updateWire(Wire wire, java.util.Dictionary<java.lang.String,?> properties)
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:
java.lang.IllegalArgumentException
- Ifproperties
contains invalid wire types or case variants of the same key name.
-
getWires
Wire[] getWires(java.lang.String filter) throws org.osgi.framework.InvalidSyntaxException
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:
org.osgi.framework.InvalidSyntaxException
- If the specifiedfilter
has an invalid syntax.- See Also:
Filter
-
-