public final class ApplicationSessionService
extends java.lang.Object
Session service internally sets up session transparently. This API is exposed for application to use the session. It must work together with session setup layer. (servlet filter)
The methods can be grouped as:
- Attach/detach/destroy session - Namespace operation - Privilege checkThe following code snippet provides a typical use of this class:
try { ApplicationSessionService.attachSession(conn); stmt = conn.createStatement(); rs = stmt.executeQuery(query); } finally { ApplicationSessionService.detachSession(conn); }
Constructor and Description |
---|
ApplicationSessionService() |
Modifier and Type | Method and Description |
---|---|
static void |
attachSession(java.sql.Connection conn)
Attaches the current user's application session to the given connection.
|
static void |
attachSessionPrivileged(java.sql.Connection conn, java.lang.String role)
Attaches the current user's application session to the given connection, and enable the given dynamic role in the attached session.
|
static boolean |
checkPrivilege(java.sql.Connection conn, byte[] acls, java.lang.String privilege)
Checks the privielge on the attached session.
|
static void |
createNamespace(java.sql.Connection conn, java.lang.String name)
Creates the namespace on the current user's application session.
|
static void |
deleteNamespace(java.sql.Connection conn, java.lang.String name)
Deletes the namespace on the current user's application session.
|
static void |
deleteNamespaceAttribute(java.sql.Connection conn, java.lang.String name, java.lang.String attribute)
Deletes the namespace attribute on the current user's application session.
|
static void |
destroySession(java.sql.Connection conn)
Destroys the current user's application session.
|
static void |
detachSession(java.sql.Connection conn)
Detaches the current user's application session from the given connection.
|
static java.lang.String |
getNamespaceAttribute(java.lang.String name, java.lang.String attribute)
Gets the namespace attribute from the current user's application session.
|
static void |
setNamespaceAttribute(java.sql.Connection conn, java.lang.String name, java.lang.String attribute, java.lang.String value)
Sets the namespace attribute on the current user's application session.
|
public static void attachSession(java.sql.Connection conn) throws ApplicationSessionException
conn
- the given JDBC connectionApplicationSessionException
- if an error happens during attachpublic static void detachSession(java.sql.Connection conn) throws ApplicationSessionException
conn
- the given JDBC connectionApplicationSessionException
- if an error happens during detachpublic static void attachSessionPrivileged(java.sql.Connection conn, java.lang.String role) throws ApplicationSessionException
SessionCodePermission
granted.conn
- the given JDBC connectionrole
- the given dynamic role, must be request-scopeApplicationSessionException
- if an error happenspublic static void destroySession(java.sql.Connection conn) throws ApplicationSessionException
conn
- the given JDBC connectionApplicationSessionException
- if an error happenspublic static void createNamespace(java.sql.Connection conn, java.lang.String name) throws ApplicationSessionException
conn
- the given JDBC connectionname
- the given namespace nameApplicationSessionException
- if an error happenspublic static void deleteNamespace(java.sql.Connection conn, java.lang.String name) throws NamespaceNotFoundException, ApplicationSessionException
conn
- the given JDBC connectionname
- the given namespace nameApplicationSessionException
- if an error happensNamespaceNotFoundException
public static void setNamespaceAttribute(java.sql.Connection conn, java.lang.String name, java.lang.String attribute, java.lang.String value) throws NamespaceNotFoundException, ApplicationSessionException
conn
- the given JDBC connectionname
- the given namespace nameattribute
- the given namespace attribute namevalue
- the given namespace attribute valueNamespaceNotFoundException
- if the namespace is not existingApplicationSessionException
- if an error happenspublic static void deleteNamespaceAttribute(java.sql.Connection conn, java.lang.String name, java.lang.String attribute) throws NamespaceNotFoundException, ApplicationSessionException
conn
- the given JDBC connectionname
- the given namespace nameattribute
- the given namespace attribute nameNamespaceNotFoundException
- if the namespace is not existingApplicationSessionException
- if an error happenspublic static java.lang.String getNamespaceAttribute(java.lang.String name, java.lang.String attribute) throws NamespaceNotFoundException, ApplicationSessionException
name
- the given namespace nameattribute
- the given namespace attribute nameNamespaceNotFoundException
- if the namespace is not existingApplicationSessionException
- if an error happenspublic static boolean checkPrivilege(java.sql.Connection conn, byte[] acls, java.lang.String privilege) throws ApplicationSessionException
conn
- the given JDBC connectionacls
- the given ACL IDs in row formatprivilege
- the given privilege nameApplicationSessionException
- if an error happens