xmlBlaster 1.6.2 API

org.xmlBlaster.util
Class Global

java.lang.Object
  extended byorg.xmlBlaster.util.Global
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
ServerScope

public class Global
extends java.lang.Object
implements java.lang.Cloneable

Global variables to avoid singleton.

Each Global instance holds all configuration and helper objects for exactly one XmlBlasterAccess client instance. It is like a local stack for a connection.

Use one instance of this for each XmlBlasterAccess client connection to xmlBlaster.

A Global instance is still usable after a call to its shutdown() method, it can be used again in another XmlBlasterAccess instance.

See Also:
GlobalTest

Field Summary
protected  java.lang.String addressNormalized
           
protected  Address bootstrapAddress
           
private  java.lang.String buildJavaVendor
          This will be replaced by build.xml with the compiling JDK vendor
private  java.lang.String buildJavaVersion
          This will be replaced by build.xml with the compiling JDK version
private  java.lang.String buildTimestamp
          This will be replaced by build.xml with the build timestamp
protected  Timeout burstModeTimer
           
protected  java.lang.String cbHostname
           
protected  CbServerPluginManager cbServerPluginManager
           
protected  I_Checkpoint checkpointPlugin
          Must be loaded in runlevel 0 or 1 before any access as not synchronized
private  ClassLoaderFactory classLoaderFactory
          The xmlBlaster class loader factory
protected  PluginLoader clientSecurityLoader
           
protected  I_ConnectQosFactory connectQosFactory
           
protected  ContextNode contextNode
           
protected static int counter
           
protected  I_DisconnectQosFactory disconnectQosFactory
           
protected  DispatchPluginManager dispatchPluginManager
           
protected  DispatchWorkerPool dispatchWorkerPool
           
protected  javax.xml.parsers.DocumentBuilderFactory docBuilderFactory
           
protected  I_EntryFactory entryFactory
           
protected  java.lang.String errorText
           
private static Global firstInstance
           
static long heapMemoryUsage
          Number of bytes this JVM can allocate max, the -Xmx???M setting Set by JmxWrappter.java (defaults to Runtime.getRuntime().maxMemory())
private  HttpIORServer httpServer
           
protected  java.lang.String id
           
private  java.lang.String instanceId
           
protected  java.lang.String ip_addr
           
protected  boolean isDoingShutdown
           
protected  Timeout jdbcConnectionPoolTimer
           
private static java.util.logging.Logger log
           
protected  java.util.Hashtable logChannels
           
private static boolean logIsInitialized
           
static long maxFileDescriptorCount
          The max number of file descriptors this JVM may use Set by JmxWrappter.java, else 0
protected  java.lang.String ME
           
protected  Timeout messageTimer
           
protected  I_MsgKeyFactory msgKeyFactory
           
protected  I_MsgQosFactory msgQosFactory
           
protected  java.util.Map nativeCallbackDriverMap
           
protected  java.util.Map objectMap
          Store objects in the scope of one client connection or server instance
 java.lang.Object objectMapMonitor
          Helper to synchronize objectMap access
protected  Timeout pingTimer
           
private  PluginManagerBase pluginManager
           
private  PluginRegistry pluginRegistry
           
protected  Property property
           
protected  ProtocolPluginManager protocolPluginManager
           
protected  I_QueryKeyFactory queryKeyFactory
           
protected  I_QueryQosFactory queryQosFactory
           
protected  QueuePluginManager queuePluginManager
           
private  java.lang.String revisionNumber
          This will be replaced by build.xml with the current subversion revision number
protected  javax.xml.parsers.SAXParserFactory saxFactory
           
protected  ContextNode scopeContextNode
           
protected  long sequenceNumber
          JMX notification sequence number.
protected  I_StatusQosFactory statusQosFactory
           
static long totalPhysicalMemorySize
          The amount of physical RAM of this machine.
protected  javax.xml.transform.TransformerFactory transformerFactory
           
private  java.lang.String version
          This will be replaced by build.xml with the current version
private  java.lang.String versionDefault
          Version string, please change for new releases (4 digits)
protected  boolean wipeOutDB
          set to allow wipe out the persistence on restarts
protected  I_XmlBlasterAccess xmlBlasterAccess
          The client handle to access xmlBlaster
 
Constructor Summary
Global()
          Constructs an initial Global object, same as Global(null, true, true)
Global(java.util.Properties props)
          Constructs an initial Global object which is initialized by your properties, same as Global(args, true, true)
Global(java.lang.String[] args)
          Constructs an initial Global object which is initialized by your args array (usually the command line args).
Global(java.lang.String[] args, boolean loadPropFile, boolean checkInstance)
          Constructs an initial Global object which is initialized by your args array (usually the command line args).
 
Method Summary
 java.lang.String accessFromInternalHttpServer(Address address, java.lang.String urlPath, boolean verbose)
          Access the xmlBlaster internal HTTP server and download the requested path.
 void addNativeCallbackDriver(java.lang.String key, I_CallbackDriver driver)
          The key is the protocol and the address to access the callback instance.
 void addObjectEntry(java.lang.String key, java.lang.Object driver)
          Add an object in the scope of an I_XmlBlasterAccess or of one cluster node.
static java.lang.String byteString(long size)
          Build a nice, human readable string for the size in MB/KB/Bytes.
 java.util.logging.Level changeLogLevel(java.lang.String loggerName, java.util.logging.Level level)
          Changes the given logger to given level.
protected  java.lang.Object clone()
          Get a deep clone (everything is independent from the origin).
 DispatchConnectionsHandler createDispatchConnectionsHandler(DispatchManager dispatchManager)
          Returns the client access layer implementations 'ClientDispatchConnectionsHandler'
static java.lang.String decode(java.lang.String s, java.lang.String enc)
          This notation is URLDecoder since JDK 1.4.
static java.lang.String encode(java.lang.String s, java.lang.String enc)
          This notation is URLEncoder since JDK 1.4.
 void finalize()
           
static void gc(int numGc, long sleep)
          Do some garbage collect attempts
 boolean get(java.lang.String shortKey, boolean defaultValue, java.util.Properties map, I_PluginConfig pluginConfig)
          Checks PluginInfo as well.
 double get(java.lang.String shortKey, double defaultValue, java.util.Properties map, I_PluginConfig pluginConfig)
           
 int get(java.lang.String shortKey, int defaultValue, java.util.Properties map, I_PluginConfig pluginConfig)
           
 long get(java.lang.String shortKey, long defaultValue, java.util.Properties map, I_PluginConfig pluginConfig)
           
 java.lang.String get(java.lang.String shortKey, java.lang.String defaultValue, java.util.Properties map, I_PluginConfig pluginConfig)
          It searches for the given property.
 Address getBootstrapAddress()
          Returns the address of the xmlBlaster internal http server.
 java.lang.String getBuildJavaVendor()
           
 java.lang.String getBuildJavaVersion()
           
 java.lang.String getBuildTimestamp()
          See @build.timestamp@ which will be replaced by build.xml with the current timestamp
 Timeout getBurstModeTimer()
          Access the handle of the burst mode timer thread.
 java.lang.String getCbHostname()
          Returns a local IP or bootstrapHostname as a default setting to use for callback servers.
 java.lang.String getCbHostname(java.lang.String hostname, int port)
          Returns a local IP as a default setting to use for callback servers.
 CbServerPluginManager getCbServerPluginManager()
          Access the handle of the burst mode timer thread.
 I_Checkpoint getCheckpointPlugin()
           
 ClassLoaderFactory getClassLoaderFactory()
          Access the xmlBlaster Classloader.
 PluginLoader getClientSecurityPluginLoader()
          Needed by java client helper classes to load the security plugin
 Global getClone(java.lang.String[] args)
          Get a cloned instance.
 I_ConnectQosFactory getConnectQosFactory()
          Return a factory parsing QoS XML strings from connect() and connect-return messages.
 ContextNode getContextNode()
          The unique name of this instance.
static int getCounter()
           
 I_DisconnectQosFactory getDisconnectQosFactory()
          Return a factory parsing QoS XML strings from disconnect() requests.
 DispatchPluginManager getDispatchPluginManager()
           
 DispatchWorkerPool getDispatchWorkerPool()
          Access the handle of the callback thread pool.
 javax.xml.parsers.DocumentBuilderFactory getDocumentBuilderFactory()
          Get the configured DocumentBuilderFactoryFactory.
 I_EntryFactory getEntryFactory()
          The factory creating queue or msgUnitStore entries from persistent store.
 java.lang.String getErrorText()
           
static byte[] getFromClasspath(java.lang.String file, java.lang.Object location)
          Access a file from the CLASSPATH, typically from xmlBlaster.jar It is searched in the directory of the package of the calling java class org.xmlBlaster.util.http => org/xmlBlaster/util/http
 HttpIORServer getHttpServer()
          Access the http server which allows bootstrapping the CORBA IOR
 java.lang.String getId()
          Access the unique local id (as a String), on client side typically the loginName with the public sessionId, on server side the server instance unique id.
 java.lang.String getInstanceId()
          Unique id of the client, changes on each restart.
static java.lang.String getJavadocUrl(java.lang.String className, java.lang.String methodName)
          http://www.xmlblaster.org/xmlBlaster/doc/api/org/xmlBlaster/util/admin/I_AdminPop3Driver.html#setPollingInterval(long)
 Timeout getJdbcConnectionPoolTimer()
          Access the handle of the jdbcConnectionPool timer (the timer for the polling when the connection has been lost).
static java.lang.String getJmxUsageLinkInfo(java.lang.String className, java.lang.String methodName)
          http://www.xmlblaster.org/xmlBlaster/doc/api/org/xmlBlaster/util/admin/I_AdminPop3Driver.html#setPollingInterval(long)
 JmxWrapper getJmxWrapper()
           
 java.lang.String getLocalIP()
          The IP address where we are running.
 java.util.logging.Level getLogLevel(java.lang.String loggerName)
          Get the current loglevel.
 java.lang.String getLogPrefix()
          Is coded in derived engine.Global
 java.lang.String getLogPrefixDashed()
          Is coded in derived engine.Global
static java.lang.String getMemoryStatistic()
          Access a nice, human readable string with the current RAM memory situation.
 Timeout getMessageTimer()
          Access the handle of the message expiry timer thread.
 I_MsgKeyFactory getMsgKeyFactory()
          Return a factory parsing key XML strings from publish() and update() messages.
 I_MsgQosFactory getMsgQosFactory()
          Return a factory parsing QoS XML strings from publish() and update() messages.
 I_CallbackDriver getNativeCallbackDriver(java.lang.String key)
          The key is the protocol and the address to access the callback instance.
 java.lang.String[] getNativeConnectArgs()
          Convenience method which returns the typical environment settings for a LOCAL connection.
 NodeId getNodeId()
           
 java.lang.Object getObjectEntry(java.lang.String key)
          Get an object in the scope of an xmlBlaster client connection or of one cluster node.
 java.util.Map getPersistentMap(java.lang.String id)
          Returns a persistent map.
 Timeout getPingTimer()
          Access the handle of the ping timer thread to test a client or callback connection.
 PluginManagerBase getPluginManager()
          Returns the plugin manager used by the run level manager.
 PluginRegistry getPluginRegistry()
          Returns the plugin registry.
 Property getProperty()
          Access the environment properties, is never null.
 ProtocolPluginManager getProtocolPluginManager()
          Access the handle of the burst mode timer thread.
 I_QueryKeyFactory getQueryKeyFactory()
          Return a factory parsing key XML strings from subscribe() and other query invocations.
 I_QueryQosFactory getQueryQosFactory()
          Return a factory parsing QoS XML strings from publish() and update() messages.
 QueuePluginManager getQueuePluginManager()
           
 java.lang.String getReleaseId()
          Combination from getVersion() and getRevisionNumber().
 java.lang.String getRevisionNumber()
          See @revision.number@ which will be replaced by build.xml with the current subversion revision
 int getRunlevel()
           
 javax.xml.parsers.SAXParserFactory getSAXParserFactory()
          Get the configured SAXParserFactory.
 ContextNode getScopeContextNode()
          Helper for the time being to be used on client side by services like SmtpClient.
static java.lang.String getStackTraceAsString(java.lang.Throwable ex)
          Prints the stack trace as a String so it can be put on the normal logs.
 I_StatusQosFactory getStatusQosFactory()
          Return a factory parsing QoS XML strings from subcribe(), unSubscribe() and erase() returns.
 java.lang.String getStrippedId()
          Same as getId() but all 'special characters' are stripped so you can use it for file names.
static java.lang.String getStrippedString(java.lang.String text)
          Utility method to strip any string, all characters which prevent to be used for e.g.
 javax.xml.transform.TransformerFactory getTransformerFactory()
          Get the configured TransformerFactory.
 java.lang.String getVersion()
          See @version@ which will be replaced by build.xml with the current version
 boolean getWipeOutDB()
          Tells the jdbc queue manager if a cleanup of the DB is necessary
 I_XmlBlasterAccess getXmlBlasterAccess()
          The client handle to access xmlBlaster remotely.
 int init(java.applet.Applet applet)
           
 int init(java.util.Map props)
          Calls init(String[] args), the props keys have no leading "-".
 int init(java.lang.String[] args)
          The args key needs a leading "-".
protected  void initId()
          Our identifier, the cluster node we want connect to
private  java.net.URL initLogManager(java.lang.String[] args)
          Configure JDK 1.4 java.util.logging (only once per JVM-Classloader, multiple Global instances share the same).
private  int initProps(java.lang.String[] args, boolean loadPropFile)
          private, called from constructor
static Global instance()
          Global access to the default 'global' instance.
private  boolean isIbmVM()
           
 boolean isJmxActivated()
          Check if JMX is activated.
 boolean isRegisteredMBean(ContextNode ctxNode)
           
 boolean isServerSide()
          Check where we are, on client or on server side? engine.Global overwrites this
static java.lang.String logUsage()
           
static void main(java.lang.String[] args)
          To play with a profiling tool
 java.lang.String[] peekQueueMessagesToFile(I_Queue queue, int numOfEntries, java.lang.String path, java.lang.String label)
          Dumps given amount of messages from queue to file.
 JmxMBeanHandle registerMBean(ContextNode contextNode, java.lang.Object mbean)
          JMX support.
 void removeNativeCallbackDriver(java.lang.String key)
          The key is the protocol and the address to access the callback instance.
 void removeObjectEntry(java.lang.String key)
          Remove an object from the scope of an I_XmlBlasterAccess or of one cluster node.
 void resetInstanceId()
          Reset the cached instance id
 void sendNotification(javax.management.NotificationBroadcasterSupport source, java.lang.String msg, java.lang.String attributeName, java.lang.String attributeType, java.lang.Object oldValue, java.lang.Object newValue)
          Send an administrative notification.
 void setBootstrapAddress(Address address)
          Force to use the given bootstrap address, used for cluster connections
 void setCheckpointPlugin(I_Checkpoint checkpointPlugin)
           
 void setContextNode(ContextNode contextNode)
          The unique name of this instance.
 void setId(java.lang.String id)
          Currently set by enging.Global, used server side only.
 void setScopeContextNode(ContextNode contextNode)
           
 void setWipeOutDB(boolean doWipeout)
          Tells the queue manager it should remove all entries from the persisence.
protected  void shallowCopy(Global utilGlob)
           
 void shutdown()
           
 void shutdownHttpServer()
           
 void unregisterMBean(java.lang.Object objectName)
          Unregister a JMX MBean.
 java.lang.String usage()
          Command line usage.
 java.lang.String validateJmxValue(java.lang.String value)
           
static int waitOnKeyboardHit(java.lang.String str)
          Blocks until a key on the keyboard is hit.
 boolean wantsHelp()
          Allows you to query if user wants help.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static java.util.logging.Logger log

logIsInitialized

private static boolean logIsInitialized

firstInstance

private static volatile Global firstInstance

totalPhysicalMemorySize

public static long totalPhysicalMemorySize
The amount of physical RAM of this machine. Set by JmxWrappter.java, else 0

Since:
JDK 1.5

heapMemoryUsage

public static long heapMemoryUsage
Number of bytes this JVM can allocate max, the -Xmx???M setting Set by JmxWrappter.java (defaults to Runtime.getRuntime().maxMemory())

Since:
JDK 1.5

maxFileDescriptorCount

public static long maxFileDescriptorCount
The max number of file descriptors this JVM may use Set by JmxWrappter.java, else 0

Since:
JDK 1.5

versionDefault

private java.lang.String versionDefault
Version string, please change for new releases (4 digits)


version

private java.lang.String version
This will be replaced by build.xml with the current version


revisionNumber

private java.lang.String revisionNumber
This will be replaced by build.xml with the current subversion revision number


buildTimestamp

private java.lang.String buildTimestamp
This will be replaced by build.xml with the build timestamp


buildJavaVendor

private java.lang.String buildJavaVendor
This will be replaced by build.xml with the compiling JDK vendor


buildJavaVersion

private java.lang.String buildJavaVersion
This will be replaced by build.xml with the compiling JDK version


ME

protected java.lang.String ME

ip_addr

protected java.lang.String ip_addr

id

protected java.lang.String id

instanceId

private volatile java.lang.String instanceId

property

protected volatile Property property

errorText

protected java.lang.String errorText

contextNode

protected ContextNode contextNode

scopeContextNode

protected ContextNode scopeContextNode

cbHostname

protected java.lang.String cbHostname

addressNormalized

protected java.lang.String addressNormalized

classLoaderFactory

private ClassLoaderFactory classLoaderFactory
The xmlBlaster class loader factory


nativeCallbackDriverMap

protected java.util.Map nativeCallbackDriverMap

objectMap

protected java.util.Map objectMap
Store objects in the scope of one client connection or server instance


objectMapMonitor

public final java.lang.Object objectMapMonitor
Helper to synchronize objectMap access


bootstrapAddress

protected volatile Address bootstrapAddress

clientSecurityLoader

protected PluginLoader clientSecurityLoader

queuePluginManager

protected volatile QueuePluginManager queuePluginManager

dispatchPluginManager

protected volatile DispatchPluginManager dispatchPluginManager

protocolPluginManager

protected volatile ProtocolPluginManager protocolPluginManager

cbServerPluginManager

protected volatile CbServerPluginManager cbServerPluginManager

httpServer

private volatile HttpIORServer httpServer

logChannels

protected java.util.Hashtable logChannels

saxFactory

protected javax.xml.parsers.SAXParserFactory saxFactory

docBuilderFactory

protected javax.xml.parsers.DocumentBuilderFactory docBuilderFactory

transformerFactory

protected javax.xml.transform.TransformerFactory transformerFactory

checkpointPlugin

protected I_Checkpoint checkpointPlugin
Must be loaded in runlevel 0 or 1 before any access as not synchronized


msgKeyFactory

protected volatile I_MsgKeyFactory msgKeyFactory

queryKeyFactory

protected volatile I_QueryKeyFactory queryKeyFactory

connectQosFactory

protected volatile I_ConnectQosFactory connectQosFactory

disconnectQosFactory

protected volatile I_DisconnectQosFactory disconnectQosFactory

msgQosFactory

protected volatile I_MsgQosFactory msgQosFactory

queryQosFactory

protected volatile I_QueryQosFactory queryQosFactory

statusQosFactory

protected volatile I_StatusQosFactory statusQosFactory

pingTimer

protected volatile Timeout pingTimer

burstModeTimer

protected volatile Timeout burstModeTimer

messageTimer

protected volatile Timeout messageTimer

jdbcConnectionPoolTimer

protected volatile Timeout jdbcConnectionPoolTimer

dispatchWorkerPool

protected volatile DispatchWorkerPool dispatchWorkerPool

counter

protected static int counter

pluginManager

private volatile PluginManagerBase pluginManager

pluginRegistry

private volatile PluginRegistry pluginRegistry

xmlBlasterAccess

protected volatile I_XmlBlasterAccess xmlBlasterAccess
The client handle to access xmlBlaster


isDoingShutdown

protected boolean isDoingShutdown

wipeOutDB

protected boolean wipeOutDB
set to allow wipe out the persistence on restarts


entryFactory

protected I_EntryFactory entryFactory

sequenceNumber

protected long sequenceNumber
JMX notification sequence number.

Constructor Detail

Global

public Global()
Constructs an initial Global object, same as Global(null, true, true)


Global

public Global(java.util.Properties props)
Constructs an initial Global object which is initialized by your properties, same as Global(args, true, true)


Global

public Global(java.lang.String[] args)
Constructs an initial Global object which is initialized by your args array (usually the command line args). Same as Global(args, true, true)


Global

public Global(java.lang.String[] args,
              boolean loadPropFile,
              boolean checkInstance)
Constructs an initial Global object which is initialized by your args array (usually the command line args).

By setting loadPropFile to false it is possible to create a Global which does not automatically search out the xmlBlaster.properties file, which is good when you want to start xmlBlaster in an embedded environment.

It is possible to later load the property file if one wants, here is one way to do it:

         Property p = glob.getProperty();
         Properties prop = new Properties();
         FileInfo i = p.findPath("xmlBlaster.properties");
         InputStream is = i.getInputStream();
         prop.load(is);
         String[] ar = Property.propsToArgs(prop);
         p.addArgs2Props( ar != null ? ar : new String[0] );
       

It is also possible to load an entire second property file or find it with some other algorithm byte using the same pattern as above, just don't use findPath, but some other code.

Parameters:
args - args array (usually the command line args).
loadPropFile - if automatic loading of xmlBlaster.properties should be done.
Method Detail

getCounter

public static int getCounter()

getJmxWrapper

public final JmxWrapper getJmxWrapper()
                               throws XmlBlasterException
Returns:
the JmxWrapper used to manage the MBean resources
Throws:
XmlBlasterException

isJmxActivated

public boolean isJmxActivated()
Check if JMX is activated.

Returns:
true if JMX is in use

sendNotification

public void sendNotification(javax.management.NotificationBroadcasterSupport source,
                             java.lang.String msg,
                             java.lang.String attributeName,
                             java.lang.String attributeType,
                             java.lang.Object oldValue,
                             java.lang.Object newValue)
Send an administrative notification.


registerMBean

public JmxMBeanHandle registerMBean(ContextNode contextNode,
                                    java.lang.Object mbean)
                             throws XmlBlasterException
JMX support. Start xmlBlaster with java -Dcom.sun.management.jmxremote org.xmlBlaster.Main You can access xmlBlaster from 'jconsole' delivered with JDK1.5 or above. The root node is always the cluster node id.

Parameters:
contextNode - Used to retrieve a unique instance name for the given MBean
mbean - the MBean object instance
Returns:
The object name used to register or null on error
Throws:
XmlBlasterException
Since:
1.0.5
See Also:
http://www.xmlblaster.org/xmlBlaster/doc/requirements/admin.jmx.html

unregisterMBean

public void unregisterMBean(java.lang.Object objectName)
Unregister a JMX MBean. Never throws any exception

Parameters:
objectName - The object you got from registerMBean() of type ObjectName, if null nothing happens

isRegisteredMBean

public boolean isRegisteredMBean(ContextNode ctxNode)
                          throws XmlBlasterException
Throws:
XmlBlasterException

getVersion

public java.lang.String getVersion()
See @version@ which will be replaced by build.xml with the current version

Returns:
e.g. "0.79f"

getRevisionNumber

public java.lang.String getRevisionNumber()
See @revision.number@ which will be replaced by build.xml with the current subversion revision

Returns:
e.g. "12702" or "12702M". If no subversion is available getVersion() is returned

getReleaseId

public java.lang.String getReleaseId()
Combination from getVersion() and getRevisionNumber().

Returns:
e.g. "0.91 #12702"

getBuildTimestamp

public java.lang.String getBuildTimestamp()
See @build.timestamp@ which will be replaced by build.xml with the current timestamp

Returns:
e.g. "06/17/2002 01:38 PM"

getBuildJavaVendor

public java.lang.String getBuildJavaVendor()
Returns:
e.g. "1.3.1-beta"

getBuildJavaVersion

public java.lang.String getBuildJavaVersion()
Returns:
e.g. "1.3.1-beta"

waitOnKeyboardHit

public static int waitOnKeyboardHit(java.lang.String str)
Blocks until a key on the keyboard is hit. Consumes multiple hits (for Windows DOS box)

Parameters:
str - If not null it will be printed on console with System.out
Returns:
The int pressed (for example 49 for '1')

initId

protected void initId()
Our identifier, the cluster node we want connect to


shallowCopy

protected void shallowCopy(Global utilGlob)

initProps

private int initProps(java.lang.String[] args,
                      boolean loadPropFile)
private, called from constructor

Parameters:
args - arguments to initilize the property with.
loadPropFile - if loading of xmlBlaster.properties file should be done, if false no loading of the file is done.
Returns:
-1 on error
Throws:
If - no Property instance can be created

initLogManager

private java.net.URL initLogManager(java.lang.String[] args)
                             throws XmlBlasterException
Configure JDK 1.4 java.util.logging (only once per JVM-Classloader, multiple Global instances share the same).

Switch off xmlBlaster specific logging:
 xmlBlaster/java.util.logging=false
 

Lookup a specific logging.properties:
 java.util.logging.config.file=logging.properties
 

Returns:
The used configuration file (can be used for user notification) or null
Throws:
XmlBlasterException - if redirection fails

getLogLevel

public java.util.logging.Level getLogLevel(java.lang.String loggerName)
                                    throws XmlBlasterException
Get the current loglevel.

Parameters:
loggerName - e.g. "logging" or "/node/heron/logging/org.xmlBlaster.util.Timestamp"
Returns:
The logging level, for example "WARNING" or "FINE"
Throws:
XmlBlasterException

changeLogLevel

public java.util.logging.Level changeLogLevel(java.lang.String loggerName,
                                              java.util.logging.Level level)
                                       throws XmlBlasterException
Changes the given logger to given level.

Parameters:
loggerName - e.g. "logging" or "logging/org.xmlBlaster.util.StopWatch"
level - For example "FINE"
Returns:
The set level
Throws:
XmlBlasterException - if your bool is strange

init

public int init(java.util.Map props)
Calls init(String[] args), the props keys have no leading "-".

Returns:
1 Show usage, 0 OK, -1 error

init

public int init(java.lang.String[] args)
The args key needs a leading "-".

Returns:
1 Show usage, 0 OK, -1 error

wantsHelp

public final boolean wantsHelp()
Allows you to query if user wants help.

Returns:
true If '-help' or '-?' was passed to us

getErrorText

public java.lang.String getErrorText()
Returns:
If not null there was an error during construction / initialization

init

public int init(java.applet.Applet applet)
Returns:
1 Show usage, 0 OK

getContextNode

public ContextNode getContextNode()
The unique name of this instance.

Returns:
Can be null during startup

setContextNode

public void setContextNode(ContextNode contextNode)
The unique name of this instance.

Parameters:
contextNode - The new node id

getScopeContextNode

public ContextNode getScopeContextNode()
Helper for the time being to be used on client side by services like SmtpClient. Is filled by XmlBlasterAccess with for example "/node/heron/client/joe/session/1"

Returns:

setScopeContextNode

public void setScopeContextNode(ContextNode contextNode)

isServerSide

public boolean isServerSide()
Check where we are, on client or on server side? engine.Global overwrites this

Returns:
false As we are util.Global and running client side

getNodeId

public NodeId getNodeId()
Returns:
null on client side

getId

public java.lang.String getId()
Access the unique local id (as a String), on client side typically the loginName with the public sessionId, on server side the server instance unique id.

Returns:
""

getStrippedId

public java.lang.String getStrippedId()
Same as getId() but all 'special characters' are stripped so you can use it for file names.

Returns:
""

getStrippedString

public static final java.lang.String getStrippedString(java.lang.String text)
Utility method to strip any string, all characters which prevent to be used for e.g. file names are replaced.

This conversion is used for file names and for the administrative hierarchy e.g. "/node/heron/client/joe" is OK but 'http://xy:8080' instead of 'heron' is not

Parameters:
text - e.g. "http://www.xmlBlaster.org:/home\\x"
Returns:
e.g. "http_www_xmlBlaster_org_homex"

validateJmxValue

public final java.lang.String validateJmxValue(java.lang.String value)
See Also:
JmxWrapper.validateJmxValue(String)

setId

public void setId(java.lang.String id)
Currently set by enging.Global, used server side only.


getLogPrefixDashed

public java.lang.String getLogPrefixDashed()
Is coded in derived engine.Global


getLogPrefix

public java.lang.String getLogPrefix()
Is coded in derived engine.Global


instance

public static Global instance()
Global access to the default 'global' instance. If you have parameters (e.g. from the main() mehtod) you should initialize Global first before using instance():
    public static void main(String[] args) {
       new Global(args);
       ...
    }

    //later you can get this initialized instance with:
    Global glob = Global.instance();
    ...
 

Note that you should avoid to use Global.instance() and preferably use the global which describes your current context, e.g. the specific client connection like xmlBlasterAccess.getGlobal(). Use global.getClone(String[]) to create a new Global instance.


getClone

public final Global getClone(java.lang.String[] args)
Get a cloned instance.

Calls clone() and sets the given args thereafter.

This is the preferred way to create a new and independent Global instance for example for another client connection.

Note that Global.instance() will return the original instance even if called on the cloned object (it's a static variable). You should avoid to use Global.instance()

Parameters:
args - Additional configuration parameters

clone

protected java.lang.Object clone()
Get a deep clone (everything is independent from the origin).

The properties and log channels and ContextNode are copied with a deep copy manipulating these will not affect the original Global.
All other attributes are initialized as on startup.


getProperty

public final Property getProperty()
Access the environment properties, is never null.


getCheckpointPlugin

public I_Checkpoint getCheckpointPlugin()
Returns:
the checkpointPlugin

setCheckpointPlugin

public void setCheckpointPlugin(I_Checkpoint checkpointPlugin)
Parameters:
checkpointPlugin - the checkpointPlugin to set

getMsgKeyFactory

public final I_MsgKeyFactory getMsgKeyFactory()
Return a factory parsing key XML strings from publish() and update() messages.


getQueryKeyFactory

public final I_QueryKeyFactory getQueryKeyFactory()
Return a factory parsing key XML strings from subscribe() and other query invocations.


getConnectQosFactory

public final I_ConnectQosFactory getConnectQosFactory()
Return a factory parsing QoS XML strings from connect() and connect-return messages.


getDisconnectQosFactory

public final I_DisconnectQosFactory getDisconnectQosFactory()
Return a factory parsing QoS XML strings from disconnect() requests.


getMsgQosFactory

public final I_MsgQosFactory getMsgQosFactory()
Return a factory parsing QoS XML strings from publish() and update() messages.


getQueryQosFactory

public final I_QueryQosFactory getQueryQosFactory()
Return a factory parsing QoS XML strings from publish() and update() messages.


getStatusQosFactory

public final I_StatusQosFactory getStatusQosFactory()
Return a factory parsing QoS XML strings from subcribe(), unSubscribe() and erase() returns.


getNativeCallbackDriver

public final I_CallbackDriver getNativeCallbackDriver(java.lang.String key)
The key is the protocol and the address to access the callback instance.

Parameters:
key - e.g. "SOCKET192.168.2.2:7604" from 'cbAddr.getType() + cbAddr.getRawAddress()'
Returns:
The instance of the protocol callback driver or null if not known

addNativeCallbackDriver

public final void addNativeCallbackDriver(java.lang.String key,
                                          I_CallbackDriver driver)
The key is the protocol and the address to access the callback instance.

Parameters:
key - e.g. "SOCKET192.168.2.2:7604" from 'cbAddr.getType() + cbAddr.getRawAddress()'

removeNativeCallbackDriver

public final void removeNativeCallbackDriver(java.lang.String key)
The key is the protocol and the address to access the callback instance.

Parameters:
key - e.g. "SOCKET192.168.2.2:7604" from 'cbAddr.getType() + cbAddr.getRawAddress()'

getObjectEntry

public final java.lang.Object getObjectEntry(java.lang.String key)
Get an object in the scope of an xmlBlaster client connection or of one cluster node.

This is helpful if you have more than one I_XmlBlasterAccess or cluster nodes running in the same JVM

Parameters:
key - e.g. "SOCKET192.168.2.2:7604" from 'cbAddr.getType() + cbAddr.getRawAddress()'
or "/xmlBlaster/I_Authenticate"
Returns:
The instance of this object

addObjectEntry

public final void addObjectEntry(java.lang.String key,
                                 java.lang.Object driver)
Add an object in the scope of an I_XmlBlasterAccess or of one cluster node.

This is helpful if you have more than one I_XmlBlasterAccess or cluster nodes running in the same JVM

Parameters:
key - e.g. "SOCKET192.168.2.2:7604" from 'cbAddr.getType() + cbAddr.getRawAddress()'

removeObjectEntry

public final void removeObjectEntry(java.lang.String key)
Remove an object from the scope of an I_XmlBlasterAccess or of one cluster node.

This is helpful if you have more than one I_XmlBlasterAccess or cluster nodes running in the same JVM

Parameters:
key - e.g. "SOCKET192.168.2.2:7604" from 'cbAddr.getType() + cbAddr.getRawAddress()'

setBootstrapAddress

public final void setBootstrapAddress(Address address)
Force to use the given bootstrap address, used for cluster connections


getBootstrapAddress

public final Address getBootstrapAddress()
Returns the address of the xmlBlaster internal http server.

Is configurable with

   -bootstrapHostname myhost.mycompany.com   (or the raw IP)
   -bootstrapPort 3412
 
Defaults to the local machine and the IANA xmlBlaster port.
You can set "-bootstrapPort 0" to avoid starting the internal HTTP server


getCbHostname

public java.lang.String getCbHostname()
Returns a local IP or bootstrapHostname as a default setting to use for callback servers.

It is determined by doing a short connect to the xmlBlaster HTTP server an reading the used local hostname. The precedence of finding the callback hostname is:

  1. Evaluate the -bootstrapHostnameCB property
  2. Try to determin