|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.farrago.session.FarragoSessionVariables
public class FarragoSessionVariables
FarragoSessionVariables defines global variable settings for a Farrago
session. It has two types of variables, plain old Java object fields, and
variables stored in a generic name to value map. Plain old Java object fields
are accessed directly, while mapped fields are accessed with set(String, String)
and get(String)
. Validation is handled in
FarragoSessionPersonality
.
Example:
FarragoSessionVariables sessionVars = ...;
String catalogName = sessionVars.catalogName;
sessionVars.set("newVar", "value"); // registers and sets value in map
String newVar = sessionVars.get("newVar"); // gets mapped value only
Field Summary | |
---|---|
String |
catalogName
The name of the default catalog qualifier, changed by SET CATALOG. |
String |
currentRoleName
Value of SQL expression CURRENT_ROLE. |
String |
currentUserName
Value of SQL expression CURRENT_USER. |
static String |
LOG_DIR
Name of session variable defining directory for log files; this is not currently used by the default Farrago personality, but it serves as a canonical name across all other personalities which need a similar concept. |
long |
processId
Client process Id. |
String |
programName
Client program name. |
String |
schemaName
The name of the default schema qualifier, changed by SET SCHEMA. |
List<SqlIdentifier> |
schemaSearchPath
Value of SQL expression CURRENT_PATH as a list of schemas. |
String |
sessionName
Session name. |
String |
sessionUserName
Value of SQL expression SESSION_USER. |
String |
systemUserFullName
Full user name, e.g. |
String |
systemUserName
Value of SQL expression SYSTEM_USER. |
private Map<String,String> |
valueMap
Additional variables |
Constructor Summary | |
---|---|
FarragoSessionVariables()
|
Method Summary | |
---|---|
FarragoSessionVariables |
cloneVariables()
|
boolean |
containsVariable(String name)
Tests whether a session variable is defined in this map. |
protected void |
copyVariables(FarragoSessionVariables baseVariables)
Copy the values in baseVariables to this instance. |
String |
get(String name)
Gets the value of variable in a generic value map. |
Boolean |
getBoolean(String name)
Gets the value of a variable, casted to a Boolean |
String |
getFormattedSchemaSearchPath(DatabaseMetaData databaseMetadata)
Format the schema search path as required by the SQL99 standard. |
Integer |
getInteger(String name)
Gets the value of a variable, casted to an Integer |
Long |
getLong(String name)
Gets the value of a variable, casted to a Long |
Map<String,String> |
getMap()
Retrieves a read only map from parameter name to parameter value. |
void |
set(String name,
String value)
Sets the value of a variable in a generic value map. |
void |
setBoolean(String name,
Boolean value)
Sets the value of a variable, expressed as an boolean |
void |
setDefault(String name,
String value)
Sets the default value for a variable. |
void |
setInteger(String name,
Integer value)
Sets the value of a variable, expressed as an integer |
void |
setLong(String name,
Long value)
Sets the value of a variable, expressed as a long |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String LOG_DIR
public String catalogName
public String schemaName
public String systemUserName
public String sessionUserName
public String currentUserName
public String currentRoleName
public List<SqlIdentifier> schemaSearchPath
SqlIdentifier
(catalog.schema). This list is immutable to
prevent accidental aliasing.
public String systemUserFullName
public String sessionName
public String programName
public long processId
private Map<String,String> valueMap
Constructor Detail |
---|
public FarragoSessionVariables()
Method Detail |
---|
public FarragoSessionVariables cloneVariables()
public String getFormattedSchemaSearchPath(DatabaseMetaData databaseMetadata)
databaseMetadata
- current database metadata
protected void copyVariables(FarragoSessionVariables baseVariables)
baseVariables
to this instance. Allows
extensions projects to provide extend FarragoSessionVariables and those
new session variables to values from an existing FarragoSessionVariables.
baseVariables
- an existing FarragoSessionVariables to copy into
this
.public void set(String name, String value)
name
- the name of a session variablevalue
- the value to set, expressed as a stringpublic String get(String name)
name
- the name of a session variable
IllegalArgumentException
- if the variable is not in the mappublic boolean containsVariable(String name)
name
- variable name to check
public void setInteger(String name, Integer value)
set(String, String)
public Integer getInteger(String name)
name
- the name of a session variable
IllegalArgumentException
- if the variable is not in the map
NumberFormatException
- if the value cannot be casted to an Integerget(String)
public void setLong(String name, Long value)
set(String, String)
public Long getLong(String name)
name
- the name of a session variable
IllegalArgumentException
- if the variable is not in the map
NumberFormatException
- if the value cannot be casted to a Longget(String)
public void setBoolean(String name, Boolean value)
set(String, String)
public Boolean getBoolean(String name)
name
- the name of a session variable
IllegalArgumentException
- if the variable is not in the mapget(String)
public void setDefault(String name, String value)
name
- the name of the variablevalue
- the default value of a variablepublic Map<String,String> getMap()
FarragoSessionVariables()
. The public fields take precedence.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |