no.ubicollab.osgi
Class ServiceList

java.lang.Object
  extended by no.ubicollab.osgi.ServiceList

public class ServiceList
extends java.lang.Object

The Class ServiceList is used to represent all services which have been registered with the Service Domain Manager.

The class functionality neccessary to handle Service management tasks.

Since:
0.1
Version:
0.5
Author:
Kim-Steve Johansen

Constructor Summary
ServiceList(org.osgi.framework.BundleContext bc)
          The Constructor for this class.
 
Method Summary
 boolean addService(Service s)
          Adds a specified service to the servicelist.
 boolean checkIfServiceExist(java.lang.String uri)
          Check if a given service exist (is member of the service list).
 java.lang.String getInfoAboutService(java.lang.Long bundleID)
          Gets information about a service object, and returns it as serialized XML.
 void persistenceUpdate()
          Persistence update for the service xml file.
 boolean removeService(java.lang.Long bundleID)
          Removes a service specified by the bundle id of the bundle which hosts the proxy service.
 boolean setActiveSpace(int SpaceID, boolean stopOtherServices, DomainManagerImpl dm)
          Activates all services belonging to the space identified by the provided id.
 java.lang.String toXML()
          Method to serialize the service list to XML.
 boolean updateService(long bundleID, java.lang.String friendlyName, java.lang.String space, int spaceID, java.lang.String type, java.lang.String description)
          Method to update the properties of the service identified by serviceUri
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServiceList

public ServiceList(org.osgi.framework.BundleContext bc)
The Constructor for this class. Fetches the servicelist from file and initializes the service list.

Parameters:
bc - the active Bundlecontext
Method Detail

updateService

public boolean updateService(long bundleID,
                             java.lang.String friendlyName,
                             java.lang.String space,
                             int spaceID,
                             java.lang.String type,
                             java.lang.String description)
Method to update the properties of the service identified by serviceUri

Parameters:
bundleID - The id for the bundle which hosts the service
friendlyName - The service friendly name
space - The space this service will be active in
Returns:
True if URI is found and update is OK, false otherwise.

addService

public boolean addService(Service s)
Adds a specified service to the servicelist.

Parameters:
s - the service to install
Returns:
true, if service is added, false othervise

removeService

public boolean removeService(java.lang.Long bundleID)
Removes a service specified by the bundle id of the bundle which hosts the proxy service.

Parameters:
bundleID - the bundle ID that is to be removed
Returns:
true, if service is removed, false othervise

persistenceUpdate

public void persistenceUpdate()
Persistence update for the service xml file.


toXML

public java.lang.String toXML()
Method to serialize the service list to XML.

The xml-structure used to represent the returned service is described in DomainManager#getServiceList.

Returns:
A String containing a representation of the service list
See Also:
DomainManager.getServiceList()

getInfoAboutService

public java.lang.String getInfoAboutService(java.lang.Long bundleID)
Gets information about a service object, and returns it as serialized XML.

The xml-structure used to represent the returned service is described in DomainManager#getInfoAboutService.

Returns:
A String containing a representation of the service list or "INVALID BUNDLE ID" if bundle id does not exist.
See Also:
DomainManager.getInfoAboutService(java.lang.Long)

checkIfServiceExist

public boolean checkIfServiceExist(java.lang.String uri)
Check if a given service exist (is member of the service list).

Parameters:
uri - the service uri
Returns:
true, if service exists, false otherwise

setActiveSpace

public boolean setActiveSpace(int SpaceID,
                              boolean stopOtherServices,
                              DomainManagerImpl dm)
Activates all services belonging to the space identified by the provided id.

Parameters:
SpaceID - the ID for the Space to activate
stopOtherServices - true to stop the other service proxies, false othervise
Returns:
true, if all proxies adhering to the space ID is started, false othervise.