TPTP 4.0.0 Monitoring Tools Project
Public API Specification

org.eclipse.hyades.logging.adapter.impl
Class Context

java.lang.Object
  extended byorg.eclipse.hyades.logging.adapter.impl.Component
      extended byorg.eclipse.hyades.logging.adapter.impl.Context
All Implemented Interfaces:
IComponent, IContext, java.lang.Runnable
Direct Known Subclasses:
BasicContext

public abstract class Context
extends Component
implements IContext

Context is a component. A Context instance corresponds to one thread of processing - sensor, event extractor, parser, outputters etc.


Field Summary
protected  IContextListener listener
          Listener for this context
 
Fields inherited from class org.eclipse.hyades.logging.adapter.impl.Component
logger, status, stopping
 
Constructor Summary
Context()
           
 
Method Summary
 java.lang.String getCharset()
          Retrieve the name of the character set that this context is working with
 IContextListener getContextListener()
          Get the IContextListener that is invoked as the context manages its sub-components.
 Status getContextStatus()
          Get the status of the context
 boolean getContinuousOperation()
          Get whether the context is running in continuous monitoring mode.
 java.util.Locale getLocale()
          Retrieve the locale that this context is operating within
 long getMaximumIdleTime()
          Get the maximum idle time used for determining when to stop the context that is running in continuous mode.
protected  long getPauseCount()
          Get the pause counter.
 long getPauseInterval()
          Get the pause interval time used for determining when to stop the context that is running in continuous mode.
 void handleControledStop()
          Determine if the context should be stopped based whether it is running in continuous monitoring mode and the maximum idle time has been reached.
protected  void incrementPauseCount()
          Increment the pause counter.
protected  boolean isHardStop()
          Is the context stopping without notifying its listeners.
 void resetControledStop()
          Reset the counters used to determine if the context should be stopped when running in continuous monitoring mode.
protected  void resetPauseCount()
          Reset the pause counter back to zero.
 void setCharset(java.lang.String charset)
          Set the character set to be used by this context
 void setContextListener(IContextListener listener)
          Set the IContextListener that will be invoked as the context manages its sub-components.
 void setContinuousOperation(boolean newContinuousOperation)
          Set whether the context should run in continuous monitoring mode or not.
 void setHardStop()
          Set the hardStop flag so the context will stop without notifying its listeners.
 void setLocale(java.util.Locale locale)
          Set the locale to be used by this context
 void setMaximumIdleTime(long newMaximumIdleTime)
          Set the maximum idle time used for determining when to stop the context that is running in continuous mode.
protected  void setPauseCount(long newPauseCount)
          Set the pause counter.
 void setPauseInterval(long newPauseInterval)
          Set the pause interval time used for determining when to stop the context that is running in continuous mode.
 void stop()
          Stop the context.
 void update()
          Method update.
 
Methods inherited from class org.eclipse.hyades.logging.adapter.impl.Component
clean, getComponents, getComponentStatus, getConfiguration, getContextConfiguration, getDescription, getEventFactory, getExecutableClassName, getImplementationCreationDate, getImplementationVersion, getImplementationVersionDescription, getItemsProcessedCount, getLogger, getLoggingLevel, getName, getParent, getRole, getRoleCreationDate, getRoleVersion, getRoleVersionDescription, getUniqueID, incrementItemsProcessedCount, incrementItemsProcessedCount, init, isStopping, log, log, setComponents, setConfiguration, setContextConfiguration, setDescription, setExecutableClassName, setImplemenationCreationDate, setImplementationVersion, setImplementationVersionDescription, setLogger, setLoggingLevel, setName, setParent, setRole, setRoleCreationDate, setRoleVersion, setRoleVersionDescription, setStopping, setUniqueID, start, stop, trace, trace, trace, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.hyades.logging.adapter.IComponent
getComponents, getConfiguration, getContextConfiguration, getDescription, getExecutableClassName, getImplementationCreationDate, getImplementationVersion, getImplementationVersionDescription, getLogger, getLoggingLevel, getName, getParent, getRole, getRoleCreationDate, getRoleVersion, getRoleVersionDescription, getUniqueID, init, log, log, setComponents, setConfiguration, setContextConfiguration, setDescription, setExecutableClassName, setImplemenationCreationDate, setImplementationVersion, setImplementationVersionDescription, setLogger, setLoggingLevel, setName, setParent, setRole, setRoleCreationDate, setRoleVersion, setRoleVersionDescription, setUniqueID, start, update
 
Methods inherited from interface java.lang.Runnable
run
 

Field Detail

listener

protected IContextListener listener
Listener for this context

Constructor Detail

Context

public Context()
Method Detail

stop

public void stop()
Stop the context.

Specified by:
stop in interface IComponent
Overrides:
stop in class Component
See Also:
IComponent.stop()

resetControledStop

public void resetControledStop()
Reset the counters used to determine if the context should be stopped when running in continuous monitoring mode.


resetPauseCount

protected void resetPauseCount()
Reset the pause counter back to zero.


incrementPauseCount

protected void incrementPauseCount()
Increment the pause counter.


getPauseCount

protected long getPauseCount()
Get the pause counter.

Returns:
the pause counter as a long.

setPauseCount

protected void setPauseCount(long newPauseCount)
Set the pause counter.

Parameters:
newPauseCount - - the new value of the pause counter.

setContinuousOperation

public void setContinuousOperation(boolean newContinuousOperation)
Set whether the context should run in continuous monitoring mode or not.

Parameters:
newContinuousOperation - - boolean for whether context is to run in continuous mode.

getContinuousOperation

public boolean getContinuousOperation()
Get whether the context is running in continuous monitoring mode.

Returns:
true if context is running in continuous mode, false otherwise.

setMaximumIdleTime

public void setMaximumIdleTime(long newMaximumIdleTime)
Set the maximum idle time used for determining when to stop the context that is running in continuous mode. This is the maximum time the context will wait for new data to be returned by the sensor.

Parameters:
newMaximumIdleTime - - the new maximum idle time in microseconds

getMaximumIdleTime

public long getMaximumIdleTime()
Get the maximum idle time used for determining when to stop the context that is running in continuous mode. This is the maximum time the context will wait for new data to be returned by the sensor.

Returns:
maximum idle time as a long

setPauseInterval

public void setPauseInterval(long newPauseInterval)
Set the pause interval time used for determining when to stop the context that is running in continuous mode. This is the wait time before checking if the sensor has read some new data.

Parameters:
newPauseInterval - - the new pause interval in microseconds

getPauseInterval

public long getPauseInterval()
Get the pause interval time used for determining when to stop the context that is running in continuous mode. This is the wait time before checking if the sensor has read some new data.

Returns:
pause interval in microseconds as a long

update

public void update()
            throws AdapterInvalidConfig
Description copied from interface: IComponent
Method update. By reading the current component configuration, sets the properties of the component. Subclasses should invoke parent update() to ensure proper behaviour.

Specified by:
update in interface IComponent
Overrides:
update in class Component
Throws:
AdapterInvalidConfig
See Also:
IComponent.update()

handleControledStop

public void handleControledStop()
Determine if the context should be stopped based whether it is running in continuous monitoring mode and the maximum idle time has been reached.


setContextListener

public void setContextListener(IContextListener listener)
Description copied from interface: IContext
Set the IContextListener that will be invoked as the context manages its sub-components.

Specified by:
setContextListener in interface IContext
Parameters:
listener -
See Also:
IContext.setContextListener(IContextListener)

getContextListener

public IContextListener getContextListener()
Description copied from interface: IContext
Get the IContextListener that is invoked as the context manages its sub-components.

Specified by:
getContextListener in interface IContext
Returns:
IContextListener - the context listener instance
See Also:
IContext.getContextListener()

isHardStop

protected boolean isHardStop()
Is the context stopping without notifying its listeners.

Returns:
true if context is stopping without notifying its listeners., otherwise false

setHardStop

public void setHardStop()
Set the hardStop flag so the context will stop without notifying its listeners.


getLocale

public java.util.Locale getLocale()
Description copied from interface: IContext
Retrieve the locale that this context is operating within

Specified by:
getLocale in interface IContext
Returns:
Locale - locale of context
See Also:
IContext.getLocale()

setLocale

public void setLocale(java.util.Locale locale)
Description copied from interface: IContext
Set the locale to be used by this context

Specified by:
setLocale in interface IContext
Parameters:
locale - to be used by the context
See Also:
IContext.setLocale(java.util.Locale)

getCharset

public java.lang.String getCharset()
Description copied from interface: IContext
Retrieve the name of the character set that this context is working with

Specified by:
getCharset in interface IContext
Returns:
String - character set
See Also:
IContext.getCharset()

setCharset

public void setCharset(java.lang.String charset)
Description copied from interface: IContext
Set the character set to be used by this context

Specified by:
setCharset in interface IContext
Parameters:
charset - the name of the character set to use for this context
See Also:
org.eclipse.hyades.logging.adapter.IContext#setCharset(java.nio.charset.Charset)

getContextStatus

public Status getContextStatus()
Get the status of the context

Returns:
Status object representing the status of the context.

TPTP 4.0.0 Monitoring Tools Project
Public API Specification