public class SEHRConfiguration
extends java.lang.Object
The configuration file knows (due to the setup procedure) where to find the
databases and environments on servers like J2EE, Apache, Mail, JMS etc. as
well as clients. These data are processed by this handler and stored in the
reusable POJO SEHRConfigurationObject
. Use this POJO if you want to
track only some settings during runtime, i.e. on clients without a
configuration file. But it does not contain secret data like admin passwords.
To retrieve the running configuration one of the methods listed below should
be used in accordance to the context. Use 'true' only if you want the object
to locate the running configuration file
by running some tests on the host because this takes some more time to load
all the stuff. After retrieving all parameters the is stored as a serialized
bean (see SEHRConfigurationObject
) at the LDAP service of the zone to
inform clients about important settings and implemented services.
SEHRConfiguration cfg = new SEHRConfiguration(String cfgfile);
SEHRConfiguration cfg = new SEHRConfiguration(false);
SEHRConfiguration cfg = new SEHRConfiguration(hostip, port);
(...) SEHRConfiguration cfg= new SEHRConfiguration(); //search and load the config if (!cfg.loadSEHRCfg()){ //return/exit with error return false; } //continue (...)
Important: This object requires always a local access to a running or
defined configuration file or an access to a LDAP server.
On remote clients transmit specific data of a running SEHR zone, i.e.
EHR objects by the using SOAP, LDAP (JNDI) or the native
SEHRRemote
interface.
In the JEE environment use the EJB named 'SEHRService' to retrieve the
SEHRConfigurationObject
or single settings like IMAP, POP3 etc. The
EJB retrieves the configuration object by starting the SEHRServer from
commandline. The JEE environment should be used to trensfer EHR objects
between SEHR hosts.
Constructor and Description |
---|
SEHRConfiguration()
Parameterless instance for using this handler in JSP as bean.
|
SEHRConfiguration(boolean search)
Init SEHR environment object either by scanning for a configuration file
(true) or by accessing the host via ip/port to retrieve he settings by
JNDI/LDAP (false).
|
SEHRConfiguration(SEHRConfigurationObject sco)
Init configuration handler with settings by the configuration object.
|
SEHRConfiguration(java.lang.String file)
Init SEHR environment object using specified configuration file
|
SEHRConfiguration(java.lang.String ip,
int port)
Init SEHR environment object using specified host/port to get the
configuration file to load.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getAMQBrokerURL() |
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.util.logging.Level |
getDebugLevel()
Returns a 'Level' object related to the stored/current debugging level
|
static java.util.logging.Level |
getDebugLevel(int debuglevel)
Returns a 'Level' object related to a given 'int' between 0 to 9
See SEHR conventions for debugging details.
|
java.lang.String |
getDomain() |
SEHRDataSource |
getFbds()
Deprecated.
use getSEHRDataSource()
|
java.lang.String |
getFQNN()
Retrieve the FQNN for accessing the zone db.
|
java.lang.String |
getIMAPServer() |
java.io.File |
getIPBlacklistFh() |
java.io.File |
getIPWhitelistFh() |
java.lang.String |
getLANIP()
Get LAN IP where current server by SERVER IP is running on.
|
java.lang.String |
getLDAPBaseDN() |
java.lang.String |
getLDAPCtx() |
java.lang.String |
getLDAPHost() |
java.lang.String |
getLDAPPort() |
java.lang.String |
getLDAPUser()
Get the user to access a LDAP host.
|
java.lang.String |
getLDAPUserDN()
Get the DN of an LDAP entry.
|
java.lang.String |
getLDAPUserPw() |
java.lang.String |
getLogfile()
Returns the property entry 'LogFile' or creates a default value.
|
java.util.logging.Logger |
getLogger() |
java.lang.String |
getModuleOwner() |
java.lang.String |
getModuleRoot() |
java.lang.String |
getPOP3Server() |
java.lang.String |
getRootOID() |
java.lang.String |
getRunningCfgFile() |
SEHRConfigurationObject |
getRunningCfgObject()
Deprecated.
|
SEHRConfigurationObject |
getRuntimeSCO(java.lang.String host,
int port)
Get runtime settings from SEHR host.
|
java.lang.String |
getRuntimeValue(java.lang.String host,
int port,
java.lang.String key) |
java.lang.String |
getSEHRCfgValue(java.lang.String key)
Common getter to retrieve a setting value from running(!)
|
SEHRConfigurationObject |
getSEHRConfigurationObject()
Get SEHR configuration without secret data for public usage.
|
SEHRDataSource |
getSEHRDataSource() |
java.lang.String |
getSEHRHost()
Get name of host for using in URLs or accesses via namespacing
|
java.lang.String |
getSEHRPort() |
java.lang.String |
getSERVERIP()
Get real IP of host using fpr direct tcp/ip access
|
java.lang.String |
getSERVERPort()
Deprecated.
HJH: var changed to 'SEHRPort'
|
java.lang.String |
getSMTPServer() |
java.lang.String |
getSubdomain() |
java.lang.String |
getSYSHOME()
Returns the 'home' path of the system whereare the center home directories
are located
|
java.lang.String |
getTitle() |
java.lang.String |
getURLSEHRAdminAsIP()
Returns the URL to access the SEHR-OSI module by JEE for administration
purposes.
|
java.lang.String |
getZoneID() |
int |
getZoneIDInt() |
java.sql.Connection |
initDBConnection()
Deprecated.
Don't cascade objects. Use
SEHRDataSource |
void |
initLogger()
Init logging for this and other SEHR modules using the debugging level
defined by the configuration file.
|
void |
initLogger(int debuglevel)
Init logging using the default logger and the given debugging level
|
void |
initLogger(java.lang.String loggerid,
int dl) |
boolean |
isLDAP() |
boolean |
isMessaging() |
static boolean |
isNULLOrEmpty(java.lang.String s)
Check if a given String is null or empty.
|
boolean |
isSEHRCfgLoaded()
Simple check wether the SEHR object was loaded (is available).
|
boolean |
isSEHRCfgProp()
Check wether SEHR environment is initialized (configuration is avlb.)
|
boolean |
loadSEHRCfg()
Load SEHR configuration by searching for the running configuration.
|
boolean |
loadSEHRCfg(java.io.InputStream is) |
boolean |
loadSEHRCfg(java.lang.String f)
Load SEHR configuration from a given configuration file.
|
boolean |
loadSEHRCfg(java.lang.String host,
int port)
Loads the configuration of a running SEHR server from LDAP store.
|
void |
logDebug(java.lang.String message) |
void |
logError(java.lang.String message)
Deprecated.
use LoggingHelper#logError
|
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.
|
void |
setAMQBrokerURL(java.lang.String url) |
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 |
setDebugLevel(int d) |
void |
setFbds(SEHRDataSource fbds)
Deprecated.
use setSEHRDataSource(SEHRDataSource sehrds)
|
void |
setLDAPBaseDN(java.lang.String basedn) |
void |
setLDAPCtx(java.lang.String ctx) |
void |
setLDAPHost(java.lang.String host) |
void |
setLDAPPort(java.lang.String port) |
void |
setLDAPUser(java.lang.String user)
Set the user to access a LDAP host.
|
void |
setLDAPUserDN(java.lang.String dn)
Set the DN of an LDAP entry.
|
void |
setLDAPUserPw(java.lang.String pw) |
void |
setRootOID(java.lang.String oid) |
boolean |
setSEHRCfgValue(java.lang.String key,
java.lang.String value)
Common method to set/redefine a configuration value to the running
configuration.
|
void |
setSEHRConfigurationObject(SEHRConfigurationObject obj)
Set SEHR configuration but note that there are no secrets inside.
|
void |
setSEHRDataSource(SEHRDataSource sehrds)
Set the instance of the SEHRDataSource for usage.
|
boolean |
setSYSHOME(java.lang.String absolutepath) |
void |
setZoneID(java.lang.String zoneid) |
java.lang.String |
toString()
Retrieve a very simple object information.
|
static java.lang.String |
trimnull(java.lang.String s)
Helper method to set 'null' strings to "" strings for a better review from
database.
|
public SEHRConfiguration()
If using object as bean don't forget to load the configuration by
sehrcfg.loadSEHRCfg([options]);
. Also there is *NO* d
initialization. Use
to initialize
a simple db connection. initDBConnection()
public SEHRConfiguration(SEHRConfigurationObject sco)
public SEHRConfiguration(boolean search)
This constructor also initializes the logger. Parameter 'true' means scan for a running config file; 'false' means don't init by file, use the an existing LDAP/J2EE context. This is working only on the server site. For external clients acessing a SEHR server by LAN/WAN use
SEHRConfiguration cfg = SEHRConfiguration(<local file>); cfg.loadSEHRCfg("<host>", <port>)
search
- public SEHRConfiguration(java.lang.String file)
file
- Path and name of a configuration file which must be accessable
physicallypublic SEHRConfiguration(java.lang.String ip, int port)
Note: Finally you must have a physical read access to the file or to
a JNDI service to load the configuration. On WEB services 127.0.0.1/24100
is the default and you can use the simplified instantiation by using
SEHRConfiguration(true)
. This method is used in testing
environments...
ip
- IP or DNS of SEHR hostport
- SEHR Port (24100 by default)public SEHRConfigurationObject getSEHRConfigurationObject()
public void setSEHRConfigurationObject(SEHRConfigurationObject obj)
obj
- public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getSEHRCfgValue(java.lang.String key)
Note: There are a lot of getters of the configuration object. The configuration object is loaded on start up and represente the real running environment. N.B. Settings of the config file may be changed by command line.
key
- public boolean setSEHRCfgValue(java.lang.String key, java.lang.String value)
Note: There are a lot of config values...
key
- value
- public java.lang.String getModuleRoot()
public java.lang.String getModuleOwner()
public java.lang.String getLogfile()
public java.lang.String getTitle()
public java.lang.String getZoneID()
public int getZoneIDInt()
public void setZoneID(java.lang.String zoneid)
public java.lang.String getDomain()
public java.lang.String getSubdomain()
public java.lang.String getSERVERPort()
public java.lang.String getSEHRPort()
public java.lang.String getSEHRHost()
public java.lang.String getSERVERIP()
public java.lang.String getLANIP()
Due to the SEHR conventions the LAN IP should be build from SERVER IP otherwise the server would not work :)
public java.lang.String getFQNN()
public java.lang.String getURLSEHRAdminAsIP()
public java.lang.String getSMTPServer()
public java.lang.String getPOP3Server()
public java.lang.String getIMAPServer()
public java.lang.String getLDAPPort()
public void setLDAPPort(java.lang.String port)
public java.lang.String getLDAPBaseDN()
public void setLDAPBaseDN(java.lang.String basedn)
public java.lang.String getLDAPHost()
public void setLDAPHost(java.lang.String host)
public void setLDAPUser(java.lang.String user)
e.g. 'sehradmin'. The DN will be build later, e.g.
uid=sehradmin,ou=sehradmins,cn=people,o=zone\#0000000,dc=de,dc=e-hn,dc=org
user
- public java.lang.String getLDAPUser()
e.g. 'sehradmin'. To get the DN use getLDAPUserDN()
public void setLDAPUserDN(java.lang.String dn)
by example
uid=sehradmin,ou=sehradmins,cn=people,o=zone\#0000000,dc=de,dc=e-hn,dc=org
dn
- public java.lang.String getLDAPUserDN()
Example
uid=sehradmin,ou=sehradmins,cn=people,o=zone\#0000000,dc=de,dc=e-hn,dc=org
public void setLDAPUserPw(java.lang.String pw)
public java.lang.String getLDAPUserPw()
public void setLDAPCtx(java.lang.String ctx)
public java.lang.String getLDAPCtx()
public boolean isLDAP()
public java.lang.String getAMQBrokerURL()
public void setAMQBrokerURL(java.lang.String url)
public boolean isMessaging()
public java.lang.String getDebug()
public int getDebugInt()
public void setDebugLevel(int d)
public java.util.logging.Level getDebugLevel()
public static java.util.logging.Level getDebugLevel(int debuglevel)
See SEHR conventions for debugging details.
Note:This method
does not affect the changing of the debug level of the current session. It
is a convenience method to translate the given number to a 'Level' object.
debuglevel
- 0 (=none) to 9 (=detailed)public java.lang.String getdbSec()
public java.lang.String getdbHost()
public java.lang.String getdbHostname()
public java.lang.String getRootOID()
public void setRootOID(java.lang.String oid)
public void setdbHost(java.lang.String dbHost)
public java.lang.String getdbSecUser()
public void setdbSecUser(java.lang.String dbSecUser)
public java.lang.String getdbSecUserPw()
public void setdbSecUserPw(java.lang.String dbSecUserPw)
public java.sql.Connection getCon()
public void setCon(java.sql.Connection con)
con
- Set (store) the current connection handle to IntraSEC.public SEHRDataSource getFbds()
public SEHRDataSource getSEHRDataSource()
public void setFbds(SEHRDataSource fbds)
public void setSEHRDataSource(SEHRDataSource sehrds)
sehrds
- Set (store) the current SEHRDataSource instancepublic java.lang.String getSYSHOME()
public boolean setSYSHOME(java.lang.String absolutepath)
public java.lang.String getRunningCfgFile()
public SEHRConfigurationObject getRunningCfgObject()
getSEHRConfigurationObject()
public java.sql.Connection initDBConnection()
SEHRDataSource
Note: This is a simple, not pooled access to the zone database on the host. To use persistent transactions on WEB applications use a JNDI based datasource.
public boolean isSEHRCfgLoaded()
Use this method to check if the configuration is avbl. and the db 'intrasec' is accessable
public boolean isSEHRCfgProp()
public boolean loadSEHRCfg()
Use this method to get/init the SEHR configuration for all modules.
The configuration file is placed at 'path_to_sehrroot/etc/.sehr' by
convention. If the server has been started (with default or another
configuration file using option -c) the running configuration is stored as
'path_to_sehrroot/tmp/.running'.
This method tries to get the
running configuration using some methods to find it.
To use
another configuration file use
'loadSEHRCfg(fullpath_and_name)'
If the SEHR service host(ip and port)
is known use
'loadSEHRCfg(ip, port)'
If the SEHR module/client is
running on the same host (localhost) just use
'loadSEHRCfg('127.0.0.1',
port)'
Note:
Using this method to load the configuration there is
finally a physical request to a local configuration file.
public SEHRConfigurationObject getRuntimeSCO(java.lang.String host, int port)
Loads the settings from runtime configuration file. The returned object should be the same like the settings object from LDAP store.
host
- port
- public boolean loadSEHRCfg(java.lang.String host, int port)
This is a helper function to get the configuration from the LDAP context by requesting the running SEHR server using the params 'host' and 'port'. Use this method also to get settings of the SEHR zone like mail server, JMS broker. If there is no LDAP the SEHR service is not fully configured.
Note:A running SEHR OSI service is required to use this function!
Use getSEHRConfigurationObject()
to use the loaded settings.
host
- IP/DNS name of a running SEHR service hostport
- Port of the SEHR service (not the LDAP/J2EE context!)public java.lang.String getRuntimeValue(java.lang.String host, int port, java.lang.String key)
host
- port
- key
- The key for which the value is requestedpublic boolean loadSEHRCfg(java.lang.String f)
f
- String as path_and_name_to_cfg_filepublic boolean loadSEHRCfg(java.io.InputStream is)
public java.lang.String getCssfile()
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
public static boolean isNULLOrEmpty(java.lang.String s)
s
- public static java.lang.String trimnull(java.lang.String s)
The method is static so it can be used by other classes :)
s
- public void readSEHRCfgFileToProp(java.lang.String file) throws java.io.IOException
from modules use 'loadSEHRCfg()'
java.io.IOException
public boolean readSEHRCfgFile(java.lang.String file)
Use
file
- The configuration of the SEHR hostpublic void saveCfgFile(java.lang.String file) throws java.io.IOException
This method is used by the SEHRServer task to store the 'runnning' configuration and may be used by the user to redefine settings...
file
- java.io.IOException
public void initLogger()
public void initLogger(int debuglevel)
debuglevel
- public void initLogger(java.lang.String loggerid, int dl)
public java.util.logging.Logger getLogger()
public void logInfo(java.lang.String message)
public void logDebug(java.lang.String message)
public void logWarn(java.lang.String message)
public void logError(java.lang.String message)
message
- public java.io.File getIPWhitelistFh()
public java.io.File getIPBlacklistFh()
public static void main(java.lang.String[] args)