org.objectweb.telosys.common
Class Telosys

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

public final class Telosys
extends java.lang.Object

General Telosys environment informations and utilities


Constructor Summary
Telosys()
           
 
Method Summary
static void error(java.lang.String sMsg)
          Logs an error message using both standard logger and specific application logger if any
static void error(java.lang.String sClassName, java.lang.String sMsg)
          Logs an error message using both standard logger and specific application logger if any
static void error(java.lang.String sClassName, java.lang.Throwable ex)
          Logs an exception using both standard logger and specific application logger if any
static void error(java.lang.Throwable ex)
          Logs an exception using both standard logger and specific application logger if any
static java.lang.String getDbConfigFileName()
          Returns the file name (or resource name) of the databases XML file ( databases.dbcfg, formerly dbconfig.xml )
static java.io.InputStream getDbConfigInputStream()
          Returns the InputStream of the databases XML file or resource ( databases.dbcfg, formerly dbconfig.xml )
static TelosysFactory getFactory()
          Returns the Telosys factory
static java.lang.String getFullPath(java.lang.String sFile)
          Return the full path for the given relative file
( ie : "myfile.txt" -> "C:/dir1/dir2/mywebapp/myfile.txt" )
This method concats the "Application Root Dir" with the file name
if the "Application Root Dir" is not set, it returns the file as is.
static java.util.Properties getProperties()
          Returns the Telosys properties ( loaded from the 'telosys.properties' file )
static java.lang.String getProperty(java.lang.String sPropertyName)
          Returns the property value for the given property name
( properties loaded from the "telosys.properties" file )
static java.lang.String getSAXParserClassName()
          Returns the SAX parser class name
static java.lang.String getScreensConfigFileName()
          Returns the file name (or resource name) of the screens XML file ( screens.xml )
static java.io.InputStream getScreensConfigInputStream()
          Returns the InputStream of the screens XML file or resource ( screens.xml )
static javax.servlet.ServletContext getServletContext()
          Returns the web app ServletContext object
static java.lang.String getTagsConfigFileName()
          Returns the file name (or resource name) of the tags properties file ( tags.properties )
static java.io.InputStream getTagsConfigInputStream()
          Returns the InputStream of the tags properties file ( tags.properties )
static java.lang.String getTraceConfigFileName()
          Returns the file name (or resource name) of the trace properties file ( traces.properties )
static java.io.InputStream getTraceConfigInputStream()
          Returns the InputStream of the trace properties file ( traces.properties )
static java.lang.String getTranslatorLoaderClassName()
          Returns the TranslatorLoader class name
static java.lang.String getVersion()
          Returns the Telosys framework version ( e.g. "1.2.3" )
static java.lang.String getWebAppName()
          Returns the name of the current Web App ( from tag 'display-name' in web.xml )
Set from ServletContext.getServletContextName()
static java.lang.String getWebAppRootDir()
          Returns the absolute filesystem root directory of the current Web App
e.g.
static javax.xml.parsers.DocumentBuilderFactory getXmlDomParserFactory()
          Returns a JAXP DocumentBuilderFactory
static IXmlWrapperProvider getXmlWrapperProvider()
          Returns the XmlWrapperProvider provided by the Telosys factory
static void info(java.lang.String sMsg)
          Logs an info message using both standard logger and specific application logger if any
static void info(java.lang.String sClassName, java.lang.String sMsg)
          Logs an info message using both standard logger and specific application logger if any
static java.util.Properties init(IExternalMainFactory extFactory)
          Try to initialize the Telosys properties :
try to find 'telosys.properties' using the classpath if the file is find
the properties are loaded and Telosys is initialized.
static java.util.Properties init(IExternalMainFactory extFactory, javax.servlet.ServletConfig servletConfig)
          Initialize the Telosys properties.
static java.util.Properties init(IExternalMainFactory extFactory, javax.servlet.ServletContext servletContext)
          Initialize the Telosys properties.
static java.util.Properties init(IExternalMainFactory extFactory, java.lang.String sPropFile)
          Initialize the Telosys properties using a specific properties file
static boolean isAuthenticationRequired()
          Returns true if user authentication is required
static boolean isInitialized()
          Returns true if Telosys is initialized
( true if the properties are loaded and the factory exists )
static void trace(java.lang.String sMsg)
          Logs a trace message using both standard logger and specific application logger if any
static void trace(java.lang.String sClassName, java.lang.String sMsg)
          Logs a trace message using both standard logger and specific application logger if any
static void warn(java.lang.String sMsg)
          Logs a warning message using both standard logger and specific application logger if any
static void warn(java.lang.String sClassName, java.lang.String sMsg)
          Logs a warning message using both standard logger and specific application logger if any
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Telosys

public Telosys()
Method Detail

getVersion

public static java.lang.String getVersion()
Returns the Telosys framework version ( e.g. "1.2.3" )

Returns:

isInitialized

public static boolean isInitialized()
Returns true if Telosys is initialized
( true if the properties are loaded and the factory exists )

Returns:

init

public static java.util.Properties init(IExternalMainFactory extFactory)
Try to initialize the Telosys properties :
try to find 'telosys.properties' using the classpath if the file is find
the properties are loaded and Telosys is initialized.

Returns:
the properties

init

public static java.util.Properties init(IExternalMainFactory extFactory,
                                        javax.servlet.ServletContext servletContext)
Initialize the Telosys properties.
Try to find a properties file :
1/ specific file name in 'web.xml' ( servlet TelosysProperties )
2/ 'telosys.properties' located in 'WEB-INF/conf'
3/ 'telosys.properties' located via CLASSPATH

Parameters:
extFactory -
servletContext - : the ServletContext to use
Returns:

init

public static java.util.Properties init(IExternalMainFactory extFactory,
                                        javax.servlet.ServletConfig servletConfig)
Initialize the Telosys properties.
Try to find a properties file :
1/ specific file name in 'web.xml' ( servlet TelosysProperties )
2/ 'telosys.properties' located in 'WEB-INF/conf'
3/ 'telosys.properties' located via CLASSPATH

Parameters:
extFactory -
servletConfig - : the ServletConfig to use ( can be null )
Returns:

init

public static java.util.Properties init(IExternalMainFactory extFactory,
                                        java.lang.String sPropFile)
Initialize the Telosys properties using a specific properties file

Parameters:
extFactory -
sPropFile -
Returns:

getWebAppRootDir

public static java.lang.String getWebAppRootDir()
Returns the absolute filesystem root directory of the current Web App
e.g. "C:\dir1\dir2\mywebapp\"
Set from ServletContext.getRealPath("/"), so it can be null

Returns:
the full WebApp path or null if the WAR file is not exploded in the server filesystem

getWebAppName

public static java.lang.String getWebAppName()
Returns the name of the current Web App ( from tag 'display-name' in web.xml )
Set from ServletContext.getServletContextName()

Returns:
the WebApp display name or null if not defined

getSAXParserClassName

public static java.lang.String getSAXParserClassName()
Returns the SAX parser class name

Returns:

getTranslatorLoaderClassName

public static java.lang.String getTranslatorLoaderClassName()
Returns the TranslatorLoader class name

Returns:

getFullPath

public static java.lang.String getFullPath(java.lang.String sFile)
Return the full path for the given relative file
( ie : "myfile.txt" -> "C:/dir1/dir2/mywebapp/myfile.txt" )
This method concats the "Application Root Dir" with the file name
if the "Application Root Dir" is not set, it returns the file as is.

Parameters:
sFile -
Returns:

getProperties

public static java.util.Properties getProperties()
Returns the Telosys properties ( loaded from the 'telosys.properties' file )

Returns:

getFactory

public static TelosysFactory getFactory()
Returns the Telosys factory

Returns:

getServletContext

public static javax.servlet.ServletContext getServletContext()
Returns the web app ServletContext object

Returns:
Since:
1.0.0

getXmlWrapperProvider

public static IXmlWrapperProvider getXmlWrapperProvider()
Returns the XmlWrapperProvider provided by the Telosys factory

Returns:

isAuthenticationRequired

public static boolean isAuthenticationRequired()
Returns true if user authentication is required

Returns:

getXmlDomParserFactory

public static javax.xml.parsers.DocumentBuilderFactory getXmlDomParserFactory()
Returns a JAXP DocumentBuilderFactory

Returns:

error

public static void error(java.lang.String sClassName,
                         java.lang.String sMsg)
Logs an error message using both standard logger and specific application logger if any

Parameters:
sClassName -
sMsg -

error

public static void error(java.lang.String sMsg)
Logs an error message using both standard logger and specific application logger if any

Parameters:
sMsg -

error

public static void error(java.lang.String sClassName,
                         java.lang.Throwable ex)
Logs an exception using both standard logger and specific application logger if any

Parameters:
sClassName -
ex -

error

public static void error(java.lang.Throwable ex)
Logs an exception using both standard logger and specific application logger if any

Parameters:
ex -

warn

public static void warn(java.lang.String sClassName,
                        java.lang.String sMsg)
Logs a warning message using both standard logger and specific application logger if any

Parameters:
sClassName -
sMsg -

warn

public static void warn(java.lang.String sMsg)
Logs a warning message using both standard logger and specific application logger if any

Parameters:
sMsg -

info

public static void info(java.lang.String sClassName,
                        java.lang.String sMsg)
Logs an info message using both standard logger and specific application logger if any

Parameters:
sClassName -
sMsg -

info

public static void info(java.lang.String sMsg)
Logs an info message using both standard logger and specific application logger if any

Parameters:
sMsg -

trace

public static void trace(java.lang.String sClassName,
                         java.lang.String sMsg)
Logs a trace message using both standard logger and specific application logger if any

Parameters:
sClassName -
sMsg -

trace

public static void trace(java.lang.String sMsg)
Logs a trace message using both standard logger and specific application logger if any

Parameters:
sMsg -

getDbConfigFileName

public static java.lang.String getDbConfigFileName()
Returns the file name (or resource name) of the databases XML file ( databases.dbcfg, formerly dbconfig.xml )

Returns:

getDbConfigInputStream

public static java.io.InputStream getDbConfigInputStream()
Returns the InputStream of the databases XML file or resource ( databases.dbcfg, formerly dbconfig.xml )

Returns:
the InputStream ( or null if cannot get it )

getScreensConfigFileName

public static java.lang.String getScreensConfigFileName()
Returns the file name (or resource name) of the screens XML file ( screens.xml )

Returns:

getScreensConfigInputStream

public static java.io.InputStream getScreensConfigInputStream()
Returns the InputStream of the screens XML file or resource ( screens.xml )

Returns:
the InputStream ( or null if cannot get it )

getTagsConfigFileName

public static java.lang.String getTagsConfigFileName()
Returns the file name (or resource name) of the tags properties file ( tags.properties )

Returns:

getTagsConfigInputStream

public static java.io.InputStream getTagsConfigInputStream()
Returns the InputStream of the tags properties file ( tags.properties )

Returns:

getTraceConfigFileName

public static java.lang.String getTraceConfigFileName()
Returns the file name (or resource name) of the trace properties file ( traces.properties )

Returns:

getTraceConfigInputStream

public static java.io.InputStream getTraceConfigInputStream()
Returns the InputStream of the trace properties file ( traces.properties )

Returns:

getProperty

public static java.lang.String getProperty(java.lang.String sPropertyName)
Returns the property value for the given property name
( properties loaded from the "telosys.properties" file )

Parameters:
sPropertyName -
Returns: