org.objectweb.telosys.common
Class Tool

java.lang.Object
  extended byorg.objectweb.telosys.common.Tool

public class Tool
extends java.lang.Object


Constructor Summary
Tool()
           
 
Method Summary
static java.lang.String buildPath(java.lang.String sLeftPart, java.lang.String sRightPart)
          Builds a path like "LeftPart" + "/" + "RightPart" without redundant separators
static java.lang.String buildPath(java.lang.String sLeftPart, java.lang.String sRightPart, java.lang.String sSeparatorArg)
          Builds a path like "LeftPart" + SEPARATOR + "RightPart" without redundant separators
static void closeInputStream(java.io.InputStream in)
          Close an input stream without exception
static GenericVOList createVOListInstance(java.lang.Class cl)
          Creates a GenericVOList instance of the given class
static java.util.Properties findAndLoadProperties(java.lang.String sFileName)
          Try to find a properties file with classpath and load it (if found)
static java.lang.String findFileByClassPath(java.lang.String sFileName)
          Find a file using the CLASSPATH
static boolean isVOListClass(java.lang.Class cl)
          Returns true if the given class is a subclass of GenericVOList
static boolean isVOListInstance(java.lang.Object obj)
          Returns true if the given object is not null and is an instance of GenericVOList
static java.util.Properties loadProperties(java.io.InputStream is)
          Loads properties from the given InputStream
static java.util.Properties loadProperties(java.lang.String sFileName)
          Load properties from a specific file name and return them
static void showProperties(java.util.Properties prop)
          Print the content of the properties on the standard output
static void showProperties(java.util.Properties prop, java.io.PrintStream out)
          Print the content of the properties on a specific output
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Tool

public Tool()
Method Detail

buildPath

public static java.lang.String buildPath(java.lang.String sLeftPart,
                                         java.lang.String sRightPart)
Builds a path like "LeftPart" + "/" + "RightPart" without redundant separators

Parameters:
sLeftPart - : left part ( with or without ending "/" )
sRightPart - : right part ( with or without starting "/" )
Returns:

buildPath

public static java.lang.String buildPath(java.lang.String sLeftPart,
                                         java.lang.String sRightPart,
                                         java.lang.String sSeparatorArg)
Builds a path like "LeftPart" + SEPARATOR + "RightPart" without redundant separators

Parameters:
sLeftPart - : left part ( with or without ending separator )
sRightPart - : right part ( with or without starting separator )
sSeparatorArg - : the separator to use ( e.g. "/", ".", ... )
Returns:

closeInputStream

public static void closeInputStream(java.io.InputStream in)
Close an input stream without exception

Parameters:
in -

findFileByClassPath

public static java.lang.String findFileByClassPath(java.lang.String sFileName)
Find a file using the CLASSPATH

Parameters:
sFileName -
Returns:

findAndLoadProperties

public static java.util.Properties findAndLoadProperties(java.lang.String sFileName)
Try to find a properties file with classpath and load it (if found)

Parameters:
sFileName -
Returns:

loadProperties

public static java.util.Properties loadProperties(java.lang.String sFileName)
Load properties from a specific file name and return them

Parameters:
sFileName -
Returns:

loadProperties

public static java.util.Properties loadProperties(java.io.InputStream is)
Loads properties from the given InputStream

Parameters:
is -
Returns:

showProperties

public static void showProperties(java.util.Properties prop)
Print the content of the properties on the standard output

Parameters:
prop -

showProperties

public static void showProperties(java.util.Properties prop,
                                  java.io.PrintStream out)
Print the content of the properties on a specific output

Parameters:
prop -
out -

isVOListClass

public static boolean isVOListClass(java.lang.Class cl)
Returns true if the given class is a subclass of GenericVOList

Parameters:
cl -
Returns:

isVOListInstance

public static boolean isVOListInstance(java.lang.Object obj)
Returns true if the given object is not null and is an instance of GenericVOList

Parameters:
obj -
Returns:

createVOListInstance

public static GenericVOList createVOListInstance(java.lang.Class cl)
Creates a GenericVOList instance of the given class

Parameters:
cl - the class to instanciate (supposed to be a subclass of GenericVOList)
Returns:
Throws:
TelosysRuntimeException - if the instance cannot be created or not an instance of GenericVOList