org.yawlfoundation.yawl.util
Class Sessions

java.lang.Object
  extended by org.yawlfoundation.yawl.util.Sessions

public class Sessions
extends Object

A generic session manager utility that can be used by custom services to allow connections from any service or client application that has been registered in the engine.

Author:
Michael Adams
Created/Last Date:
9/11/11

Constructor Summary
Sessions()
          Constructs a new Sessions object
Sessions(String iaURI, String iaUserid, String iaPassword)
          Constructs a new Sessions object, and uses the parameters passed to connect to the engine via Interface A so that the registered services' and client applications' credentials can be retrieved.
 
Method Summary
 boolean checkConnection(String handle)
          Checks that a session handle is valid and active (i.e.
 String connect(String userid, String password)
          Attempts to establish a session using the credentials passed
 boolean disconnect(String handle)
          Ends a session
 void setupInterfaceA(String iaURI, String iaUserid, String iaPassword)
          Uses the parameters passed to connect to the engine via Interface A so that the registered services' and client applications' credentials can be retrieved.
 void shutdown()
          Cancels all current sessions and their inactivity timers.
 boolean uncacheCredentials(String userid)
          Removes a userid/password pair from the local cache (e.g.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Sessions

public Sessions()
Constructs a new Sessions object


Sessions

public Sessions(String iaURI,
                String iaUserid,
                String iaPassword)
Constructs a new Sessions object, and uses the parameters passed to connect to the engine via Interface A so that the registered services' and client applications' credentials can be retrieved.

Parameters:
iaURI - The URI of the engine's Interface A
iaUserid - the userid of the registered service or client app calling this method
iaPassword - the password of the registered service or client app calling this method
Method Detail

setupInterfaceA

public void setupInterfaceA(String iaURI,
                            String iaUserid,
                            String iaPassword)
Uses the parameters passed to connect to the engine via Interface A so that the registered services' and client applications' credentials can be retrieved. Note this method must be called before any sessions can be authenticated

Parameters:
iaURI - The URI of the engine's Interface A
iaUserid - the userid of the registered service or client app calling this method
iaPassword - the password of the registered service or client app calling this method

shutdown

public void shutdown()
Cancels all current sessions and their inactivity timers. Usually called from Servlet#destroy


connect

public String connect(String userid,
                      String password)
Attempts to establish a session using the credentials passed

Parameters:
userid - the userid of a registered service or client application
password - the corresponding password
Returns:
a session handle if successful, or a diagnostic error if not (incl. unknown userid, invalid password, invalid or missing Interface A credentials, or other problems connecting to the engine or retrieving registered credentials)

checkConnection

public boolean checkConnection(String handle)
Checks that a session handle is valid and active (i.e. has not timed out through inactivity)

Parameters:
handle - the session handle to check
Returns:
true if the session handle is known and active, false otherwise

disconnect

public boolean disconnect(String handle)
Ends a session

Parameters:
handle - the session handle to cancel
Returns:
true if the session handle was known and valid, and has now been disconnected, false if the handle was already disconnected

uncacheCredentials

public boolean uncacheCredentials(String userid)
Removes a userid/password pair from the local cache (e.g. in the event that the password has been changed in the engine)

Parameters:
userid - the userid to clear
Returns:
true if the userid was in the cache


Copyright © 2004-2012 The YAWL Foundation.