edu.UCL.satin.impl.registrar
Class CoreRegistrar
java.lang.Object
edu.UCL.satin.arch.components.Component
edu.UCL.satin.arch.components.container.Registrar
edu.UCL.satin.impl.registrar.CoreRegistrar
- All Implemented Interfaces:
- ComponentFacet, Facet, RegistrarFacet
- public class CoreRegistrar
- extends Registrar
- Author:
- Stefanos Zachariadis
Field Summary |
private boolean |
enabled
|
private java.util.Vector |
listeners
|
private java.util.Hashtable |
repo
|
Constructor Summary |
CoreRegistrar(java.util.Hashtable repo,
java.util.Vector listeners)
Creates a new registrar, using the given hashtable as the actual registry and the given vector as the collection of listeners. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
repo
private java.util.Hashtable repo
listeners
private java.util.Vector listeners
enabled
private boolean enabled
CoreRegistrar
public CoreRegistrar(java.util.Hashtable repo,
java.util.Vector listeners)
- Creates a new registrar, using the given hashtable as the actual registry and the given vector as the collection of listeners.
IMPORTANT
We assume that components have a GenericAttribute, with key ID and a String as a value to represent their identifier
We assume that components have a GenericAttribute, with key VER and an Integer object as a value to represent their version. We will add (VER,1) if this is missing
We assume that components have a GenericAttribute, with key DEP and a String of IDs, separated by "," as a value, to represent their dependencies. If they don't have a DEP attribute, then they are atomic
- Parameters:
repo
- listeners
-
registerComponent
public boolean registerComponent(Component c)
- Description copied from class:
Registrar
- Adds a new component to the container.
- Specified by:
registerComponent
in interface RegistrarFacet
- Specified by:
registerComponent
in class Registrar
- Parameters:
c
- The component to add
- Returns:
- true if the operation was successful or false otherwise (component with the same id and version number exist/failure/etc.)
removeComponent
public java.lang.String removeComponent(Component c)
- Description copied from class:
Registrar
- Removes a component from the container
- Specified by:
removeComponent
in interface RegistrarFacet
- Specified by:
removeComponent
in class Registrar
- Parameters:
c
- The component to remove
- Returns:
- null if the operation was successful or the ID of the component that depends on c
checkListeners
private void checkListeners(Component c)
subset
private static boolean subset(java.util.Hashtable a,
java.util.Hashtable b)
- Returns true if a is a subset of b
- Returns:
- true if a is a subset of b, or false otherwise
setEnabled
public void setEnabled(boolean enabled)
- Description copied from interface:
ComponentFacet
- Enables or disables the component
- Specified by:
setEnabled
in interface ComponentFacet
- Overrides:
setEnabled
in class Component
- Parameters:
enabled
-
isEnabled
public boolean isEnabled()
- Description copied from interface:
ComponentFacet
- Checks whether this component is enabled or not.
- Specified by:
isEnabled
in interface ComponentFacet
- Overrides:
isEnabled
in class Component
- Returns: