com.ibm.di.util
Class HookTree

java.lang.Object
  extended by com.ibm.di.util.HookTree

public class HookTree
extends Object


Nested Class Summary
static class HookTree.Phase
           
 
Method Summary
 boolean equals(Object o)
           
static String getArrayName(Object element)
          Return the name of an Object[] used for constructing a HookTree.
 Object[] getChildrenArray()
          Gets the children of this HookTree.
 ConnectorConfig getConfig()
          Returns the Associated ConnectorConfig
 HookConfig getHookConfig(boolean create)
          Return the HookConfig using the name of this HookTree.
static String getHookLabel(HookConfig hc)
          Return a user friendly label for the given HookConfig.
static String getHookLabel(String hookName)
          Return a user friendly label for the given hook name.
static Object[] getHookNames(String mode)
          Returns Internal Hook names for a Connector mode.
 HooksConfig getHooksConfig()
          Return the HooksConfig used by this HookTree.
static HookTree getHookTree(AssemblyLineConfig alc)
          Return a new HookTree for an AssemblyLineConfig
static HookTree getHookTree(ConnectorConfig cc)
          Return a new HookTree for a ConnectorConfig
static HookTree getHookTree(ConnectorConfig cc, HookTree.Phase phase)
          Return a new HookTree for a ConnectorConfig in a given Phase.
static HookTree getHookTree(HooksConfig hc)
          Return a new HookTree for a HooksConfig.
 String getName()
          Returns the name of the hook matching this HookTree.
 boolean hasChildren()
          Returns true is this HookTree has children
 int hashCode()
           
 boolean isEnabled()
          Returns true if the HookConfig with this name is enabled.
 void setEnabled(boolean enabled)
          Set the HookConfig with this name to enabled.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

getHookNames

public static Object[] getHookNames(String mode)
Returns Internal Hook names for a Connector mode. The returned Objects are either Strings, or new Object arrays with Strings or Object arrays. An empty array means no hooks are used in this mode, null means that the mode was unknown.

Parameters:
mode - A connector mode
Returns:
The hook names for the given mode, or null for an unknown mode.

getArrayName

public static String getArrayName(Object element)
Return the name of an Object[] used for constructing a HookTree.

Parameters:
element - really an Object[]
Returns:
a String suitable for showing the user.

getHookLabel

public static String getHookLabel(HookConfig hc)
Return a user friendly label for the given HookConfig.

Parameters:
hc -
Returns:
a String

getHookLabel

public static String getHookLabel(String hookName)
Return a user friendly label for the given hook name.

Parameters:
hookName - - The internal name of the hook.
Returns:
The translated String, or the internal name if nothing found.

getHookTree

public static HookTree getHookTree(ConnectorConfig cc)
Return a new HookTree for a ConnectorConfig

Parameters:
cc - The ConnectorConfig
Returns:
a HookTree

getHookTree

public static HookTree getHookTree(ConnectorConfig cc,
                                   HookTree.Phase phase)
Return a new HookTree for a ConnectorConfig in a given Phase. Associates the ConnectorConfig with the root of the Tree.

Parameters:
cc - The ConnectorConfig
phase - The Phase
Returns:
a HookTree, null if nothing defined for this Phase and mode.

getHookTree

public static HookTree getHookTree(AssemblyLineConfig alc)
Return a new HookTree for an AssemblyLineConfig

Parameters:
alc - The AssemblyLineConfig
Returns:
a HookTree

getHookTree

public static HookTree getHookTree(HooksConfig hc)
Return a new HookTree for a HooksConfig. Tries to guess if this is an AssemblyLine or Connector.

Parameters:
hc - The HooksConfig
Returns:
a HookTree

getHookConfig

public HookConfig getHookConfig(boolean create)
Return the HookConfig using the name of this HookTree.

Parameters:
create - - If true, create a HookConfig if it does not exist
Returns:
The HookConfig, or null if not found and create is false.

getHooksConfig

public HooksConfig getHooksConfig()
Return the HooksConfig used by this HookTree.

Returns:
The HooksConfig.

isEnabled

public boolean isEnabled()
Returns true if the HookConfig with this name is enabled.

Returns:
true if the HookConfig with this name is enabled.

setEnabled

public void setEnabled(boolean enabled)
Set the HookConfig with this name to enabled. Creates the HookConfig if needed.

Parameters:
enabled -

hasChildren

public boolean hasChildren()
Returns true is this HookTree has children

Returns:
true is this HookTree has children

getChildrenArray

public Object[] getChildrenArray()
Gets the children of this HookTree.

Returns:
an array of HookTree, empty if no children

getName

public String getName()
Returns the name of the hook matching this HookTree. If there are no children, this will typically be an internal Hook Name, or input_attribute_map/output_attribute_map. If this HookTree has children, the name will be a user friendly String.

Returns:
The name of the hook matching this HookTree

toString

public String toString()
Overrides:
toString in class Object

getConfig

public ConnectorConfig getConfig()
Returns the Associated ConnectorConfig

Returns:
the Associated ConnectorConfig

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object