no.ubicollab.osgi
Class PluginList

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

public class PluginList
extends java.lang.Object

The Class PluginList is used to represent all service discovery plugins which have registered with the Service Discovery Manager.

The class provide the methods neccessary to handle Plugin related tasks.

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

Constructor Summary
PluginList()
          The Constructor.
 
Method Summary
 boolean addClientRequest(ClientRequest clientRequest)
          Adds a client request to the list of ClientRequest belonging to this Plugin.
 int addNewPlugin(java.lang.String name)
          Creates a new plugin and returns the unique identifier for this plugin.
 void decreaseTimeToLive(int time)
          Decrease the time to live for all plugins.
 java.lang.String getClientRequest(int pluginID)
          Gets a xml-string containing the client request list.
 java.lang.String getPluginList()
          Returns a list containing all registered plugins in XML-format.
 java.lang.String getPluginName(int pluginID)
          Method to get the name of a plugin based on the id.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PluginList

public PluginList()
The Constructor. Instanciates the plugin list and plugin counter.

Method Detail

addClientRequest

public boolean addClientRequest(ClientRequest clientRequest)
Adds a client request to the list of ClientRequest belonging to this Plugin.

Parameters:
clientRequest - the client request to add
Returns:
true, if the ClientRequest is successfullt appended, false otherwise.

getClientRequest

public java.lang.String getClientRequest(int pluginID)
Gets a xml-string containing the client request list.

The returned string is a well formed XML-document with a structure as defined in ServiceDiscovery#getClientRequest

Parameters:
pluginID - the plugin ID
Returns:
the String with the client request list.
See Also:
ServiceDiscovery.getClientRequest(int)

addNewPlugin

public int addNewPlugin(java.lang.String name)
Creates a new plugin and returns the unique identifier for this plugin.

Returns:
the int that is the unique id for the plugin.

getPluginList

public java.lang.String getPluginList()
Returns a list containing all registered plugins in XML-format.

The list returned is a well-formed xml-document stored in a String, with the following structure:

 <Pluginlist>
   <Plugin Name="String" 
   Id="int" />
... more Plugin elements ...
</Pluginlist>

Returns:
the XML-formatted String containing Plugin objects.

getPluginName

public java.lang.String getPluginName(int pluginID)
Method to get the name of a plugin based on the id.

Parameters:
pluginID - the plugin ID to search for
Returns:
the name of the plugin, or "Unknown ID" if none found

decreaseTimeToLive

public void decreaseTimeToLive(int time)
Decrease the time to live for all plugins. Plugins with time-to-live <= 0 are assumed to have disconnected and will be removed.

Parameters:
time - the time in millisecounds to decrease