com.novell.service.session
Class SessionEnv

java.lang.Object
  |
  +--com.novell.service.session.SessionEnv

public class SessionEnv
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

Provides a collection of key/value pairs describing a session environment. SessionEnv affects the behavior of the session and its children.

SessionEnv has been optimized to be cloneable without requiring a new copy of it's internal data until that data is modified. This is a performance and memory usage optimization. Until the internal hashtable is modified, clones of this object share the hashtable.


Field Summary
static java.lang.String ALLOW_BACKGROUND_VALIDATION
          Key describing whether or not a separate thread will be spawned by the SessionManager to keep Sessions validated.
static java.lang.String INITIAL_SESSION_FACTORY
          Key describing initial sessions and their load order in a colon-separated list.
static java.lang.String RMI_SOCKET_FACTORIES_OBJECT
          Key indicating whether to use custom RMI sockets when running in RMI mode.
static java.lang.String SESSION_MANAGER_SERVICE
          Deprecated. Use SESSION_MANAGER_URL
static java.lang.String SESSION_MANAGER_URL
          Key indicating whether to run local or in RMI mode Set this key to the location of the remote SessionManager to run RMI
 
Constructor Summary
SessionEnv()
          Constructs a new, empty session environment that is shared.
 
Method Summary
 void add(java.lang.String key, java.lang.Object val)
          Adds a new entry to this environment.
 void clear()
          Clears this environment so it contains no keys.
 java.lang.Object clone()
          Creates a new copy of this environment.
 boolean contains(java.lang.Object value)
          Determines if some value maps into the specified value of this environment.
 boolean containsKey(java.lang.String key)
          Determines if a key maps into the specified key of this environment.
 java.util.Enumeration elements()
          Returns an enumeration of the values in this environment.
 java.lang.Object get(java.lang.String key)
          Returns the value to which the specified key is mapped in this environment.
 boolean isEmpty()
          Determines if this environment is empty.
 java.util.Enumeration keys()
          Returns an enumeration of the keys in this environment.
 boolean matchesSubset(SessionEnv subEnv)
          Determines if the passed-in subEnv is a subset of this set and all attributes match.
 void merge(java.util.Properties subSet)
          Merge properties into this session environment.
 void merge(SessionEnv subSet)
          Merge two session environments together.
 void modify(java.util.Properties subSet)
          Replaces the attributes in this set by those in subSet, or adds any that do not exist.
 void modify(SessionEnv newEnv)
          Replaces the attributes in this set by those in newEnv, or adds any that do not exist.
 java.lang.Object modify(java.lang.String key, java.lang.Object val)
          Replaces the entry identified by key with val, or adds it if it does not exist.
 java.lang.Object mustGet(java.lang.String key)
          Returns the value to which the specified key is mapped in this environment.
 java.lang.Object put(java.lang.String key, java.lang.Object value)
          Maps the specified key to the specified value in this environment.
 java.lang.Object remove(java.lang.String key)
          Removes the key and it's value from this environment.
 int size()
          Returns the number keys in this environment.
 java.lang.String toString()
          Returns a string that textually represents this environment.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

INITIAL_SESSION_FACTORY

public static final java.lang.String INITIAL_SESSION_FACTORY
Key describing initial sessions and their load order in a colon-separated list.

(INITIAL_SESSION_FACTORY = "com.novell.service.session.spi.InitialSessionFactory")

Following is a code example:

(SessionEnv)e.add(
    INITIAL_SESSION_FACTORY,
    "com.novell.service.session.nds.NDSInitialSessionFactory:" +
    "com.novell.service.session.bindery.BinderyInitialSessionFactory");
 


SESSION_MANAGER_URL

public static final java.lang.String SESSION_MANAGER_URL
Key indicating whether to run local or in RMI mode Set this key to the location of the remote SessionManager to run RMI

(SESSION_MANAGER_URL = "com.novell.service.session.spi.SessionManagerService")

Following is a code example:

SessionEnv env = new SessionEnv();
    env.add(SessionEnv.SESSION_MANAGER_URL, rmiServerName);
    SessionManager sm = SessionManagerFactory.getPrivate(env);
 


RMI_SOCKET_FACTORIES_OBJECT

public static final java.lang.String RMI_SOCKET_FACTORIES_OBJECT
Key indicating whether to use custom RMI sockets when running in RMI mode. Set the value of this key to an instance of com.novell.service.session.spi.RMISocketFactories

SESSION_MANAGER_SERVICE

public static final java.lang.String SESSION_MANAGER_SERVICE
Deprecated. Use SESSION_MANAGER_URL

ALLOW_BACKGROUND_VALIDATION

public static final java.lang.String ALLOW_BACKGROUND_VALIDATION
Key describing whether or not a separate thread will be spawned by the SessionManager to keep Sessions validated.

(ALLOW_BACKGROUND_VALIDATION = "com.novell.service.session.spi.SessionManagerServiceDaemon")

Following is a code example:

(SessionEnv)e.add(
    ALLOW_BACKGROUND_VALIDATION,
    new Boolean(true));
 

Constructor Detail

SessionEnv

public SessionEnv()
Constructs a new, empty session environment that is shared.
Method Detail

add

public void add(java.lang.String key,
                java.lang.Object val)
         throws SessionException
Adds a new entry to this environment. If key already exists, EntryInUseException will be thrown.
Parameters:
key - The key to be added.
val - The value to be added.
Throws:
SessionException - Top-level exception extended by all Session exceptions and thrown by Session objects.
EntryInUseException - Thrown if a key already exists.

clear

public void clear()
Clears this environment so it contains no keys.

clone

public java.lang.Object clone()
Creates a new copy of this environment. The environment is shared until a modification is made to the clone.

For more information on this Object, see Sun's java.lang.Cloneable class.

Returns:
A clone of this session environment.

contains

public boolean contains(java.lang.Object value)
Determines if some value maps into the specified value of this environment.
Parameters:
value - The value for which to search.
Returns:
A boolean set to TRUE if the target value maps into the specified value of this environment, otherwise set to FALSE.

containsKey

public boolean containsKey(java.lang.String key)
Determines if a key maps into the specified key of this environment.
Parameters:
key - The possible key for which to search.
Returns:
A boolean set to TRUE if the target key maps into the specified key of this environment, otherwise set to FALSE.

elements

public java.util.Enumeration elements()
Returns an enumeration of the values in this environment.
Returns:
An enumeration of the values in this environment.

get

public java.lang.Object get(java.lang.String key)
Returns the value to which the specified key is mapped in this environment.
Parameters:
key - A key in the environment.
Returns:
An Object containing the value to which the key is mapped.

isEmpty

public boolean isEmpty()
Determines if this environment is empty.
Returns:
A boolean set to TRUE if this environment is empty, otherwise set to FALSE.

keys

public java.util.Enumeration keys()
Returns an enumeration of the keys in this environment.
Returns:
An enumeration of the keys in this environment.

matchesSubset

public boolean matchesSubset(SessionEnv subEnv)
Determines if the passed-in subEnv is a subset of this set and all attributes match.
Parameters:
subEnv - The environment to match.
Returns:
A boolean set to TRUE if the passed-in subEnv is a subset of this session environment, otherwise set to FALSE.

merge

public void merge(SessionEnv subSet)
           throws SessionException
Merge two session environments together. Keys in this environment that are matched by the subSet will not be overridden.
Parameters:
subSet - The environment to merge into this environment.
Throws:
SessionException - Top-level exception extended by all Session exceptions and thrown by Session objects.

merge

public void merge(java.util.Properties subSet)
           throws SessionException
Merge properties into this session environment. Keys in this environment that are matched by the subSet will not be overridden.
Parameters:
subSet - The properties to merge.
Throws:
SessionException - Top-level exception extended by all Session exceptions and thrown by Session objects.

modify

public java.lang.Object modify(java.lang.String key,
                               java.lang.Object val)
Replaces the entry identified by key with val, or adds it if it does not exist.
Parameters:
key - The key to be modified.
val - The value to modify.
Returns:
The Object containing the modified environment.

modify

public void modify(SessionEnv newEnv)
Replaces the attributes in this set by those in newEnv, or adds any that do not exist.
Parameters:
newEnv - The environment to use for modification.

modify

public void modify(java.util.Properties subSet)
Replaces the attributes in this set by those in subSet, or adds any that do not exist.
Parameters:
subSet - The attributes to use for modification.

mustGet

public java.lang.Object mustGet(java.lang.String key)
                         throws EntryNotFoundException
Returns the value to which the specified key is mapped in this environment.
Parameters:
key - The specified key in this environment.
Returns:
The Object containing the environment.
Throws:
EntryNotFoundException - Thrown if no value matching the key.

put

public java.lang.Object put(java.lang.String key,
                            java.lang.Object value)
Maps the specified key to the specified value in this environment.
Parameters:
key - The key to map.
value - The value to map.
Returns:
The Object containing the modified environment.

remove

public java.lang.Object remove(java.lang.String key)
Removes the key and it's value from this environment.
Parameters:
key - The key to remove.
Returns:
The Object containing the modified environment.

size

public int size()
Returns the number keys in this environment.
Returns:
The number of keys in this environment as an int.

toString

public java.lang.String toString()
Returns a string that textually represents this environment.
Returns:
A string representation of the environment.
Overrides:
toString in class java.lang.Object