A Wire object connects a Producer service to a Consumer service. Both
the Producer and Consumer services are identified by their unique
service.pid values. The Producer and Consumer services may
communicate with each other via Wire objects that connect them. The
Producer service may send updated values to the Consumer service by calling
the update(Object) method. The Consumer service may request an
updated value from the Producer service by calling the poll()
method.
A Producer service and a Consumer service may be connected through multiple
Wire objects.
Security Considerations. Wire objects are available to Producer and
Consumer services connected to a given Wire object and to bundles
which can access the WireAdmin service. A bundle must have
ServicePermission[WireAdmin,GET] to get the WireAdmin service
to access all Wire objects. A bundle registering a Producer service
or a Consumer service must have the appropriate
ServicePermission[Consumer|Producer,REGISTER] to register the service
and will be passed Wire objects when the service object's
consumersConnected or producersConnected method is called.
Scope. Each Wire object can have a scope set with the setScope
method. This method should be called by a Consumer service when it assumes a
Producer service that is composite (supports multiple information items). The
names in the scope must be verified by the Wire object before it is
used in communication. The semantics of the names depend on the Producer
service and must not be interpreted by the Wire Admin service.
| Modifier and Type | Method and Description |
|---|---|
| public Class | Returns: An array containing the list of classes understood by the Consumer service ornull if the Wire is not
connected, or the consumer did not register a
WireConstants#WIREADMIN_CONSUMER_FLAVORS property or the
value of the property is not of type Class[].Return the list of data types understood by the Consumer service
connected to this |
| public Object | Returns: The last value passed though thisWire object or
null if no valid values have been passed or the Consumer
service has no permission.Return the last value sent through this |
| public Dictionary | Returns: The properties for thisWire object. The returned
Dictionary must be read only.Return the wire properties for this |
| public String[] | Returns: A list of permitted scope names or null if the Produce or Consumer service has set no scope names.Return the calculated scope of this |
| public boolean | |
| public boolean | Returns: true if both the Producer and Consumer for this
Wire object are connected to the Wire object;
false otherwise.Return the connection state of this |
| public boolean | Returns: false if this Wire object is invalid because it
has been deleted via WireAdmin#deleteWire(Wire);
true otherwise.Return the state of this |
| public Object | Returns: A value whose type should be one of the types returned bygetFlavors(),Envelope[], or null if the
Wire object is not connected, the Producer service threw
an exception, or the Producer service returned a value which is
not an instance of one of the types returned by
getFlavors().Poll for an updated value. |
| public void | update(Object
The updated value. The value should be an instance of one of
the types returned by value)getFlavors().Update the value. |
| getFlavors | back to summary |
|---|---|
| public Class Return the list of data types understood by the Consumer service
connected to this
The list is the value of the
| |
| getLastValue | back to summary |
|---|---|
| public Object getLastValue() Return the last value sent through this
The returned value is the most recent, valid value passed to the
| |
| getProperties | back to summary |
|---|---|
| public Dictionary Return the wire properties for this
| |
| getScope | back to summary |
|---|---|
| public String[] getScope() Return the calculated scope of this
If neither the Consumer, or the Producer service registers scope names
with its service registration, then the
The
A scope name is permitted for a Producer service when the registering
bundle has
If either Consumer service or Producer service has not set a
If the scope is set, the
| |
| hasScope | back to summary |
|---|---|
| public boolean hasScope(String name) Return true if the given name is in this
| |
| isConnected | back to summary |
|---|---|
| public boolean isConnected() Return the connection state of this
A
A
A
A
| |
| isValid | back to summary |
|---|---|
| public boolean isValid() Return the state of this
A connected
| |
| poll | back to summary |
|---|---|
| public Object poll() Poll for an updated value.
This methods is normally called by the Consumer service to request an
updated value from the Producer service connected to this
If this
A
| |
| update | back to summary |
|---|---|
| public void update(Object value) Update the value.
This methods is called by the Producer service to notify the Consumer
service connected to this
If the properties of this
If no filtering is done, or the filter indicates the updated value should
be delivered to the Consumer service, then this
If the value is an
A
| |