net.sf.jradius.session
Class JRadiusSessionManager

java.lang.Object
  extended by net.sf.jradius.session.JRadiusSessionManager

public class JRadiusSessionManager
extends java.lang.Object

Maintains an in-memory cache of sessions. Sessions are stored in a Map. Keys are created by a SessionKeyProvider while sessions are created by a SessionFactory.

Author:
Gert Jan Verhoog, David Bird

Constructor Summary
JRadiusSessionManager()
          Creates a new JRadiusSessionManager instance.
 
Method Summary
static JRadiusSessionManager getManager()
          There is a single JRadiusSessionManager available that is accessible through this method.
 int getMaxInactiveInterval()
           
 int getMinInterimInterval()
           
 JRadiusSession getSession(JRadiusRequest request)
          Returns a session object.
 JRadiusSession getSession(JRadiusRequest request, java.io.Serializable key)
           
 SessionFactory getSessionFactory(java.lang.Object name)
          returns the session manager's session factory
 SessionKeyProvider getSessionKeyProvider(java.lang.Object name)
          returns the session manager's key provider
 RadiusLogEntry newLogEntry(JRadiusEvent event, JRadiusSession session, java.lang.String packetId)
           
 JRadiusSession newSession(JRadiusRequest request, java.lang.Object key)
           
 void putSession(JRadiusSession session)
           
 void rehashSession(JRadiusSession session, java.io.Serializable okey, java.io.Serializable nkey)
           
 void removeSession(JRadiusSession session)
           
 void setMaxInactiveInterval(int maxInactiveInterval)
           
 void setMinInterimInterval(int minInterimInterval)
           
 void setSessionFactory(java.lang.String name, SessionFactory factory)
          Sets the session factory for this session manager.
 void setSessionKeyProvider(java.lang.String name, SessionKeyProvider provider)
          Sets the key provider for this session manager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JRadiusSessionManager

public JRadiusSessionManager()
Creates a new JRadiusSessionManager instance. This sets the key provider and session factory to the DefaultSessionKeyProvider and RadiusSessionFactory, respectively

Method Detail

getManager

public static JRadiusSessionManager getManager()
There is a single JRadiusSessionManager available that is accessible through this method. Using the default application-wide manager is sufficient for most uses. For specific needs, it is possible to create a new JRadiusSessionManager object.

Returns:
the default JRadiusSessionManager instance

setSessionKeyProvider

public void setSessionKeyProvider(java.lang.String name,
                                  SessionKeyProvider provider)
Sets the key provider for this session manager. The key provider generates a key to store a session with. The key is generated based on a JRadiusRequest that is passed to the key provider's getSessionKey method. Keys are used to retrieve stored sessions from the session manager.

Parameters:
name - The name of the SessionKeyProvider (null for default)
provider - The SessionKeyProvider
See Also:
SessionKeyProvider

setSessionFactory

public void setSessionFactory(java.lang.String name,
                              SessionFactory factory)
Sets the session factory for this session manager. The session factory generates a new session object, possibly initialized based on values of a JRadiusRequest.

Parameters:
name - The name of the SessionFactory (null for default)
factory - a SessionFactory
See Also:
SessionFactory

getSessionKeyProvider

public SessionKeyProvider getSessionKeyProvider(java.lang.Object name)
returns the session manager's key provider

Parameters:
name - The name of the SessionKeyProvider (null for default)
Returns:
the session manager's key provider

getSessionFactory

public SessionFactory getSessionFactory(java.lang.Object name)
returns the session manager's session factory

Parameters:
name - The name of the SessionFactory (null for default)
Returns:
the session manager's session factory

getSession

public JRadiusSession getSession(JRadiusRequest request)
                          throws RadiusException
Returns a session object. First, a key is generated by the session manager's key provider, based on the JRadiusRequest. If there is a stored session based on the key, this session is returned, otherwise a new session created by the session factory is returned

Parameters:
request - a JRadiusRequest used to retrieve or generate a session with
Returns:
Returns a RadiusSession
Throws:
RadiusException

rehashSession

public void rehashSession(JRadiusSession session,
                          java.io.Serializable okey,
                          java.io.Serializable nkey)
                   throws RadiusException
Throws:
RadiusException

newSession

public JRadiusSession newSession(JRadiusRequest request,
                                 java.lang.Object key)
                          throws RadiusException
Throws:
RadiusException

getSession

public JRadiusSession getSession(JRadiusRequest request,
                                 java.io.Serializable key)
                          throws RadiusException
Throws:
RadiusException

putSession

public void putSession(JRadiusSession session)

newLogEntry

public RadiusLogEntry newLogEntry(JRadiusEvent event,
                                  JRadiusSession session,
                                  java.lang.String packetId)

removeSession

public void removeSession(JRadiusSession session)

getMaxInactiveInterval

public int getMaxInactiveInterval()

setMaxInactiveInterval

public void setMaxInactiveInterval(int maxInactiveInterval)

getMinInterimInterval

public int getMinInterimInterval()

setMinInterimInterval

public void setMinInterimInterval(int minInterimInterval)


Copyright © 2006 The JRadius Project, All Rights Reserved.