org.ifeth.sehr.lib
Class SEHRCfg

java.lang.Object
  |
  +--org.ifeth.sehr.lib.SEHRCfg

public class SEHRCfg
extends java.lang.Object

This method is the only one and basic configuration layer between the SEHR modules and the operating system.

The configuration file knows (due to the setup procedure) where to find the databases, environments like Apache, SAMBA etc.

To retrieve the running configuration one of the methods listed below should be used in accordence to the context:

Important: This object requires always a local read access to the running or defined configuration file for security reasons.
On external, remote clients get relevant data of the running SEHR system by the implemented SOAP interface.

Version:
$Id: SEHRCfg.java,v 1.11 2005/01/16 12:15:57 hansjhaase Exp $
Author:
Hans J. Haase HJH

Constructor Summary
SEHRCfg()
          Parameterless instance for using in JSP beans.
SEHRCfg(boolean load)
          Init SEHR environment object either by scaning for the configuration or by accessing the default host/port
SEHRCfg(java.lang.String file)
          Init SEHR environment object using specified configuration file
SEHRCfg(java.lang.String ip, int port)
          Init SEHR environment object using specified host/port to get the configuration file to load.
 
Method Summary
 java.sql.Connection getCon()
           
 java.lang.String getCssfile()
          Get the style file for WEB pages.
 java.lang.String getdbHost()
           
 java.lang.String getdbHostname()
           
 java.lang.String getdbSec()
           
 java.lang.String getdbSecUser()
           
 java.lang.String getdbSecUserPw()
           
 java.lang.String getDebug()
           
 int getDebugInt()
           
 java.lang.String getDomain()
           
 SEHRDataSource getFbds()
           
 java.lang.String getFQNN()
           
 java.lang.String getIMAPServer()
           
 java.lang.String getLANIP()
          Get LAN IP where current server by SERVER IP running in Due to IP conventions the LAN Ip can be build from SERVER IP otherwise the server would not work :)
 java.lang.String getLogfile()
           
 java.lang.String getModuleOwner()
           
 java.lang.String getModuleRoot()
           
 java.lang.String getPOP3Server()
           
 java.lang.String getRunningCfgFile()
           
 java.lang.String getSERVERIP()
           
 java.lang.String getSERVERPort()
           
 java.lang.String getSMTPServer()
           
 java.lang.String getSubdomain()
           
 java.lang.String getSYSHOME()
           
 java.lang.String getTitle()
           
 java.lang.String getURLSEHRAdminAsIP()
          Returns the URL to access the SEHR-OSI module by Tomcat for administration purposes.
 java.lang.String getZoneID()
           
 void initDBConnection()
          Init a db connection to 'intrasec' using settings of this object
 boolean isSEHRCfgLoaded()
          Returns the status if the SEHR object.
 boolean isSEHRCfgProp()
          Check wether SEHR environment is initialized (configuration is avlb.)
 boolean loadSEHRCfg()
          Load the SEHR configuration.
 boolean loadSEHRCfg(java.lang.String f)
          Load SEHR configuration from a given configuration file.
 boolean loadSEHRCfg(java.lang.String host, int port)
          Get the configuration from the running server but from another port.
 void logDebug(java.lang.String message)
           
 void logError(java.lang.String message)
           
 void logInfo(java.lang.String message)
           
 void logWarn(java.lang.String message)
           
static void main(java.lang.String[] args)
           
 boolean readSEHRCfgFile(java.lang.String file)
          Read configuration file and store key value pairs as properties.
 void readSEHRCfgFileToProp(java.lang.String file)
          Deprecated. (for downgrading compatibility)

from modules use 'loadSEHRCfg()'

 void saveCfgFile(java.lang.String file)
          Save configuration in memory as configuration property file This method is used by the SEHRServer task to store the 'runnning' configuration and may be used by the user to redefine settings...
 void setCon(java.sql.Connection con)
           
 void setdbHost(java.lang.String dbHost)
           
 void setdbSecUser(java.lang.String dbSecUser)
           
 void setdbSecUserPw(java.lang.String dbSecUserPw)
           
 void setFbds(SEHRDataSource fbds)
           
 java.lang.String toString()
           
static java.lang.String trimnull(java.lang.String s)
          Helper method to set 'null' strings to "" strings for a better review from database.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SEHRCfg

public SEHRCfg()
Parameterless instance for using in JSP beans.

Using this don't forget to load the configuration by sehrcfg.loadSEHRCfg([options]);


SEHRCfg

public SEHRCfg(boolean load)
Init SEHR environment object either by scaning for the configuration or by accessing the default host/port


SEHRCfg

public SEHRCfg(java.lang.String file)
Init SEHR environment object using specified configuration file


SEHRCfg

public SEHRCfg(java.lang.String ip,
               int port)
Init SEHR environment object using specified host/port to get the configuration file to load.

Note: Finally you must have a physical read access to the file to load the configuration. On WEB services 127.0.0.1/24100 is the default and you can use the simplified instantiation by using SEHRCfg(true); use this in testing environments...

Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getModuleRoot

public java.lang.String getModuleRoot()

getModuleOwner

public java.lang.String getModuleOwner()

getLogfile

public java.lang.String getLogfile()

getTitle

public java.lang.String getTitle()

getZoneID

public java.lang.String getZoneID()

getDomain

public java.lang.String getDomain()

getSubdomain

public java.lang.String getSubdomain()

getSERVERPort

public java.lang.String getSERVERPort()

getSERVERIP

public java.lang.String getSERVERIP()

getLANIP

public java.lang.String getLANIP()
Get LAN IP where current server by SERVER IP running in

Due to IP conventions the LAN Ip can be build from SERVER IP otherwise the server would not work :)

Returns:
lanip

getFQNN

public java.lang.String getFQNN()

getURLSEHRAdminAsIP

public java.lang.String getURLSEHRAdminAsIP()
Returns the URL to access the SEHR-OSI module by Tomcat for administration purposes. The method may be useful for retrieving the URL with the correct server IP for using by 'thick' clients.


getSMTPServer

public java.lang.String getSMTPServer()

getPOP3Server

public java.lang.String getPOP3Server()

getIMAPServer

public java.lang.String getIMAPServer()

getDebug

public java.lang.String getDebug()

getDebugInt

public int getDebugInt()

getdbSec

public java.lang.String getdbSec()

getdbHost

public java.lang.String getdbHost()

getdbHostname

public java.lang.String getdbHostname()

setdbHost

public void setdbHost(java.lang.String dbHost)

getdbSecUser

public java.lang.String getdbSecUser()

setdbSecUser

public void setdbSecUser(java.lang.String dbSecUser)

getdbSecUserPw

public java.lang.String getdbSecUserPw()

setdbSecUserPw

public void setdbSecUserPw(java.lang.String dbSecUserPw)

getCon

public java.sql.Connection getCon()
Returns:
Returns the database connection handle.

setCon

public void setCon(java.sql.Connection con)
Parameters:
con - Set (store) the current connection to IntraSEC by this object.

getFbds

public SEHRDataSource getFbds()
Returns:
Returns the fbds.

setFbds

public void setFbds(SEHRDataSource fbds)
Parameters:
fbds - The fbds to set.

getSYSHOME

public java.lang.String getSYSHOME()
Returns:
syshome Returns the 'home' path of the system

getRunningCfgFile

public java.lang.String getRunningCfgFile()

initDBConnection

public void initDBConnection()
Init a db connection to 'intrasec' using settings of this object


isSEHRCfgLoaded

public boolean isSEHRCfgLoaded()
Returns the status if the SEHR object.

Use this method to check if the configuration is avbl. and the db 'intrasec' is accessable

Returns:
status

isSEHRCfgProp

public boolean isSEHRCfgProp()
Check wether SEHR environment is initialized (configuration is avlb.)


loadSEHRCfg

public boolean loadSEHRCfg()
Load the SEHR configuration.

Use this method to get/init the SEHR configuration for all modules.
The default configuration file is 'path_to_sehrroot/etc/.sehr'. The method tries to get the configuration using some different methods. To use another specific configuration file use either
'loadSEHRCfg(fullpath_and_name)' or
'loadSEHRCfg(ip, port)'
Note:
Keep in mind that there must be finally a physical request to the local configuration file - You can't hop to an external SEHR node configuration file due to important security aspects!


loadSEHRCfg

public boolean loadSEHRCfg(java.lang.String host,
                           int port)
Get the configuration from the running server but from another port.

This is a helper function to get the path and name of the configuration file on a server running on a different port than 24100. If the server is not running the method returns "false".
This method also usable as an indicator for a correctly running SEHR core.

Parameters:
host -
port -

loadSEHRCfg

public boolean loadSEHRCfg(java.lang.String f)
Load SEHR configuration from a given configuration file.


getCssfile

public java.lang.String getCssfile()
Get the style file for WEB pages.

Notes:
The default CSS file to use is defined in WEB.XML
Path must be included within HTML code and depends on the location the styles are located

Returns:
cssfile file w/o path

trimnull

public static java.lang.String trimnull(java.lang.String s)
Helper method to set 'null' strings to "" strings for a better review from database. If string is not null the string itself is returned trimmed.

The method is static so it can be used by other classes :)

Returns:
string

readSEHRCfgFileToProp

public void readSEHRCfgFileToProp(java.lang.String file)
                           throws java.io.IOException
Deprecated. (for downgrading compatibility)

from modules use 'loadSEHRCfg()'

This method reads the configuration file and generates a prop object

java.io.IOException

readSEHRCfgFile

public boolean readSEHRCfgFile(java.lang.String file)
Read configuration file and store key value pairs as properties.

Use

  • 'loadSEHRCfg()' to get DEFAULT SEHR configuration.
  • 'loadSEHRCfg(file)' to use a specific SEHR configuration.
  • Returns:
    (boolean) true if configuration was loaded successfully

    saveCfgFile

    public void saveCfgFile(java.lang.String file)
                     throws java.io.IOException
    Save configuration in memory as configuration property file

    This method is used by the SEHRServer task to store the 'runnning' configuration and may be used by the user to redefine settings...

    java.io.IOException

    logInfo

    public void logInfo(java.lang.String message)

    logDebug

    public void logDebug(java.lang.String message)

    logWarn

    public void logWarn(java.lang.String message)

    logError

    public void logError(java.lang.String message)

    main

    public static void main(java.lang.String[] args)