@ThreadSafe public abstract class SessionFactoryImpl extends Object implements SessionFactory
Modifier | Constructor and Description |
---|---|
protected |
SessionFactoryImpl()
Constructs an instance.
|
protected |
SessionFactoryImpl(Optional<SessionSecurityContext> securityContext)
Constructs an instance.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addSession(SessionImpl session)
Adds a session to the set.
|
void |
close()
Closes the sessions.
|
static SessionSecurityContext |
createSecurityContext(KeyedGroups configProperties,
KeyedGroups securityProperties,
Logger logger)
Creates a security context.
|
protected Session |
createSession(Session.ConnectionMode connectionMode,
Optional<RMIClientSocketFactory> clientSocketFactory,
Optional<RMIServerSocketFactory> serverSocketFactory,
Object reference)
Creates a session.
|
protected Session |
createSession(UUID uuid,
Object reference)
Creates a session.
|
boolean |
equals(Object object) |
Remote |
export()
Exports this.
|
protected abstract void |
fillRolesMap()
Fills the role map.
|
Config |
getConfig()
Gets the configuration.
|
String[] |
getMappedRoles(String requiredRole)
Gets the mapped roles for a required role.
|
Optional<Realm> |
getRealm()
Gets the realm configuration.
|
protected int |
getSessionCount()
Gets the session count.
|
protected Collection<SessionImpl> |
getSessions()
Gets the sessions.
|
protected Logger |
getThisLogger()
Gets the logger.
|
int |
hashCode() |
boolean |
hasRolesMap()
Asks if this has a roles map.
|
protected boolean |
hasSecurityContext()
Asks if the security context has been defined.
|
boolean |
isClosed()
Asks if this service is closed.
|
protected void |
mapRoles(String requiredRole,
String[] roles)
Adds a role to a roles map.
|
protected abstract Session |
newSession(Session.ConnectionMode connectionMode,
Optional<RMIClientSocketFactory> clientSocketFactory,
Optional<RMIServerSocketFactory> serverSocketFactory,
Object reference)
Returns a new session
|
boolean |
removeSession(SessionImpl session)
Removes a session from the set.
|
boolean |
setUp(Config config)
Sets up this session factory.
|
void |
tearDown()
Tears down what has been set up.
|
void |
unexport()
Unexports this.
|
protected SessionFactoryImpl()
protected SessionFactoryImpl(@Nonnull Optional<SessionSecurityContext> securityContext)
securityContext
- The optional security context.@Nullable @CheckReturnValue public static SessionSecurityContext createSecurityContext(@Nonnull KeyedGroups configProperties, @Nonnull KeyedGroups securityProperties, @Nonnull Logger logger)
configProperties
- The configuration properties (may be empty).securityProperties
- Security properties (may be empty).logger
- The logger instance to use.public final boolean addSession(SessionImpl session)
addSession
in interface SessionFactory
session
- The session.public void close()
public final boolean equals(Object object)
equals
in class Object
public final Remote export() throws RemoteException
export
in interface SessionFactory
RemoteException
- When the export operation fails.public final Config getConfig()
getConfig
in interface SessionFactory
public final String[] getMappedRoles(String requiredRole)
getMappedRoles
in interface SessionFactory
requiredRole
- The required role.public final Optional<Realm> getRealm()
getRealm
in interface SessionFactory
public final boolean hasRolesMap()
hasRolesMap
in interface SessionFactory
public final int hashCode()
hashCode
in class Object
@CheckReturnValue public final boolean isClosed()
public boolean removeSession(SessionImpl session)
removeSession
in interface SessionFactory
session
- The session.@CheckReturnValue public boolean setUp(@Nonnull Config config)
config
- The config.public void tearDown()
public final void unexport() throws NoSuchObjectException
unexport
in interface SessionFactory
NoSuchObjectException
- When the unexport operation fails.@Nonnull @CheckReturnValue protected final Session createSession(@Nonnull UUID uuid, @Nonnull Object reference) throws SessionException
uuid
- A UUID used to locate the RMI client instance.reference
- A reference object.SessionException
- When the session creation fails.@Nonnull @CheckReturnValue protected final Session createSession(@Nonnull Session.ConnectionMode connectionMode, @Nonnull Optional<RMIClientSocketFactory> clientSocketFactory, @Nonnull Optional<RMIServerSocketFactory> serverSocketFactory, @Nonnull Object reference) throws SessionException
connectionMode
- The connection mode.clientSocketFactory
- The optional client socket factory.serverSocketFactory
- The optional server socket factory.reference
- A reference object.SessionException
- When the session creation fails.protected abstract void fillRolesMap()
This associates internal roles to external required roles.
@CheckReturnValue protected final int getSessionCount()
@Nonnull @CheckReturnValue protected final Collection<SessionImpl> getSessions()
@Nonnull @CheckReturnValue protected final Logger getThisLogger()
@CheckReturnValue protected boolean hasSecurityContext()
protected final void mapRoles(@Nonnull String requiredRole, @Nonnull String[] roles)
requiredRole
- The name of the required role.roles
- The name of the mapped roles@Nonnull @CheckReturnValue protected abstract Session newSession(@Nonnull Session.ConnectionMode connectionMode, @Nonnull Optional<RMIClientSocketFactory> clientSocketFactory, @Nonnull Optional<RMIServerSocketFactory> serverSocketFactory, Object reference) throws SessionException
connectionMode
- The connection mode.clientSocketFactory
- The optional client socket factory.serverSocketFactory
- The optional server socket factory.reference
- A reference object.SessionException
- When the session creation fails.Copyright © 2003-2019 Serge Brisson. All Rights Reserved.