org.ws4d.java.service.reference
Interface ServiceReference

All Superinterfaces:
Reference
All Known Subinterfaces:
ServiceReferenceInternal
All Known Implementing Classes:
DefaultServiceReference

public interface ServiceReference
extends Reference

Interface of service reference. The service within it can be replaced. Get present service by calling getService() method.

Service references are registered in the DeviceServiceRegistry. There should only be one service reference for each service.

Global service listening can be initiated by registration via ServiceReferenceEventRegistry.registerServiceListening(ServiceListener) , the method ServiceReferenceEventRegistry.unregisterServiceListening(ServiceListener) removes service listening.


Field Summary
 
Fields inherited from interface org.ws4d.java.service.reference.Reference
LOCATION_LOCAL, LOCATION_REMOTE, LOCATION_UNKNOWN
 
Method Summary
 boolean containsAllPortTypes(QNameSet portTypes)
          Returns true only in case this service reference provides all port types listed within argumentportTypes.
 Iterator getEprInfos()
          Gets endpoint references.
 Iterator getMetadataLocations()
          Returns an iterator over the set of URI instances pointing at the addresses of the target service's metadata description locations (i.e.
 Iterator getMetadataReferences()
          Returns an iterator over the set of EndpointReference instances pointing at the locations of the target service's metadata descriptions (i.e. usually its WSDL files).
 DeviceReference getParentDeviceRef()
          Returns the parent device reference of the device which hosts the service, if the device is known.
 int getPortTypeCount()
          Returns the number of port types for this service reference.
 Iterator getPortTypes()
          Gets service port types.
 Service getService()
          Gets present service of reference.
 URI getServiceId()
          Returns the service ID (unique within the scope of its parent device).
 Iterator getWSDLs()
          Returns an iterator over the set of WSDL instances describing the target service.
 boolean isSecureService()
          Returns whether or not the service is secured
 boolean isServiceObjectExisting()
          Returns whether the service is build up or not.
 void reset()
          Resets this service reference, i.e. makes it loose all internal state information but the endpoint references of the service.
 
Methods inherited from interface org.ws4d.java.service.reference.Reference
getLocation, getPreferredCommunicationManagerID, getPreferredXAddress
 

Method Detail

getService

Service getService()
                   throws TimeoutException
Gets present service of reference. If the service is remote and its proxy not built up, the proxy may be built by an existing WSDL within the WSDLRepository or by sending a get metadata message.

Returns:
service The present service of this reference. The returned service may change.
Throws:
TimeoutException - This exception is thrown if the remote service doesn't answer to the get metadata message, which tries to receive the necessary data to build up the service. The timeout value can be configured in the DispatchingProperties via the method DispatchingProperties.setResponseWaitTime(int).

getEprInfos

Iterator getEprInfos()
Gets endpoint references. In DPWS the address contained in an endpoint reference is a transport address.

Returns:
endpoint references.

getPortTypes

Iterator getPortTypes()
Gets service port types. The port types defines the operations the service provides.

Returns:
service port types.

getPortTypeCount

int getPortTypeCount()
Returns the number of port types for this service reference.

Returns:
the number of port types

containsAllPortTypes

boolean containsAllPortTypes(QNameSet portTypes)
Returns true only in case this service reference provides all port types listed within argumentportTypes.

Parameters:
portTypes - the port types to check this service reference for
Returns:
true if all port types are provided by this service reference, false otherwise

getServiceId

URI getServiceId()
Returns the service ID (unique within the scope of its parent device).

Returns:
the service ID

getMetadataReferences

Iterator getMetadataReferences()
Returns an iterator over the set of EndpointReference instances pointing at the locations of the target service's metadata descriptions (i.e. usually its WSDL files).

Returns:
an iterator over EndpointReferences to the service's metadata

getMetadataLocations

Iterator getMetadataLocations()
Returns an iterator over the set of URI instances pointing at the addresses of the target service's metadata description locations (i.e. usually its WSDL files).

Returns:
an iterator over URIs to the service's metadata

getWSDLs

Iterator getWSDLs()
Returns an iterator over the set of WSDL instances describing the target service.

Returns:
an iterator over WSDLs containing the service's metadata

getParentDeviceRef

DeviceReference getParentDeviceRef()
Returns the parent device reference of the device which hosts the service, if the device is known.

Returns:
The device reference of the device which hosts the service.

isSecureService

boolean isSecureService()
Returns whether or not the service is secured

Returns:

isServiceObjectExisting

boolean isServiceObjectExisting()
Returns whether the service is build up or not.

Returns:
true, if service object exists.

reset

void reset()
Resets this service reference, i.e. makes it loose all internal state information but the endpoint references of the service.