org.ifeth.sehr.client.api
Class SessionHandler

java.lang.Object
  extended byorg.ifeth.sehr.client.api.SEHRRemote
      extended byorg.ifeth.sehr.client.api.SessionHandler
All Implemented Interfaces:
ConnectionListener, SEHRConnectionDriverInterface, SEHRRemoteInterface

public class SessionHandler
extends SEHRRemote
implements SEHRRemoteInterface

Session and remote connection object.

This class extends SEHRRemote object to make the SEHR-API more comfortable. SEHR GUI applications should use this SEHRRemote object instance to handle the connection.
A session commonly starts with the 'binding' followed by 'connect'. A session ends by using 'close' or 'shutdown'. The 'shutdown' closes all connections and exits the application.
Note: 'Don't use 'disconnect'; this may destroy ongoing transfers. The 'close' method let the background SEHR thread close the connection after finishing transfers.

Author:
hansjhaase

Field Summary
static java.util.logging.Logger Log
           
 java.util.Vector netservices
           
 java.util.TreeMap sehrcategories
           
 java.util.Vector usrservices
          Runtime cache of SEHR user services
 
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
SessionHandler(java.lang.Object model)
          Constructor initializing a session object.
 
Method Summary
 void bindSEHRServer()
          Binds session to SEHR service in host either by RAS or LAN
 void close()
          Close session but keep application alive until all transfers are made.
 boolean connect()
          Connect to server using defined ip and port and receive settings
 void exit()
          Just a handy method, same as shutdown()
 java.lang.String getAccount()
           
 java.lang.Object getModel()
          Get model object...
 java.lang.String getPassword()
           
 SEHRServices getSEHRServicesObject()
          Get an instance of the SEHRService object itself
 java.lang.String getUser()
           
 java.util.Vector getUserServices()
          Get a list of services of the logged in user
 int getUsrid()
           
 boolean isAuthenticated()
           
 boolean isConnection()
          Checks connection state
 boolean isDial()
          Get the flag if 'LAN' or 'RAS'
 boolean isDirtyTransfer()
          Get the flag if sth. to transfer is marked
 void setAccount(java.lang.String account)
           
 void setAuthenticated(boolean isAuthenticated)
           
 void setConnection(boolean b)
          Flags manually the connection state; set this only if you're shure
 void setDial(boolean isDial)
          Set connection type 'LAN' or 'RAS'(dial=true) for running mode
 void setDirtyTransfer(boolean dirtyTransfer)
          Set the flag to mark that there is sth. to transfer
 void setPassword(java.lang.String pw)
           
 void setUser(java.lang.String user)
           
 void setUsrid(int usrid)
           
 void shutdown()
          Close application like 'close' but listen to thread and display splash.
 void startSessionListener()
           
 
Methods inherited from class org.ifeth.sehr.client.api.SEHRRemote
bindSEHRServer, bindSEHRServer, bindSEHRServer, CheckSEHRHostConnection, connect, connectIntraSEC, connectionChanged, connectionClosed, connectionOpen, disconnect, disconnect, getConinfo, getConnectionLayers, getConnectionObject, getConnectionStatus, getConnectionTimeOut, getCurrentDuration, getCurrentDuration, getDriver, getLog, getSEHRconnection, getSEHRHostProperties, getSEHRServerIP, getSEHRServerPort, getTotalConnectionTime, initSEHRDataSource, isConnected, isNULLOrEmpty, isSEHRService, login2service, login2zone, main, reconnect, setConnectionTimeOut, setDriver, setLog, setRASEntry, setRASPassword, setRASUsername, setSEHRHostProperties, setSEHRServerIP, setSEHRServerPort, setSEHRService, trimNULL
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.ifeth.sehr.client.api.SEHRRemoteInterface
bindSEHRServer, bindSEHRServer, bindSEHRServer, initSEHRDataSource
 

Field Detail

usrservices

public java.util.Vector usrservices
Runtime cache of SEHR user services


netservices

public java.util.Vector netservices

sehrcategories

public java.util.TreeMap sehrcategories

Log

public static java.util.logging.Logger Log
Constructor Detail

SessionHandler

public SessionHandler(java.lang.Object model)
Constructor initializing a session object.

Method Detail

startSessionListener

public void startSessionListener()

bindSEHRServer

public void bindSEHRServer()
Binds session to SEHR service in host either by RAS or LAN


connect

public boolean connect()
Description copied from interface: SEHRRemoteInterface
Connect to server using defined ip and port and receive settings

Specified by:
connect in interface SEHRRemoteInterface
Overrides:
connect in class SEHRRemote

isConnection

public boolean isConnection()
Checks connection state

Returns:
true if connected

setConnection

public void setConnection(boolean b)
Flags manually the connection state; set this only if you're shure


isDial

public boolean isDial()
Get the flag if 'LAN' or 'RAS'


setDial

public void setDial(boolean isDial)
Set connection type 'LAN' or 'RAS'(dial=true) for running mode


getModel

public java.lang.Object getModel()
Get model object... The 'M' object of the MVC architecture that contains the business process


getUsrid

public int getUsrid()

setUsrid

public void setUsrid(int usrid)

getUser

public java.lang.String getUser()

setUser

public void setUser(java.lang.String user)

setPassword

public void setPassword(java.lang.String pw)

getPassword

public java.lang.String getPassword()

getAccount

public java.lang.String getAccount()

setAccount

public void setAccount(java.lang.String account)

isAuthenticated

public boolean isAuthenticated()

setAuthenticated

public void setAuthenticated(boolean isAuthenticated)

getSEHRServicesObject

public SEHRServices getSEHRServicesObject()
Get an instance of the SEHRService object itself


getUserServices

public java.util.Vector getUserServices()
Get a list of services of the logged in user

Returns:
Vector_list List of services as vector object

isDirtyTransfer

public boolean isDirtyTransfer()
Get the flag if sth. to transfer is marked


setDirtyTransfer

public void setDirtyTransfer(boolean dirtyTransfer)
Set the flag to mark that there is sth. to transfer


close

public void close()
Close session but keep application alive until all transfers are made.

Note: Use shutdown()to close session and application.


exit

public void exit()
Just a handy method, same as shutdown()


shutdown

public void shutdown()
Close application like 'close' but listen to thread and display splash.