net.jradius.session
Class JRadiusSessionManager

java.lang.Object
  extended by net.jradius.session.JRadiusSessionManager
All Implemented Interfaces:
java.lang.Cloneable, net.sf.ehcache.event.CacheEventListener, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware

public class JRadiusSessionManager
extends java.lang.Object
implements org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware, net.sf.ehcache.event.CacheEventListener


Constructor Summary
JRadiusSessionManager()
          Creates a new JRadiusSessionManager instance.
 
Method Summary
 void afterPropertiesSet()
           
 java.lang.Object clone()
           
 void dispose()
           
 org.springframework.context.ApplicationContext getApplicationContext()
           
 net.sf.ehcache.CacheManager getCacheManager()
           
 java.lang.String getCacheName()
           
static JRadiusSessionManager getManager(java.lang.Object name)
          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)
           
 net.sf.ehcache.Ehcache getSessionCache()
           
 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
 void lock(JRadiusSession session)
           
 JRadiusLogEntry newLogEntry(JRadiusEvent event, JRadiusSession session, java.lang.String packetId)
           
 JRadiusSession newSession(JRadiusRequest request, java.lang.Object key)
           
 void notifyElementEvicted(net.sf.ehcache.Ehcache cache, net.sf.ehcache.Element element)
           
 void notifyElementExpired(net.sf.ehcache.Ehcache cache, net.sf.ehcache.Element element)
           
 void notifyElementPut(net.sf.ehcache.Ehcache cache, net.sf.ehcache.Element element)
           
 void notifyElementRemoved(net.sf.ehcache.Ehcache cache, net.sf.ehcache.Element element)
           
 void notifyElementUpdated(net.sf.ehcache.Ehcache cache, net.sf.ehcache.Element element)
           
 void notifyRemoveAll(net.sf.ehcache.Ehcache cache)
           
 void rehashSession(JRadiusSession session, java.io.Serializable okey, java.io.Serializable nkey)
           
 void removeSession(JRadiusSession session)
           
 void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
           
 void setCacheManager(net.sf.ehcache.CacheManager cacheManager)
           
 void setCacheName(java.lang.String cacheName)
           
 void setEventDispatcher(EventDispatcher eventDispatcher)
           
static JRadiusSessionManager setManager(java.lang.String name, JRadiusSessionManager manager)
           
 void setMaxInactiveInterval(int maxInactiveInterval)
           
 void setMinInterimInterval(int minInterimInterval)
           
 void setSessionCache(net.sf.ehcache.Cache sessionCache)
           
 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.
 void shutdown()
           
static void shutdownManagers()
           
 void unlock(JRadiusSession session)
           
 
Methods inherited from class java.lang.Object
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(java.lang.Object name)
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

setManager

public static JRadiusSessionManager setManager(java.lang.String name,
                                               JRadiusSessionManager manager)

shutdownManagers

public static void shutdownManagers()

shutdown

public void shutdown()

afterPropertiesSet

public void afterPropertiesSet()
                        throws java.lang.Exception
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
java.lang.Exception

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

lock

public void lock(JRadiusSession session)

unlock

public void unlock(JRadiusSession session)

newLogEntry

public JRadiusLogEntry 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)

getCacheManager

public net.sf.ehcache.CacheManager getCacheManager()

setCacheManager

public void setCacheManager(net.sf.ehcache.CacheManager cacheManager)

getCacheName

public java.lang.String getCacheName()

setCacheName

public void setCacheName(java.lang.String cacheName)

dispose

public void dispose()
Specified by:
dispose in interface net.sf.ehcache.event.CacheEventListener

notifyElementEvicted

public void notifyElementEvicted(net.sf.ehcache.Ehcache cache,
                                 net.sf.ehcache.Element element)
Specified by:
notifyElementEvicted in interface net.sf.ehcache.event.CacheEventListener

notifyElementExpired

public void notifyElementExpired(net.sf.ehcache.Ehcache cache,
                                 net.sf.ehcache.Element element)
Specified by:
notifyElementExpired in interface net.sf.ehcache.event.CacheEventListener

notifyElementPut

public void notifyElementPut(net.sf.ehcache.Ehcache cache,
                             net.sf.ehcache.Element element)
                      throws net.sf.ehcache.CacheException
Specified by:
notifyElementPut in interface net.sf.ehcache.event.CacheEventListener
Throws:
net.sf.ehcache.CacheException

notifyElementRemoved

public void notifyElementRemoved(net.sf.ehcache.Ehcache cache,
                                 net.sf.ehcache.Element element)
                          throws net.sf.ehcache.CacheException
Specified by:
notifyElementRemoved in interface net.sf.ehcache.event.CacheEventListener
Throws:
net.sf.ehcache.CacheException

notifyElementUpdated

public void notifyElementUpdated(net.sf.ehcache.Ehcache cache,
                                 net.sf.ehcache.Element element)
                          throws net.sf.ehcache.CacheException
Specified by:
notifyElementUpdated in interface net.sf.ehcache.event.CacheEventListener
Throws:
net.sf.ehcache.CacheException

notifyRemoveAll

public void notifyRemoveAll(net.sf.ehcache.Ehcache cache)
Specified by:
notifyRemoveAll in interface net.sf.ehcache.event.CacheEventListener

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Specified by:
clone in interface net.sf.ehcache.event.CacheEventListener
Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException

getSessionCache

public net.sf.ehcache.Ehcache getSessionCache()

setSessionCache

public void setSessionCache(net.sf.ehcache.Cache sessionCache)

setEventDispatcher

public void setEventDispatcher(EventDispatcher eventDispatcher)

getApplicationContext

public org.springframework.context.ApplicationContext getApplicationContext()

setApplicationContext

public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
Specified by:
setApplicationContext in interface org.springframework.context.ApplicationContextAware


Copyright © 2008 JRadius Project, All Rights Reserved.