velosurf.tools
Class VelosurfTool

java.lang.Object
  |
  +--java.util.AbstractMap
        |
        +--java.util.HashMap
              |
              +--velosurf.context.DBReference
                    |
                    +--velosurf.tools.VelosurfTool
All Implemented Interfaces:
java.lang.Cloneable, DataAccessor, java.util.Map, java.io.Serializable, org.apache.velocity.tools.view.tools.ViewTool

public class VelosurfTool
extends DBReference
implements org.apache.velocity.tools.view.tools.ViewTool

This class is a tool meant to be referenced in toolbox.xml

It can be used in any scope you want (application/session/request), depending on the behaviour you need for the refinement and ordering mechanisms (which will follow the same scope)

The initialization itself is very fast once all static initialization has been done, so there is no performance bottleneck when using request scope.

Author:
Claude Brisson
See Also:
Serialized Form

Inner classes inherited from class java.util.Map
java.util.Map.Entry
 
Field Summary
protected static java.lang.String DATABASE_CONFIG_FILE_KEY
          key used in the deployment descriptor (web.xml) to set the name of the config file
protected static java.lang.String DEFAULT_DATABASE_CONFIG_FILE
          default database config file
protected static DBConnection sDB
          database connection
protected static boolean sInitialized
          has the static initialization been done ?
 
Fields inherited from class velosurf.context.DBReference
mCache, mDB, mExternalParams
 
Fields inherited from class java.util.HashMap
count, emptyHashIterator, ENTRIES, entrySet, KEYS, keySet, loadFactor, modCount, serialVersionUID, table, threshold, values, VALUES
 
Constructor Summary
VelosurfTool()
          builds a new VelosurfTool
 
Method Summary
 void init(java.lang.Object inViewContext)
          Initializes this instance using the given ViewContext
static DBConnection initDB(javax.servlet.ServletContext inServletContext)
          static initialization method
 
Methods inherited from class velosurf.context.DBReference
deobfuscate, get, getError, init, obfuscate, put
 
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

DATABASE_CONFIG_FILE_KEY

protected static final java.lang.String DATABASE_CONFIG_FILE_KEY
key used in the deployment descriptor (web.xml) to set the name of the config file

DEFAULT_DATABASE_CONFIG_FILE

protected static final java.lang.String DEFAULT_DATABASE_CONFIG_FILE
default database config file

sInitialized

protected static boolean sInitialized
has the static initialization been done ?

sDB

protected static DBConnection sDB
database connection
Constructor Detail

VelosurfTool

public VelosurfTool()
builds a new VelosurfTool
Method Detail

init

public void init(java.lang.Object inViewContext)
Initializes this instance using the given ViewContext
Specified by:
init in interface org.apache.velocity.tools.view.tools.ViewTool
Parameters:
inViewContext - initialization data

initDB

public static DBConnection initDB(javax.servlet.ServletContext inServletContext)
static initialization method
Parameters:
inServletContext - servlet context
Returns:
database connection


ooOoo