xmlBlaster 2.2.0 API

org.xmlBlaster.contrib
Class GlobalInfo

java.lang.Object
  extended by org.xmlBlaster.contrib.GlobalInfo
All Implemented Interfaces:
I_Info, I_Plugin
Direct Known Subclasses:
DbWatcherPlugin, DbWriterPlugin, DesignQueues2008InitialTest.TestInfo, FileWatcherFeeder, FileWatcherPlugin, FileWriter, MX4JAdaptor, ReplicationAgent.OwnGlobalInfo, ReplManagerPlugin, SchedulerPlugin, SocketGetterPlugin, TestInfo.OwnGlobalInfo, XBDatabaseAccessor.QueueGlobalInfo

public abstract class GlobalInfo
extends java.lang.Object
implements I_Plugin, I_Info

Author:
Michele Laghi, Marcel Ruff

Field Summary
private  ContextNode contextNode
           
protected  Global global
           
private  InfoHelper helper
           
private  java.util.Set jmxHandleSet
          My JMX registration
private static java.util.logging.Logger log
           
static int LOWER_CASE
           
private  java.util.Map objects
           
static java.lang.String ORIGINAL_ENGINE_GLOBAL
           
protected  PluginInfo pluginInfo
           
private  java.util.Set propsOfOwnInterest
           
static int UNTOUCHED
           
static int UPPER_CASE
           
 
Fields inherited from interface org.xmlBlaster.contrib.I_Info
ID, JMX_PREFIX
 
Constructor Summary
GlobalInfo(Global otherGlobal, I_Info additionalInfo)
          Additional infos are added on top of the initial Global configuration.
GlobalInfo(GlobalInfo baseInfo, I_Info additionalInfo)
           
GlobalInfo(java.util.Set propsOfOwnInterest)
           
GlobalInfo(java.lang.String[] propKeysAsString)
           
 
Method Summary
protected abstract  void doInit(Global global, PluginInfo pluginInfo)
           
static java.lang.String dump(I_Info info)
           
private static java.lang.String fixCase(java.lang.String val, int chCase)
           
 java.lang.String get(java.lang.String key, java.lang.String def)
          Access a string environment setting.
 boolean getBoolean(java.lang.String key, boolean def)
          Access an environment setting of type boolean.
 Global getGlobal()
           
 int getInt(java.lang.String key, int def)
          Access an environment setting of type int.
 java.util.Set getKeys()
          Gets the keys of the entries stored.
 long getLong(java.lang.String key, long def)
          Access an environment setting of type long.
 java.lang.Object getObject(java.lang.String key)
          Access the remembered object.
 java.util.Set getObjectKeys()
          Gets the keys of the objects registered.
private static Global getOriginalGlobal(Global global, boolean recursive)
           
static Global getOriginalGlobal(I_Info info)
          Returns the Base global.
 java.lang.String getRaw(java.lang.String key)
          Returns the value associated to this key.
static java.lang.String getStrippedString(java.lang.String pureVal)
           
 java.lang.String getType()
          The plugin name as configured im xmlBlasterPlugins.xml
 java.lang.String getVersion()
          The plugin version as configured in xmlBlasterPlugins.xml
 void init(Global global_, PluginInfo pluginInfo)
          This method is called by the PluginManager.
private  void initJmx()
           
static java.lang.Object loadPlugin(I_Info info, java.lang.String pluginClassName, java.lang.String registryName)
          Checks in the registry if such an object exitsts and if not it creates one for you and intializes it.
 void put(java.lang.String key, java.lang.String value)
          Put key/value to environment.
 java.lang.Object putObject(java.lang.String key, java.lang.Object o)
          Store an object.
 void putRaw(java.lang.String key, java.lang.String value)
          Put key/value to environment.
protected  void replaceAllEntries()
           
static java.lang.String setStrippedHostname(I_Info info, int chCase)
          Convenience to allow the usage of a name mapped to the hostname which can be used as an identifier in a database.
 void shutdown()
          Cleans up the resource.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ORIGINAL_ENGINE_GLOBAL

public static final java.lang.String ORIGINAL_ENGINE_GLOBAL
See Also:
Constant Field Values

UNTOUCHED

public static final int UNTOUCHED
See Also:
Constant Field Values

UPPER_CASE

public static final int UPPER_CASE
See Also:
Constant Field Values

LOWER_CASE

public static final int LOWER_CASE
See Also:
Constant Field Values

log

private static java.util.logging.Logger log

global

protected Global global

pluginInfo

protected PluginInfo pluginInfo

objects

private java.util.Map objects

propsOfOwnInterest

private java.util.Set propsOfOwnInterest

helper

private InfoHelper helper

jmxHandleSet

private java.util.Set jmxHandleSet
My JMX registration


contextNode

private ContextNode contextNode
Constructor Detail

GlobalInfo

public GlobalInfo(java.util.Set propsOfOwnInterest)

GlobalInfo

public GlobalInfo(java.lang.String[] propKeysAsString)

GlobalInfo

public GlobalInfo(Global otherGlobal,
                  I_Info additionalInfo)
           throws XmlBlasterException
Additional infos are added on top of the initial Global configuration.

Parameters:
otherGlobal - can not be null.
additionalInfo - can be null. If not null, these properties will be added on top of the already set in global.
Throws:
XmlBlasterException

GlobalInfo

public GlobalInfo(GlobalInfo baseInfo,
                  I_Info additionalInfo)
           throws XmlBlasterException
Parameters:
otherInfo -
additionalInfo - can be null. If not null, these properties will be added on top of the already set in global.
Throws:
XmlBlasterException
Method Detail

getStrippedString

public static java.lang.String getStrippedString(java.lang.String pureVal)

fixCase

private static final java.lang.String fixCase(java.lang.String val,
                                              int chCase)

setStrippedHostname

public static java.lang.String setStrippedHostname(I_Info info,
                                                   int chCase)
Convenience to allow the usage of a name mapped to the hostname which can be used as an identifier in a database. Specifically used for the prefix in the replication.

Parameters:
info - can be null, in which case only system properties are changed.

loadPlugin

public static java.lang.Object loadPlugin(I_Info info,
                                          java.lang.String pluginClassName,
                                          java.lang.String registryName)
                                   throws java.lang.Exception
Checks in the registry if such an object exitsts and if not it creates one for you and intializes it.

Parameters:
info - The info object to use.
pluginClassName - The complete name of the plugin to load.
registryName - The name to search in the registry for this instance. The registry will be in the info object passed. If you specify null, the lookup is skipped.
Returns:
Throws:
java.lang.Exception

doInit

protected abstract void doInit(Global global,
                               PluginInfo pluginInfo)
                        throws XmlBlasterException
Parameters:
global - The global passed by the RunLevelManager, this is not the object owned by the plugin. It is the original global.
pluginInfo -
Throws:
XmlBlasterException

init

public final void init(Global global_,
                       PluginInfo pluginInfo)
                throws XmlBlasterException
Description copied from interface: I_Plugin
This method is called by the PluginManager.

Example how options are evaluated:

   // An entry in xmlBlaster.properties (in one line):
   MimeSubscribePlugin[ContentLenFilter][1.0]=\
                 org.xmlBlaster.engine.mime.demo.ContentLenFilter,\
                 DEFAULT_MAX_LEN=200,DEFAULT_MIN_LEN=20

  // Access it like this:
  java.util.Properties props = pluginInfo.getParameters();
  String maxLen = (String)props.get("DEFAULT_MAX_LEN");
  String throwLen = (String)props.get("THROW_EXCEPTION_FOR_LEN");
 

Specified by:
init in interface I_Plugin
Throws:
XmlBlasterException
See Also:
I_Plugin.init(org.xmlBlaster.util.Global, org.xmlBlaster.util.plugin.PluginInfo)

replaceAllEntries

protected void replaceAllEntries()

initJmx

private void initJmx()

getType

public java.lang.String getType()
The plugin name as configured im xmlBlasterPlugins.xml

Specified by:
getType in interface I_Plugin
See Also:
I_Plugin.getType()

getVersion

public java.lang.String getVersion()
The plugin version as configured in xmlBlasterPlugins.xml

Specified by:
getVersion in interface I_Plugin
See Also:
I_Plugin.getVersion()

shutdown

public void shutdown()
              throws XmlBlasterException
Description copied from interface: I_Plugin
Cleans up the resource.

Specified by:
shutdown in interface I_Plugin
Throws:
XmlBlasterException - if an exception occurs. The exception is handled by the RunLevelManager depending on how the plugin has been configured with the action:

<action do='STOP' onShutdownRunlevel='2' sequence='5' onFail='resource.configuration.pluginFailed'> If onFail is defined to something, the RunLevelManager will stop.

See Also:
I_Plugin.shutdown()

getRaw

public java.lang.String getRaw(java.lang.String key)
Description copied from interface: I_Info
Returns the value associated to this key.

Specified by:
getRaw in interface I_Info
Returns:

get

public java.lang.String get(java.lang.String key,
                            java.lang.String def)
Description copied from interface: I_Info
Access a string environment setting.

Specified by:
get in interface I_Info
Parameters:
key - The parameter key
def - The default used if key is not found
Returns:
The configured value of the parameter
See Also:
I_Info.get(java.lang.String, java.lang.String)

put

public void put(java.lang.String key,
                java.lang.String value)
Description copied from interface: I_Info
Put key/value to environment.

Specified by:
put in interface I_Info
Parameters:
key - The parameter key
value - The parameter value, if null the parameter is removed.
See Also:
I_Info.put(java.lang.String, java.lang.String)

putRaw

public void putRaw(java.lang.String key,
                   java.lang.String value)
Description copied from interface: I_Info
Put key/value to environment. This put does not modify (replace) the key, nor the value.

Specified by:
putRaw in interface I_Info
Parameters:
key - The parameter key
value - The parameter value, if null the parameter is removed.
See Also:
I_Info.put(java.lang.String, java.lang.String)

getLong

public long getLong(java.lang.String key,
                    long def)
Description copied from interface: I_Info
Access an environment setting of type long.

Specified by:
getLong in interface I_Info
Parameters:
key - The parameter key
def - The default used if key is not found
Returns:
The configured value of the parameter
See Also:
I_Info.getLong(java.lang.String, long)

getInt

public int getInt(java.lang.String key,
                  int def)
Description copied from interface: I_Info
Access an environment setting of type int.

Specified by:
getInt in interface I_Info
Parameters:
key - The parameter key
def - The default used if key is not found
Returns:
The configured value of the parameter
See Also:
I_Info.getInt(java.lang.String, int)

getBoolean

public boolean getBoolean(java.lang.String key,
                          boolean def)
Description copied from interface: I_Info
Access an environment setting of type boolean.

Specified by:
getBoolean in interface I_Info
Parameters:
key - The parameter key
def - The default used if key is not found
Returns:
The configured value of the parameter
See Also:
I_Info.getBoolean(java.lang.String, boolean)

getObject

public java.lang.Object getObject(java.lang.String key)
Description copied from interface: I_Info
Access the remembered object.

Specified by:
getObject in interface I_Info
Parameters:
key - The object key
Returns:
The found object or null
See Also:
I_Info.getObject(java.lang.String)

putObject

public java.lang.Object putObject(java.lang.String key,
                                  java.lang.Object o)
Description copied from interface: I_Info
Store an object.

Specified by:
putObject in interface I_Info
Parameters:
key - The object key
o - The object to remember or null to remove it
Returns:
The old object or null
See Also:
I_Info.putObject(java.lang.String, Object)

getKeys

public java.util.Set getKeys()
Description copied from interface: I_Info
Gets the keys of the entries stored. Note that this does not return the key of the entries stored as objects. To retrieve these use getObjectKeys().

Specified by:
getKeys in interface I_Info
Returns:
See Also:
I_Info.getKeys()

getObjectKeys

public java.util.Set getObjectKeys()
Description copied from interface: I_Info
Gets the keys of the objects registered. Note that this does not return the key of the normal entries. To retrieve these use getKeys().

Specified by:
getObjectKeys in interface I_Info
Returns:
See Also:
I_Info.getObjectKeys()

dump

public static java.lang.String dump(I_Info info)

getGlobal

public Global getGlobal()

getOriginalGlobal

private static Global getOriginalGlobal(Global global,
                                        boolean recursive)

getOriginalGlobal

public static Global getOriginalGlobal(I_Info info)
Returns the Base global. The Base Global is the Global

Parameters:
info -
Returns:

xmlBlaster 2.2.0 API

Copyright © 1999-2014 The xmlBlaster.org contributers.