org.n52.security.authentication.loginmodule
Class SharedState

java.lang.Object
  extended by org.n52.security.authentication.loginmodule.SharedState
All Implemented Interfaces:
java.io.Serializable

public class SharedState
extends java.lang.Object
implements java.io.Serializable

Class SharedState represents the shared state between login modules.

This class is introduced to encapsulate the access to common shared states and therefor to minimize programming errors.
This class is created in the initialize method of AbstractLoginModule and provided via a getter method to sub classes.

Version:
$Revision: $
Author:
Marko Reiprecht Created on 15.09.2007
See Also:
Serialized Form

Field Summary
static java.lang.String KEY_SHARED_NAME
          Field KEY_SHARED_NAME identifies a name (user/login) in the shared map.
static java.lang.String KEY_SHARED_PASSWORD
          Field KEY_SHARED_PASSWORD identifies a password in the shared map.
 
Constructor Summary
SharedState(java.util.Map state)
          Constructor SharedState creates a new SharedState instance.
 
Method Summary
 void clear()
          Method clears all state information.
 boolean contains(java.lang.String key)
          Method checks if the state information contains the key.
 java.lang.Object get(java.lang.String key)
          Method gets the state information for the key.
 java.lang.String getLoginName()
          Method gets the loginName of this SharedState object.
 char[] getLoginPassword()
          Method gets the loginPassword of this SharedState object.
 boolean isEmpty()
          Methods checks for an empty shared state.
 boolean isLoginNameSet()
          Method checks if a shared login name is set.
 boolean isLoginPasswordSet()
          Method checks if a shared login password is set.
 void put(java.lang.String key, java.lang.Object value)
          Method registers a state information for the key.
 java.lang.Object remove(java.lang.String key)
          Method remove state information registered for the key.
 void removeLoginName()
          Method removes the login name from the shared state.
 void removeLoginPassword()
          Method removes the login password from the shared state.
 void setLoginName(java.lang.String name)
          Method sets the loginName of this SharedState object.
 void setLoginPassword(char[] password)
          Method sets the loginPassword of this SharedState object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEY_SHARED_PASSWORD

public static final java.lang.String KEY_SHARED_PASSWORD
Field KEY_SHARED_PASSWORD identifies a password in the shared map. Please use getLoginPassword() and setLoginPassword(char[]) to access the state information.

See Also:
Description of the login method in the LoginModule Developer's Guide , Constant Field Values

KEY_SHARED_NAME

public static final java.lang.String KEY_SHARED_NAME
Field KEY_SHARED_NAME identifies a name (user/login) in the shared map. Please use getLoginName() and setLoginName(String) to access the state information.

See Also:
Description of the login method in the LoginModule Developer's Guide , Constant Field Values
Constructor Detail

SharedState

public SharedState(java.util.Map state)
Constructor SharedState creates a new SharedState instance.

Parameters:
state - of type Map
Method Detail

clear

public void clear()
Method clears all state information.


getLoginName

public java.lang.String getLoginName()
Method gets the loginName of this SharedState object.

Returns:
String the login name, can be null if not set.
See Also:
KEY_SHARED_NAME

get

public java.lang.Object get(java.lang.String key)
Method gets the state information for the key.

Parameters:
key - of type String identifying a state information.
Returns:
Object or null if (!contains(key))

getLoginPassword

public char[] getLoginPassword()
Method gets the loginPassword of this SharedState object.

Returns:
String the login password, can be null if not set.
See Also:
KEY_SHARED_PASSWORD

isEmpty

public boolean isEmpty()
Methods checks for an empty shared state.

Returns:
boolean true if no state information is available.

isLoginNameSet

public boolean isLoginNameSet()
Method checks if a shared login name is set.

Returns:
boolean.
See Also:
KEY_SHARED_NAME

contains

public boolean contains(java.lang.String key)
Method checks if the state information contains the key.

Parameters:
key - of type String identifying a state information.
Returns:
boolean true if key in state.

isLoginPasswordSet

public boolean isLoginPasswordSet()
Method checks if a shared login password is set.

Returns:
boolean.
See Also:
KEY_SHARED_PASSWORD

removeLoginName

public void removeLoginName()
Method removes the login name from the shared state.


remove

public java.lang.Object remove(java.lang.String key)
Method remove state information registered for the key.

Parameters:
key - of type String identifying a state information.
Returns:
Object the removed state information.

removeLoginPassword

public void removeLoginPassword()
Method removes the login password from the shared state.


setLoginName

public void setLoginName(java.lang.String name)
Method sets the loginName of this SharedState object.

Parameters:
name - the loginName.
See Also:
KEY_SHARED_NAME

put

public void put(java.lang.String key,
                java.lang.Object value)
Method registers a state information for the key. State information stored with the same key are overwritten.

Parameters:
key - of type String identifying the state information.
value - of type Object a new state information.

setLoginPassword

public void setLoginPassword(char[] password)
Method sets the loginPassword of this SharedState object.

Parameters:
password - the shared password.
See Also:
KEY_SHARED_PASSWORD


Copyright © 2004-2009 52north.org. All Rights Reserved.