| Modifier and Type | Class and Description |
|---|---|
static interface |
ParseSession.Action
Callback interface used by
ParseSession.performParseSessionAction()
and ParseSession.performParseSessionActionWithCurrentTransaction(). |
Session.HasTransactionOptions, Session.RetryableAction, Session.TransactionalAction| Modifier and Type | Field and Description |
|---|---|
static String |
PARSE_FUNCTIONS_DESCRIPTOR_RESOURCE
Classpath XML file resource describing available
Functions: "META-INF/jsimpledb/parse-function-implementations.xml". |
DEFAULT_INITIAL_RETRY_DELAY, DEFAULT_MAX_RETRIES, DEFAULT_MAXIMUM_RETRY_DELAY, log| Constructor and Description |
|---|
ParseSession(Database db)
Constructor for
SessionMode.CORE_API mode. |
ParseSession(JSimpleDB jdb)
Constructor for
SessionMode.JSIMPLEDB mode. |
ParseSession(KVDatabase kvdb)
Constructor for
SessionMode.KEY_VALUE mode. |
| Modifier and Type | Method and Description |
|---|---|
SortedMap<String,Function> |
getFunctions()
Get the
Functions registered with this instance. |
Parser<? extends Node> |
getIdentifierParser()
Get the current standalone identifier parser.
|
Set<String> |
getImports()
Get currently configured Java imports.
|
SortedMap<String,Value> |
getVars()
Get all variables set on this instance.
|
void |
loadFunctionsFromClasspath()
Scan the classpath for
Functions and register them. |
boolean |
performParseSessionAction(ParseSession.Action action)
Perform the given action in the context of this session.
|
boolean |
performParseSessionActionWithCurrentTransaction(ParseSession.Action action)
Associate the current
JTransaction with this instance, if not already associated,
while performing the given action. |
void |
registerFunction(Function function)
Register the given
Function. |
String |
relativizeClassName(Class<?> klass)
Relativize the given class's name, so that it is as short as possible given the configured imports.
|
Class<?> |
resolveClass(String name,
boolean allowPrimitive)
Resolve a class name against this instance's currently configured class imports.
|
void |
setIdentifierParser(Parser<? extends Node> identifierParser)
Set the standalone identifier parser.
|
getDatabase, getDatabaseDescription, getInitialRetryDelay, getJSimpleDB, getJTransaction, getKVDatabase, getKVTransaction, getMaximumRetryDelay, getMaxRetries, getMode, getNameIndex, getSchemaModel, getSchemaVersion, getTransaction, getValidationMode, isAllowNewSchema, isReadOnly, isTransactionOpen, performSessionAction, performSessionActionWithCurrentTransaction, reportException, setAllowNewSchema, setDatabaseDescription, setInitialRetryDelay, setMaximumRetryDelay, setMaxRetries, setMode, setReadOnly, setRollbackOnly, setSchemaModel, setSchemaVersion, setValidationModepublic static final String PARSE_FUNCTIONS_DESCRIPTOR_RESOURCE
Functions: "META-INF/jsimpledb/parse-function-implementations.xml".
Example:
<parse-function-implementations>
<parse-function-implementation class="com.example.MyFunction"/>
</parse-function-implementations>
Instances must have a public constructor taking either zero parameters or one ParseSession parameter.
public ParseSession(KVDatabase kvdb)
SessionMode.KEY_VALUE mode.kvdb - key/value databaseIllegalArgumentException - if kvdb is nullpublic ParseSession(Database db)
SessionMode.CORE_API mode.db - core databaseIllegalArgumentException - if db is nullpublic ParseSession(JSimpleDB jdb)
SessionMode.JSIMPLEDB mode.jdb - databaseIllegalArgumentException - if jdb is nullpublic Set<String> getImports()
Each entry should of the form foo.bar.Name or foo.bar.*.
public SortedMap<String,Function> getFunctions()
Functions registered with this instance.public SortedMap<String,Value> getVars()
public void loadFunctionsFromClasspath()
Functions and register them.PARSE_FUNCTIONS_DESCRIPTOR_RESOURCEpublic void registerFunction(Function function)
function - new functionIllegalArgumentException - if function is nullpublic Parser<? extends Node> getIdentifierParser()
public void setIdentifierParser(Parser<? extends Node> identifierParser)
The configured identifier parser, if any, is invoked on standalone identifiers. This allows for configurable behavior with respect to resolving such identifiers.
Typically when installing a new parser, the previous parser (if any) is set as its delegate.
identifierParser - parser for standalone identifiers, or null for nonepublic Class<?> resolveClass(String name, boolean allowPrimitive)
name - class name as it would appear in the Java languageallowPrimitive - whether to allow primitive types like intIllegalArgumentException - if name cannot be resolvedpublic String relativizeClassName(Class<?> klass)
String this will return String, but for class ArrayList
this will return java.util.ArrayList unless java.util.* has been imported.klass - class whose name to relativizeIllegalArgumentException - if klass is nullpublic boolean performParseSessionAction(ParseSession.Action action)
This is a ParseSession-specific overload of
Session.performSessionAction(); see that method for details.
action - action to perform, possibly within a transactionaction completed successfully, false if a transaction could not be created
or action threw an exceptionIllegalArgumentException - if action is nullpublic boolean performParseSessionActionWithCurrentTransaction(ParseSession.Action action)
JTransaction with this instance, if not already associated,
while performing the given action.
This is a ParseSession-specific overload of
Session.performSessionActionWithCurrentTransaction();
see that method for details.
action - action to performaction completed successfully, false if action threw an exceptionIllegalStateException - if there is a different open transaction already associated with this instanceIllegalStateException - if this instance is not in mode SessionMode.JSIMPLEDBIllegalArgumentException - if action is nullCopyright © 2017. All rights reserved.