biz.hammurapi.config
Class GenericContainer

java.lang.Object
  extended by biz.hammurapi.util.VisitableBase
      extended by biz.hammurapi.config.GenericContainer
All Implemented Interfaces:
Command, Component, Context, MeasurementCollector, MeasurementConsumer, Attributable, Searchable, Visitable
Direct Known Subclasses:
DomConfigurableContainer, RowsetConfigurableContainer

public class GenericContainer
extends VisitableBase
implements Component, Command, Attributable, Context, MeasurementCollector, MeasurementConsumer


Constructor Summary
GenericContainer()
           
 
Method Summary
protected  void acceptChildren(Visitor visitor)
          Override this method to navigate visitor through object constituents.
 void addComponent(java.lang.String name, java.lang.Object component)
          Adds component and starts it.
 void addMeasurement(java.lang.String name, double value, long time)
          Adds measurement
 void execute(java.lang.Object executionContext)
          Invokes execute() of executable components sequentially.
 java.lang.Object get(java.lang.String name)
          Looks up component in component tree.
 java.lang.Object getAttribute(java.lang.Object key)
           
protected  java.util.Map getComponentMap()
           
 java.util.Set getComponentNames()
           
protected  java.util.Collection getComponents()
           
 MeasurementConsumer getMeasurementConsumer()
           
 java.lang.Object getOwner(java.lang.Class ownerType)
          Finds component owner of particular type.
 java.lang.Object removeAttribute(java.lang.Object key)
           
 void setAttribute(java.lang.Object key, java.lang.Object value)
           
 void setMeasurementConsumer(MeasurementConsumer measurementConsumer)
          Sets measurement consumer to pass measurements to.
 void setOwner(java.lang.Object owner)
          Plugs the component into container and naming bus.
 void start()
          Invoked by container before the first use.
 void stop()
          Invoked by container when component is not needed anymore.
 
Methods inherited from class biz.hammurapi.util.VisitableBase
accept, convert2searchable, find, findAll, object2visitor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenericContainer

public GenericContainer()
Method Detail

getComponentMap

protected java.util.Map getComponentMap()

get

public java.lang.Object get(java.lang.String name)
Looks up component in component tree.

Specified by:
get in interface Context
Parameters:
name -
Returns:

addComponent

public void addComponent(java.lang.String name,
                         java.lang.Object component)
                  throws ConfigurationException
Adds component and starts it.

Parameters:
name -
component -
Throws:
ConfigurationException

start

public void start()
           throws ConfigurationException
Description copied from interface: Component
Invoked by container before the first use. Component shall perform initialization in this method.

Specified by:
start in interface Component
Throws:
ConfigurationException

stop

public void stop()
          throws ConfigurationException
Description copied from interface: Component
Invoked by container when component is not needed anymore. Component shall perform cleanup in this method.

Specified by:
stop in interface Component
Throws:
ConfigurationException

setOwner

public void setOwner(java.lang.Object owner)
Description copied from interface: Component
Plugs the component into container and naming bus.

Specified by:
setOwner in interface Component

execute

public void execute(java.lang.Object executionContext)
Invokes execute() of executable components sequentially.

Specified by:
execute in interface Command

acceptChildren

protected void acceptChildren(Visitor visitor)
Description copied from class: VisitableBase
Override this method to navigate visitor through object constituents.

Overrides:
acceptChildren in class VisitableBase

getComponents

protected java.util.Collection getComponents()

getComponentNames

public java.util.Set getComponentNames()

setAttribute

public void setAttribute(java.lang.Object key,
                         java.lang.Object value)
Specified by:
setAttribute in interface Attributable

getAttribute

public java.lang.Object getAttribute(java.lang.Object key)
Specified by:
getAttribute in interface Attributable

removeAttribute

public java.lang.Object removeAttribute(java.lang.Object key)
Specified by:
removeAttribute in interface Attributable

setMeasurementConsumer

public void setMeasurementConsumer(MeasurementConsumer measurementConsumer)
Description copied from interface: MeasurementCollector
Sets measurement consumer to pass measurements to.

Specified by:
setMeasurementConsumer in interface MeasurementCollector

getMeasurementConsumer

public MeasurementConsumer getMeasurementConsumer()

addMeasurement

public void addMeasurement(java.lang.String name,
                           double value,
                           long time)
Description copied from interface: MeasurementConsumer
Adds measurement

Specified by:
addMeasurement in interface MeasurementConsumer
Parameters:
name - Metric name
value - Measurement value
time - Time when metric was collected. If this parameter is 0 then metric subsystem uses System.currentTimeMillis() to provide correct value if needed.

getOwner

public java.lang.Object getOwner(java.lang.Class ownerType)
Finds component owner of particular type.

Parameters:
ownerType -
Returns:
Owner which is an instance of specified type or null if no such owner is found.


Copyright © 2003 Hammurapi Group. All Rights Reserved.