velosurf.context
Class DBReference

java.lang.Object
  |
  +--java.util.AbstractMap
        |
        +--java.util.HashMap
              |
              +--velosurf.context.DBReference
All Implemented Interfaces:
java.lang.Cloneable, DataAccessor, java.util.Map, java.io.Serializable
Direct Known Subclasses:
Velosurf, VelosurfTool

public class DBReference
extends java.util.HashMap
implements DataAccessor

A context wrapper for the main database connection object.

The "$db" context variable is assigned a new instance of this class at each velocity parsing.

Author:
Claude Brisson
See Also:
Serialized Form

Inner classes inherited from class java.util.Map
java.util.Map.Entry
 
Field Summary
protected  java.util.Map mCache
          a cache used by the generic getter - it's purpose is to avoid the creation of several attribute references for the same multivalued attribute.
protected  DBConnection mDB
          the wrapped database connection
protected  java.util.Map mExternalParams
          The map of external query parameters used by children attributes
 
Fields inherited from class java.util.HashMap
count, emptyHashIterator, ENTRIES, entrySet, KEYS, keySet, loadFactor, modCount, serialVersionUID, table, threshold, values, VALUES
 
Constructor Summary
protected DBReference()
          Default constructor for use by derived classes
  DBReference(DBConnection inDB)
          Constructs a new reference
 
Method Summary
 java.lang.String deobfuscate(java.lang.Object value)
          de-obfuscate the given value
 java.lang.Object get(java.lang.Object inKey)
          Generic getter, used to access entities or root attributes by their name.
 java.lang.String getError()
          Get the last error message, or null if none occured.
protected  void init(DBConnection inDB)
          protected initialization method
 java.lang.String obfuscate(java.lang.Object value)
          obfuscate the given value
 java.lang.Object put(java.lang.Object inKey, java.lang.Object inValue)
          Generic setter used to set external params for children attributes
 
Methods inherited from class java.util.HashMap
, capacity, clear, clone, containsKey, containsValue, entrySet, getHashIterator, isEmpty, keySet, loadFactor, putAll, readObject, rehash, remove, size, values, writeObject
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, registerNatives, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Field Detail

mDB

protected DBConnection mDB
the wrapped database connection

mCache

protected java.util.Map mCache
a cache used by the generic getter - it's purpose is to avoid the creation of several attribute references for the same multivalued attribute.

mExternalParams

protected java.util.Map mExternalParams
The map of external query parameters used by children attributes
Constructor Detail

DBReference

protected DBReference()
Default constructor for use by derived classes

DBReference

public DBReference(DBConnection inDB)
Constructs a new reference
Parameters:
inDB - the wrapped database connection
Method Detail

init

protected void init(DBConnection inDB)
protected initialization method
Parameters:
inDB - database connection

getError

public java.lang.String getError()
Get the last error message, or null if none occured.
Returns:
The last error message, or null

get

public java.lang.Object get(java.lang.Object inKey)
Generic getter, used to access entities or root attributes by their name.

For attributes, the return value depends upon the type of the attribute :

Specified by:
get in interface DataAccessor
Overrides:
get in class java.util.HashMap
Parameters:
inKey - the name of the desired entity or root attribute.
Returns:
an entity, an attribute reference, an instance, a string or null if not found. See See above.

put

public java.lang.Object put(java.lang.Object inKey,
                            java.lang.Object inValue)
Generic setter used to set external params for children attributes
Overrides:
put in class java.util.HashMap
Parameters:
inKey - name of the external parameter
inValue - value given to the external parameter
Returns:
null

obfuscate

public java.lang.String obfuscate(java.lang.Object value)
obfuscate the given value
Parameters:
value - value to obfuscate
Returns:
obfuscated value

deobfuscate

public java.lang.String deobfuscate(java.lang.Object value)
de-obfuscate the given value
Parameters:
value - value to de-obfuscate
Returns:
obfuscated value


ooOoo