org.ws4d.java.service
Class DeviceCommons

java.lang.Object
  extended by org.ws4d.java.service.DeviceCommons
All Implemented Interfaces:
Device
Direct Known Subclasses:
DefaultDevice, ProxyDevice

public abstract class DeviceCommons
extends java.lang.Object
implements Device

Class represents the common part of a proxy/local DPWS device also known as Hosting Service.


Method Summary
 boolean equals(java.lang.Object obj)
           
 java.lang.Object getCertificate()
          This certificate is used to validate signatures.
 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.
 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.
 java.lang.String getPresentationUrl()
          Gets presentation url of device.
 java.lang.Object getPrivateKey()
           
 java.lang.String getSerialNumber()
          Gets serial number.
 int hashCode()
           
 boolean isSecure()
          Sent using WS-Security techniques.
 void setCertificate(java.lang.Object certificate)
          Sets the certificate of this device.
 void setPrivateKey(java.lang.Object privKey)
           
 void setSecureDevice()
          Sets the device to use security techniques.
 boolean setSecureDevice(java.lang.String certAlias, java.lang.String privKeyAlias, java.lang.String privKeyPass)
          Makes the device secure and sets certificate and private key.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.ws4d.java.service.Device
addServiceReferences, getDefaultNamespace, getDeviceReference, getEndpointReference, getMetadataVersion, getPortTypes, getScopes, getServiceReference, getServiceReference, getServiceReferences, getServiceReferences, getXAddressInfos, hasCustomizeMData, invalidate, isRemote, isValid, readCustomizeMData
 

Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getManufacturer

public java.lang.String getManufacturer(java.lang.String lang)
Description copied from interface: Device
Gets manufacturer by language. Language consts are specified in LocalizedString.

Specified by:
getManufacturer in interface Device
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

public Iterator getManufacturers()
Description copied from interface: Device
Gets all manufacturers as iterator over manufacterer names. A single manufacturer name is of type LocalizedString.

Specified by:
getManufacturers in interface Device
Returns:
Iterator over manufacturer of type LocalizedString.

getManufacturerUrl

public java.lang.String getManufacturerUrl()
Description copied from interface: Device
Gets the url of the manufacturer.

Specified by:
getManufacturerUrl in interface Device
Returns:
Url of manufacturer

getModelName

public java.lang.String getModelName(java.lang.String lang)
Description copied from interface: Device
Gets model name by language. Language consts are specified in LocalizedString.

Specified by:
getModelName in interface Device
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

public Iterator getModelNames()
Description copied from interface: Device
Gets all model names as iterator over model names. A single model name is of type LocalizedString.

Specified by:
getModelNames in interface Device
Returns:
Iterator over model names of type LocalizedString.

getModelNumber

public java.lang.String getModelNumber()
Description copied from interface: Device
Gets model number of device.

Specified by:
getModelNumber in interface Device
Returns:
Model number.

getModelUrl

public java.lang.String getModelUrl()
Description copied from interface: Device
Gets model url of device.

Specified by:
getModelUrl in interface Device
Returns:
Model url.

getPresentationUrl

public java.lang.String getPresentationUrl()
Description copied from interface: Device
Gets presentation url of device.

Specified by:
getPresentationUrl in interface Device
Returns:
Presentation url.

getFriendlyName

public java.lang.String getFriendlyName(java.lang.String lang)
Description copied from interface: Device
Gets friendly name of device.

Specified by:
getFriendlyName in interface Device
Parameters:
lang - language of friendly name
Returns:
Friendly name of type LocalizedString in specified language

getFriendlyNames

public Iterator getFriendlyNames()
Description copied from interface: Device
Gets iterator over all friendly names of device. A single name is of type LocalizedString.

Specified by:
getFriendlyNames in interface Device
Returns:
Iterator over friendly names of type LocalizedString.

getFirmwareVersion

public java.lang.String getFirmwareVersion()
Description copied from interface: Device
Gets firmware version.

Specified by:
getFirmwareVersion in interface Device
Returns:
firmware version

getSerialNumber

public java.lang.String getSerialNumber()
Description copied from interface: Device
Gets serial number.

Specified by:
getSerialNumber in interface Device
Returns:
serial number

setSecureDevice

public void setSecureDevice()
                     throws java.lang.RuntimeException
Sets the device to use security techniques. Use this method after setting the services EPR

Throws:
java.lang.Exception
java.lang.RuntimeException

setSecureDevice

public boolean setSecureDevice(java.lang.String certAlias,
                               java.lang.String privKeyAlias,
                               java.lang.String privKeyPass)
                        throws java.lang.RuntimeException
Description copied from interface: Device
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.

Specified by:
setSecureDevice in interface Device
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.

isSecure

public boolean isSecure()
Sent using WS-Security techniques.

Specified by:
isSecure in interface Device
Returns:

setCertificate

public void setCertificate(java.lang.Object certificate)
Description copied from interface: Device
Sets the certificate of this device. Used only in the security package.

Specified by:
setCertificate in interface Device
Parameters:
certificate - must be the java.security.cert.Certificate of the sender device/service

getCertificate

public java.lang.Object getCertificate()
Description copied from interface: Device
This certificate is used to validate signatures. Used in the security package.

Specified by:
getCertificate in interface Device
Returns:
the java.security.cert.Certificate;

getPrivateKey

public java.lang.Object getPrivateKey()
Specified by:
getPrivateKey in interface Device
Returns:

setPrivateKey

public void setPrivateKey(java.lang.Object privKey)
Specified by:
setPrivateKey in interface Device
Parameters:
privKey - must be the java.security.PrivateKey of the sender device/ service

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object