public class DefaultServiceReference extends java.lang.Object implements ServiceReferenceInternal
| Modifier and Type | Field and Description |
|---|---|
protected HashMap |
outgoingDiscoveryInfosDown |
protected HashMap |
outgoingDiscoveryInfosUp |
boolean |
suppressGetMetadataIfPossible |
SUPPRESS_GET_METADATA_IF_POSSIBLE_DEFAULTLOCATION_LOCAL, LOCATION_REMOTE, LOCATION_UNKNOWN| Modifier | Constructor and Description |
|---|---|
protected |
DefaultServiceReference(DefaultServiceReference oldServiceReference,
SecurityKey newSecurityKey) |
protected |
DefaultServiceReference(EndpointReference epr,
SecurityKey securityKey,
java.lang.String comManId)
Constructor.
|
protected |
DefaultServiceReference(SecurityKey securityKey,
HostedMData hosted,
ConnectionInfo connectionInfo,
java.lang.String comManId)
Constructor, used for proxy services.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addOutgoingDiscoveryInfo(OutgoingDiscoveryInfo info)
Adds the specified outgoing discovery info to this device.
|
void |
buildUpService(java.lang.String comManId)
Instructs this service reference to asynchronously send a GetMetadata message to the service
and create a new proxy, if required.
|
boolean |
containsAllPortTypes(QNameSet newTypes)
Returns
true only in case this service reference provides all port types listed
within argumentportTypes. |
void |
disconnectFromDevice()
Removes the parent device reference from this service reference.
|
void |
dispose() |
java.lang.String |
getComManId()
Returns the ID of the communication protocol to use when communicating with this reference's
target over the current
preferred transport address. |
java.lang.String |
getDebugString() |
Iterator |
getEprInfos()
Gets
EprInfos. |
int |
getHostedBlockVersion() |
int |
getLocation()
Returns the location of the device or service, which may be - LOCATION_UNKNOWN, -
LOCATION_REMOTE, - LOCATION_LOCAL.
|
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. |
XAddressInfo |
getNextXAddressInfoAfterFailure(URI transportAddress,
int syncHostedBlockVersion) |
DataStructure |
getOutgoingDiscoveryInfos() |
EndpointReference |
getParentDeviceEndpointReference()
Returns the parent device endpoint 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.
|
URI |
getPreferredXAddress()
Returns the preferred transport address for communication with this reference.
|
EprInfo |
getPreferredXAddressInfo() |
SecurityKey |
getSecurityKey() |
Service |
getService()
Gets present service of reference.
|
Service |
getService(boolean doBuildUp)
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 |
isServiceObjectExisting()
Returns whether the service is build up or not.
|
boolean |
isSuppressGetMetadataIfPossible() |
Service |
rebuildService() |
boolean |
removeOutgoingDiscoveryInfo(OutgoingDiscoveryInfo info)
Removes a previously
added outgoing
discovery info from this device. |
void |
reset()
Resets this service reference, i.e.
|
void |
setHostedFromService(HostedMData newHosted,
ConnectionInfo connectionInfo) |
Service |
setLocalService(LocalService service)
Sets local service, replaces present service.
|
void |
setLocation(int location)
Location of service, which this reference is linked to.
|
void |
setMetaDataLocations(URISet metaLocs) |
void |
setMetadataReferences(EndpointReferenceSet metaRefs)
Updates metadata references.
|
void |
setParentDeviceEndpointReference(EndpointReference endpoint)
Sets the endpoint reference of the parent device.
|
void |
setSecurityKey(SecurityKey newKey) |
void |
setSuppressGetMetadataIfPossible(boolean suppressGetMetadataIfPossible)
Set suppressGetMetadataIfPossible to decide if a get metadata message to a service should be
suppressed if the related hosted block of the parent device contains at least one type and all
contained types can be retrieved form the WSDLRepository.
|
void |
setWSDLs(DataStructure wsdls)
Updates WSDLs linked to this service
|
java.lang.String |
toString() |
void |
update(HostedMData newHosted,
EndpointReference parentDeviceEndpointReference,
ConnectionInfo connectionInfo)
Update service references with hosted metadata.
|
public boolean suppressGetMetadataIfPossible
protected HashMap outgoingDiscoveryInfosUp
protected HashMap outgoingDiscoveryInfosDown
protected DefaultServiceReference(SecurityKey securityKey, HostedMData hosted, ConnectionInfo connectionInfo, java.lang.String comManId)
service - protected DefaultServiceReference(EndpointReference epr, SecurityKey securityKey, java.lang.String comManId)
epr - protected DefaultServiceReference(DefaultServiceReference oldServiceReference, SecurityKey newSecurityKey)
public void dispose()
dispose in interface ServiceReferencepublic java.lang.String toString()
toString in class java.lang.Objectpublic boolean isSuppressGetMetadataIfPossible()
isSuppressGetMetadataIfPossible in interface ServiceReferenceServiceReference.setSuppressGetMetadataIfPossible(boolean
suppressGetMetadataIfPossible)public void setSuppressGetMetadataIfPossible(boolean suppressGetMetadataIfPossible)
ServiceReferencesetSuppressGetMetadataIfPossible in interface ServiceReferencepublic Service getService() throws CommunicationException
ServiceReferenceDescriptionRepository or by sending a
get metadata message.getService in interface ServiceReferenceCommunicationException - 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).public void addOutgoingDiscoveryInfo(OutgoingDiscoveryInfo info)
info - the new protocol domain to add to this devicepublic boolean removeOutgoingDiscoveryInfo(OutgoingDiscoveryInfo info)
added outgoing
discovery info from this device.info - the output domain to removepublic Service getService(boolean doBuildUp) throws CommunicationException
ServiceReferenceInternalDescriptionRepository or by sending a
get metadata message.getService in interface ServiceReferenceInternaldoBuildUp - If false and service does not exist, service will not be build up. In this case, returned
service is nullCommunicationException - 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).public void buildUpService(java.lang.String comManId)
ServiceListener.serviceCreated(ServiceReference, Service) method.
Note that in order to reduce network traffic a GetMetadata message will actually be sent only if it is detected that the service within this device reference instance is not up to date anymore.
public Service setLocalService(LocalService service)
ServiceReferenceInternalsetLocalService in interface ServiceReferenceInternalservice - replacement service.public Service rebuildService() throws CommunicationException
CommunicationExceptionpublic void reset()
ServiceReferencereset in interface ServiceReferencepublic void update(HostedMData newHosted, EndpointReference parentDeviceEndpointReference, ConnectionInfo connectionInfo)
update in interface ServiceReferenceInternalnewHosted - the new hosted metadataparentDeviceEndpointReference - connectionInfo - public void disconnectFromDevice()
ServiceReferenceInternaldisconnectFromDevice in interface ServiceReferenceInternalpublic Iterator getPortTypes()
ServiceReferencegetPortTypes in interface ServiceReferenceQName.public int getPortTypeCount()
ServiceReferencegetPortTypeCount in interface ServiceReferencepublic boolean containsAllPortTypes(QNameSet newTypes)
ServiceReferencetrue only in case this service reference provides all port types listed
within argumentportTypes.containsAllPortTypes in interface ServiceReferencenewTypes - the port types to check this service reference fortrue if all port types are provided by this service reference, false otherwisepublic int getLocation()
ReferencegetLocation in interface Referencepublic void setLocation(int location)
Reference.LOCATION_LOCAL,
Reference.LOCATION_REMOTE or
Reference.LOCATION_UNKNOWN setLocation in interface ServiceReferenceInternallocation - Reference.LOCATION_LOCAL, Reference.LOCATION_REMOTE or Reference.LOCATION_UNKNOWN.public Iterator getEprInfos()
ServiceReferenceEprInfos. In DPWS the address contained in an endpoint reference is a transport
address.getEprInfos in interface EprInfoHandler.EprInfoProvidergetEprInfos in interface ServiceReferencepublic SecurityKey getSecurityKey()
getSecurityKey in interface ServiceReferencepublic void setSecurityKey(SecurityKey newKey)
setSecurityKey in interface ServiceReferencepublic DataStructure getOutgoingDiscoveryInfos()
getOutgoingDiscoveryInfos in interface EprInfoHandler.EprInfoProviderpublic URI getServiceId()
ServiceReferencegetServiceId in interface ServiceReferencepublic Iterator getMetadataReferences()
EndpointReference instances pointing at the
locations of the target service's metadata descriptions (i.e. usually its WSDL files).getMetadataReferences in interface ServiceReferenceEndpointReferences to the service's metadatapublic void setMetadataReferences(EndpointReferenceSet metaRefs)
ServiceReferenceInternalsetMetadataReferences in interface ServiceReferenceInternalpublic Iterator getMetadataLocations()
URI instances pointing at the addresses of the
target service's metadata description locations (i.e. usually its WSDL files).getMetadataLocations in interface ServiceReferenceURIs to the service's metadatapublic Iterator getWSDLs()
WSDL instances describing the target service.getWSDLs in interface ServiceReferenceWSDLs containing the service's metadatapublic void setWSDLs(DataStructure wsdls)
ServiceReferenceInternalsetWSDLs in interface ServiceReferenceInternalpublic URI getPreferredXAddress() throws CommunicationException
ReferencegetPreferredXAddress in interface ReferenceCommunicationException - if no suitable transport address can be detectedpublic java.lang.String getComManId()
Referencepreferred transport address. Will
return the framework-wide
default communication ID, if no preferred transport address has been explicitly set.getComManId in interface Referencepublic EndpointReference getParentDeviceEndpointReference()
ServiceReferencegetParentDeviceEndpointReference in interface ServiceReferencepublic void setParentDeviceEndpointReference(EndpointReference endpoint)
ServiceReferenceInternalsetParentDeviceEndpointReference in interface ServiceReferenceInternalendpoint - the endpoint reference to setpublic boolean isServiceObjectExisting()
ServiceReferenceisServiceObjectExisting in interface ServiceReferencetrue, if service object exists.public void setHostedFromService(HostedMData newHosted, ConnectionInfo connectionInfo)
public void setMetaDataLocations(URISet metaLocs)
setMetaDataLocations in interface ServiceReferenceInternalpublic XAddressInfo getNextXAddressInfoAfterFailure(URI transportAddress, int syncHostedBlockVersion) throws CommunicationException
getNextXAddressInfoAfterFailure in interface ServiceReferenceInternalCommunicationExceptionpublic int getHostedBlockVersion()
getHostedBlockVersion in interface ServiceReferenceInternalpublic EprInfo getPreferredXAddressInfo() throws CommunicationException
getPreferredXAddressInfo in interface ServiceReferenceInternalCommunicationExceptionpublic java.lang.String getDebugString()
getDebugString in interface EprInfoHandler.EprInfoProvider