|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.ifeth.sehr.client.api.SEHRRemote
This is the basic layer to connect a GUI client by LAN or WAN to a SEHR host (server).
WEB based SEHR applications are based on servlets and running on the
same machine (host) as the SEHR service. So the serverside components do
have physical (file) access to the configuration of a SEHR server.
External (GUI) applications running on remote clients can not simply
read the configuration file on the host to retrieve settings for
accessing e.g. the mailservice, zone and medical databases.
This remote object therefore binds, connects and get the settings for
external clients.
Requirements and Connection:
bindSEHRServer(String, int, int)
connect()
It will be a useful practice to store the IP and port in a local
configuration file or batchfile as commandline parameters. In this case
no inside coding is required to connect a SEHR server. Once bind and
connected use getter methods to receive the SEHR host configuration. Use
some of the use-case methods to shorten up your coding, e.g. for user
authentication use
login2service(int, String, String, String)
.
SEHRConnectionDriverInterface
,
SEHRConnectionDriver
Field Summary | |
static java.util.logging.Logger |
Log
|
Fields inherited from interface org.ifeth.sehr.client.api.SEHRRemoteInterface |
DBPORT, DBUSER, DBUSERPASS, SEHRHOST, sehrkeyphrase, SEHRPORT |
Fields inherited from interface org.ifeth.sehr.client.api.SEHRConnectionDriverInterface |
COSTCONTROL_NONE, COSTCONTROL_TIME, COSTCONTROL_VOLUME, DRV_ASYNC, DRV_LAN, DRV_RAS, TYPE_ASYNC, TYPE_LAN, TYPE_RAS, TYPE_WLAN |
Constructor Summary | |
SEHRRemote()
Parameterless constructor. |
|
SEHRRemote(java.lang.String ip,
int port)
Constructor binding the client to a SEHR server using given IP and port by using the LAN driver (for LAN and permanent WAN connections) |
|
SEHRRemote(java.lang.String ip,
int port,
int typeofdriver)
Constructor binding the client to a SEHR server using IP, port and given SEHR driver |
|
SEHRRemote(java.lang.String ip,
int port,
java.lang.String driverclass)
Constructor binding the client to a SEHR server using given IP, Port and SEHR compatible driver as named class |
Method Summary | |
void |
bindSEHRServer(java.lang.String ip,
int port)
This method binds a client to a SEHR server using the LAN connection driver. |
void |
bindSEHRServer(java.lang.String ip,
int port,
int contype)
This method binds a client to a SEHR server using one of the implemented drivers depending on the type of connection. |
void |
bindSEHRServer(java.lang.String ip,
int port,
java.lang.String driverclass)
This method binds a client to a SEHR server using the given driver class to establish the physical connection Note: No physical IP connection is required at this point. |
static boolean |
CheckSEHRHostConnection(java.lang.String ip,
int port,
java.lang.String drv)
Static method to check if a SEHR host is available for requests. |
boolean |
connect()
This method establishes the connection between the client and the SEHR host. |
boolean |
connect(boolean keepalive)
This method establishes a socket connection to the SEHR host and loads the SEHR host settings |
java.sql.Connection |
connectIntraSEC()
Establish a connection to the zone database IntraSEC of a SEHR host. |
void |
connectionChanged(SEHRConnection c)
Notifies the listener that a connection status has changed, e.g. from 'used' to 'unused'. |
void |
connectionClosed(SEHRConnection c)
Notifies the listener that a connection is closed and going to be discarded. |
void |
connectionOpen(SEHRConnection c)
Notifies the listener that a connection is new or open. |
void |
disconnect()
Disconnects the physical transport layer (#0) Use this to cut the connection on expensive lines. |
double |
disconnect(int layer)
Disconnects the given connection layer |
ConnectionInfo |
getConinfo()
Returns information object about the physical connection (layer 0) |
java.util.Vector |
getConnectionLayers()
(Vector-)List of ConnectionInfo objects Each ConnectionInfo object represents a connection layer
including the object with id '0', the physical connection to a SEHR
host. |
java.lang.Object |
getConnectionObject(int layer)
|
int |
getConnectionStatus()
Returns the current connection status of the physical layer of the driver interface. |
int |
getConnectionTimeOut()
For informational usage: get current sec to wait for a C/S connection |
double |
getCurrentDuration()
Returns elapsed time of physical layer(0); this represents the remote connection itself |
double |
getCurrentDuration(int layer)
Returns elapsed time of a given layer(0); this represents e.g. a db connection on top of the pysical connection |
ConnectionDriver |
getDriver()
Get driver object used for the c/s connection |
java.util.logging.Logger |
getLog()
|
SEHRConnection |
getSEHRconnection(int idx)
Returns the SEHRconnection layer of the remote object for a given index |
java.util.Hashtable |
getSEHRHostProperties()
Get the received server settings as Hashtable |
java.lang.String |
getSEHRServerIP()
|
int |
getSEHRServerPort()
|
double |
getTotalConnectionTime(int layer)
|
SEHRDataSource |
initSEHRDataSource()
Initialize a new SEHRDataSource object on the SEHR host connection Use this to access a db on SEHR host e.g. by 'Java.sql' objects, DAOJdbc.DAOJdbc(SEHRDataSource) or other layers. |
boolean |
isConnected()
|
static boolean |
isNULLOrEmpty(java.lang.String s)
Check if a string is null or empty. |
boolean |
isSEHRService()
'true' if a (previous) connection was established successfully To test only if a connection can be established use static method
and give IP and port as parameters.
|
int |
login2service(int usrid,
java.lang.String login,
java.lang.String pw,
java.lang.String pik)
Simple login wrapper for checking user access against a SEHR service. |
int |
login2zone(java.lang.String usrname,
java.lang.String pw,
java.lang.String zoneid)
Simple login wrapper for checking user against a SEHR zone. |
static void |
main(java.lang.String[] args)
For testing purposes this class should be executed within the workspace Eclipse. |
boolean |
reconnect()
|
void |
setConnectionTimeOut(int msecs)
Set timeout in msecs to establish a connection (listensocket); |
void |
setDriver(ConnectionDriver driver)
Redefine or set an already defined driver to use for the c/s connection |
void |
setLog(java.util.logging.Logger log)
|
void |
setRASEntry(java.lang.String entry)
Set the RAS entry to dial |
void |
setRASPassword(java.lang.String pw)
Set the user's password to login at SEHR host |
void |
setRASUsername(java.lang.String username)
Set the user to login at SEHR host, e.g. for a RAS connection |
void |
setSEHRHostProperties(java.util.Hashtable sp)
|
void |
setSEHRServerIP(java.lang.String serverip)
|
void |
setSEHRServerPort(int serverport)
|
void |
setSEHRService(boolean isSEHRService)
|
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, toString, wait, wait, wait |
Field Detail |
public static java.util.logging.Logger Log
Constructor Detail |
public SEHRRemote()
bindSEHRServer(String, int)
public SEHRRemote(java.lang.String ip, int port)
public SEHRRemote(java.lang.String ip, int port, int typeofdriver)
public SEHRRemote(java.lang.String ip, int port, java.lang.String driverclass)
Method Detail |
public static boolean isNULLOrEmpty(java.lang.String s)
Note: The method is static so it can be used by other classes :)
public static java.lang.String trimNULL(java.lang.String s)
Note: The method is static so it can be used by other classes :)
public void bindSEHRServer(java.lang.String ip, int port, int contype)
Note:
No physical IP connection is required at this point. This
method just initialize the remote object for connections to the given
SEHR host by loading the driver and setting the connection params.
bindSEHRServer
in interface SEHRRemoteInterface
ip
- IP of SEHR host connect toport
- Port of SEHR service on hostpublic void bindSEHRServer(java.lang.String ip, int port, java.lang.String driverclass)
Note:
No physical IP connection is required at this point. This
method just initialize the remote object for connections to the given
SEHR host by loading the driver and setting the params.
bindSEHRServer
in interface SEHRRemoteInterface
ip
- IP of SEHR host connect toport
- Port of SEHR service on hostpublic void bindSEHRServer(java.lang.String ip, int port)
Note:
No physical IP connection is started at this point. This
method just initialize the remote object for connections to the given
SEHR host by LAN.
bindSEHRServer
in interface SEHRRemoteInterface
ip
- IP of SEHR host connect toport
- Port of SEHR service on hostpublic boolean connect()
Note: A physical IP connection will be established by this method.
connect
in interface SEHRRemoteInterface
public boolean connect(boolean keepalive)
public boolean reconnect()
public boolean isConnected()
public void disconnect()
Use this to cut the connection on expensive lines.
Note:
The field isSEHRService remain unchanged to keep the last status of
SEHR host connection.
public double disconnect(int layer)
public java.util.Vector getConnectionLayers()
Each ConnectionInfo
object represents a connection layer
including the object with id '0', the physical connection to a SEHR
host.
A client connection manager should iterate frequently through the list
to check if a data handler tells that a connection is not required any
longer ( closeRequest==true
). On this flag the handler
should check if there is sth. to do left and then free the connection
by setting the status to 0 (setStatud(0)
). The build
in remote cleaner then will remove the conenction the next time he
arrives on it.
public double getCurrentDuration()
public double getCurrentDuration(int layer)
public java.lang.Object getConnectionObject(int layer)
public int getConnectionStatus()
For the status codes see ConnectionConstants
public double getTotalConnectionTime(int layer)
public void connectionOpen(SEHRConnection c)
ConnectionListener
connectionOpen
in interface ConnectionListener
public void connectionClosed(SEHRConnection c)
ConnectionListener
connectionClosed
in interface ConnectionListener
public void connectionChanged(SEHRConnection c)
ConnectionListener
connectionChanged
in interface ConnectionListener
public java.util.Hashtable getSEHRHostProperties()
connect(boolean)
public void setSEHRHostProperties(java.util.Hashtable sp)
public SEHRDataSource initSEHRDataSource()
Use this to access a db on SEHR host e.g. by 'Java.sql' objects,
DAOJdbc.DAOJdbc(SEHRDataSource)
or other layers.
Note: A physical db connection is not required at this point.
initSEHRDataSource
in interface SEHRRemoteInterface
public java.sql.Connection connectIntraSEC()
Note: This method is not required if DAOJdbc is used.
public int login2service(int usrid, java.lang.String login, java.lang.String pw, java.lang.String pik)
To get the names and PIK of modules use
SEHRModules.listModules()
. For example build a menu to let
the user select a service, then get the PIK from vector list and check
with this method if user is allowed to use the service.
public int login2zone(java.lang.String usrname, java.lang.String pw, java.lang.String zoneid)
The current zoneid is read by
getSEHRHostProperties()
.
public static boolean CheckSEHRHostConnection(java.lang.String ip, int port, java.lang.String drv)
Note: This method connects to a SEHR host using the given driver class.
port
- port to connect on host; 'int' value >1024 (otherwise
24100 is set)
public java.lang.String getSEHRServerIP()
public void setSEHRServerIP(java.lang.String serverip)
public int getSEHRServerPort()
public void setSEHRServerPort(int serverport)
public ConnectionDriver getDriver()
public void setDriver(ConnectionDriver driver)
public ConnectionInfo getConinfo()
public SEHRConnection getSEHRconnection(int idx)
public boolean isSEHRService()
To test only if a connection can be established use static method
and give IP and port as parameters.
CheckSEHRHostConnection(String, int, String)
public void setSEHRService(boolean isSEHRService)
public void setRASEntry(java.lang.String entry)
public void setRASUsername(java.lang.String username)
public void setRASPassword(java.lang.String pw)
public int getConnectionTimeOut()
public void setConnectionTimeOut(int msecs)
public java.util.logging.Logger getLog()
public void setLog(java.util.logging.Logger log)
public static void main(java.lang.String[] args)
Instruction:
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |