org.norther.tammi.spray.session
Class DefaultSessionManager

java.lang.Object
  extended by org.norther.tammi.acorn.cache.CachedMapAdapter<K,V>
      extended by org.norther.tammi.core.cache.DefaultCache<String,AuthenticatedSession>
          extended by org.norther.tammi.spray.session.DefaultSessionManager
All Implemented Interfaces:
Serializable, ConcurrentMap<String,AuthenticatedSession>, EventListener, Map<String,AuthenticatedSession>, NotificationBroadcaster, NotificationEmitter, HttpSessionAttributeListener, HttpSessionListener, ServletContextAttributeListener, ServletContextListener, ServletRequestAttributeListener, ServletRequestListener, CachedMap<String,AuthenticatedSession>, Manageable, Startable, Cache<String,AuthenticatedSession>, Configurable, Manager, SessionManager

public class DefaultSessionManager
extends DefaultCache<String,AuthenticatedSession>
implements SessionManager, ServletContextListener, ServletContextAttributeListener, HttpSessionListener, HttpSessionAttributeListener, ServletRequestListener, ServletRequestAttributeListener

A session manager implementation.

Version:
$Id: DefaultSessionManager.java,v 1.19 2009/09/28 17:56:49 cvsimp Exp $
Author:
Ilkka Priha
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.norther.tammi.acorn.cache.CachedMap
CachedMap.Value<K,V>
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Nested classes/interfaces inherited from interface org.norther.tammi.spray.session.Manager
Manager.SessionPolicy
 
Field Summary
static String DEFAULT_SESSION_STORE
          The default session store path.
 
Fields inherited from class org.norther.tammi.core.cache.DefaultCache
DEFAULT_CAPACITY, DEFAULT_LOAD_FACTOR
 
Fields inherited from class org.norther.tammi.acorn.cache.CachedMapAdapter
DEFAULT_EXPIRATION_SLEEP_INTERVAL, DEFAULT_EXPIRATION_TIME
 
Constructor Summary
DefaultSessionManager()
          Constructs a new session manager.
DefaultSessionManager(int max)
          Constructs a new session cache with max expiration time.
DefaultSessionManager(int max, int def)
          Constructs a new session cache with max and default expiration times.
DefaultSessionManager(int max, int def, int sleep)
          Constructs a new session cache with max and default expiration times and expiration sleep interval.
DefaultSessionManager(int max, int def, int sleep, int capacity)
          Constructs a new session cache with max and default expiration times, an expiration sleep interval and initial capacity.
DefaultSessionManager(int max, int def, int sleep, int capacity, float loadFactor)
          Constructs a new session cache with max and default expiration times, an expiration sleep interval, initial capacity and load factor.
 
Method Summary
 void addHttpSessionAttributeListener(HttpSessionAttributeListener listener)
          Adds a HTTP session attribute listener.
 void addHttpSessionListener(HttpSessionListener listener)
          Adds a HTTP session listener.
 void addProperty(int index, String key, String value)
          Inserts a multivalued property at the specified index.
 void addProperty(String key, String value)
          Adds a multivalued property.
 void addPropertyFilePath(String path)
          Adds a property file path.
 void addPropertyFilePath(String path, String encoding)
          Adds a property file path with an encoding.
 void addServletContextAttributeListener(ServletContextAttributeListener listener)
          Adds a servlet context attribute listener.
 void addServletContextListener(ServletContextListener listener)
          Adds a servlet context listener.
 void addServletRequestAttributeListener(ServletRequestAttributeListener listener)
          Adds a servlet request attribute listener.
 void addServletRequestListener(ServletRequestListener listener)
          Adds a servlet request listener.
 void attributeAdded(HttpSessionBindingEvent event)
           
 void attributeAdded(ServletContextAttributeEvent event)
           
 void attributeAdded(ServletRequestAttributeEvent event)
           
 void attributeRemoved(HttpSessionBindingEvent event)
           
 void attributeRemoved(ServletContextAttributeEvent event)
           
 void attributeRemoved(ServletRequestAttributeEvent event)
           
 void attributeReplaced(HttpSessionBindingEvent event)
           
 void attributeReplaced(ServletContextAttributeEvent event)
           
 void attributeReplaced(ServletRequestAttributeEvent event)
           
 void clearProperties()
          Clears all properties.
 boolean containsProperty(String key)
          Checks whether a property is defined.
 void contextDestroyed(ServletContextEvent event)
           
 void contextInitialized(ServletContextEvent event)
           
 AuthenticatedSession createSession()
          Constructs a new session based on the default settings specified by manager properties.
 AuthenticatedSession createSession(String id)
          Constructs a new session based on the default settings specified by manager properties.
 void expireAll()
          Expires all entries.
 void expireSession(String id)
          Expires the specified session.
 String getConfigKey()
          Gets the path finder key for resolving configuration paths.
protected  Configuration getConfiguration()
          Gets the configuration.
 String getHttpSessionClassName()
          Gets the http session class name.
 int getIdLength()
          Gets the length of session ids.
 int getInitialExpirationTime()
          Gets the initial expiration time for new sessions.
protected  MBeanDelegate getMBeanDelegate()
          Gets the delegate to provide access to its methods for subclasses.
 String[] getProperties(String key)
          Gets a multivalued property.
 String getProperty(String key)
          Gets a property.
 String getPropertyFilePath()
          Gets the property file path.
 String[] getPropertyFilePaths()
          Gets the property file paths.
 String getRequestDispatcherClassName()
          Gets the request dispatcher class name.
 String getSerializedSessionsPath()
          Gets the path to store serialized sessions.
 ServletContext getServletContext()
          Gets the servlet context.
 AuthenticatedSession getSession(String id)
          Gets the active session with the specified session id.
 Manager.SessionPolicy getUserSessionPolicy()
          Gets the policy for multiple sessions for the same principal.
 String[] getUserSessions(Principal principal)
          Gets ids of active sessions of the specified principal.
 String[] getUserSessions(String username)
          Gets ids of active sessions of the named user.
 int indexOfProperty(String key, String value)
          Returns the index of a multivalued property value.
 boolean isDistributable()
          Checks the distributable flag for the sessions.
 boolean isStarted()
          Checks whether the startable has been started.
 void load()
          Loads currently active sessions that were previously unloaded to the appropriate persistence mechanism, if any.
 OrderedMap<String,Object> propertyMap()
          Returns a map of properties.
 OrderedMap<String,Object> propertyMap(String prefix)
          Returns a map of prefixed properties.
 AuthenticatedSession registerUserPrincipal(Principal principal, String id)
          Registers a user principal to a session.
 void removeHttpSessionAttributeListener(HttpSessionAttributeListener listener)
          Removes a HTTP session attribute listener.
 void removeHttpSessionListener(HttpSessionListener listener)
          Removes a HTTP session listener.
 Object removeProperty(String key)
          Removes a property.
 boolean removeProperty(String key, String value)
          Removes a multivalued property.
 void removePropertyFilePath(String path)
          Removes a property file path.
 void removeServletContextAttributeListener(ServletContextAttributeListener listener)
          Removes a servlet context attribute listener.
 void removeServletContextListener(ServletContextListener listener)
          Removes a servlet context listener.
 void removeServletRequestAttributeListener(ServletRequestAttributeListener listener)
          Removes a servlet request attribute listener.
 void removeServletRequestListener(ServletRequestListener listener)
          Removes a servlet request listener.
 void requestDestroyed(ServletRequestEvent event)
           
 void requestInitialized(ServletRequestEvent event)
           
 void sessionCreated(HttpSessionEvent event)
           
 void sessionDestroyed(HttpSessionEvent event)
           
 void setConfigKey(String key)
          Sets the path finder key for resolving configuration paths.
 void setDistributable(boolean flag)
          Sets the distributable flag for the sessions.
 void setHttpSessionClassName(String className)
          Sets the http session class name.
 void setIdLength(int l)
          Sets the length of session ids.
 void setInitialExpirationTime(int t)
          Sets the initial expiration time for new sessions.
 Object setProperties(String key, String[] values)
          Sets a multivalued property.
 Object setProperty(String key, String value)
          Sets a property.
 void setPropertyFilePath(String path)
          Sets the property file path.
 void setPropertyFilePath(String path, String encoding)
          Sets the property file path with an encoding.
 void setPropertyFilePaths(String[] paths)
          Sets the property file paths.
 void setPropertyFilePaths(String[] paths, String... encoding)
          Sets the property file paths with encodings.
 void setRequestDispatcherClassName(String className)
          Sets the request dispatcher class name.
 void setSerializedSessionsPath(String path)
          Sets the path to store serialized sessions.
 void setSessionExpirationTime(String id, int t)
          Sets the expiration time for a specific session.
 void setUserSessionPolicy(Manager.SessionPolicy policy)
          Sets the policy for multiple sessions of the same principal.
 void start()
          Starts the MBean.
 void stop()
          Stops the MBean.
 void storeProperties()
          Stores properties to the property file.
 void unload()
          Saves currently active sessions in the appropriate persistence mechanism, if any.
 void unregisterUserPrincipal(Principal principal, String id)
          Unregisters a user principal from a session.
 Set<Principal> userPrincipalSet()
          Returns a read-only set of registered user principals.
 
Methods inherited from class org.norther.tammi.core.cache.DefaultCache
addNotificationListener, getNotificationInfo, postmanaged, premanaged, removeNotificationListener, removeNotificationListener, setAllowExpired, setDefaultExpirationTime, setDiscardOverloaded, setExpirationLimit, setExpirationSleepInterval, setExpirationThreshold, setMaxExpirationTime, toString, unmanaged
 
Methods inherited from class org.norther.tammi.acorn.cache.CachedMapAdapter
add, add, clear, containsKey, containsValue, entrySet, equals, expire, expireFraction, get, get, getDefaultExpirationTime, getExpirationLimit, getExpirationSleepInterval, getExpirationThreshold, getExpirationTimer, getMaxExpirationTime, getSwapOutHandler, hashCode, isAllowExpired, isAutoRefreshDeclined, isDiscardOverloaded, isEmpty, keySet, put, put, putAll, putIfAbsent, putIfAbsent, refresh, refresh, remove, remove, replace, replace, setAutoRefreshDeclined, setExpirationTimer, setSwapOutHandler, size, values
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.norther.tammi.acorn.cache.CachedMap
add, add, expire, expireFraction, get, getDefaultExpirationTime, getExpirationLimit, getExpirationSleepInterval, getExpirationThreshold, getMaxExpirationTime, isAllowExpired, isAutoRefreshDeclined, isDiscardOverloaded, put, putIfAbsent, refresh, refresh, setAllowExpired, setAutoRefreshDeclined, setDefaultExpirationTime, setDiscardOverloaded, setExpirationLimit, setExpirationSleepInterval, setExpirationThreshold, setMaxExpirationTime
 
Methods inherited from interface java.util.concurrent.ConcurrentMap
putIfAbsent, remove, replace, replace
 
Methods inherited from interface java.util.Map
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values
 
Methods inherited from interface org.norther.tammi.spray.session.Manager
getDefaultExpirationTime, setDefaultExpirationTime
 

Field Detail

DEFAULT_SESSION_STORE

public static final String DEFAULT_SESSION_STORE
The default session store path.

See Also:
Constant Field Values
Constructor Detail

DefaultSessionManager

public DefaultSessionManager()
Constructs a new session manager.


DefaultSessionManager

public DefaultSessionManager(int max)
Constructs a new session cache with max expiration time.

Parameters:
max - a max expiration time (0 = default, -1 = infinite).

DefaultSessionManager

public DefaultSessionManager(int max,
                             int def)
Constructs a new session cache with max and default expiration times.

Parameters:
max - a max expiration time in secs (0 = default, -1 = infinite).
def - a default expiration time in secs (0 = default, -1 = infinite).

DefaultSessionManager

public DefaultSessionManager(int max,
                             int def,
                             int sleep)
Constructs a new session cache with max and default expiration times and expiration sleep interval.

Parameters:
max - a max expiration time in secs (0 = default, -1 = infinite).
def - a default expiration time in secs (0 = default, -1 = infinite).
sleep - an expiration sleep interval in secs (0 = default, -1 = infinite).

DefaultSessionManager

public DefaultSessionManager(int max,
                             int def,
                             int sleep,
                             int capacity)
Constructs a new session cache with max and default expiration times, an expiration sleep interval and initial capacity.

Parameters:
max - a max expiration time in secs (0 = default, -1 = infinite).
def - a default expiration time in secs (0 = default, -1 = infinite).
sleep - an expiration sleep interval in secs (0 = default, -1 = infinite).
capacity - an initial capacity.

DefaultSessionManager

public DefaultSessionManager(int max,
                             int def,
                             int sleep,
                             int capacity,
                             float loadFactor)
Constructs a new session cache with max and default expiration times, an expiration sleep interval, initial capacity and load factor.

Parameters:
max - a max expiration time in secs (0 = default, -1 = infinite).
def - a default expiration time in secs (0 = default, -1 = infinite).
sleep - an expiration sleep interval in secs (0 = default, -1 = infinite).
capacity - an initial capacity.
loadFactor - a load factor.
Method Detail

getIdLength

public int getIdLength()
Description copied from interface: Manager
Gets the length of session ids.

Specified by:
getIdLength in interface Manager
Returns:
the id length.

setIdLength

public void setIdLength(int l)
Description copied from interface: Manager
Sets the length of session ids.

Specified by:
setIdLength in interface Manager
Parameters:
l - the id length.

isDistributable

public boolean isDistributable()
Description copied from interface: Manager
Checks the distributable flag for the sessions.

Specified by:
isDistributable in interface Manager
Returns:
the distributable flag.

setDistributable

public void setDistributable(boolean flag)
Description copied from interface: Manager
Sets the distributable flag for the sessions. If this flag is set, all user data objects added to sessions associated must be serializable.

Specified by:
setDistributable in interface Manager
Parameters:
flag - the distributable flag.

getInitialExpirationTime

public int getInitialExpirationTime()
Description copied from interface: Manager
Gets the initial expiration time for new sessions.

Specified by:
getInitialExpirationTime in interface Manager
Returns:
the initial expiration time in seconds (0 = default).

setInitialExpirationTime

public void setInitialExpirationTime(int t)
Description copied from interface: Manager
Sets the initial expiration time for new sessions.

Specified by:
setInitialExpirationTime in interface Manager
Parameters:
t - the initial expiration time in seconds (0 = default).

setSessionExpirationTime

public void setSessionExpirationTime(String id,
                                     int t)
Description copied from interface: Manager
Sets the expiration time for a specific session.

Specified by:
setSessionExpirationTime in interface Manager
Parameters:
id - the id of the session to set.
t - the expiration time in seconds.

getUserSessionPolicy

public Manager.SessionPolicy getUserSessionPolicy()
Description copied from interface: Manager
Gets the policy for multiple sessions for the same principal.

Specified by:
getUserSessionPolicy in interface Manager
Returns:
the policy to apply.

setUserSessionPolicy

public void setUserSessionPolicy(Manager.SessionPolicy policy)
Description copied from interface: Manager
Sets the policy for multiple sessions of the same principal.

Specified by:
setUserSessionPolicy in interface Manager
Parameters:
policy - the policy to apply.

createSession

public AuthenticatedSession createSession()
                                   throws LogException
Description copied from interface: Manager
Constructs a new session based on the default settings specified by manager properties. The session id will be assigned by this method, and available via the getId() method of the returned session.

Specified by:
createSession in interface Manager
Returns:
a new session.
Throws:
LogException - if a new session cannot be instantiated.

createSession

public AuthenticatedSession createSession(String id)
                                   throws LogException
Description copied from interface: Manager
Constructs a new session based on the default settings specified by manager properties. The session id is specified by the caller.

Specified by:
createSession in interface Manager
Parameters:
id - the session id.
Returns:
a new session.
Throws:
LogException - if a new session cannot be instantiated.

getSession

public AuthenticatedSession getSession(String id)
Description copied from interface: Manager
Gets the active session with the specified session id.

Specified by:
getSession in interface Manager
Parameters:
id - the session id.
Returns:
the session or null.

getUserSessions

public String[] getUserSessions(Principal principal)
Description copied from interface: Manager
Gets ids of active sessions of the specified principal.

Specified by:
getUserSessions in interface Manager
Parameters:
principal - the principal instance.
Returns:
an array of session ids or null.

getUserSessions

public String[] getUserSessions(String username)
Description copied from interface: Manager
Gets ids of active sessions of the named user.

Specified by:
getUserSessions in interface Manager
Parameters:
username - the named user.
Returns:
an array of session ids or null.

registerUserPrincipal

public AuthenticatedSession registerUserPrincipal(Principal principal,
                                                  String id)
Description copied from interface: Manager
Registers a user principal to a session. The registration session depends on the defined user session policy and can be different from the session associated to the given id.

Specified by:
registerUserPrincipal in interface Manager
Parameters:
principal - the user principal.
id - the session id.
Returns:
the session of the registered principal.

unregisterUserPrincipal

public void unregisterUserPrincipal(Principal principal,
                                    String id)
Description copied from interface: Manager
Unregisters a user principal from a session.

Specified by:
unregisterUserPrincipal in interface Manager
Parameters:
principal - the user principal.
id - the session id.

userPrincipalSet

public Set<Principal> userPrincipalSet()
Description copied from interface: Manager
Returns a read-only set of registered user principals.

Specified by:
userPrincipalSet in interface Manager
Returns:
a set of user principals.

expireSession

public void expireSession(String id)
Description copied from interface: Manager
Expires the specified session.

Specified by:
expireSession in interface Manager
Parameters:
id - the id of the session to expire.

expireAll

public void expireAll()
Description copied from interface: CachedMap
Expires all entries.

Specified by:
expireAll in interface CachedMap<String,AuthenticatedSession>
Specified by:
expireAll in interface Manager
Overrides:
expireAll in class CachedMapAdapter<String,AuthenticatedSession>

getServletContext

public ServletContext getServletContext()
Description copied from interface: Manager
Gets the servlet context.

Specified by:
getServletContext in interface Manager
Returns:
the servlet context.

getHttpSessionClassName

public String getHttpSessionClassName()
Description copied from interface: Manager
Gets the http session class name.

Specified by:
getHttpSessionClassName in interface Manager
Returns:
the class name or null.

setHttpSessionClassName

public void setHttpSessionClassName(String className)
Description copied from interface: Manager
Sets the http session class name.

Specified by:
setHttpSessionClassName in interface Manager
Parameters:
className - the class name.

getRequestDispatcherClassName

public String getRequestDispatcherClassName()
Description copied from interface: Manager
Gets the request dispatcher class name.

Specified by:
getRequestDispatcherClassName in interface Manager
Returns:
the class name or null.

setRequestDispatcherClassName

public void setRequestDispatcherClassName(String className)
Description copied from interface: Manager
Sets the request dispatcher class name.

Specified by:
setRequestDispatcherClassName in interface Manager
Parameters:
className - the class name.

load

public void load()
          throws LogException
Description copied from interface: Manager
Loads currently active sessions that were previously unloaded to the appropriate persistence mechanism, if any. If persistence is not supported, this method returns without doing anything.

Specified by:
load in interface Manager
Throws:
LogException - for processing errors.

unload

public void unload()
            throws LogException
Description copied from interface: Manager
Saves currently active sessions in the appropriate persistence mechanism, if any. If persistence is not supported, this method returns without doing anything.

Specified by:
unload in interface Manager
Throws:
LogException - for processing errors.

addServletContextListener

public void addServletContextListener(ServletContextListener listener)
Description copied from interface: Manager
Adds a servlet context listener.

Specified by:
addServletContextListener in interface Manager
Parameters:
listener - the listener.

removeServletContextListener

public void removeServletContextListener(ServletContextListener listener)
Description copied from interface: Manager
Removes a servlet context listener.

Specified by:
removeServletContextListener in interface Manager
Parameters:
listener - the listener.

addServletContextAttributeListener

public void addServletContextAttributeListener(ServletContextAttributeListener listener)
Description copied from interface: Manager
Adds a servlet context attribute listener.

Specified by:
addServletContextAttributeListener in interface Manager
Parameters:
listener - the listener.

removeServletContextAttributeListener

public void removeServletContextAttributeListener(ServletContextAttributeListener listener)
Description copied from interface: Manager
Removes a servlet context attribute listener.

Specified by:
removeServletContextAttributeListener in interface Manager
Parameters:
listener - the listener.

addHttpSessionListener

public void addHttpSessionListener(HttpSessionListener listener)
Description copied from interface: Manager
Adds a HTTP session listener.

Specified by:
addHttpSessionListener in interface Manager
Parameters:
listener - the listener.

removeHttpSessionListener

public void removeHttpSessionListener(HttpSessionListener listener)
Description copied from interface: Manager
Removes a HTTP session listener.

Specified by:
removeHttpSessionListener in interface Manager
Parameters:
listener - the listener.

addHttpSessionAttributeListener

public void addHttpSessionAttributeListener(HttpSessionAttributeListener listener)
Description copied from interface: Manager
Adds a HTTP session attribute listener.

Specified by:
addHttpSessionAttributeListener in interface Manager
Parameters:
listener - the listener.

removeHttpSessionAttributeListener

public void removeHttpSessionAttributeListener(HttpSessionAttributeListener listener)
Description copied from interface: Manager
Removes a HTTP session attribute listener.

Specified by:
removeHttpSessionAttributeListener in interface Manager
Parameters:
listener - the listener.

addServletRequestListener

public void addServletRequestListener(ServletRequestListener listener)
Description copied from interface: Manager
Adds a servlet request listener.

Specified by:
addServletRequestListener in interface Manager
Parameters:
listener - the listener.

removeServletRequestListener

public void removeServletRequestListener(ServletRequestListener listener)
Description copied from interface: Manager
Removes a servlet request listener.

Specified by:
removeServletRequestListener in interface Manager
Parameters:
listener - the listener.

addServletRequestAttributeListener

public void addServletRequestAttributeListener(ServletRequestAttributeListener listener)
Description copied from interface: Manager
Adds a servlet request attribute listener.

Specified by:
addServletRequestAttributeListener in interface Manager
Parameters:
listener - the listener.

removeServletRequestAttributeListener

public void removeServletRequestAttributeListener(ServletRequestAttributeListener listener)
Description copied from interface: Manager
Removes a servlet request attribute listener.

Specified by:
removeServletRequestAttributeListener in interface Manager
Parameters:
listener - the listener.

getSerializedSessionsPath

public String getSerializedSessionsPath()
Description copied from interface: SessionManager
Gets the path to store serialized sessions.

Specified by:
getSerializedSessionsPath in interface SessionManager
Returns:
the session store path.

setSerializedSessionsPath

public void setSerializedSessionsPath(String path)
Description copied from interface: SessionManager
Sets the path to store serialized sessions.

Specified by:
setSerializedSessionsPath in interface SessionManager
Parameters:
path - the session store path.

isStarted

public boolean isStarted()
Description copied from interface: Startable
Checks whether the startable has been started.

Specified by:
isStarted in interface Startable
Returns:
true if started, otherwise false.

start

public void start()
Description copied from interface: Startable
Starts the MBean.

Specified by:
start in interface Startable

stop

public void stop()
Description copied from interface: Startable
Stops the MBean.

Specified by:
stop in interface Startable

getConfigKey

public String getConfigKey()
Description copied from interface: Configurable
Gets the path finder key for resolving configuration paths.

Specified by:
getConfigKey in interface Configurable
Returns:
the path finder key.

setConfigKey

public void setConfigKey(String key)
Description copied from interface: Configurable
Sets the path finder key for resolving configuration paths. The default key is PathFinderMBean.CONFIG.

Specified by:
setConfigKey in interface Configurable
Parameters:
key - the path finder key.

getPropertyFilePath

public String getPropertyFilePath()
Description copied from interface: Configurable
Gets the property file path. The first one is returned if more than one is defined.

Specified by:
getPropertyFilePath in interface Configurable
Returns:
the property file path or null.

setPropertyFilePath

public void setPropertyFilePath(String path)
Description copied from interface: Configurable
Sets the property file path. The path may be an absolute file path, a file path relative to the specified config key folder or a URL. The properties will be loaded before the next get/set property operation.

Note that all previously defined property file paths and properties are cleared.

Specified by:
setPropertyFilePath in interface Configurable
Parameters:
path - a property file path.

setPropertyFilePath

public void setPropertyFilePath(String path,
                                String encoding)
Description copied from interface: Configurable
Sets the property file path with an encoding.

Specified by:
setPropertyFilePath in interface Configurable
Parameters:
path - a property file path.
encoding - an encoding to use.

getPropertyFilePaths

public String[] getPropertyFilePaths()
Description copied from interface: Configurable
Gets the property file paths.

Specified by:
getPropertyFilePaths in interface Configurable
Returns:
the property file paths.

setPropertyFilePaths

public void setPropertyFilePaths(String[] paths)
Description copied from interface: Configurable
Sets the property file paths. The path may be an absolute file path, a file path relative to the specified config key folder or a URL. The properties will be loaded before the next get/set property operation. New paths are added after existing ones.

Specified by:
setPropertyFilePaths in interface Configurable
Parameters:
paths - property file paths.

setPropertyFilePaths

public void setPropertyFilePaths(String[] paths,
                                 String... encoding)
Description copied from interface: Configurable
Sets the property file paths with encodings.

Specified by:
setPropertyFilePaths in interface Configurable
Parameters:
paths - property file paths.
encoding - encodings to use.

addPropertyFilePath

public void addPropertyFilePath(String path)
Description copied from interface: Configurable
Adds a property file path.

Specified by:
addPropertyFilePath in interface Configurable
Parameters:
path - a property file path.

addPropertyFilePath

public void addPropertyFilePath(String path,
                                String encoding)
Description copied from interface: Configurable
Adds a property file path with an encoding.

Specified by:
addPropertyFilePath in interface Configurable
Parameters:
path - a property file path.
encoding - an encoding to use.

removePropertyFilePath

public void removePropertyFilePath(String path)
Description copied from interface: Configurable
Removes a property file path.

Specified by:
removePropertyFilePath in interface Configurable
Parameters:
path - the property file path.

containsProperty

public boolean containsProperty(String key)
Description copied from interface: Configurable
Checks whether a property is defined.

Specified by:
containsProperty in interface Configurable
Parameters:
key - the key.
Returns:
true for a defined property, false otherwise.

getProperty

public String getProperty(String key)
Description copied from interface: Configurable
Gets a property.

Specified by:
getProperty in interface Configurable
Parameters:
key - the key.
Returns:
the value or null.

setProperty

public Object setProperty(String key,
                          String value)
Description copied from interface: Configurable
Sets a property.

Specified by:
setProperty in interface Configurable
Parameters:
key - the key.
value - the value.
Returns:
the previous value.

getProperties

public String[] getProperties(String key)
Description copied from interface: Configurable
Gets a multivalued property.

Specified by:
getProperties in interface Configurable
Parameters:
key - the key.
Returns:
the values or null.

setProperties

public Object setProperties(String key,
                            String[] values)
Description copied from interface: Configurable
Sets a multivalued property.

Specified by:
setProperties in interface Configurable
Parameters:
key - the key.
values - the values.
Returns:
the previous value.

removeProperty

public Object removeProperty(String key)
Description copied from interface: Configurable
Removes a property.

Specified by:
removeProperty in interface Configurable
Parameters:
key - the key.
Returns:
the removed value or null.

indexOfProperty

public int indexOfProperty(String key,
                           String value)
Description copied from interface: Configurable
Returns the index of a multivalued property value.

Specified by:
indexOfProperty in interface Configurable
Parameters:
key - the key.
value - the value.
Returns:
the index of the value or -1.

addProperty

public void addProperty(String key,
                        String value)
Description copied from interface: Configurable
Adds a multivalued property.

Specified by:
addProperty in interface Configurable
Parameters:
key - the key.
value - the property.

addProperty

public void addProperty(int index,
                        String key,
                        String value)
Description copied from interface: Configurable
Inserts a multivalued property at the specified index.

Specified by:
addProperty in interface Configurable
Parameters:
index - the index.
key - the key.
value - the value.

removeProperty

public boolean removeProperty(String key,
                              String value)
Description copied from interface: Configurable
Removes a multivalued property.

Specified by:
removeProperty in interface Configurable
Parameters:
key - the key.
value - the value.
Returns:
true if removed, false otherwise.

clearProperties

public void clearProperties()
Description copied from interface: Configurable
Clears all properties.

Specified by:
clearProperties in interface Configurable

propertyMap

public OrderedMap<String,Object> propertyMap()
Description copied from interface: Configurable
Returns a map of properties. Multivalued properties are presented as string arrays.

Specified by:
propertyMap in interface Configurable
Returns:
a map of properties.

propertyMap

public OrderedMap<String,Object> propertyMap(String prefix)
Description copied from interface: Configurable
Returns a map of prefixed properties. The prefix is removed from the keys of the returned map. Multivalued properties are presented as string arrays.

Specified by:
propertyMap in interface Configurable
Parameters:
prefix - the prefix.
Returns:
a map of properties.

storeProperties

public void storeProperties()
                     throws IOException
Description copied from interface: Configurable
Stores properties to the property file. The first defined property file is applied to all properties.

Specified by:
storeProperties in interface Configurable
Throws:
IOException - on I/O errors.

contextInitialized

public void contextInitialized(ServletContextEvent event)
Specified by:
contextInitialized in interface ServletContextListener

contextDestroyed

public void contextDestroyed(ServletContextEvent event)
Specified by:
contextDestroyed in interface ServletContextListener

attributeAdded

public void attributeAdded(ServletContextAttributeEvent event)
Specified by:
attributeAdded in interface ServletContextAttributeListener

attributeRemoved

public void attributeRemoved(ServletContextAttributeEvent event)
Specified by:
attributeRemoved in interface ServletContextAttributeListener

attributeReplaced

public void attributeReplaced(ServletContextAttributeEvent event)
Specified by:
attributeReplaced in interface ServletContextAttributeListener

sessionCreated

public void sessionCreated(HttpSessionEvent event)
Specified by:
sessionCreated in interface HttpSessionListener

sessionDestroyed

public void sessionDestroyed(HttpSessionEvent event)
Specified by:
sessionDestroyed in interface HttpSessionListener

attributeAdded

public void attributeAdded(HttpSessionBindingEvent event)
Specified by:
attributeAdded in interface HttpSessionAttributeListener

attributeRemoved

public void attributeRemoved(HttpSessionBindingEvent event)
Specified by:
attributeRemoved in interface HttpSessionAttributeListener

attributeReplaced

public void attributeReplaced(HttpSessionBindingEvent event)
Specified by:
attributeReplaced in interface HttpSessionAttributeListener

requestInitialized

public void requestInitialized(ServletRequestEvent event)
Specified by:
requestInitialized in interface ServletRequestListener

requestDestroyed

public void requestDestroyed(ServletRequestEvent event)
Specified by:
requestDestroyed in interface ServletRequestListener

attributeAdded

public void attributeAdded(ServletRequestAttributeEvent event)
Specified by:
attributeAdded in interface ServletRequestAttributeListener

attributeRemoved

public void attributeRemoved(ServletRequestAttributeEvent event)
Specified by:
attributeRemoved in interface ServletRequestAttributeListener

attributeReplaced

public void attributeReplaced(ServletRequestAttributeEvent event)
Specified by:
attributeReplaced in interface ServletRequestAttributeListener

getMBeanDelegate

protected MBeanDelegate getMBeanDelegate()
Description copied from class: DefaultCache
Gets the delegate to provide access to its methods for subclasses.

Overrides:
getMBeanDelegate in class DefaultCache<String,AuthenticatedSession>
Returns:
the delegate.

getConfiguration

protected Configuration getConfiguration()
Gets the configuration.

Returns:
the configuration.


Copyright © 2004 The Norther Organization. All rights reserved.