Openwings API Documentation (v1.0)

net.openwings.component
Class ServiceResult

java.lang.Object
  |
  +--net.openwings.component.ServiceResult
All Implemented Interfaces:
java.io.Serializable

public class ServiceResult
extends java.lang.Object
implements java.io.Serializable

This class is used to associate a used service object with its unique service identifier and additional information such as service attributes and user interfaces.

For synchronous services, this class is returned from calls to Component.useService() and is passed to UseServiceListener.serviceProvided(). Additional information can be requested by passing a UseServiceParameters object in the useService() call.

For asynchronous services, this class is returned from calls to Component.publishService() / Component.subscribeService() and is passed to EventServiceListener.serviceAvailable(). For service subscribers, the service object will be null. Additional information can be requested by passing a EventServiceParameters object in the Component.publishService() / Component.subscribeService() call.

See Also:
Serialized Form

Constructor Summary
ServiceResult(UniqueID serviceID, UniqueID componentID, java.lang.Object service, Attribute[] serviceAttributes, java.lang.Object userInterface, UserInterfaceFactory[] factories)
          Simple constructor.
 
Method Summary
 UniqueID getComponentID()
          This method returns the global unique service identifier for the component that provided this synchronous service / created this asynchronous service (topic), if known.
 java.lang.Object getService()
          This method returns the service object.
 Attribute getServiceAttribute(java.lang.String attributeName)
          This convenience method retrieves a service attribute by name.
 Attribute[] getServiceAttributes()
          This method returns attributes that describe a service, if requested
 UniqueID getServiceID()
          This method returns the global unique service identifier for this service
 java.lang.Object getUserInterface()
          This method returns the user interface object for this service, if one was requested.
 UserInterfaceFactory[] getUserInterfaceFactories()
          This method returns acceptable user interface factories for this service, if requested.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServiceResult

public ServiceResult(UniqueID serviceID,
                     UniqueID componentID,
                     java.lang.Object service,
                     Attribute[] serviceAttributes,
                     java.lang.Object userInterface,
                     UserInterfaceFactory[] factories)
Simple constructor.

Parameters:
serviceID - global unique service identifier
service - service object
userInterface - optional user interface attached to the service
Method Detail

getServiceID

public UniqueID getServiceID()
This method returns the global unique service identifier for this service


getComponentID

public UniqueID getComponentID()
This method returns the global unique service identifier for the component that provided this synchronous service / created this asynchronous service (topic), if known.


getService

public java.lang.Object getService()
This method returns the service object. If this ServiceResult is for a service subscriber, the method returns null.


getServiceAttributes

public Attribute[] getServiceAttributes()
This method returns attributes that describe a service, if requested

To request that attributes be returned for a synchronous service, a UseServiceParameters must be passed to one of the ComponentComplex.useService() methods, with the following settings:

To request that attributes be returned for an asynchronous service (topic), a EventServiceParameters must be passed to one of the ComponentComplex.publishService() / ComponentComplex.subscribeService() methods, with the following settings:

Returns:
array of attributes

getServiceAttribute

public Attribute getServiceAttribute(java.lang.String attributeName)
This convenience method retrieves a service attribute by name.

Parameters:
attributeName - name of the attribute to retrieve
Returns:
the named attribute, or null if no attribute with the name was found.

getUserInterface

public java.lang.Object getUserInterface()
This method returns the user interface object for this service, if one was requested.

To request a user interface for a synchronous service, a UseServiceParameters must be passed to one of the ComponentComplex.useService() methods, with the following settings:

To request a user interface for an asynchronous service, a EventServiceParameters must be passed to one of the ComponentComplex.publishService() / ComponentComplex.subscribeService() methods, with the following settings:

Returns:
user interface object if one was requested, or if no user interface was requested.

getUserInterfaceFactories

public UserInterfaceFactory[] getUserInterfaceFactories()
This method returns acceptable user interface factories for this service, if requested.

To request that user interface factories be returned for a synchronous service, a UseServiceParameters must be passed to one of the ComponentComplex.useService() methods, with the following settings:

If the desiredUIClass and/or desiredUIConstructorParameters attributes are set, only UserInterfaceFactory objects that meet the criteria will be returned.

To request that user interface factories be returned for an asynchronous service, an EventServiceParameters must be passed to one of the ComponentComplex.publishService() / ComponentComplex.subscribeService() methods, with the following settings:

If the desiredUIClass and/or desiredUIConstructorParameters attributes are set, only UserInterfaceFactory objects that meet the criteria will be returned.

Returns:
user interface object if one was requested, or if no user interface was requested.

Openwings API Documentation (v1.0)