nenok.net.registry
Class RegistryImpl

java.lang.Object
  extended by nenok.net.registry.RegistryImpl
All Implemented Interfaces:
Remote, Registry

public class RegistryImpl
extends Object
implements Registry

A possible implementation of the NENOK knowledgebase registry server with an internal Hashtable. This associative storage links names of knowledgebases together with Locator objects that belong to this knowledgebase.

Version:
1.1
Author:
Marc Pouly

Constructor Summary
RegistryImpl(String host)
          Constructor:
 
Method Summary
 boolean add(String knowledgebase, Locator locator)
          Adds a locator to the knowledgebase with the given name.
 boolean addAll(String knowledgebase, Collection<Locator> locators)
          Adds a collection of locators to the knowledgebasewith the given name.
 boolean addAll(String knowledgebase, Locator[] locators)
          Adds an array of locators to the knowledgebasewith the given name.
 boolean contains(String knowledgebase, Locator locator)
          Does the knowledgebase contain the given locator?
 boolean createKnowledgebase(String name)
          Create a new knowledgebase with the given name.
 boolean deleteKnowledgebase(String knowledgebase)
          Deletes the knowledgebase with the given name.
 boolean exists(String knowledgebase)
          Does a knowledgebase with this name exist?
 String getIP()
           
 Knowledgebase getKnowledgebase(String name)
          Looks for a knowledgebase with the given name.
 String[] getKnowledgebases()
           
 boolean remove(String knowledgebase, Locator locator)
          Removes a locator from the knowledgebase with the given name.
 void reset()
          Resets the knowledgebase registry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RegistryImpl

public RegistryImpl(String host)
Constructor:

Parameters:
host - The name of the host running this registry.
Method Detail

createKnowledgebase

public boolean createKnowledgebase(String name)
Description copied from interface: Registry
Create a new knowledgebase with the given name.

Specified by:
createKnowledgebase in interface Registry
Parameters:
name - The name of the new knowledgebase.
Returns:
false if a knowledgebase with this name exists already.
See Also:
Registry.createKnowledgebase(java.lang.String)

deleteKnowledgebase

public boolean deleteKnowledgebase(String knowledgebase)
Description copied from interface: Registry
Deletes the knowledgebase with the given name.

Specified by:
deleteKnowledgebase in interface Registry
Parameters:
knowledgebase - The name of the knowledgebase to delete.
Returns:
true if a knowledgebase has been deleted.
See Also:
Registry.deleteKnowledgebase(java.lang.String)

getKnowledgebase

public Knowledgebase getKnowledgebase(String name)
Description copied from interface: Registry
Looks for a knowledgebase with the given name.

Specified by:
getKnowledgebase in interface Registry
Parameters:
name - The name of the knowledgebase to find.
Returns:
The knowledgebase with the given name or null.
See Also:
Registry.getKnowledgebase(java.lang.String)

getKnowledgebases

public String[] getKnowledgebases()
                           throws RemoteException
Specified by:
getKnowledgebases in interface Registry
Returns:
The names of all registered knowledgebases.
Throws:
RemoteException - Remote methods all throw remote exceptions.
See Also:
Registry.getKnowledgebases()

add

public boolean add(String knowledgebase,
                   Locator locator)
            throws RemoteException
Description copied from interface: Registry
Adds a locator to the knowledgebase with the given name.

Specified by:
add in interface Registry
Parameters:
knowledgebase - The name of the knowledgebase.
locator - The locator to be added to the knowledgebase.
Returns:
false if a knowledgebase with the given name does not exist, true, if the element has been added successfully
Throws:
RemoteException - Remote methods all throw remote exceptions.
See Also:
Registry.add(java.lang.String, nenok.net.Locator)

addAll

public boolean addAll(String knowledgebase,
                      Collection<Locator> locators)
               throws RemoteException
Description copied from interface: Registry
Adds a collection of locators to the knowledgebasewith the given name.

Specified by:
addAll in interface Registry
Parameters:
knowledgebase - The name of the knowledgebase.
locators - The collection of locators to add.
Returns:
false if a knowledgebase with the given name does not exist, true, if the knowledgebase changed as a result of the call.
Throws:
RemoteException - Remote methods all throw remote exceptions.
See Also:
Registry.addAll(java.lang.String, java.util.Collection)

addAll

public boolean addAll(String knowledgebase,
                      Locator[] locators)
               throws RemoteException
Description copied from interface: Registry
Adds an array of locators to the knowledgebasewith the given name.

Specified by:
addAll in interface Registry
Parameters:
knowledgebase - The name of the knowledgebase.
locators - The array of locators to add.
Returns:
false if a knowledgebase with the given name does not exist, true, if the knowledgebase changed as a result of the call.
Throws:
RemoteException - Remote methods all throw remote exceptions.
See Also:
Registry.addAll(java.lang.String, nenok.net.Locator[])

remove

public boolean remove(String knowledgebase,
                      Locator locator)
               throws RemoteException
Description copied from interface: Registry
Removes a locator from the knowledgebase with the given name.

Specified by:
remove in interface Registry
Parameters:
knowledgebase - The name of the knowledgebase.
locator - The locator to remove.
Returns:
true, if the locator has been removed successfully.
Throws:
RemoteException - Remote methods all throw remote exceptions.
See Also:
Registry.remove(java.lang.String, nenok.net.Locator)

contains

public boolean contains(String knowledgebase,
                        Locator locator)
                 throws RemoteException
Description copied from interface: Registry
Does the knowledgebase contain the given locator?

Specified by:
contains in interface Registry
Parameters:
knowledgebase - The name of the knowledgebase.
locator - The locator to find.
Returns:
true, if the knowledgebase contains the given locator.
Throws:
RemoteException - Remote methods all throw remote exceptions.
See Also:
Registry.contains(java.lang.String, nenok.net.Locator)

exists

public boolean exists(String knowledgebase)
               throws RemoteException
Description copied from interface: Registry
Does a knowledgebase with this name exist?

Specified by:
exists in interface Registry
Parameters:
knowledgebase - The name of the knowledgebase.
Returns:
true, if a corresponding knowledgebase exist.
Throws:
RemoteException - Remote methods all throw remote exceptions.
See Also:
Registry.exists(java.lang.String)

reset

public void reset()
           throws RemoteException
Description copied from interface: Registry
Resets the knowledgebase registry. Deletes all content of the activ registry.

Specified by:
reset in interface Registry
Throws:
RemoteException - Remote methods all throw remote exceptions.
See Also:
Registry.reset()

getIP

public String getIP()
             throws RemoteException
Specified by:
getIP in interface Registry
Returns:
The IP of the host running this registry.
Throws:
RemoteException - Remote methods all throw remote exceptions.
See Also:
Registry.getIP()