public class SessionI extends java.lang.Object implements _SessionOperations
Modifier and Type | Field and Description |
---|---|
Ice.ObjectAdapter |
adapter |
protected ClientCallbackPrx |
callback |
java.lang.String |
clientId |
ome.system.OmeroContext |
context |
Glacier2.SessionControlPrx |
control |
protected boolean |
doClose |
ome.services.util.Executor |
executor
Executor to be used by servant implementations which do not
delegate to the server package where all instances are wrapped with AOP
for dealing with Hibernate. |
ServantHolder |
holder |
ome.system.Principal |
principal |
protected java.util.concurrent.atomic.AtomicBoolean |
reusedSession |
ome.services.sessions.SessionManager |
sessionManager |
java.lang.String |
token
Token in the form of a UUID for securing method invocations.
|
Constructor and Description |
---|
SessionI(boolean reusedSession,
Ice.Current current,
ServantHolder holder,
Glacier2.SessionControlPrx control,
ome.system.OmeroContext context,
ome.services.sessions.SessionManager sessionManager,
ome.services.util.Executor executor,
ome.system.Principal principal,
java.lang.String token) |
Modifier and Type | Method and Description |
---|---|
void |
allow(Ice.ObjectPrx prx) |
protected Ice.Object |
callContextWrapper(Ice.Object servant,
Ice.Current current) |
void |
cleanServants(boolean all)
Use
cleanServants(boolean, String, ServantHolder, Ice.ObjectAdapter)
to clean up. |
static void |
cleanServants(boolean all,
java.lang.String clientId,
ServantHolder holder,
Ice.ObjectAdapter adapter)
Clean all servants that are in the current holder and remove them from
the adapter.
|
void |
cleanupSelf()
Called if this isn't a kill-everything event.
|
static java.lang.String |
clientId(Ice.Current current)
Helpers method to extract the
CLIENTUUID out of the given
Ice.Current. |
void |
configureServant(Ice.Object servant)
Apply proper AOP and call setters for any known injection properties.
|
protected Ice.Object |
createServantDelegate(java.lang.String name)
Creates a proxy according to the servant definition for the given
name.
|
void |
destroy(Ice.Current current)
Destruction simply decrements the reference count for a session to allow
reconnecting to it.
|
void |
doDestroy()
Performs the actual cleanup operation on all the resources shared between
this and other
ServiceFactoryI instances in the
same Session . |
Ice.ObjectAdapter |
getAdapter() |
ome.services.util.Executor |
getExecutor() |
Ice.Identity |
getIdentity(java.lang.String name) |
ome.system.Principal |
getPrincipal() |
void |
handleCallbackException(java.lang.Exception e)
Reusable method for logging an exception that occurs on one-way
communication with clients during callback notification.
|
protected void |
internalServantConfig(java.lang.Object obj) |
Ice.Current |
newCurrent(Ice.Identity id,
java.lang.String method) |
static Ice.Current |
newCurrent(Ice.Identity id,
java.lang.String method,
Ice.ObjectAdapter adapter,
java.lang.String clientId) |
Ice.ObjectPrx |
registerServant(Ice.Identity id,
Ice.Object servant)
Registers the servant with the adapter (or throws an exception if one is
already registered) as well as configures the servant in any post-Spring
way necessary, based on the type of the servant.
|
Ice.ObjectPrx |
registerServant(Ice.Identity id,
Ice.Object servant,
Ice.Current current)
Additionally stores information from the
Current argument
in the CallContext so that information from the creation of
a servant can be recorded server-side without the need for clients to
re-send the information or even for values which clients should not
know. |
Ice.Identity |
sessionId()
Returns the
Identity for this instance as defined by
sessionId(String, String) |
static Ice.Identity |
sessionId(java.lang.String clientId,
java.lang.String uuid)
Definition of session ids:
"session-<CLIENTID>/<UUID>" |
void |
submit_async(AMD_Session_submit __cb,
Request req,
Ice.Current current) |
void |
submit_async(AMD_Session_submit __cb,
Request req,
Ice.Current current,
ome.services.util.Executor.Priority priority) |
java.lang.String |
toString() |
void |
unregisterServant(Ice.Identity id)
|
static void |
unregisterServant(Ice.Identity id,
Ice.ObjectAdapter adapter,
ServantHolder holder)
Reverts all the additions made by
registerServant(Ice.Identity, Ice.Object)
Now called by SessionManagerI in response
to an UnregisterServantMessage . |
public final java.lang.String clientId
public final Glacier2.SessionControlPrx control
protected final java.util.concurrent.atomic.AtomicBoolean reusedSession
protected boolean doClose
protected ClientCallbackPrx callback
public final ServantHolder holder
public final ome.services.sessions.SessionManager sessionManager
public final ome.services.util.Executor executor
Executor
to be used by servant implementations which do not
delegate to the server package where all instances are wrapped with AOP
for dealing with Hibernate.public final ome.system.Principal principal
public final ome.system.OmeroContext context
public final Ice.ObjectAdapter adapter
public final java.lang.String token
public SessionI(boolean reusedSession, Ice.Current current, ServantHolder holder, Glacier2.SessionControlPrx control, ome.system.OmeroContext context, ome.services.sessions.SessionManager sessionManager, ome.services.util.Executor executor, ome.system.Principal principal, java.lang.String token) throws ApiUsageException
ApiUsageException
public Ice.ObjectAdapter getAdapter()
public ome.system.Principal getPrincipal()
public ome.services.util.Executor getExecutor()
public void submit_async(AMD_Session_submit __cb, Request req, Ice.Current current)
public void submit_async(AMD_Session_submit __cb, Request req, Ice.Current current, ome.services.util.Executor.Priority priority)
public void destroy(Ice.Current current)
destroy
in interface Glacier2._SessionOperations
public void handleCallbackException(java.lang.Exception e)
public void cleanupSelf()
public void doDestroy()
ServiceFactoryI
instances in the
same Session
. Since destroy(Current)
is called regardless by the
router, even when a client has just died, we have this internal method
for handling the actual closing of resources.
This method must take precautions to not throw a SessionException
. See destroy(Current)
for more information.
When destroy(Current)
is called but it isn't time to close down
the entire instance, then we should still close down the stateless
services for this instance as well as remove ourselves from the adapter.public void cleanServants(boolean all)
cleanServants(boolean, String, ServantHolder, Ice.ObjectAdapter)
to clean up.all
- if stateful sessions should be shut down such that other clients cannot reattach (the servant is cleaned up)public static void cleanServants(boolean all, java.lang.String clientId, ServantHolder holder, Ice.ObjectAdapter adapter)
all
- if stateful sessions should be shut down such that other clients cannot reattach (the servant is cleaned up)clientId
- Only used if all is false.holder
- ServantHolder
to be cleaned.adapter
- from which the servants should be removed.protected void internalServantConfig(java.lang.Object obj) throws ServerError
ServerError
public static Ice.Current newCurrent(Ice.Identity id, java.lang.String method, Ice.ObjectAdapter adapter, java.lang.String clientId)
public Ice.Current newCurrent(Ice.Identity id, java.lang.String method)
public void allow(Ice.ObjectPrx prx)
protected Ice.Object createServantDelegate(java.lang.String name) throws ServerError
interceptors
which are in effect, and
stores the instance away in the cache.
Note: Since HardWiredInterceptor
implements
MethodInterceptor
, all the Advice
instances will be
wrapped in Advisor
instances and will be returned by
Advised.getAdvisors()
.ServerError
public void configureServant(Ice.Object servant) throws ServerError
servant
- the servantServerError
- if the configuration or tying failedpublic Ice.ObjectPrx registerServant(Ice.Identity id, Ice.Object servant) throws ServerError
ServerError
public Ice.ObjectPrx registerServant(Ice.Identity id, Ice.Object servant, Ice.Current current) throws ServerError
Current
argument
in the CallContext
so that information from the creation of
a servant can be recorded server-side without the need for clients to
re-send the information or even for values which clients should not
know.ServerError
protected Ice.Object callContextWrapper(Ice.Object servant, Ice.Current current)
public void unregisterServant(Ice.Identity id)
public static void unregisterServant(Ice.Identity id, Ice.ObjectAdapter adapter, ServantHolder holder)
registerServant(Ice.Identity, Ice.Object)
Now called by SessionManagerI
in response
to an UnregisterServantMessage
.public Ice.Identity getIdentity(java.lang.String name)
public static Ice.Identity sessionId(java.lang.String clientId, java.lang.String uuid)
"session-<CLIENTID>/<UUID>"
public Ice.Identity sessionId()
Identity
for this instance as defined by
sessionId(String, String)
public static java.lang.String clientId(Ice.Current current) throws ApiUsageException
CLIENTUUID
out of the given
Ice.Current. Throws an ApiUsageException
if none is present,
since it is each client's responsibility to set this value.
(Typically done in our SDKs)ApiUsageException
public java.lang.String toString()
toString
in class java.lang.Object