com.metamatrix.platform.security.session.service
Class SessionServiceImpl

java.lang.Object
  extended by com.metamatrix.platform.security.session.service.SessionServiceImpl
All Implemented Interfaces:
ApplicationService, SessionServiceInterface

public class SessionServiceImpl
extends java.lang.Object
implements SessionServiceInterface

This class serves as the primary implementation of the Session Service.


Field Summary
 
Fields inherited from interface com.metamatrix.platform.security.api.service.SessionServiceInterface
DEFAULT_MAX_SESSIONS, DEFAULT_SESSION_EXPIRATION, MAX_SESSIONS, NAME, SESSION_EXPIRATION
 
Constructor Summary
SessionServiceImpl()
           
 
Method Summary
 void closeSession(MetaMatrixSessionID sessionID)
          Closes the specified session.
 MetaMatrixSessionInfo createSession(java.lang.String userName, Credentials credentials, java.io.Serializable trustedToken, java.lang.String applicationName, java.util.Properties properties)
          Create a session for the given user authenticating against the given Credentials.
 java.util.Collection<MetaMatrixSessionInfo> getActiveSessions()
          Get the collection of active user sessions on the system.
 int getActiveSessionsCount()
          Get the number of active user sessions on the system.
 MetaMatrixPrincipal getPrincipal(MetaMatrixSessionID sessionID)
          Returns a MetaMatrixPrincipal object describing the owner (user) of the indicated session.
 java.util.Collection<MetaMatrixSessionInfo> getSessionsLoggedInToVDB(java.lang.String VDBName, java.lang.String VDBVersion)
          Get all MetaMatrixSessionIDs that are in the ACTIVE state and currently logged in to a VDB.
 VDBService getVdbService()
           
 void initialize(java.util.Properties props)
          Initialize the service with the specified properties.
 void pingServer(MetaMatrixSessionID sessionID)
          Periodically called by the client to indicate the client is still alive.
 void register(SessionListener listener)
          Register a session listener
 void setDqpCore(org.teiid.dqp.internal.process.DQPCore dqpCore)
           
 void setMembershipService(MembershipServiceInterface membershipService)
           
 void setVdbService(VDBService vdbService)
           
 void start(ApplicationEnvironment environment)
          Start the service with the specified environment.
 void stop()
          Stop the service.
 boolean terminateSession(MetaMatrixSessionID terminatedSessionID, MetaMatrixSessionID adminSessionID)
          Terminates the specified session.
 MetaMatrixSessionInfo validateSession(MetaMatrixSessionID sessionID)
          This method is intended to verify that the session is valid, and, if need be, set the session in an active state, ready to be used.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SessionServiceImpl

public SessionServiceImpl()
Method Detail

closeSession

public void closeSession(MetaMatrixSessionID sessionID)
                  throws InvalidSessionException
Description copied from interface: SessionServiceInterface
Closes the specified session.

Specified by:
closeSession in interface SessionServiceInterface
Parameters:
sessionID - The MetaMatrixSessionID identifying user's session to be closed
Throws:
InvalidSessionException - If sessionID identifies an invalid session

createSession

public MetaMatrixSessionInfo createSession(java.lang.String userName,
                                           Credentials credentials,
                                           java.io.Serializable trustedToken,
                                           java.lang.String applicationName,
                                           java.util.Properties properties)
                                    throws MetaMatrixAuthenticationException,
                                           SessionServiceException
Description copied from interface: SessionServiceInterface
Create a session for the given user authenticating against the given Credentials.

Specified by:
createSession in interface SessionServiceInterface
Throws:
MetaMatrixAuthenticationException
SessionServiceException

getActiveSessions

public java.util.Collection<MetaMatrixSessionInfo> getActiveSessions()
                                                              throws SessionServiceException
Description copied from interface: SessionServiceInterface
Get the collection of active user sessions on the system.

Specified by:
getActiveSessions in interface SessionServiceInterface
Returns:
The collection of MetaMatrixSessionInfo objects of active users on the system - possibly empty, never null.
Throws:
SessionServiceException

getActiveSessionsCount

public int getActiveSessionsCount()
                           throws SessionServiceException
Description copied from interface: SessionServiceInterface
Get the number of active user sessions on the system.

Specified by:
getActiveSessionsCount in interface SessionServiceInterface
Returns:
int
Throws:
SessionServiceException

getPrincipal

public MetaMatrixPrincipal getPrincipal(MetaMatrixSessionID sessionID)
                                 throws InvalidSessionException,
                                        SessionServiceException
Description copied from interface: SessionServiceInterface
Returns a MetaMatrixPrincipal object describing the owner (user) of the indicated session.

Specified by:
getPrincipal in interface SessionServiceInterface
Parameters:
sessionID - MetaMatrixSessionID representing the session
Returns:
MetaMatrixPrincipal object describing the owner of the indicated session.
Throws:
InvalidSessionException
SessionServiceException

getSessionsLoggedInToVDB

public java.util.Collection<MetaMatrixSessionInfo> getSessionsLoggedInToVDB(java.lang.String VDBName,
                                                                            java.lang.String VDBVersion)
                                                                     throws SessionServiceException
Description copied from interface: SessionServiceInterface
Get all MetaMatrixSessionIDs that are in the ACTIVE state and currently logged in to a VDB.

Specified by:
getSessionsLoggedInToVDB in interface SessionServiceInterface
Parameters:
VDBName - The name of the VDB.
VDBVersion - The version of the VDB.
Throws:
SessionServiceException - when transaction with database fails or unexpected exception happens

pingServer

public void pingServer(MetaMatrixSessionID sessionID)
                throws InvalidSessionException
Description copied from interface: SessionServiceInterface
Periodically called by the client to indicate the client is still alive.

Specified by:
pingServer in interface SessionServiceInterface
Parameters:
sessionID - - identifies the client
Throws:
InvalidSessionException

terminateSession

public boolean terminateSession(MetaMatrixSessionID terminatedSessionID,
                                MetaMatrixSessionID adminSessionID)
Description copied from interface: SessionServiceInterface
Terminates the specified session. This is an administrative action.

Specified by:
terminateSession in interface SessionServiceInterface
Parameters:
terminatedSessionID - The MetaMatrixSessionID identifying user's session to be terminated
adminSessionID - The session id identifying session of administrator

validateSession

public MetaMatrixSessionInfo validateSession(MetaMatrixSessionID sessionID)
                                      throws InvalidSessionException,
                                             SessionServiceException
Description copied from interface: SessionServiceInterface
This method is intended to verify that the session is valid, and, if need be, set the session in an active state, ready to be used.

Specified by:
validateSession in interface SessionServiceInterface
Parameters:
sessionID - MetaMatrixSessionID representing the session
Returns:
SessionToken object identifying the session
Throws:
InvalidSessionException - If sessionID identifies an invalid session
SessionServiceException

setMembershipService

public void setMembershipService(MembershipServiceInterface membershipService)

setDqpCore

public void setDqpCore(org.teiid.dqp.internal.process.DQPCore dqpCore)

initialize

public void initialize(java.util.Properties props)
                throws ApplicationInitializationException
Description copied from interface: ApplicationService
Initialize the service with the specified properties.

Specified by:
initialize in interface ApplicationService
Parameters:
props - Initialialization properties
Throws:
ApplicationInitializationException - If an error occurs during initialization

start

public void start(ApplicationEnvironment environment)
           throws ApplicationLifecycleException
Description copied from interface: ApplicationService
Start the service with the specified environment. The environment can be used to find other services or resources.

Specified by:
start in interface ApplicationService
Parameters:
environment - Environment
Throws:
ApplicationLifecycleException - If an error occurs while starting

stop

public void stop()
          throws ApplicationLifecycleException
Description copied from interface: ApplicationService
Stop the service.

Specified by:
stop in interface ApplicationService
Throws:
ApplicationLifecycleException - If an error occurs while starting

setVdbService

public void setVdbService(VDBService vdbService)

getVdbService

public VDBService getVdbService()

register

public void register(SessionListener listener)
Description copied from interface: SessionServiceInterface
Register a session listener

Specified by:
register in interface SessionServiceInterface


Copyright © 2009. All Rights Reserved.