public final class FdkSystemSessionImpl extends FdkSessionImpl
m_CurrentRequestThread, m_Tag
Constructor and Description |
---|
FdkSystemSessionImpl()
Creates a new FdkSystemSessionImpl using a LibrarySession retrieved
from the SystemSessionPool.
|
Modifier and Type | Method and Description |
---|---|
void |
beginRequest(boolean wait,
long timeout,
String tag)
Notifies the session that a new request has begun.
|
void |
disconnectNotify()
Disconnects this user session.
|
boolean |
endRequest()
Notifies the session that the request has ended.
|
String |
getDistinguishedName()
Returned the distinguished name for the authenticated user.
|
long |
getId()
Returns this session identifier.
|
long |
getLastAccessTime()
Returns the time when the last request was completed by calling
endRequest() on the current session. |
LibrarySession |
getLibrarySession()
Returns the
LibrarySession associated with this user session. |
String |
getSessionIdentifier()
Get a String that identifies a user session.
|
long |
getSessionTimeout()
Returns the session timeout, in seconds, for this session.
|
Object |
getState(Object key)
Returns the value stored at the given key using
setState() . |
String |
getTrustedApplicationName()
Returns the name of the trusted application or
null if the
session was not created by a truested application. |
Item |
getUser(AttributeRequest[] attributes)
Returns the user for this session.
|
String |
getUserIdentifier()
Get a String that identifies a user.
|
String |
getUsername()
Returns the username for the authenticated user.
|
void |
httpBind()
Respond to a bind notification from the HttpSession
|
void |
httpUnbind()
Respond to an unbind notification from the HttpSession
|
boolean |
isConnected()
Returns true if this session is connected.
|
boolean |
isGuest()
Returns true if the session is a guest/anonymous session.
|
boolean |
isRequestInProgress()
Returns true if there is a request being serviced by this session.
|
boolean |
isSystem()
Returns true if the session is a system session.
|
boolean |
isTrustedApplication()
Returns true if the session was created by a trusted application.
|
void |
setLastAccessTimeUpdate(boolean update)
Sets whether the last access time will be updated when
endRequest() is called on the current session. |
void |
setSessionTimeout(long timeout)
Sets the automatic session timeout for inactivity.
|
void |
setState(Object key,
Object value)
Sets a value representing a piece of state that makes sense to the
application.
|
boolean |
verifyCredential(Credential credential)
Verifies that the given credential is valid for the user represented
by this session.
|
beginTransaction, commitTransaction, disconnect, getInternalSession, getManagersFactory, isTransactionInProgress, registerForEvents, rollbackTransaction, rollbackTransactionStack, unregisterForEvents
beginRequestCommon, getCreationTime, getCurrentSession, getTag, requestCleanup
public FdkSystemSessionImpl() throws FdkException
FdkException
public long getId()
FdkSession
getId
in class FdkSession
public long getLastAccessTime()
FdkSession
endRequest()
on the current session. The time format is the
same as System.currentTimeMillis()
.getLastAccessTime
in class FdkSession
public void setLastAccessTimeUpdate(boolean update)
FdkSession
endRequest()
is called on the current session. This is
useful behavior for requests that are not sent by the true end-user but
rather by a polling process for example.
Note that the behavior is changed on a per request basis, the default
behavior if the method is not called during a request is to always update
the last access time and the behavior is reset to the default when a
request is completed by calling endRequest()
.
setLastAccessTimeUpdate
in class FdkSession
update
- If false
the last access time will not be
updated, otherwise it will be updated.public boolean isConnected()
FdkSession
isConnected
in class FdkSession
public String getUsername()
FdkSession
getUsername
in class FdkSession
public String getDistinguishedName()
FdkSession
getDistinguishedName
in class FdkSession
public boolean isGuest()
FdkSession
isGuest
in class FdkSession
public boolean isSystem()
isSystem
in class FdkSession
public boolean isTrustedApplication()
isTrustedApplication
in class FdkSession
public String getTrustedApplicationName()
null
if the
session was not created by a truested application.getTrustedApplicationName
in class FdkSession
public boolean verifyCredential(Credential credential)
FdkSession
true
if the credential is
valid or false
otherwise. The method can also throw a
FdkException
if errors occur during the verification
process.verifyCredential
in class FdkSession
credential
- The credential to verify.public boolean isRequestInProgress()
FdkSession
beginRequest()
and endRequest()
isRequestInProgress
in class FdkSession
public void beginRequest(boolean wait, long timeout, String tag) throws FdkException
FdkSession
endRequest()
must be
called from the same thread.beginRequest
in class FdkSession
wait
- Whether the calling thread should wait for the session
to finish any existing requests or should fail right away
if the session is busy. If wait is false
, the
timeout value is ignored.timeout
- If the caller chooses to wait, this is the timeout in
milliseconds before an error is returned if the session is
still busy. If the parameter is 0, the wait is indefinite.
If the timeout is -1 or any negative value the wait is
defaulted to a system chosen, sensible value.tag
- A tag describing the application that is currently using
this session. The tag can be retrieved later on by
calling getTag()
.
Must not be null
.FdkException
public boolean endRequest()
FdkSession
false
if there were no outstanding requests on the session or the current
thread did not own the session. The caller may interpret it as an error
or just ignore it, depending on its implementation.endRequest
in class FdkSession
public void setSessionTimeout(long timeout)
FdkSession
In addition, if the timeout is greater than zero, the session will not be disconnected when it gets the unbind even from the HttpSession, as it is assumed it is being managed by a different entity.
setSessionTimeout
in class FdkSession
timeout
- Number of seconds to set the timeout to.public long getSessionTimeout()
FdkSession
getSessionTimeout
in class FdkSession
public void setState(Object key, Object value)
FdkSession
getState()
.
It is recommended that applications store only one object as their state. The object can be a Map that contains other pieces of state.
setState
in class FdkSession
key
- The key that identifies the piece of state. The namespace
for the key is not specified. It is recommended that a
package-like key name be used in order to avoid potential
conflicts.value
- The value to store at the given key. If null
,
the key will be removed.public Object getState(Object key)
FdkSession
setState()
.
See the documentation of setState()
.getState
in class FdkSession
key
- The key to retrieve the value for.public Item getUser(AttributeRequest[] attributes) throws FdkException
FdkSessionImpl
getUser
in class FdkSessionImpl
attributes
- Optional attributes to be returned.FdkException
public LibrarySession getLibrarySession()
FdkSessionImpl
LibrarySession
associated with this user session.
WARNING!
This method should not be called from client code, except for exceptional
circumstances where the caller understands the implications of using the
LibrarySession
directly and opts out of using the framework.
If you need to use this method, please check with the developers of the framework for possible alternate ways of achieving the same result.
getLibrarySession
in class FdkSessionImpl
public void disconnectNotify() throws FdkException
FdkSessionImpl
FdkException
public void httpUnbind()
FdkSession
httpUnbind
in class FdkSession
public void httpBind()
FdkSession
httpBind
in class FdkSession
public String getUserIdentifier()
LogInfo
Copyright © 2023. All rights reserved.