www.element4solution.com

e4s.util
Class E4Settings

java.lang.Object
  extended by e4s.util.E4Object
      extended by e4s.util.E4Settings
Direct Known Subclasses:
E4DBSettings, E4EditingSettings, E4LoginSettings, E4MailSettings, E4StyleSettings

public class E4Settings
extends E4Object

System properties. System properties are treatened in this way: You must include the following lines to your web.xml file: <init-param> <param-name>E4S.PROPERTIES</param-name> <param-value>e4s.ini</param-value> </init-param> This specifies the property file, which is used by several modules which make use of E4Settings or an inherited class. This module handles the editing of those values. A property has a unique name (ID) and a value. A value is typically a String, but it can contain other ID's recursivley, e.g. DIRECTORY = %BASEDIR%/myDir/ which looks for an ID BASEDIR and expands it.

Since:
JDK 1.4
See Also:
E4ModuleEditProperties, E4DBSettings

Nested Class Summary
static class E4Settings.DATATYPE_DEF
           
 
Field Summary
static int _DATATYPE_BOOLEAN
           
static int _DATATYPE_NUMBER
           
static int _DATATYPE_PASSWORD
           
static int _DATATYPE_SELECTION
           
static int _DATATYPE_STRING
           
protected static char INCLUDE_CHAR
           
static java.lang.String SERVLET_WEB_XML_PARAMETER_PROPERTIES
          Definition for parameter of the property file as to be used in tomcat web.xml.
 
Fields inherited from class e4s.util.E4Object
CRLF, E4S_CORE_SYSTEM_LANGUAGE, NBSP, NULLSTR, URL_ENCODING_CHARSET
 
Constructor Summary
E4Settings()
           
 
Method Summary
static java.lang.String _getSVNVersionString()
          Get version info string from subversion.
static void defineDatatype(java.lang.String id, E4Label_Intf rem)
           
static void defineDatatype(java.lang.String id, E4SelectValues options, E4Label_Intf rem)
           
static void defineDatatype(java.lang.String id, E4SelectValues options, java.lang.String rem)
           
static void defineDatatype(java.lang.String id, int datatype, E4Label_Intf rem)
           
static void defineDatatype(java.lang.String id, int datatype, java.lang.String rem)
           
static void defineDatatype(java.lang.String id, java.lang.String rem)
           
static void defineDatatypes()
           
static void definePropertyFile(java.lang.String propertyfile)
          Define the filename for the property (.ini) file.
static Language getAppCoreLanguage()
          Get the application core language.
static E4Settings.DATATYPE_DEF getDatatype(java.lang.String id)
           
static int getDefaultAlias()
          Default alias code for startup.
static E4DocumentBase getDocBase()
          Default document base.
static java.lang.String getErrorMailto()
          Specifies an eMail address where errors are beeing mailed to.
static boolean getForceUploadLowercase()
           
static boolean getHtmlStrict()
           
static java.lang.String getHttpAddr()
          Definition of the application home path (e.g. http://www.myhost.com/zone/servlet).
static java.lang.String getHttpRoot()
          Definition of the application root path within the properties file.
static java.lang.String getLoginPath()
          Definition of the application's login path (used in the mail me my password function)
static int getMaxUploadSize()
          Maximum upload file size for E4MultipartRequest.
static int getMenuStyle()
          Get the menu style, server requires restart.
static java.util.Enumeration getPredefinedKeys()
           
static java.util.Properties getProperties()
           
static java.lang.String getProperty(E4InputFieldName_Intf id)
          Read a property value from the properties file.
static java.lang.String getProperty(java.lang.String id)
          Read a property value from the properties file.
static java.lang.String getProperty(java.lang.String id, boolean except_not_found)
          Read a property value from the properties file.
static java.lang.String getProperty(java.lang.String id, java.lang.String default_value, boolean expand)
          Read a property value from the properties file.
static java.lang.String getProperty(java.lang.String id, java.lang.String default_value, boolean expand, boolean null_on_error)
          Read a property value from the properties file.
static boolean getPropertyBool(java.lang.String id)
          Read a property value from the properties file.
static java.lang.String getPropertyFile()
          Get the filename for the property (.ini) file.
static int getPropertyInt(java.lang.String id)
          Read a property value from the properties file.
static long getPropertyLong(java.lang.String id)
          Read a property value from the properties file.
static java.lang.String getServer()
          Server address, e.g.
static java.lang.String getSysLogFilePath()
           
static java.lang.String getSysTempPath()
          Get a place for the temporary directory on the server
static java.lang.String getSysTraceLogPath()
          Get the path for TRACE logging.
static boolean preventBackButton()
           
static boolean preventRightClick()
           
static java.util.Enumeration propertyNames()
          Get a list (Enumeration) for all properties.
static void readIniFile()
           
static void reloadFile()
          Force to reload the properties file before the next access.
static void removeProperty(java.lang.String id)
           
static void setHttpAddr(java.lang.String address)
          Definition of the application home path (e.g. http://www.myhost.com/zone/servlet).
static void setProperty(java.lang.String id, boolean value)
           
static void setProperty(java.lang.String id, long value)
           
static void setProperty(java.lang.String id, java.lang.String value)
           
static void validate(HTML html)
           
 
Methods inherited from class e4s.util.E4Object
Calendar, CName, CName, E4LabelApp, E4LabelApp, E4LabelApp, E4LabelApp, E4LabelApp, E4LabelApp, E4LabelNone, E4LabelNone, E4LabelNone, E4LabelNone, E4LabelSys, E4LabelSys, e4sCopyright, e4sVersion, encode, encode, encode, encodeHtml, encodeHtml, encodeHtml, encodeURL, encodeURL, encodeURL, finalize, getLINE, getTRACE, getTRACE, getTRACE, getTRACE, getTRACE, getTRACE, getTraceMemory, HtmlEncode, HtmlEncode, HtmlEncode, isdecimal, isdigit, isnotok, isnotok, isnumeric, isok, isok, isok, isok, lastCallingFunction, lastCallingFunction, lastCallingFunction, lastCallingFunction, lastCallingStack, mkdirs, null2nbsp, null2nbsp, null2nbsp, ok, ok, ok, ok, outPrintln, setLogFile4Trace, setTraceMemory, STACKTRACE, toDebug, toDouble, toFloat, toFloat, toString, TRACE_CALLS, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, wait
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_DATATYPE_STRING

public static final int _DATATYPE_STRING
See Also:
Constant Field Values

_DATATYPE_BOOLEAN

public static final int _DATATYPE_BOOLEAN
See Also:
Constant Field Values

_DATATYPE_PASSWORD

public static final int _DATATYPE_PASSWORD
See Also:
Constant Field Values

_DATATYPE_NUMBER

public static final int _DATATYPE_NUMBER
See Also:
Constant Field Values

_DATATYPE_SELECTION

public static final int _DATATYPE_SELECTION
See Also:
Constant Field Values

INCLUDE_CHAR

protected static final char INCLUDE_CHAR
See Also:
Constant Field Values

SERVLET_WEB_XML_PARAMETER_PROPERTIES

public static final java.lang.String SERVLET_WEB_XML_PARAMETER_PROPERTIES
Definition for parameter of the property file as to be used in tomcat web.xml. Usage:

                <web-app>
<servlet>
<servlet-name>..</servlet-name>
<servlet-class>..</servlet-class>
<init-param>
<param-name>E4S.PROPERTIES</param-name>
<param-value>myapplication.ini</param-value>
</init-param>
..
</servlet>
..
</web-app>

See Also:
Constant Field Values
Constructor Detail

E4Settings

public E4Settings()
Method Detail

getProperty

public static java.lang.String getProperty(java.lang.String id,
                                           boolean except_not_found)
                                    throws java.lang.Exception
Read a property value from the properties file. If the value contains terms like %XY% then those terms are interpreted as nested propertyvalues and they will be looked up in the properties recursivley. If this fails or the property does not exist then a value of null will be returned.

Parameters:
id - the identification of the value, must be unique within the current properties file
Returns:
the value of the property or null
Throws:
java.lang.Exception
See Also:
getProperty(String, String, boolean, boolean), getPropertyLong(String), getPropertyInt(String), getPropertyBool(String), setProperty(String,String)

getProperty

public static java.lang.String getProperty(java.lang.String id)
Read a property value from the properties file. If the value contains terms like %XY% then those terms are interpreted as nested propertyvalues and they will be looked up in the properties recursivley. If this fails or the property does not exist then a value of null will be returned.

Parameters:
id - the identification of the value, must be unique within the current properties file
Returns:
the value of the property or null
See Also:
getProperty(String, String, boolean, boolean), getPropertyLong(String), getPropertyInt(String), getPropertyBool(String), setProperty(String,String)

getProperty

public static java.lang.String getProperty(E4InputFieldName_Intf id)
Read a property value from the properties file. If the value contains terms like %XY% then those terms are interpreted as nested propertyvalues and they will be looked up in the properties recursivley. If this fails or the property does not exist then a value of null will be returned.

Parameters:
id - the identification of the value, must be unique within the current properties file
Returns:
the value of the property or null
See Also:
getProperty(String, String, boolean, boolean), getPropertyLong(String), getPropertyInt(String), getPropertyBool(String), setProperty(String,String)

getProperty

public static java.lang.String getProperty(java.lang.String id,
                                           java.lang.String default_value,
                                           boolean expand,
                                           boolean null_on_error)
Read a property value from the properties file.

Parameters:
id - the identification of the value, must be unique within the current properties file
default_value - for the case, that the value is not defined in the properties file, use this value
expand - if true, then including terms like %XY% are expanded by recursivley lookups in the properties
null_on_error - if true, and an expansion fails then no incorrect value will be returned but null instead, if false, and an expansion fails then a value might be wrong. If you are unsure, set this parameter to true.
Returns:
the value of the property or null
See Also:
getProperty(String, String, boolean), getPropertyLong(String), getPropertyInt(String), getPropertyBool(String), getProperty(String), setProperty(java.lang.String, java.lang.String)

getProperty

public static java.lang.String getProperty(java.lang.String id,
                                           java.lang.String default_value,
                                           boolean expand)
Read a property value from the properties file.

Parameters:
id - the identification of the value, must be unique within the current properties file
default_value - for the case, that the value is not defined in the properties file, use this value
expand - if true, then including terms like %XY% are expanded by recursivley lookups in the properties
Returns:
the value of the property or null if not exists or expansion falis
See Also:
getProperty(String, String, boolean), getPropertyLong(String), getPropertyInt(String), getPropertyBool(String), getProperty(String), setProperty(java.lang.String, java.lang.String)

getPropertyInt

public static int getPropertyInt(java.lang.String id)
Read a property value from the properties file. If the value contains terms like %XY% then those terms are interpreted as nested propertyvalues and they will be looked up in the properties recursivley. If this fails or the property does not exist then a value of null will be returned.

Parameters:
id - the identification of the value, must be unique within the current properties file
Returns:
the value of the property or -1
See Also:
getProperty(String, String, boolean, boolean), getProperty(String), getPropertyBool(String), getPropertyLong(String), setProperty(java.lang.String, java.lang.String)

getErrorMailto

public static java.lang.String getErrorMailto()
Specifies an eMail address where errors are beeing mailed to.

Returns:
null if errors shall not beeing mailed, an email address.
See Also:
SYS_ERROR_MAILTO

getMenuStyle

public static int getMenuStyle()
Get the menu style, server requires restart.

Returns:
the menu style or E4Menu.MENU_STYLE_IMAGES_B2 as a default value.
See Also:
E4Menu

getPropertyLong

public static long getPropertyLong(java.lang.String id)
Read a property value from the properties file. If the value contains terms like %XY% then those terms are interpreted as nested propertyvalues and they will be looked up in the properties recursivley. If this fails or the property does not exist then a value of null will be returned.

Parameters:
id - the identification of the value, must be unique within the current properties file
Returns:
the value of the property or -1
See Also:
getProperty(String, String, boolean, boolean), getProperty(String), getPropertyBool(String), setProperty(java.lang.String, java.lang.String)

getPropertyBool

public static boolean getPropertyBool(java.lang.String id)
Read a property value from the properties file. If the value contains terms like %XY% then those terms are interpreted as nested propertyvalues and they will be looked up in the properties recursivley. If this fails or the property does not exist then a value of null will be returned.

Parameters:
id - the identification of the value, must be unique within the current properties file
Returns:
the value of the property or null
See Also:
getProperty(String, String, boolean, boolean), getPropertyLong(String), getProperty(String), setProperty(String, boolean)

setProperty

public static void setProperty(java.lang.String id,
                               java.lang.String value)

readIniFile

public static void readIniFile()
                        throws java.io.IOException
Throws:
java.io.IOException

setProperty

public static void setProperty(java.lang.String id,
                               long value)

setProperty

public static void setProperty(java.lang.String id,
                               boolean value)

removeProperty

public static void removeProperty(java.lang.String id)

definePropertyFile

public static void definePropertyFile(java.lang.String propertyfile)
Define the filename for the property (.ini) file. Usually, this is an entry SERVLET_WEB_XML_PARAMETER_PROPERTIES in the web.xml file.

See Also:
getPropertyFile(), SERVLET_WEB_XML_PARAMETER_PROPERTIES

getPropertyFile

public static java.lang.String getPropertyFile()
Get the filename for the property (.ini) file.

See Also:
definePropertyFile(String)

propertyNames

public static java.util.Enumeration propertyNames()
Get a list (Enumeration) for all properties.

Returns:
an Enumeration of the property names, all elements are of type String.

reloadFile

public static void reloadFile()
Force to reload the properties file before the next access. All current values are removed from memory.


getHttpRoot

public static java.lang.String getHttpRoot()
Definition of the application root path within the properties file. This is the file location, where all data and files start, but it is also an visible path within the current directory of the Appache http server.

See Also:
SYS_HTTPROOT, getDocBase(), e4s.application.E4Client#getAbsolutePath()

getHttpAddr

public static java.lang.String getHttpAddr()
Definition of the application home path (e.g. http://www.myhost.com/zone/servlet). This definition is based on a value in the .ini file, and might be different from the value returned by E4ServletImplementation_Intf.getHttpAddr().

See Also:
SYS_HTTPADR, getHttpRoot(), e4s.application.E4Client#getRootPath(boolean), E4ServletImplementation_Intf.getHttpAddr()

getLoginPath

public static java.lang.String getLoginPath()
Definition of the application's login path (used in the mail me my password function)

See Also:
SYS_LOGINPATH

setHttpAddr

public static void setHttpAddr(java.lang.String address)
Definition of the application home path (e.g. http://www.myhost.com/zone/servlet).

See Also:
SYS_HTTPADR, getHttpAddr()

getDefaultAlias

public static int getDefaultAlias()
Default alias code for startup.

Returns:
-1 if not defined, or the alias code of the excplicit defined startup function.

getMaxUploadSize

public static int getMaxUploadSize()
Maximum upload file size for E4MultipartRequest.

See Also:
E4MultipartRequest.MAX_READ_BYTES, SYS_UPLOAD_MAXSIZE, FILESELECTION.getMaxUploadSize()

getAppCoreLanguage

public static Language getAppCoreLanguage()
Get the application core language.

See Also:
APP_CORE_LANGUAGE, E4Object.E4S_CORE_SYSTEM_LANGUAGE

getSysLogFilePath

public static java.lang.String getSysLogFilePath()

getSysTempPath

public static java.lang.String getSysTempPath()
Get a place for the temporary directory on the server

See Also:
SYS_TEMP_PATH

getSysTraceLogPath

public static java.lang.String getSysTraceLogPath()
Get the path for TRACE logging. By default, this path is not specified and TRACE logging goes to standard-out.

Returns:
null if not defined, or a path where the trace logs shall be written
See Also:
e4s.util.E4Object#TRACE(String), E4Object.setLogFile4Trace(String), SYS_TRACE_LOG_PATH

getDocBase

public static E4DocumentBase getDocBase()
Default document base. Must be relative to your web server's root directory.

See Also:
DOCBASE

getServer

public static java.lang.String getServer()
Server address, e.g. "http://localhost" or "http://www.myserver.com".

See Also:
getDocBase(), SYS_SERVER

preventRightClick

public static boolean preventRightClick()

preventBackButton

public static boolean preventBackButton()

validate

public static void validate(HTML html)

getProperties

public static java.util.Properties getProperties()

defineDatatype

public static void defineDatatype(java.lang.String id,
                                  E4SelectValues options,
                                  java.lang.String rem)

defineDatatype

public static void defineDatatype(java.lang.String id,
                                  E4SelectValues options,
                                  E4Label_Intf rem)

defineDatatype

public static void defineDatatype(java.lang.String id,
                                  java.lang.String rem)

defineDatatype

public static void defineDatatype(java.lang.String id,
                                  E4Label_Intf rem)

defineDatatype

public static void defineDatatype(java.lang.String id,
                                  int datatype,
                                  java.lang.String rem)

defineDatatype

public static void defineDatatype(java.lang.String id,
                                  int datatype,
                                  E4Label_Intf rem)

getDatatype

public static E4Settings.DATATYPE_DEF getDatatype(java.lang.String id)

getPredefinedKeys

public static java.util.Enumeration getPredefinedKeys()

defineDatatypes

public static void defineDatatypes()

getForceUploadLowercase

public static boolean getForceUploadLowercase()

getHtmlStrict

public static boolean getHtmlStrict()

_getSVNVersionString

public static java.lang.String _getSVNVersionString()
Get version info string from subversion.

Returns:
the version info string.
See Also:
E4Util.getRevisionCodeFromSVN(Class)

www.element4solution.com