com.ados.hestia.sdk.session
Class SessionManager

java.lang.Object
  extended by com.ados.hestia.sdk.session.SessionManager

public class SessionManager
extends Object

Manage Sessions. Usage. SessionManager smanager = new SessionManager(exchanger); smanager.start(); ................ smanager.stop();

Version:
$Revision: 1882 $Date: 2005/10/13 22:31:16 $

Nested Class Summary
protected  class SessionManager.SessionManagerThread
           
 
Field Summary
protected  MessageExchanger m_exchanger
           
protected  SessionProcessor m_processor
           
protected  SessionManager.SessionManagerThread m_thread
           
 
Constructor Summary
SessionManager(MessageExchanger exchanger)
          Default constructor.
SessionManager(MessageExchanger exchanger, SessionProcessor processor)
          Create manager over specific processor.
 
Method Summary
 void accept(SessionKey session)
          Accept specific session.
 SessionKey create(String partner, String eis, ServiceContent content, Attachment[] attachments)
          Allocate new initiation session.
 void deleteSession(SessionKey sessionKey)
          Delete one specific session
 void deleteSessions(SessionKey[] sessionKeies)
          Delete array of Sessions.
 SessionKey[] getActive()
          Return array of Session descriptions which are not finished.
 SessionKey[] getError()
          Return array of Session descriptions which are at error state.
 SessionKey[] getFinished()
          Return array of Session descriptions which are finished.
 SessionKey[] getForAccept(String pipId, String partner)
          Return array of Session descriptions which are awaiting accepting or rejection.
 SessionKey[] getForResponse(String pipId, String partner)
          Return array of Session descriptions which are awaiting response.
 Session getSession(SessionKey sessionKey)
          Extract Session which is specified by key.
protected  void hit()
          Periodically called by supporting thread.
protected  void onError(Object error)
          Handle error situation.
protected  void processArrived()
          Process arrived messaged.
protected  void processArrived(Container container)
          Process specific arrived message.
protected  void processArrived(int maxToReceive)
           
protected  void processReadyToSendContainer(boolean payload)
          Process ready to send to partner Containers of specific type.
protected  void processReadyToSendMessage()
          Process ready to send to partner PayloadContainers.
protected  void processReadyToSendStatus()
          Process ready to send to partner StatusContainers.
 void reject(SessionKey session, String reason)
          Reject specific session.
 void response(SessionKey session, ServiceContent content, Attachment[] attachments)
          Make response for specific session.
 void start()
          Start manager.
 void stop()
          Stop manager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_exchanger

protected MessageExchanger m_exchanger

m_processor

protected SessionProcessor m_processor

m_thread

protected SessionManager.SessionManagerThread m_thread
Constructor Detail

SessionManager

public SessionManager(MessageExchanger exchanger)
Default constructor. Sessions will be stored over local HSQL DB.

Parameters:
exchanger - - specify exchanger to communicate with Hestia Server.

SessionManager

public SessionManager(MessageExchanger exchanger,
                      SessionProcessor processor)
Create manager over specific processor.

Parameters:
processor - specify DB to store sessions entry.
exchanger - specify exchanger to communicate with Hestia Server.
Method Detail

start

public void start()
Start manager.


stop

public void stop()
Stop manager.


getSession

public Session getSession(SessionKey sessionKey)
                   throws CollectorException
Extract Session which is specified by key.

Parameters:
sessionKey - specify which Session to extract.
Returns:
extracted Session which is specified by key.
Throws:
CollectorException - if db operation cannot be peformed.

create

public SessionKey create(String partner,
                         String eis,
                         ServiceContent content,
                         Attachment[] attachments)
                  throws CollectorException
Allocate new initiation session.

Parameters:
partner - specify remote partner identifier.
eis - specify eis identifier.
content - content of initiation message.
attachments - optional parameter if initiating message has attachments.
Returns:
session description for newly created Session.
Throws:
CollectorException - if db operation cannot be peformed.

getForAccept

public SessionKey[] getForAccept(String pipId,
                                 String partner)
                          throws CollectorException
Return array of Session descriptions which are awaiting accepting or rejection.

Parameters:
pipId - optional parameter to filter only specific pips. For example 0C1.
partner - optional parameter to filter Sessions only from specific partner.
Returns:
array of Session descriptions which are awaiting accepting or rejection.
Throws:
CollectorException - if db operation cannot be peformed.

accept

public void accept(SessionKey session)
            throws CollectorException
Accept specific session. This method should be called only for returned at getForAccept call.

Parameters:
session - specify session for accepting.
Throws:
CollectorException - if db operation cannot be peformed.

reject

public void reject(SessionKey session,
                   String reason)
            throws CollectorException
Reject specific session. This method should be called only for returned at getForAccept call.

Parameters:
session - specify session for reject.
reason - specify reason why session is not accepted.
Throws:
CollectorException - if db operation cannot be peformed.

getForResponse

public SessionKey[] getForResponse(String pipId,
                                   String partner)
                            throws CollectorException
Return array of Session descriptions which are awaiting response.

Parameters:
pipId - optional parameter to filter only specific pips. For example 0C1.
partner - optional parameter to filter Sessions only from specific partner.
Returns:
array of Session descriptions which are awaiting response.
Throws:
CollectorException - if db operation cannot be peformed.

response

public void response(SessionKey session,
                     ServiceContent content,
                     Attachment[] attachments)
              throws CollectorException
Make response for specific session. This method should be called only for returned at getForResponse call.

Parameters:
session - specify session for response.
content - response content.
attachments - optional parameter if repsonse has attachments.
Throws:
CollectorException - if db operation cannot be peformed.

getActive

public SessionKey[] getActive()
                       throws CollectorException
Return array of Session descriptions which are not finished.

Returns:
array of Sessions which are not finished.
Throws:
CollectorException - if db operation cannot be peformed.

getFinished

public SessionKey[] getFinished()
                         throws CollectorException
Return array of Session descriptions which are finished.

Returns:
array of Sessions which are finished.
Throws:
CollectorException - if db operation cannot be peformed.

getError

public SessionKey[] getError()
                      throws CollectorException
Return array of Session descriptions which are at error state.

Returns:
array of Sessions which are at error state.
Throws:
CollectorException - if db operation cannot be peformed.

deleteSession

public void deleteSession(SessionKey sessionKey)
                   throws CollectorException
Delete one specific session

Parameters:
sessionKey - session description of session to delete
Throws:
CollectorException - if db operation cannot be peformed.

deleteSessions

public void deleteSessions(SessionKey[] sessionKeies)
                    throws CollectorException
Delete array of Sessions.

Parameters:
sessionKeies - specify which sessions should be deleted.
Throws:
CollectorException - if db operation cannot be peformed.

hit

protected void hit()
Periodically called by supporting thread.


processReadyToSendMessage

protected void processReadyToSendMessage()
Process ready to send to partner PayloadContainers.


processReadyToSendStatus

protected void processReadyToSendStatus()
Process ready to send to partner StatusContainers.


processReadyToSendContainer

protected void processReadyToSendContainer(boolean payload)
Process ready to send to partner Containers of specific type.

Parameters:
payload - true if PayloadContainers should be processed.

processArrived

protected void processArrived()
                       throws IOException,
                              MessageException,
                              TransactionException
Process arrived messaged.

Throws:
MessageException
IOException
TransactionException

processArrived

protected void processArrived(int maxToReceive)
                       throws IOException,
                              MessageException,
                              TransactionException
Throws:
IOException
MessageException
TransactionException

processArrived

protected void processArrived(Container container)
                       throws Throwable
Process specific arrived message.

Parameters:
container - specify message to process.
Throws:
Throwable - if logical error occured.

onError

protected void onError(Object error)
Handle error situation.

Parameters:
error - error description.


Copyright © 2005-2006 ADOS Co.,Ltd.. All Rights Reserved.