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

Variable Index

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

Constructor Index

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

Method Index

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

Variables

 o implementation
 protected Object implementation
The Java object implementating this component.

 o hookVector
 protected Vector hookVector
A vector containing the hooks for this component.

 o clientVector
 protected Vector clientVector
A vector containing the clients for this component.

 o name
 protected String name
The name of this component.

 o info
 protected String info
Information string about this component.

Constructors

 o SimpleConfigurator
 public SimpleConfigurator(String name,
                           Object implementation)
Creates a new configurator for a given object.

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

Methods

 o destroyComponentConfigurator
 public void destroyComponentConfigurator()
Deletes the references to all internal data structures.

 o indexOf
 private int indexOf(String hookName)
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o name
 public String name()
Accessor for the component name.

Returns:
a string containing the component name.
 o info
 public String info()
Accessor for the component information string.

Returns:
a string containing component information.
 o listHooks
 public Vector listHooks()
Provides a list of the hooks in this component.

Returns:
s a vector of HookSpecifications.
See Also:
HookSpecifications, Vector
 o listClients
 public Vector listClients()
Provides a list of the clients of this component.

Returns:
s a vector of HookSpecifications.
See Also:
HookSpecifications, Vector
 o name
 public void name(String s)
Sets the name of this component.

 o info
 public void info(String s)
Sets the information string for this component.

 o implementation
 public Object implementation()
Accessor for getting the component implementation.

Returns:
the object implementation.
 o implementation
 public void implementation(Object implementation)
Accessor for setting the component implementation.