@ThreadSafe public abstract class SessionImpl extends Object implements Session, Unreferenced
Session.ConnectionMode| Modifier | Constructor and Description |
|---|---|
protected |
SessionImpl(String clientName,
SessionFactory sessionFactory,
Session.ConnectionMode connectionMode)
Constructs an instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the session.
|
protected String |
getClientName()
Gets the client name.
|
Session.ConnectionMode |
getConnectionMode()
Gets the connection mode.
|
protected Identity |
getIdentity(Optional<String> identifier)
Gets the identity for an identifier.
|
SessionFactory |
getSessionFactory()
Gets the session factory.
|
protected Logger |
getThisLogger()
Gets the logger.
|
protected Optional<String> |
getUser()
Gets the user.
|
boolean |
isClosed()
Asks if the service is closed.
|
void |
login(String identifier,
char[] password)
Identifies and authenticates the identity associated with the Session.
|
void |
logout()
Logs out.
|
void |
open()
Opens the session.
|
void |
securityCheck(String requiredRole)
Performs security checks.
|
protected void |
setLogID()
Sets the log ID.
|
protected void |
setUser(Optional<String> identifier)
Sets the user.
|
String |
toString() |
void |
unreferenced() |
protected SessionImpl(@Nonnull
String clientName,
@Nonnull
SessionFactory sessionFactory,
@Nonnull
Session.ConnectionMode connectionMode)
clientName - A descriptive name for the client.sessionFactory - The factory creating this.connectionMode - The connection mode.public void close()
public final Session.ConnectionMode getConnectionMode()
getConnectionMode in interface Session@Nonnull @CheckReturnValue public final SessionFactory getSessionFactory()
@CheckReturnValue public boolean isClosed()
public final void login(String identifier,
char[] password)
throws LoginFailedException,
ServiceClosedException
login in interface Sessionidentifier - The identifier for the identity.password - The password authenticating the identity.LoginFailedExceptionServiceClosedExceptionpublic void open()
public final void securityCheck(@Nonnull
String requiredRole)
throws UnauthorizedAccessException,
ServiceClosedException
requiredRole - The required role.UnauthorizedAccessException - When access is not authorized.ServiceClosedException - When the service is closed.public String toString()
toString in class Objectpublic final void unreferenced()
unreferenced in interface Unreferenced@Nonnull @CheckReturnValue protected final String getClientName()
@Nonnull @CheckReturnValue protected final Identity getIdentity(@Nonnull Optional<String> identifier)
identifier - The optional identifier for the identity.@Nonnull @CheckReturnValue protected final Logger getThisLogger()
@Nonnull @CheckReturnValue protected Optional<String> getUser()
protected void setLogID()
protected void setUser(@Nonnull
Optional<String> identifier)
identifier - The optional user identifier.Copyright © 2003-2019 Serge Brisson. All Rights Reserved.