public class SessionImpl extends java.lang.Object implements Session
Session
interface.
A session context represents an application's session. A session object is
instantiated for each root application module when the application module
is activated (see ApplicationModuleImpl.activate()
).
The session object is garbage collected when the root application module
is garbage collected.
This class may be extended by application developers who are interested in
loading session specific context at session instantiation. For example, an
application may extend the init method with logic to load
application specific context like the local currency into the session
context. Additionally, the getTransactionHandlerFactory
may
be overriden by an extending class to return a custom TransactionHandlerFactory
.
Custom implementations of this interface may be identified to the framework with the SessionClass server property.
JBO_SESSION_COOKIE, JBO_SESSION_LOCALE
Constructor and Description |
---|
SessionImpl()
This constructor is called by the framework to
initialize the client session
|
Modifier and Type | Method and Description |
---|---|
void |
addSessionListener(SessionListener list) |
static SessionContextManager |
findOrCreateSessionContextManager() |
ApplicationModule |
findSharedApplicationModule(java.lang.String sharedAMName)
INTERNAL: Applications should not use.
|
java.lang.String[] |
getAllApplicationModuleDefNames()
Gets the names of the Application Module definitions
contained in all packages.
|
java.lang.String[] |
getAllEntityAssociationDefNames()
Gets the names of the entity association definitions defined in all packages.
|
java.lang.String[] |
getAllEntityDefNames()
Gets the names of the Entity Object definitions available in all packages.
|
java.lang.String[] |
getAllViewDefNames()
Gets the names of the View Object definitions available in all packages.
|
java.lang.String[] |
getAllViewLinkDefNames()
Gets the names of the View Link definitions defined in all packages.
|
java.lang.String[] |
getApplicationModuleDefNames(java.lang.String packName)
Gets the names of the Application Module definitions
contained in a package.
|
java.lang.String[] |
getEntityAssociationDefNames(java.lang.String packName)
Gets the names of the entity association definitions defined in a package.
|
java.lang.String[] |
getEntityDefNames(java.lang.String packName)
Gets the names of the Entity Object definitions available in a package.
|
java.util.Hashtable |
getEnvironment()
Returns the BC4J context for the session.
|
java.util.Locale |
getLocale()
Gets the current
Locale used for localizing error messages. |
LocaleContext |
getLocaleContext()
retrieves the locale context for the session
|
java.lang.String[] |
getPackageNames()
Gets names of the packages that make up this middle tier application.
|
static SessionContextManager |
getSessionContextManager() |
javax.security.auth.Subject |
getSubject()
Returns the current JAAS SUbject
|
TransactionHandlerFactory |
getTransactionHandlerFactory()
Get the session's transaction handler factory.
|
java.util.Hashtable |
getUserData()
Returns application context for the session.
|
java.lang.String |
getUserPrincipalName()
Returns the JAAS user principal name.
|
java.lang.String[] |
getUserRoles()
Returns the Roles/Groups for current user principal.
|
java.lang.String |
getVersion()
Gets the middle tier's version information.
|
java.lang.String[] |
getViewDefNames(java.lang.String packName)
Gets the names of the View Object definitions available in a package.
|
java.lang.String[] |
getViewLinkDefNames(java.lang.String packName)
Gets the names of the View Link definitions defined in a package.
|
static SessionImpl |
init(java.util.Hashtable ctxEnv)
Internal: Applications should not use this method.
|
void |
invalidateSession()
INTERNAL: Applications should not use.
|
boolean |
isClient()
Returns whether this session is running as a client in 3 tier
or not.
|
boolean |
isUserInRole(java.lang.String role) |
void |
loadPackage(java.lang.String packageName)
Loads a package that may be browsed for defined objects.
|
void |
releaseSharedApplicationModules() |
void |
removeSessionListener(SessionListener list) |
void |
setLocale(java.util.Locale l)
Sets a new
Locale for localizing error messages. |
void |
setProperty(java.lang.String name,
java.lang.String value) |
static void |
setSessionContextManager(SessionContextManager iMgr) |
void |
setTransactionHandlerFactory(TransactionHandlerFactory fac)
Set the session's transaction handler factory.
|
public SessionImpl()
public static SessionImpl init(java.util.Hashtable ctxEnv)
public java.util.Hashtable getEnvironment()
Session
PropertyMetadata
. Applications
should store custom session context in the Session userdata.getEnvironment
in interface Session
Session.getUserData()
public java.util.Locale getLocale()
Session
Locale
used for localizing error messages.public void setProperty(java.lang.String name, java.lang.String value)
public void setLocale(java.util.Locale l)
Session
Locale
for localizing error messages.public void loadPackage(java.lang.String packageName)
Session
loadPackage
in interface Session
packageName
- a fully qualified package name.public java.lang.String getVersion()
Session
getVersion
in interface Session
public java.lang.String[] getApplicationModuleDefNames(java.lang.String packName)
Session
getApplicationModuleDefNames
in interface Session
packName
- the name of the package.ApplicationModule
definition names.public java.lang.String[] getAllApplicationModuleDefNames()
Session
getAllApplicationModuleDefNames
in interface Session
ApplicationModule
definition names.public java.lang.String[] getViewDefNames(java.lang.String packName)
Session
getViewDefNames
in interface Session
packName
- the name of the package.ViewDef
names.public java.lang.String[] getAllViewDefNames()
Session
getAllViewDefNames
in interface Session
ViewDef
names.public java.lang.String[] getEntityDefNames(java.lang.String packName)
Session
getEntityDefNames
in interface Session
packName
- the name of the package.EntityDef
names.public java.lang.String[] getAllEntityDefNames()
Session
getAllEntityDefNames
in interface Session
EntityDef
names.public java.lang.String[] getEntityAssociationDefNames(java.lang.String packName)
Session
getEntityAssociationDefNames
in interface Session
packName
- the name of the package.EntityAssociationDef
names.public java.lang.String[] getAllEntityAssociationDefNames()
Session
getAllEntityAssociationDefNames
in interface Session
EntityAssociationDef
names.public java.lang.String[] getViewLinkDefNames(java.lang.String packName)
Session
getViewLinkDefNames
in interface Session
packName
- the name of the package.ViewLinkDef
names.public java.lang.String[] getAllViewLinkDefNames()
Session
getAllViewLinkDefNames
in interface Session
ViewLinkDef
names.public java.lang.String[] getPackageNames()
Session
getPackageNames
in interface Session
public TransactionHandlerFactory getTransactionHandlerFactory()
TransactionHandler
,
TransactionHandlerFactory
public static SessionContextManager getSessionContextManager()
public static void setSessionContextManager(SessionContextManager iMgr)
public static SessionContextManager findOrCreateSessionContextManager()
public void setTransactionHandlerFactory(TransactionHandlerFactory fac)
TransactionHandler
,
TransactionHandlerFactory
public LocaleContext getLocaleContext()
Session
getLocaleContext
in interface Session
public java.util.Hashtable getUserData()
Session
ApplicationModuleImpl.prepareSession(Session)
.getUserData
in interface Session
public java.lang.String getUserPrincipalName()
public boolean isUserInRole(java.lang.String role)
isUserInRole
in interface Session
role
- the name of the role.public boolean isClient()
Session
public javax.security.auth.Subject getSubject()
public java.lang.String[] getUserRoles()
getUserRoles
in interface Session
public ApplicationModule findSharedApplicationModule(java.lang.String sharedAMName)
Session
findSharedApplicationModule
in interface Session
public void releaseSharedApplicationModules()
public void invalidateSession()
Session
invalidateSession
in interface Session
public void addSessionListener(SessionListener list)
public void removeSessionListener(SessionListener list)