xmlBlaster 2.2.0 API

org.xmlBlaster.contrib
Class InfoHelper

java.lang.Object
  extended by org.xmlBlaster.contrib.InfoHelper

public class InfoHelper
extends java.lang.Object

InfoHelper offers helper methods for operations on I_Info objects.

Author:
Michele Laghi

Nested Class Summary
(package private)  class InfoHelper.Replacer
           
 
Field Summary
private static java.util.logging.Logger log
           
private  InfoHelper.Replacer replacer
           
private  ReplaceVariable replaceVariable
           
 
Constructor Summary
InfoHelper(I_Info info)
           
 
Method Summary
static void fillInfoWithEntriesFromInfo(I_Info dest, I_Info source)
          Fills the I_Info with the entries of the map.
static void fillInfoWithEntriesFromMap(I_Info info, java.util.Map map)
          Fills the I_Info with the entries of the map.
static java.lang.String getIteratorAsString(java.util.Iterator iter)
           
static java.lang.String getIteratorAsString(java.util.Iterator iter, java.lang.String separator)
          Returns a string containing all entries found.
static java.util.Map getObjectsWithKeyStartingWith(java.lang.String prefix, I_Info info, DbMetaHelper dbHelper)
          Returns the subset of objects (not normal properties) found in the I_Info object starting with the specified prefix.
static java.util.Map getPropertiesEndingWith(java.lang.String postfix, I_Info info, DbMetaHelper dbHelper, java.lang.String newPostfix)
          Returns the subset of properties found in the I_Info object ending with the specified postfix.
static java.util.Map getPropertiesStartingWith(java.lang.String prefix, I_Info info, DbMetaHelper dbHelper)
           
static java.util.Map getPropertiesStartingWith(java.lang.String prefix, I_Info info, DbMetaHelper dbHelper, java.lang.String newPrefix)
          Returns the subset of properties found in the I_Info object starting with the specified prefix.
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.
 java.lang.String replace(java.lang.String txt)
           
 void replaceAllEntries(I_Info info, java.util.Set keysToIgnore)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static java.util.logging.Logger log

replaceVariable

private ReplaceVariable replaceVariable

replacer

private InfoHelper.Replacer replacer
Constructor Detail

InfoHelper

public InfoHelper(I_Info info)
Method Detail

replace

public final java.lang.String replace(java.lang.String txt)

replaceAllEntries

public void replaceAllEntries(I_Info info,
                              java.util.Set keysToIgnore)

getPropertiesStartingWith

public static java.util.Map getPropertiesStartingWith(java.lang.String prefix,
                                                      I_Info info,
                                                      DbMetaHelper dbHelper)

getPropertiesStartingWith

public static java.util.Map getPropertiesStartingWith(java.lang.String prefix,
                                                      I_Info info,
                                                      DbMetaHelper dbHelper,
                                                      java.lang.String newPrefix)
Returns the subset of properties found in the I_Info object starting with the specified prefix.

Parameters:
prefix - The prefix to use. If null is passed, then all properties are returned
info - The I_Info object on which to operate
dbHelper - the DbMetaHelper used to determine if the key and value have to be moved to uppercase/lowcase or left untouched. Can be null, in which case it is ignored.
newPrefix - if not null, the map returned has the properties starting with the new prefix. So for example if you specify prefix='db.' and have a property called 'db.url', and the newPrefix is called 'dbinfo.' you will get 'dbinfo.url' in the return map as key.
Returns:
the subset of properties found. The keys are stripped from their prefix. The returned keys are returned in alphabetical order.

getPropertiesEndingWith

public static java.util.Map getPropertiesEndingWith(java.lang.String postfix,
                                                    I_Info info,
                                                    DbMetaHelper dbHelper,
                                                    java.lang.String newPostfix)
Returns the subset of properties found in the I_Info object ending with the specified postfix.

Parameters:
postfix - The postfix to use. If null is passed, then all properties are returned
info - The I_Info object on which to operate
dbHelper - the DbMetaHelper used to determine if the key and value have to be moved to uppercase/lowcase or left untouched. Can be null, in which case it is ignored.
newPostfix - if not null, the map returned has the properties ending with the new postfix. So for example if you specify prefix='.class' and have a property called 'db.class', and the newPrefix is called '.java' you will get 'db.java' in the return map as key.
Returns:
the subset of properties found. The keys are stripped from their postfix. The returned keys are returned in alphabetical order.

getObjectsWithKeyStartingWith

public static java.util.Map getObjectsWithKeyStartingWith(java.lang.String prefix,
                                                          I_Info info,
                                                          DbMetaHelper dbHelper)
Returns the subset of objects (not normal properties) found in the I_Info object starting with the specified prefix.

Parameters:
prefix - The prefix to use. If null is passed, then all objects are returned
info - The I_Info object on which to operate
dbHelper - the DbMetaHelper used to determine if the keys have to be moved to uppercase/lowcase or left untouched. Can be null, in which case it is ignored.
Returns:
the subset of properties only containing the objects found. The keys are stripped from their prefix. The returned keys are returned in alphabetical order.

fillInfoWithEntriesFromMap

public static void fillInfoWithEntriesFromMap(I_Info info,
                                              java.util.Map map)
Fills the I_Info with the entries of the map. If the values of the map are strings they are added if they are ClientProperties they are added too, otherwise they are added as objects.


fillInfoWithEntriesFromInfo

public static void fillInfoWithEntriesFromInfo(I_Info dest,
                                               I_Info source)
Fills the I_Info with the entries of the map. If the values of the map are strings they are added if they are ClientProperties they are added too, otherwise they are added as objects.


getIteratorAsString

public static java.lang.String getIteratorAsString(java.util.Iterator iter,
                                                   java.lang.String separator)
Returns a string containing all entries found. They are separated by what's specified as the separator,

Parameters:
iter -
Returns:

getIteratorAsString

public static java.lang.String getIteratorAsString(java.util.Iterator iter)

getStackTraceAsString

public 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.

Parameters:
ex - The exception for which to write out the stack trace. If you pass null it will print the Stack trace of a newly created exception.
Returns:
The Stack trace as a String.

xmlBlaster 2.2.0 API

Copyright © 1999-2014 The xmlBlaster.org contributers.