|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractMap<K,V>
java.util.HashMap
velosurf.context.DBReference
velosurf.web.VelosurfTool
public class VelosurfTool
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.
Since version 1.0rc1, you can have several instances of VelosurfTool, each with a distinct configuration file. This can be useful to have one instance per schema, or one instance per database if dealing with several databases.
For this to work, you have to uncomment 'Configurable' at the beginning of the class declaration in this file. You can then give each instance the pathname of its configuration file via the 'config' parameter in the toolbox.xml file (this is a brand new feature of VelocityTools 1.2, commented here because VelocityTools 1.2 has not been officially released yet, you've got to grab it from the subversion head), like this :
<!-- first instance -->
<tool>
<key>db1</key>
<scope>request</scope>
<class>velosurf.tools.VelosurfTool</scope>
<parameter name="config" value="WEB-INF/db1.xml" />
</tool>
<!-- second instance -->
<tool>
<key>db2</key>
<scope>request</scope>
<class>velosurf.tools.VelosurfTool</scope>
<parameter name="config" value="WEB-INF/db2.xml" />
</tool>
| Field Summary | |
|---|---|
protected java.lang.String |
configFile
path to the config file |
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.util.Map<java.lang.String,Database> |
dbMap
database connections |
protected static java.lang.String |
DEFAULT_DATABASE_CONFIG_FILE
default database config file |
protected static boolean |
fetchLocalizer
do we need to try to fetch the localizer object ? |
protected static java.lang.String |
OLD_DEFAULT_DATABASE_CONFIG_FILE
old default database config file |
| Fields inherited from class velosurf.context.DBReference |
|---|
cache, db, externalParams, userContext |
| Constructor Summary | |
|---|---|
VelosurfTool()
builds a new VelosurfTool |
|
| Method Summary | |
|---|---|
void |
configure(java.util.Map map)
configure |
protected static Database |
getConnection(java.lang.String configFile)
returns the existing Database for the specified config file, or null if it isn't already open. |
protected static Database |
getConnection(java.lang.String configFile,
javax.servlet.ServletContext servletContext)
returns the existing Database for the specified config file and servlet context, or null if an error occurs. |
protected static Database |
getDefaultConnection()
returns the existing Database for the default config file, or null if it does not already exist. |
protected static Database |
getDefaultConnection(javax.servlet.ServletContext servletContext)
returns the existing Database for the default config file and servlet context, or null if an error occurs. |
static DBReference |
getDefaultInstance()
returns a db reference the existing Database for the default config file, or null if it does not already exist. |
static DBReference |
getDefaultInstance(javax.servlet.ServletContext servletContext)
|
static DBReference |
getDefaultInstance(javax.servlet.ServletContext servletContext,
UserContext userContext)
returns a db reference on the existing Database for the default config file and servlet context, or null if an error occurs. |
static DBReference |
getDefaultInstance(UserContext userContext)
returns a db reference the existing Database for the default config file, or null if it does not already exist. |
static DBReference |
getInstance(java.lang.String configFile)
returns a db reference on the existing Database for the specified config file, or null if it isn't already open. |
static DBReference |
getInstance(java.lang.String configFile,
javax.servlet.ServletContext servletContext)
returns a db reference on the existing Database for the specified config file and servlet context, or null if an error occurs. |
static DBReference |
getInstance(java.lang.String configFile,
javax.servlet.ServletContext servletContext,
UserContext userContext)
returns a db reference on the existing Database for the specified config file and servlet context, or null if an error occurs. |
static DBReference |
getInstance(java.lang.String configFile,
UserContext userContext)
returns a db reference on the existing Database for the specified config file, or null if it isn't already open. |
void |
init(java.lang.Object viewContext)
Initializes this instance using the given ViewContext |
| Methods inherited from class velosurf.context.DBReference |
|---|
deobfuscate, get, getSchema, init, init, obfuscate, put |
| Methods inherited from class java.util.HashMap |
|---|
clear, clone, containsKey, containsValue, entrySet, isEmpty, keySet, putAll, remove, size, values |
| Methods inherited from class java.util.AbstractMap |
|---|
equals, hashCode, toString |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface velosurf.sql.ReadOnlyMap |
|---|
keySet |
| Methods inherited from interface java.util.Map |
|---|
equals, hashCode |
| Field Detail |
|---|
protected static final java.lang.String DATABASE_CONFIG_FILE_KEY
protected static final java.lang.String DEFAULT_DATABASE_CONFIG_FILE
protected static final java.lang.String OLD_DEFAULT_DATABASE_CONFIG_FILE
protected java.lang.String configFile
protected static java.util.Map<java.lang.String,Database> dbMap
protected static boolean fetchLocalizer
| Constructor Detail |
|---|
public VelosurfTool()
| Method Detail |
|---|
public void init(java.lang.Object viewContext)
throws java.lang.Exception
viewContext - initialization data
java.lang.Exceptionpublic void configure(java.util.Map map)
map - parametersprotected static Database getConnection(java.lang.String configFile)
configFile -
public static DBReference getInstance(java.lang.String configFile,
UserContext userContext)
configFile -
public static DBReference getInstance(java.lang.String configFile)
configFile -
protected static Database getConnection(java.lang.String configFile,
javax.servlet.ServletContext servletContext)
configFile -
public static DBReference getInstance(java.lang.String configFile,
javax.servlet.ServletContext servletContext,
UserContext userContext)
configFile -
public static DBReference getInstance(java.lang.String configFile,
javax.servlet.ServletContext servletContext)
configFile -
protected static Database getDefaultConnection()
public static DBReference getDefaultInstance(UserContext userContext)
public static DBReference getDefaultInstance()
protected static Database getDefaultConnection(javax.servlet.ServletContext servletContext)
public static DBReference getDefaultInstance(javax.servlet.ServletContext servletContext,
UserContext userContext)
public static DBReference getDefaultInstance(javax.servlet.ServletContext servletContext)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||