no.ubicollab.osgi
Class PocketDiscoveryImpl

java.lang.Object
  extended by no.ubicollab.osgi.PocketDiscoveryImpl
All Implemented Interfaces:
PocketDiscoveryService

public class PocketDiscoveryImpl
extends java.lang.Object
implements PocketDiscoveryService


Constructor Summary
PocketDiscoveryImpl()
           
 
Method Summary
 java.lang.String[] getInfoAboutService(java.lang.String url)
          Gets all registered information about the specified service.
 java.lang.String getService(java.lang.String searchString)
          Searches for services in the database, and returns any matches.
 boolean registerDiscoveryService(java.lang.String url)
          Sets the url of the Discovery Service to forward requests to.
 boolean registerService(java.lang.String url)
          Registers a service.
 boolean registerService(java.lang.String tagId, java.lang.String url)
          Registers a service.
 boolean registerService(java.lang.String tagId, java.lang.String uuId, java.lang.String name, java.lang.String type, java.lang.String protocol, java.lang.String descriptionUrl, java.lang.String serviceUrl, java.lang.String owner)
          Registers a service.
 boolean removeService(java.lang.String removeString)
          Removes all services matching the removeString.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PocketDiscoveryImpl

public PocketDiscoveryImpl()
Method Detail

registerDiscoveryService

public boolean registerDiscoveryService(java.lang.String url)
Description copied from interface: PocketDiscoveryService
Sets the url of the Discovery Service to forward requests to. The url is written to file so that the url is kept in case the service has to restart.

Specified by:
registerDiscoveryService in interface PocketDiscoveryService
Parameters:
url - Url of the Discovery Service to forward requests to.
Returns:
true if url was successfully updated and written to file, false otherwise

registerService

public boolean registerService(java.lang.String tagId,
                               java.lang.String url)
Description copied from interface: PocketDiscoveryService
Registers a service. Use this method if you have an RFID tag with the URL to a WSDL-file or to the description-XML of a UPnP service.

Specified by:
registerService in interface PocketDiscoveryService
Parameters:
tagId - The id of the RFID tag scanned to get the service.
url - The descriptionUrl of the service.
Returns:
True if the service is successfully registered, false otherwise.

registerService

public boolean registerService(java.lang.String url)
Description copied from interface: PocketDiscoveryService
Registers a service. Use this method if you have the URL to a WSDL-file or to the description XML of a UPnP service.

Specified by:
registerService in interface PocketDiscoveryService
Parameters:
url - The descriptionUrl of the service.
Returns:
True if the service is successfully registered, false otherwise.

registerService

public boolean registerService(java.lang.String tagId,
                               java.lang.String uuId,
                               java.lang.String name,
                               java.lang.String type,
                               java.lang.String protocol,
                               java.lang.String descriptionUrl,
                               java.lang.String serviceUrl,
                               java.lang.String owner)
Description copied from interface: PocketDiscoveryService
Registers a service. Use this method if you have more information about the service that you want to add with it.

Specified by:
registerService in interface PocketDiscoveryService
Parameters:
tagId - The id of the RFID tag scanned to get the service.
uuId - The id of the UPnP device providing the service.
name - The name of the service.
type - The service type.
protocol - The service protocol.
descriptionUrl - The URL describing the service (ie. the URL to a WSDL-file).
serviceUrl - The service URL of the service (ie. http://abc.com/axis/services/ubiService)
owner - The person owning the service.
Returns:
True if the service is successfully registered, false otherwise.

getService

public java.lang.String getService(java.lang.String searchString)
Description copied from interface: PocketDiscoveryService
Searches for services in the database, and returns any matches.

Specified by:
getService in interface PocketDiscoveryService
Parameters:
searchString - tagId:<tagId> uuId:<uuId> name:<name> type:<type> protocol:<protocol> descriptionUrl:<descriptionUrl> serviceUrl:<serviceUrl> Any number of these flags may be present, but they must come in the right order. Example: "name:My Service type:no.ubicollab.service"
Returns:
The method returns either "Service is stopped", "No matching services", or a list of service/protocol pairs represented like this: "service1 protocol1 service2 protocol2"

removeService

public boolean removeService(java.lang.String removeString)
Description copied from interface: PocketDiscoveryService
Removes all services matching the removeString.

Specified by:
removeService in interface PocketDiscoveryService
Parameters:
removeString - tagId:<tagId> uuId:<uuId> name:<name> type:<type> protocol:<protocol> descriptionUrl:<descriptionUrl> serviceUrl:<serviceUrl> Any number of these flags may be present, but they must come in the right order. Example: "name:My Service type:no.ubicollab.service"
Returns:
True if any services are successfully removed, false otherwise.

getInfoAboutService

public java.lang.String[] getInfoAboutService(java.lang.String url)
Description copied from interface: PocketDiscoveryService
Gets all registered information about the specified service.

Specified by:
getInfoAboutService in interface PocketDiscoveryService
Parameters:
url - Either the descriptionUrl or the serviceUrl of the service.
Returns:
A String[] with a length of 10, with the fields: dbId, tagId, uuId, name, type, protocol, descriptionUrl, serviceUrl, owner, discovered.