Package org.geotools.jdbc
Class SessionCommandsListener
Object
SessionCommandsListener
- All Implemented Interfaces:
ConnectionLifecycleListener
A
ConnectionLifecycleListener that executes custom SQL commands on connection grab and
release. The SQL commands can contain environment variable references, where the environment
variable reference contains a name and an eventual default value.
Parsing rules are:
- whatever is between
${and}is considered a environment variable reference in the form${name,defaultvalue}, the default value being optional $and}can be used stand alone only escaped with\(e.g.\$and\})\can be used stand alone only escaped with another\ (e.g.
- a environment variable name cannot contain a comma, which is used as the separator between the environment variable name and its default value (first comma acts as a separator)
- the default value is always interpreted as a string and expanded as such in the sql commands
\\)
- "one two three \} \$ \\" (simple literal with special chars escaped)
- "My name is ${name}" (a simple environment variable reference without a default value)
- "My name is ${name,Joe}" (a simple environment variable reference with a default value)
- "bla ${myAttName" (unclosed expression section)
- "bla } bla" (
}is reserved, should have been escaped)
- Author:
- Andrea Aime - GeoSolutions
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidonBorrow(JDBCDataStore store, Connection cx) Called when the collection is being borrowed from the connection poolvoidonCommit(JDBCDataStore store, Connection cx) Called when the connection comes to a commitvoidonRelease(JDBCDataStore store, Connection cx) Called when the collection is being released back to the connection poolvoidonRollback(JDBCDataStore store, Connection cx) Called when the connection comes to a rollback
-
Constructor Details
-
SessionCommandsListener
-
-
Method Details
-
onBorrow
Description copied from interface:ConnectionLifecycleListenerCalled when the collection is being borrowed from the connection pool- Specified by:
onBorrowin interfaceConnectionLifecycleListener- Throws:
SQLException
-
onRelease
Description copied from interface:ConnectionLifecycleListenerCalled when the collection is being released back to the connection pool- Specified by:
onReleasein interfaceConnectionLifecycleListener- Throws:
SQLException
-
onCommit
Description copied from interface:ConnectionLifecycleListenerCalled when the connection comes to a commit- Specified by:
onCommitin interfaceConnectionLifecycleListener
-
onRollback
Description copied from interface:ConnectionLifecycleListenerCalled when the connection comes to a rollback- Specified by:
onRollbackin interfaceConnectionLifecycleListener
-