edu.UCL.satin.impl.registrar
Class CoreRegistrar

java.lang.Object
  extended byedu.UCL.satin.arch.components.Component
      extended byedu.UCL.satin.arch.components.container.Registrar
          extended byedu.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
           
 
Fields inherited from class edu.UCL.satin.arch.components.Component
immutable, properties
 
Fields inherited from interface edu.UCL.satin.arch.facets.ComponentFacet
DISABLED, ENABLED
 
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.
 
Method Summary
private  void checkListeners(Component c)
           
 boolean isEnabled()
          Checks whether this component is enabled or not.
 boolean registerComponent(Component c)
          Adds a new component to the container.
 java.lang.String removeComponent(Component c)
          Removes a component from the container
 void setEnabled(boolean enabled)
          Enables or disables the component
private static boolean subset(java.util.Hashtable a, java.util.Hashtable b)
          Returns true if a is a subset of b
 
Methods inherited from class edu.UCL.satin.arch.components.Component
addAttribute, construct, destroy, getAttribute, getProperties, hasAttribute, match, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface edu.UCL.satin.arch.facets.ComponentFacet
addAttribute, construct, destroy, getAttribute, getProperties, hasAttribute
 

Field Detail

repo

private java.util.Hashtable repo

listeners

private java.util.Vector listeners

enabled

private boolean enabled
Constructor Detail

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 -
Method Detail

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: