org.ws4d.java.service
Interface Device

All Known Subinterfaces:
LocalDevice
All Known Implementing Classes:
DefaultDevice, DeviceCommons, ProxyDevice

public interface Device

DPWS Device. "DPWS Hosting Service" This is the most common interface of all devices.

A device in DPWS is a web service with specific functions. It can be discovered via probing from clients and it supports resolving of its endpoint. A device bears services.

A device is encapsulated in a DeviceReference.


Method Summary
 void addServiceReferences(DataStructure to, QNameSet serviceTypes)
          Adds service references associated to this device to the data structure to, if they match the service port types given within serviceTypes.
 java.lang.Object getCertificate()
          This certificate is used to validate signatures.
 java.lang.String getDefaultNamespace()
          return the default namespace.
 DeviceReference getDeviceReference()
          Gets the DeviceReference of this device.
 EndpointReference getEndpointReference()
          Returns the endpoint reference of this device.
 java.lang.String getFirmwareVersion()
          Gets firmware version.
 java.lang.String getFriendlyName(java.lang.String lang)
          Gets friendly name of device.
 Iterator getFriendlyNames()
          Gets iterator over all friendly names of device.
 java.lang.String getManufacturer(java.lang.String lang)
          Gets manufacturer by language.
 Iterator getManufacturers()
          Gets all manufacturers as iterator over manufacterer names.
 java.lang.String getManufacturerUrl()
          Gets the url of the manufacturer.
 long getMetadataVersion()
          Returns metadata version for this device.
 java.lang.String getModelName(java.lang.String lang)
          Gets model name by language.
 Iterator getModelNames()
          Gets all model names as iterator over model names.
 java.lang.String getModelNumber()
          Gets model number of device.
 java.lang.String getModelUrl()
          Gets model url of device.
 Iterator getPortTypes()
          Gets the iterator over device port types of the device.
 java.lang.String getPresentationUrl()
          Gets presentation url of device.
 java.lang.Object getPrivateKey()
           
 Iterator getScopes()
          Gets iterator over all scopes of the device.
 java.lang.String getSerialNumber()
          Gets serial number.
 ServiceReference getServiceReference(EndpointReference serviceEpr)
          Get service reference by endpoint reference of referenced service.
 ServiceReference getServiceReference(URI serviceId)
          Gets service reference by service id of referenced service.
 Iterator getServiceReferences()
          Gets iterator over the service references of all services.
 Iterator getServiceReferences(QNameSet servicePortTypes)
          Gets iterator over the service reference of the services, which implements all port types specified.
 Iterator getXAddressInfos()
          Returns a iterator over the transport addresses of this device.
 boolean hasCustomizeMData()
          Tagged if a Device has metadata which are added by a user
 void invalidate()
           
 boolean isRemote()
          Is device remote (proxy) or local?
 boolean isSecure()
          return weather or not this services uses the security techniques.
 boolean isValid()
           
 java.lang.String readCustomizeMData()
          The method return the metadata that a user has added as String
 void setCertificate(java.lang.Object cert)
          Sets the certificate of this device.
 void setPrivateKey(java.lang.Object privKey)
           
 boolean setSecureDevice(java.lang.String certAlias, java.lang.String privKeyAlias, java.lang.String privKeyPass)
          Makes the device secure and sets certificate and private key.
 

Method Detail

getEndpointReference

EndpointReference getEndpointReference()
Returns the endpoint reference of this device. This endpoint reference is a unique identifier for the device.

Returns:
endpoint reference as unique identifier.

getMetadataVersion

long getMetadataVersion()
Returns metadata version for this device. The metadata version is transmitted via discovery messages.

Returns:
metadata version as unsigned integer.

getXAddressInfos

Iterator getXAddressInfos()
Returns a iterator over the transport addresses of this device. The type of the addresses is URI.

Returns:
Iterator over transport addresses of type URI.

getPortTypes

Iterator getPortTypes()
Gets the iterator over device port types of the device. The port types are of type QName.

Returns:
Iterator over device port types of type QName.

getManufacturer

java.lang.String getManufacturer(java.lang.String lang)
Gets manufacturer by language. Language consts are specified in LocalizedString.

Parameters:
lang - The language of the manufacturer's name to be obtained. The language consts are specified in LocalizedString.
Returns:
Manufacturer's name in specified language of type LocalizedString.

getManufacturers

Iterator getManufacturers()
Gets all manufacturers as iterator over manufacterer names. A single manufacturer name is of type LocalizedString.

Returns:
Iterator over manufacturer of type LocalizedString.

getManufacturerUrl

java.lang.String getManufacturerUrl()
Gets the url of the manufacturer.

Returns:
Url of manufacturer

getModelName

java.lang.String getModelName(java.lang.String lang)
Gets model name by language. Language consts are specified in LocalizedString.

Parameters:
lang - Language of the model name to get. The language consts are specified in LocalizedString.
Returns:
Model name in specified language of type LocalizedString.

getModelNames

Iterator getModelNames()
Gets all model names as iterator over model names. A single model name is of type LocalizedString.

Returns:
Iterator over model names of type LocalizedString.

getModelNumber

java.lang.String getModelNumber()
Gets model number of device.

Returns:
Model number.

getModelUrl

java.lang.String getModelUrl()
Gets model url of device.

Returns:
Model url.

getPresentationUrl

java.lang.String getPresentationUrl()
Gets presentation url of device.

Returns:
Presentation url.

getFriendlyName

java.lang.String getFriendlyName(java.lang.String lang)
Gets friendly name of device.

Parameters:
lang - language of friendly name
Returns:
Friendly name of type LocalizedString in specified language

getFriendlyNames

Iterator getFriendlyNames()
Gets iterator over all friendly names of device. A single name is of type LocalizedString.

Returns:
Iterator over friendly names of type LocalizedString.

getFirmwareVersion

java.lang.String getFirmwareVersion()
Gets firmware version.

Returns:
firmware version

getSerialNumber

java.lang.String getSerialNumber()
Gets serial number.

Returns:
serial number

getServiceReferences

Iterator getServiceReferences()
Gets iterator over the service references of all services. A service reference is of type ServiceReference.

Returns:
Iterator over the (@link ServiceReference) of each service of the device.

getServiceReferences

Iterator getServiceReferences(QNameSet servicePortTypes)
Gets iterator over the service reference of the services, which implements all port types specified. A service reference is of type ServiceReference.

Parameters:
servicePortTypes - The service port types the services must implement, to be returned by its reference.
Returns:
Iterator over the (@link ServiceReferences) to the services of the device, which implements the specified service port types.

addServiceReferences

void addServiceReferences(DataStructure to,
                          QNameSet serviceTypes)
Adds service references associated to this device to the data structure to, if they match the service port types given within serviceTypes.

Parameters:
to - collection to add matching service references to
serviceTypes - service port types to look for

getServiceReference

ServiceReference getServiceReference(URI serviceId)
Gets service reference by service id of referenced service. Service id is compared as case-sensitive string.

Parameters:
serviceId -
Returns:
service reference, or null if no service matches the service id.

getServiceReference

ServiceReference getServiceReference(EndpointReference serviceEpr)
Get service reference by endpoint reference of referenced service.

Parameters:
serviceEpr -
Returns:
service reference, or null, if no service matches the service id.

isRemote

boolean isRemote()
Is device remote (proxy) or local?

Returns:
whether this is a remote device (proxy) or not

getScopes

Iterator getScopes()
Gets iterator over all scopes of the device. A scope is of type URI.

Returns:
Iterator over all scopes of type URI.

getDeviceReference

DeviceReference getDeviceReference()
Gets the DeviceReference of this device.

Returns:
The DeviceReference of this device.

getCertificate

java.lang.Object getCertificate()
This certificate is used to validate signatures. Used in the security package.

Returns:
the java.security.cert.Certificate;

setCertificate

void setCertificate(java.lang.Object cert)
Sets the certificate of this device. Used only in the security package.

Parameters:
cert - the java.security.cert.Certificate

isSecure

boolean isSecure()
return weather or not this services uses the security techniques.

Returns:

getDefaultNamespace

java.lang.String getDefaultNamespace()
return the default namespace.

Returns:
default namespace

setSecureDevice

boolean setSecureDevice(java.lang.String certAlias,
                        java.lang.String privKeyAlias,
                        java.lang.String privKeyPass)
                        throws java.lang.RuntimeException
Makes the device secure and sets certificate and private key. The aliases are used to get the certificate and private key from the security manager.

Parameters:
certAlias - Alias to get the certificate.
privKeyAlias - Alias to get the private key.
privKeyPass - Password to get the private key.
Returns:
false, if certificate or private key can't be retrieved by specified aliases.
Throws:
java.lang.RuntimeException - thrown, if security is not supported by the framework.

getPrivateKey

java.lang.Object getPrivateKey()
Returns:

setPrivateKey

void setPrivateKey(java.lang.Object privKey)
Parameters:
privKey - must be the java.security.PrivateKey of the sender device/ service

isValid

boolean isValid()

invalidate

void invalidate()

readCustomizeMData

java.lang.String readCustomizeMData()
The method return the metadata that a user has added as String

Returns:
String which contains the users metadata

hasCustomizeMData

boolean hasCustomizeMData()
Tagged if a Device has metadata which are added by a user

Returns:
boolean