railo.runtime.type.scope.storage
Class StorageScopeImpl

java.lang.Object
  extended by railo.runtime.type.util.StructSupport
      extended by railo.runtime.type.scope.storage.StorageScopeImpl
All Implemented Interfaces:
Serializable, Cloneable, Map, Dumpable, Castable, Collection, ForEachIteratorable, Iteratorable, Objects, Scope, SharedScope, StorageScope, Sizeable, Struct
Direct Known Subclasses:
StorageScopeCache, StorageScopeCookie, StorageScopeDatasource, StorageScopeFile, StorageScopeMemory

public abstract class StorageScopeImpl
extends StructSupport
implements StorageScope, Sizeable

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface railo.runtime.type.Collection
Collection.Key
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Field Summary
static Collection.Key CFID
           
static Collection.Key CFTOKEN
           
static Collection.Key HITCOUNT
           
static Collection.Key LASTVISIT
           
static Collection.Key SESSION_ID
           
static Collection.Key TIMECREATED
           
static Collection.Key URLTOKEN
           
 
Fields inherited from interface railo.runtime.type.scope.Scope
SCOPE_APPLICATION, SCOPE_ARGUMENTS, SCOPE_CALLER, SCOPE_CGI, SCOPE_CLIENT, SCOPE_CLUSTER, SCOPE_COOKIE, SCOPE_COUNT, SCOPE_FORM, SCOPE_LOCAL, SCOPE_REQUEST, SCOPE_SERVER, SCOPE_SESSION, SCOPE_UNDEFINED, SCOPE_URL, SCOPE_VAR, SCOPE_VARIABLES
 
Fields inherited from interface railo.runtime.type.Struct
TYPE_LINKED, TYPE_REGULAR, TYPE_SOFT, TYPE_SYNC, TYPE_WEAKED
 
Constructor Summary
StorageScopeImpl(StorageScopeImpl other, boolean deepCopy)
          Constructor of the class
StorageScopeImpl(Struct sct, DateTime timecreated, DateTime _lastvisit, long lastvisit, int hitcount, String strType, int type)
          Constructor of the class
 
Method Summary
 int _getId()
           
 Boolean castToBoolean(Boolean defaultValue)
          cast the castable value to a boolean value
 boolean castToBooleanValue()
          cast the castable value to a boolean value
 DateTime castToDateTime()
          cast the castable value to a date time object
 DateTime castToDateTime(DateTime defaultValue)
          cast the castable value to a date time object
 double castToDoubleValue()
          cast the castable value to a double value
 double castToDoubleValue(double defaultValue)
          cast the castable value to a double value
 String castToString()
          cast the castable value to a string, other than the Method toString, this Method can throw a Exception
 String castToString(String defaultValue)
          cast the castable value to a string, return the default value, when the method is not castable
 void clear()
          clears the collection
 int compareTo(boolean b)
           
 int compareTo(DateTime dt)
           
 int compareTo(double d)
           
 int compareTo(String str)
           
 boolean containsKey(Collection.Key key)
          contains this key
 boolean containsValue(Object value)
           
static String decode(String input)
           
static String encode(String input)
           
 Iterator<Map.Entry<Collection.Key,Object>> entryIterator()
           
 String generateToken(String key, boolean forceNew)
           
 Object get(Collection.Key key)
          return a value from the collection
 Object get(Collection.Key key, Object defaultValue)
          return a value from the collection, if key doesn't exist, dont throw a exception, reeturns null
 long getCreated()
           
 long getLastAccess()
           
 int getMaxInactiveInterval()
          Returns the maximum time interval, in seconds, that the servlet container will keep this session open between client accesses.
 String getStorage()
          return the name of the storage used, this is not the storage type!
 long getTimeSpan()
           
 int getType()
           
 String getTypeAsString()
           
 boolean hasChanges()
           
 boolean hasContent()
           
 void initialize(PageContext pc)
          Initalize Scope
 boolean isExpired()
           
 boolean isInitalized()
          return if the scope is Initialiesd
 Iterator<Collection.Key> keyIterator()
           
 Collection.Key[] keys()
           
 Iterator<String> keysAsStringIterator()
           
 long lastVisit()
           
 Collection.Key[] pureKeys()
           
 void release()
          release scope for reuse
 void release(PageContext pc)
          release scope for reuse
 Object remove(Collection.Key key)
          removes value from collection and return it when it exists, otherwise throws a exception
 Object removeEL(Collection.Key key)
          removes value from collection and return it when it exists, otherwise returns null
 void resetEnv(PageContext pc)
           
 Object set(Collection.Key key, Object value)
          sets a value to the collection
 Object setEL(Collection.Key key, Object value)
          sets a value to the collection, if key doesn't exist, dont throw a exception, returns null
 void setMaxInactiveInterval(int interval)
          Specifies the time, in seconds, between client requests before the servlet container will invalidate this session.
 void setStorage(String storage)
          sets the name of the storage used, this is not the storage type!
 int size()
           
 long sizeOf()
          return the size of the object
 void store(Config config)
          store content on persistent layer
 DumpData toDumpData(PageContext pageContext, int maxlevel, DumpProperties dp)
          method to print out information to a object as HTML
 void touch()
           
 void touchAfterRequest(PageContext pc)
          release scope only for current request, scope will be used again
 void touchBeforeRequest(PageContext pc)
          Initalize Scope only for this request, scope was already used
 void unstore(Config config)
          remove stored data from persistent layer
 Iterator<Object> valueIterator()
           
 Collection values()
           
 boolean verifyToken(String token, String key)
           
 
Methods inherited from class railo.runtime.type.util.StructSupport
call, callWithNamedValues, clone, containsKey, containsKey, entrySet, equals, get, get, get, get, get, getIterator, hashCode, invalidKey, isEmpty, keySet, put, putAll, remove, set, set, setEL, setEL, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface railo.runtime.type.scope.storage.StorageScope
getStorageType
 
Methods inherited from interface railo.runtime.type.Collection
clone, containsKey, duplicate, get, get, set, setEL
 
Methods inherited from interface railo.runtime.type.ForEachIteratorable
getIterator
 
Methods inherited from interface java.util.Map
containsKey, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove
 
Methods inherited from interface railo.runtime.type.Objects
call, callWithNamedValues, get, get, set, setEL
 

Field Detail

CFID

public static Collection.Key CFID

CFTOKEN

public static Collection.Key CFTOKEN

URLTOKEN

public static Collection.Key URLTOKEN

LASTVISIT

public static Collection.Key LASTVISIT

HITCOUNT

public static Collection.Key HITCOUNT

TIMECREATED

public static Collection.Key TIMECREATED

SESSION_ID

public static Collection.Key SESSION_ID
Constructor Detail

StorageScopeImpl

public StorageScopeImpl(Struct sct,
                        DateTime timecreated,
                        DateTime _lastvisit,
                        long lastvisit,
                        int hitcount,
                        String strType,
                        int type)
Constructor of the class

Parameters:
sct -
timecreated -
_lastvisit -
lastvisit -
hitcount -

StorageScopeImpl

public StorageScopeImpl(StorageScopeImpl other,
                        boolean deepCopy)
Constructor of the class

Parameters:
other -
deepCopy -
Method Detail

touchBeforeRequest

public void touchBeforeRequest(PageContext pc)
Description copied from interface: SharedScope
Initalize Scope only for this request, scope was already used

Specified by:
touchBeforeRequest in interface SharedScope
Parameters:
pc - Page Context

resetEnv

public void resetEnv(PageContext pc)

setMaxInactiveInterval

public void setMaxInactiveInterval(int interval)
Description copied from interface: StorageScope
Specifies the time, in seconds, between client requests before the servlet container will invalidate this session. A negative time indicates the session should never timeout.

Specified by:
setMaxInactiveInterval in interface StorageScope
Parameters:
interval - - An integer specifying the number of seconds

getMaxInactiveInterval

public int getMaxInactiveInterval()
Description copied from interface: StorageScope
Returns the maximum time interval, in seconds, that the servlet container will keep this session open between client accesses. After this interval, the servlet container will invalidate the session. The maximum time interval can be set with the setMaxInactiveInterval method. A negative time indicates the session should never timeout.

Specified by:
getMaxInactiveInterval in interface StorageScope
Returns:
an integer specifying the number of seconds this session remains open between client requests

isInitalized

public final boolean isInitalized()
Description copied from interface: Scope
return if the scope is Initialiesd

Specified by:
isInitalized in interface Scope
Returns:
scope is init

initialize

public final void initialize(PageContext pc)
Description copied from interface: Scope
Initalize Scope

Specified by:
initialize in interface Scope
Parameters:
pc - Page Context

touchAfterRequest

public void touchAfterRequest(PageContext pc)
Description copied from interface: SharedScope
release scope only for current request, scope will be used again

Specified by:
touchAfterRequest in interface SharedScope

release

public final void release()
Description copied from interface: Scope
release scope for reuse

Specified by:
release in interface Scope

release

public final void release(PageContext pc)
Description copied from interface: Scope
release scope for reuse

Specified by:
release in interface Scope

hasContent

public boolean hasContent()
Returns:
returns if the scope is empty or not, this method ignore the "constant" entries of the scope (cfid,cftoken,urltoken)

clear

public void clear()
Description copied from interface: Collection
clears the collection

Specified by:
clear in interface Map
Specified by:
clear in interface Collection

containsKey

public boolean containsKey(Collection.Key key)
Description copied from interface: Collection
contains this key

Specified by:
containsKey in interface Collection
Returns:
returns if collection has a key with given name

get

public Object get(Collection.Key key)
           throws PageException
Description copied from interface: Collection
return a value from the collection

Specified by:
get in interface Collection
Parameters:
key - key of the value to get must be lower case
Returns:
value on key position
Throws:
PageException

get

public Object get(Collection.Key key,
                  Object defaultValue)
Description copied from interface: Collection
return a value from the collection, if key doesn't exist, dont throw a exception, reeturns null

Specified by:
get in interface Collection
Parameters:
key - key of the value to get
Returns:
value on key position or null

keyIterator

public Iterator<Collection.Key> keyIterator()
Specified by:
keyIterator in interface Iteratorable
Returns:
return a Iterator for Keys as Collection.Keys

keysAsStringIterator

public Iterator<String> keysAsStringIterator()
Specified by:
keysAsStringIterator in interface Iteratorable
Overrides:
keysAsStringIterator in class StructSupport
Returns:
return a Iterator for Keys as String

entryIterator

public Iterator<Map.Entry<Collection.Key,Object>> entryIterator()
Specified by:
entryIterator in interface Iteratorable

valueIterator

public Iterator<Object> valueIterator()
Specified by:
valueIterator in interface Iteratorable
Returns:
return a Iterator for Values

keys

public Collection.Key[] keys()
Specified by:
keys in interface Collection
Returns:
returns a string array of all keys in the collection

remove

public Object remove(Collection.Key key)
              throws PageException
Description copied from interface: Collection
removes value from collection and return it when it exists, otherwise throws a exception

Specified by:
remove in interface Collection
Parameters:
key - key of the collection
Returns:
removed Object
Throws:
PageException

removeEL

public Object removeEL(Collection.Key key)
Description copied from interface: Collection
removes value from collection and return it when it exists, otherwise returns null

Specified by:
removeEL in interface Collection
Parameters:
key - key of the collection
Returns:
removed Object

set

public Object set(Collection.Key key,
                  Object value)
           throws PageException
Description copied from interface: Collection
sets a value to the collection

Specified by:
set in interface Collection
Parameters:
key - key of the new value
value - value to set
Returns:
value setted
Throws:
PageException

setEL

public Object setEL(Collection.Key key,
                    Object value)
Description copied from interface: Collection
sets a value to the collection, if key doesn't exist, dont throw a exception, returns null

Specified by:
setEL in interface Collection
Parameters:
key - key of the value to get
value - value to set
Returns:
value on key position or null

size

public int size()
Specified by:
size in interface Map
Specified by:
size in interface Collection
Returns:
the size of the collection

castToBooleanValue

public boolean castToBooleanValue()
                           throws PageException
Description copied from interface: Castable
cast the castable value to a boolean value

Specified by:
castToBooleanValue in interface Castable
Overrides:
castToBooleanValue in class StructSupport
Returns:
boolean Value representation of the Object
Throws:
PageException

castToBoolean

public Boolean castToBoolean(Boolean defaultValue)
Description copied from interface: Castable
cast the castable value to a boolean value

Specified by:
castToBoolean in interface Castable
Overrides:
castToBoolean in class StructSupport
Returns:
boolean Value representation of the Object

castToDateTime

public DateTime castToDateTime()
                        throws PageException
Description copied from interface: Castable
cast the castable value to a date time object

Specified by:
castToDateTime in interface Castable
Overrides:
castToDateTime in class StructSupport
Returns:
date time representation of the Object
Throws:
PageException

castToDateTime

public DateTime castToDateTime(DateTime defaultValue)
Description copied from interface: Castable
cast the castable value to a date time object

Specified by:
castToDateTime in interface Castable
Overrides:
castToDateTime in class StructSupport
Parameters:
defaultValue - returned when it is not possible to cast to a dateTime object
Returns:
date time representation of the Object

castToDoubleValue

public double castToDoubleValue()
                         throws PageException
Description copied from interface: Castable
cast the castable value to a double value

Specified by:
castToDoubleValue in interface Castable
Overrides:
castToDoubleValue in class StructSupport
Returns:
double Value representation of the Object
Throws:
PageException

castToDoubleValue

public double castToDoubleValue(double defaultValue)
Description copied from interface: Castable
cast the castable value to a double value

Specified by:
castToDoubleValue in interface Castable
Overrides:
castToDoubleValue in class StructSupport
Returns:
double Value representation of the Object

castToString

public String castToString()
                    throws PageException
Description copied from interface: Castable
cast the castable value to a string, other than the Method toString, this Method can throw a Exception

Specified by:
castToString in interface Castable
Overrides:
castToString in class StructSupport
Returns:
String representation of the Object
Throws:
PageException

castToString

public String castToString(String defaultValue)
Description copied from interface: Castable
cast the castable value to a string, return the default value, when the method is not castable

Specified by:
castToString in interface Castable
Overrides:
castToString in class StructSupport
Returns:
String representation of the Object

compareTo

public int compareTo(boolean b)
              throws PageException
Specified by:
compareTo in interface Castable
Overrides:
compareTo in class StructSupport
Throws:
PageException

compareTo

public int compareTo(DateTime dt)
              throws PageException
Specified by:
compareTo in interface Castable
Overrides:
compareTo in class StructSupport
Throws:
PageException

compareTo

public int compareTo(double d)
              throws PageException
Specified by:
compareTo in interface Castable
Overrides:
compareTo in class StructSupport
Throws:
PageException

compareTo

public int compareTo(String str)
              throws PageException
Specified by:
compareTo in interface Castable
Overrides:
compareTo in class StructSupport
Throws:
PageException

lastVisit

public long lastVisit()
Specified by:
lastVisit in interface StorageScope
Returns:
time when the Scope last time was visited

pureKeys

public Collection.Key[] pureKeys()

store

public void store(Config config)
Description copied from interface: StorageScope
store content on persistent layer

Specified by:
store in interface StorageScope

unstore

public void unstore(Config config)
Description copied from interface: StorageScope
remove stored data from persistent layer

Specified by:
unstore in interface StorageScope

hasChanges

public boolean hasChanges()
Returns:
the hasChanges

containsValue

public boolean containsValue(Object value)
Specified by:
containsValue in interface Map
Overrides:
containsValue in class StructSupport

values

public Collection values()
Specified by:
values in interface Map
Overrides:
values in class StructSupport

sizeOf

public long sizeOf()
Description copied from interface: Sizeable
return the size of the object

Specified by:
sizeOf in interface Sizeable
Overrides:
sizeOf in class StructSupport
Returns:
size of the object

getType

public final int getType()
Specified by:
getType in interface Scope
Returns:
return the scope type (SCOPE_SERVER, SCOPE_SESSION usw.)

getTypeAsString

public final String getTypeAsString()
Specified by:
getTypeAsString in interface Scope
Returns:
return the scope type as a String (server,session usw.)

toDumpData

public final DumpData toDumpData(PageContext pageContext,
                                 int maxlevel,
                                 DumpProperties dp)
Description copied from interface: Dumpable
method to print out information to a object as HTML

Specified by:
toDumpData in interface Dumpable
Overrides:
toDumpData in class StructSupport
Returns:
HTML print out

getLastAccess

public long getLastAccess()
Specified by:
getLastAccess in interface StorageScope

getTimeSpan

public long getTimeSpan()
Specified by:
getTimeSpan in interface StorageScope

touch

public void touch()
Specified by:
touch in interface StorageScope

isExpired

public boolean isExpired()
Specified by:
isExpired in interface StorageScope

setStorage

public void setStorage(String storage)
Description copied from interface: StorageScope
sets the name of the storage used, this is not the storage type!

Specified by:
setStorage in interface StorageScope

getStorage

public String getStorage()
Description copied from interface: StorageScope
return the name of the storage used, this is not the storage type!

Specified by:
getStorage in interface StorageScope
Returns:

encode

public static String encode(String input)

decode

public static String decode(String input)

_getId

public int _getId()

getCreated

public long getCreated()
Specified by:
getCreated in interface StorageScope

generateToken

public String generateToken(String key,
                            boolean forceNew)
Specified by:
generateToken in interface StorageScope

verifyToken

public boolean verifyToken(String token,
                           String key)
Specified by:
verifyToken in interface StorageScope


Copyright © 2012 Railo