com.sdm.quasar.client.core.common.sysinfo
Class DefaultSystemInfoOptions

java.lang.Object
  extended bycom.sdm.quasar.client.core.common.sysinfo.DefaultSystemInfoOptions
All Implemented Interfaces:
SystemInfoOptions

public class DefaultSystemInfoOptions
extends java.lang.Object
implements SystemInfoOptions

An default implementation of SystemInfoOptions.

Author:
Thomas Wolf

Field Summary
 
Fields inherited from interface com.sdm.quasar.client.core.common.sysinfo.SystemInfoOptions
DETAIL_LEVEL_DETAILED, DETAIL_LEVEL_FULL, DETAIL_LEVEL_NORMAL, DETAIL_LEVEL_SIMPLE
 
Constructor Summary
DefaultSystemInfoOptions(int detailLevel)
          Creates a new DefaultSystemInfoOptions.
 
Method Summary
 java.lang.String createId(java.lang.Object object)
          Creates a unique id for the object given (unique while this application runs).
 int getDetailLevel()
          Returns the detail level of informations to collect (can be any of SystemInfoOptions.DETAIL_LEVEL_SIMPLE, SystemInfoOptions.DETAIL_LEVEL_NORMAL, SystemInfoOptions.DETAIL_LEVEL_DETAILED, SystemInfoOptions.DETAIL_LEVEL_FULL).
 java.lang.Object getOption(java.lang.String key)
          Returns a previously set option object for the given key.
 java.lang.String getTraversedId(java.lang.Object object)
          Returns the stored traveres id for the object given.
 boolean isDetailLevelAtLeast(int minLevel)
          Returns true, if this SystemInfoOptions detail level is least min_level or more detailed.
 boolean isTraversed(java.lang.Object object)
          Returns true, if the object given was already traversed within the current run of collecting system information.
 void markTraversed(java.lang.Object object, java.lang.String id)
          Marks the given object as traversed.
 boolean markTraversedAndSetId(SystemInfoNode node, java.lang.Object object)
          Marks the given object as traversed and sets a created id to the given SystemInfoNode.
 void setOption(java.lang.String key, java.lang.Object option)
          Sets an additional option object for the key given.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultSystemInfoOptions

public DefaultSystemInfoOptions(int detailLevel)
Creates a new DefaultSystemInfoOptions.

Method Detail

getDetailLevel

public int getDetailLevel()
Description copied from interface: SystemInfoOptions
Returns the detail level of informations to collect (can be any of SystemInfoOptions.DETAIL_LEVEL_SIMPLE, SystemInfoOptions.DETAIL_LEVEL_NORMAL, SystemInfoOptions.DETAIL_LEVEL_DETAILED, SystemInfoOptions.DETAIL_LEVEL_FULL).

Specified by:
getDetailLevel in interface SystemInfoOptions

isDetailLevelAtLeast

public boolean isDetailLevelAtLeast(int minLevel)
Description copied from interface: SystemInfoOptions
Returns true, if this SystemInfoOptions detail level is least min_level or more detailed.

Specified by:
isDetailLevelAtLeast in interface SystemInfoOptions
Parameters:
minLevel - the minimum detail level to check against

getOption

public java.lang.Object getOption(java.lang.String key)
Description copied from interface: SystemInfoOptions
Returns a previously set option object for the given key.

Specified by:
getOption in interface SystemInfoOptions
Parameters:
key - the key of the option to return (not null)
Returns:
the option object for the key (if not found, null is returned)
See Also:
SystemInfoOptions.getOption(java.lang.String)

setOption

public void setOption(java.lang.String key,
                      java.lang.Object option)
Description copied from interface: SystemInfoOptions
Sets an additional option object for the key given.

Specified by:
setOption in interface SystemInfoOptions
Parameters:
key - the option key (not null)
option - the option object to set (if null, will be removed)
See Also:
SystemInfoOptions.setOption(java.lang.String, java.lang.Object)

createId

public java.lang.String createId(java.lang.Object object)
Description copied from interface: SystemInfoOptions
Creates a unique id for the object given (unique while this application runs). The id is build of three parts:
  1. the full qualified class name of the object,
  2. the at-sign ("@") and
  3. the system identity hash code (see System.identityHashCode(Object)) in hexadecimal representation.
  4. Specified by:
    createId in interface SystemInfoOptions
    See Also:
    SystemInfoOptions.createId(java.lang.Object)

markTraversed

public void markTraversed(java.lang.Object object,
                          java.lang.String id)
Description copied from interface: SystemInfoOptions
Marks the given object as traversed. This is done by storing the id given in a map.

Specified by:
markTraversed in interface SystemInfoOptions
Parameters:
object - an object beeing traversed (may be null)
id - the id to set (if null, a unique id will be set using SystemInfoOptions.createId(Object))
See Also:
SystemInfoOptions.markTraversed(java.lang.Object, java.lang.String)

isTraversed

public boolean isTraversed(java.lang.Object object)
Description copied from interface: SystemInfoOptions
Returns true, if the object given was already traversed within the current run of collecting system information.

Specified by:
isTraversed in interface SystemInfoOptions
Parameters:
object - the object beeing checked (if null, always false will be returned)
See Also:
SystemInfoOptions.isTraversed(java.lang.Object)

getTraversedId

public java.lang.String getTraversedId(java.lang.Object object)
Description copied from interface: SystemInfoOptions
Returns the stored traveres id for the object given.

Specified by:
getTraversedId in interface SystemInfoOptions
Parameters:
object - the object to get an id for (may be null, then always null will be returned)
Returns:
the traversed id or null if the object was not yet traversed and so no traverse-id was stored
See Also:
SystemInfoOptions.getTraversedId(java.lang.Object)

markTraversedAndSetId

public boolean markTraversedAndSetId(SystemInfoNode node,
                                     java.lang.Object object)
Description copied from interface: SystemInfoOptions
Marks the given object as traversed and sets a created id to the given SystemInfoNode. If the object already was traversed, the id will set as reference id.

Specified by:
markTraversedAndSetId in interface SystemInfoOptions
Parameters:
node - the SystemInfoNode to set id or idref (if null, no id will be set)
object - the object traversing (may be null; the id for null will be "<null>")
Returns:
true if object is traversed the first time, false otherwise
See Also:
SystemInfoOptions.markTraversedAndSetId(com.sdm.quasar.client.core.common.sysinfo.SystemInfoNode, java.lang.Object)