# Class SimpleConfigurator

    java.lang.Object
       |
       +----SimpleConfigurator

public class SimpleConfigurator
extends Object
implements ComponentConfigurator

A class representing the dependencies between Java Objects. It implements the ComponentConfigurator interface.

Version:
  0.1
Author:
  Fabio Kon
See Also:
  ComponentConfigurator, HookSpecification

##

clientVector
  A vector containing the clients for this component.
hookVector
  A vector containing the hooks for this component.
implementation
  The Java object implementating this component.
info
  Information string about this component.
name
  The name of this component.

##

SimpleConfigurator(String, Object)
  Creates a new configurator for a given object.

##

addHook(String)
  Adds a hook to the configurator.
deleteHook(String)
  Deletes a hook from the configurator.
destroyComponentConfigurator()
  Deletes the references to all internal data structures.
eventOnClient(ComponentConfigurator, ComponentEvent)
  This implementation simply prints the event to the standard output.
eventOnHookedComponent(ComponentConfigurator, ComponentEvent)
  This implementation simply prints the event to the standard output.
hook(String, ComponentConfigurator)
  Attaches a ComponentConfigurator to the given hook.
implementation()
  Accessor for getting the component implementation.
implementation(Object)
  Accessor for setting the component implementation.
indexOf(String)
info()
  Accessor for the component information string.
info(String)
  Sets the information string for this component.
listClients()
  Provides a list of the clients of this component.
listHooks()
  Provides a list of the hooks in this component.
name()
  Accessor for the component name.
name(String)
  Sets the name of this component.
registerClient(ComponentConfigurator, String)
  Adds a new component to the list of clients.
unhook(String)
  Detaches a ComponentConfigurator from the given hook.
unregisterClient(ComponentConfigurator, String)
  Removes a pair (client, hook) from the list of clients.

##

implementation

     protected Object implementation

  The Java object implementating this component.

hookVector

     protected Vector hookVector

  A vector containing the hooks for this component.

clientVector

     protected Vector clientVector

  A vector containing the clients for this component.

name

     protected String name

  The name of this component.

info

     protected String info

  Information string about this component.

##

SimpleConfigurator

     public SimpleConfigurator(String name,
                               Object implementation)

  Creates a new configurator for a given object.

  Parameters:
    implementation - the object implementation.
  See Also:
    Object

##

destroyComponentConfigurator

     public void destroyComponentConfigurator()

  Deletes the references to all internal data structures.

indexOf

     private int indexOf(String hookName)

addHook

     public void addHook(String hookName) throws ElementExists

  Adds a hook to the configurator.

  Parameters:
    hookName - the name of the hook to be added.
  Throws: ElementExists
    if the hook already exists.

deleteHook

     public void deleteHook(String hookName) throws NotFound

  Deletes a hook from the configurator.

  Parameters:
    hookName - the name of the hook to be deleted.
  Throws: NotFound
    if the hook is not found.

hook

     public void hook(String hookName,
                      ComponentConfigurator cc) throws HookBusy, NotFound

  Attaches a ComponentConfigurator to the given hook.

  Parameters:
    hookName - the name of the hook.
    cc - the ComponentConfigurator to be attached to the hook.
  Throws: HookBusy
    if there is already a component attached to the hook.
  Throws: NotFound
    if the hook does not exist.

unhook

     public void unhook(String hookName) throws HookVacant, NotFound

  Detaches a ComponentConfigurator from the given hook.

  Parameters:
    hookName - the name of the hook.
    cc - the ComponentConfigurator to be detached.
  Throws: HookVacant
    if there are no components attached to the hook.
  Throws: NotFound
    if the hook does not exist.

registerClient

     public void registerClient(ComponentConfigurator client,
                                String hookNameInClient) throws ElementExists

  Adds a new component to the list of clients.

  Parameters:
    client - the ComponentConfigurator representing the new client.
    hookNameInClient - the name of the hook to which this component is attached.
  Throws: ElementExists
    if the given pair (client, hookNameInClient) is already present in the client list.

unregisterClient

     public void unregisterClient(ComponentConfigurator client,
                                  String hookNameInClient) throws NotFound

  Removes a pair (client, hook) from the list of clients.

  Parameters:
    client - the ComponentConfigurator representing the new client.
    hookNameInClient - the name of the hook to which this component is attached.
  Throws: NotFound
    if the given pair (client, hookNameInClient) is not present in the client list.

eventOnHookedComponent

     public void eventOnHookedComponent(ComponentConfigurator hookedComponent,
                                        ComponentEvent e)

  This implementation simply prints the event to the standard output.

  Parameters:
    hookedComponent - the ComponentConfigurator that generated the event.
    e - the event that was generated.

eventOnClient

     public void eventOnClient(ComponentConfigurator client,
                               ComponentEvent e)

  This implementation simply prints the event to the standard output.

  Parameters:
    client - the ComponentConfigurator that generated the event.
    e - the event that was generated.

name

     public String name()

  Accessor for the component name.

  Returns:
    a string containing the component name.

info

     public String info()

  Accessor for the component information string.

  Returns:
    a string containing component information.

listHooks

     public Vector listHooks()

  Provides a list of the hooks in this component.

  Returns:
    s a vector of HookSpecifications.
  See Also:
    HookSpecifications, Vector

listClients

     public Vector listClients()

  Provides a list of the clients of this component.

  Returns:
    s a vector of HookSpecifications.
  See Also:
    HookSpecifications, Vector

name

     public void name(String s)

  Sets the name of this component.

info

     public void info(String s)

  Sets the information string for this component.

implementation

     public Object implementation()

  Accessor for getting the component implementation.

  Returns:
    the object implementation.

implementation

     public void implementation(Object implementation)

  Accessor for setting the component implementation.