org.vfny.geoserver.global
Class UserContainer

java.lang.Object
  extended byorg.vfny.geoserver.global.UserContainer
All Implemented Interfaces:
java.util.EventListener, javax.servlet.http.HttpSessionBindingListener

public class UserContainer
extends java.lang.Object
implements javax.servlet.http.HttpSessionBindingListener

Represents a User for GeoServer.

Used as a typesafe Session container. This is an alternative to using calls to request.getAttributes( key ) and casting.

The User object is saved in session scope by ConfigAction:


 HttpSession session = request.getSession();
 User user = request.getAttributes( UserContainer.WEB_CONTAINER_KEY );
 if( user == null ){
     user = new UserContainer( request.getLocal() );
     session.setAttributes( UserContainer.WEB_CONTAINER_KEY, user );
 }
 

This class is based on the UserContainer class outlined in the book "Programming Jakarta Struts" by Chuck Cavaness.


Field Summary
 DataStoreConfig newDataStore
          New DataStore info before it is added to DataConfig.
static java.lang.String SESSION_KEY
           
 java.lang.String username
          User name for this user
 
Constructor Summary
UserContainer()
          Create User Container for the current locale
UserContainer(java.util.Locale local)
          Create User Container for the provided locale
 
Method Summary
 org.geotools.feature.AttributeType getAttributeType()
          Access attributeType property.
 AttributeTypeInfoConfig getAttributeTypeConfig()
          Access attributeTypeConfig property.
 org.geotools.data.DataStore getDataStore()
          Access dataStore property.
 DataStoreConfig getDataStoreConfig()
          Access dataStoreConfig property.
 java.lang.String getDataStoreID()
          Access dataStoreID property.
 org.geotools.feature.FeatureType getFeatureType()
          Access featureType property.
 FeatureTypeConfig getFeatureTypeConfig()
          Access featureTypeConfig property.
 java.util.Locale getLocale()
          User's Locale.
 DataStoreConfig getNewDataStore()
          Access newDataStore property.
 java.lang.String getUsername()
          Access username property.
 void setAttributeType(org.geotools.feature.AttributeType attributeType)
          Set attributeType to attributeType.
 void setAttributeTypeConfig(AttributeTypeInfoConfig attributeTypeConfig)
          Set attributeTypeConfig to attributeTypeConfig.
 void setDataStore(org.geotools.data.DataStore dataStore)
          Set dataStore to dataStore.
 void setDataStoreConfig(DataStoreConfig dataStoreConfig)
          Set dataStoreConfig to dataStoreConfig.
 void setDataStoreID(java.lang.String dataStoreID)
          Set dataStoreID to dataStoreID.
 void setFeatureType(org.geotools.feature.FeatureType featureType)
          Set featureType to featureType.
 void setFeatureTypeConfig(FeatureTypeConfig featureTypeConfig)
          Set featureTypeConfig to featureTypeConfig.
 void setLocale(java.util.Locale locale)
          Set the user's Locale.
 void setNewDataStore(DataStoreConfig newDataStore)
          Set newDataStore to newDataStore.
 void setUsername(java.lang.String username)
          Set username to username.
 void valueBound(javax.servlet.http.HttpSessionBindingEvent arg0)
          Session callback.
 void valueUnbound(javax.servlet.http.HttpSessionBindingEvent arg0)
          Clean up user resources when unbound from session.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SESSION_KEY

public static final java.lang.String SESSION_KEY
See Also:
Constant Field Values

username

public java.lang.String username
User name for this user


newDataStore

public DataStoreConfig newDataStore
New DataStore info before it is added to DataConfig.

Unlike the DataStores in DataConfig this one does not yet have to work.

Constructor Detail

UserContainer

public UserContainer()
Create User Container for the current locale


UserContainer

public UserContainer(java.util.Locale local)
Create User Container for the provided locale

Parameters:
local - DOCUMENT ME!
Method Detail

getLocale

public java.util.Locale getLocale()
User's Locale.

Used to format messages. Should be used in conjunction with internatalization support.

Returns:
Locale for the User.

setLocale

public void setLocale(java.util.Locale locale)
Set the user's Locale.

Parameters:
locale - User's locale.

valueBound

public void valueBound(javax.servlet.http.HttpSessionBindingEvent arg0)
Session callback.

Specified by:
valueBound in interface javax.servlet.http.HttpSessionBindingListener
Parameters:
arg0 -
See Also:
HttpSessionBindingListener.valueBound(javax.servlet.http.HttpSessionBindingEvent)

valueUnbound

public void valueUnbound(javax.servlet.http.HttpSessionBindingEvent arg0)
Clean up user resources when unbound from session.

Specified by:
valueUnbound in interface javax.servlet.http.HttpSessionBindingListener
Parameters:
arg0 -
See Also:
HttpSessionBindingListener.valueUnbound(javax.servlet.http.HttpSessionBindingEvent)

getAttributeType

public org.geotools.feature.AttributeType getAttributeType()
Access attributeType property.

Returns:
Returns the attributeType.

setAttributeType

public void setAttributeType(org.geotools.feature.AttributeType attributeType)
Set attributeType to attributeType.

Parameters:
attributeType - The attributeType to set.

getAttributeTypeConfig

public AttributeTypeInfoConfig getAttributeTypeConfig()
Access attributeTypeConfig property.

Returns:
Returns the attributeTypeConfig.

setAttributeTypeConfig

public void setAttributeTypeConfig(AttributeTypeInfoConfig attributeTypeConfig)
Set attributeTypeConfig to attributeTypeConfig.

Parameters:
attributeTypeConfig - The attributeTypeConfig to set.

getDataStore

public org.geotools.data.DataStore getDataStore()
Access dataStore property.

Returns:
Returns the dataStore.

setDataStore

public void setDataStore(org.geotools.data.DataStore dataStore)
Set dataStore to dataStore.

Parameters:
dataStore - The dataStore to set.

getDataStoreConfig

public DataStoreConfig getDataStoreConfig()
Access dataStoreConfig property.

Returns:
Returns the dataStoreConfig.

setDataStoreConfig

public void setDataStoreConfig(DataStoreConfig dataStoreConfig)
Set dataStoreConfig to dataStoreConfig.

Parameters:
dataStoreConfig - The dataStoreConfig to set.

getDataStoreID

public java.lang.String getDataStoreID()
Access dataStoreID property.

Returns:
Returns the dataStoreID.

getFeatureType

public org.geotools.feature.FeatureType getFeatureType()
Access featureType property.

Returns:
Returns the featureType.

getFeatureTypeConfig

public FeatureTypeConfig getFeatureTypeConfig()
Access featureTypeConfig property.

Returns:
Returns the featureTypeConfig.

getNewDataStore

public DataStoreConfig getNewDataStore()
Access newDataStore property.

Returns:
Returns the newDataStore.

setNewDataStore

public void setNewDataStore(DataStoreConfig newDataStore)
Set newDataStore to newDataStore.

Parameters:
newDataStore - The newDataStore to set.

getUsername

public java.lang.String getUsername()
Access username property.

Returns:
Returns the username.

setUsername

public void setUsername(java.lang.String username)
Set username to username.

Parameters:
username - The username to set.

setDataStoreID

public void setDataStoreID(java.lang.String dataStoreID)
Set dataStoreID to dataStoreID.

Parameters:
dataStoreID - The dataStoreID to set.

setFeatureType

public void setFeatureType(org.geotools.feature.FeatureType featureType)
Set featureType to featureType.

Parameters:
featureType - The featureType to set.

setFeatureTypeConfig

public void setFeatureTypeConfig(FeatureTypeConfig featureTypeConfig)
Set featureTypeConfig to featureTypeConfig.

Parameters:
featureTypeConfig - The featureTypeConfig to set.