public class SessionI extends Object implements omero.cmd._SessionOperations
Modifier and Type | Field and Description |
---|---|
Ice.ObjectAdapter |
adapter |
protected omero.api.ClientCallbackPrx |
callback |
String |
clientId |
OmeroContext |
context |
Glacier2.SessionControlPrx |
control |
protected boolean |
doClose |
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 |
Principal |
principal |
protected AtomicBoolean |
reusedSession |
SessionManager |
sessionManager |
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,
OmeroContext context,
SessionManager sessionManager,
Executor executor,
Principal principal,
String token) |
Modifier and Type | Method and Description |
---|---|
void |
allow(Ice.ObjectPrx prx) |
protected Ice.Object |
callContextWrapper(Ice.Object servant) |
void |
cleanServants(boolean all)
Use
cleanServants(boolean, String, ServantHolder, Ice.ObjectAdapter)
to clean up. |
static void |
cleanServants(boolean all,
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 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(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() |
Executor |
getExecutor() |
Ice.Identity |
getIdentity(String name) |
Principal |
getPrincipal() |
void |
handleCallbackException(Exception e)
Reusable method for logging an exception that occurs on one-way
communication with clients during callback notification.
|
protected void |
internalServantConfig(Object obj) |
Ice.Current |
newCurrent(Ice.Identity id,
String method) |
static Ice.Current |
newCurrent(Ice.Identity id,
String method,
Ice.ObjectAdapter adapter,
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.Identity |
sessionId()
Returns the
Identity for this instance as defined by
sessionId(String, String) |
static Ice.Identity |
sessionId(String clientId,
String uuid)
Definition of session ids:
"session-<CLIENTID>/<UUID>" |
void |
submit_async(omero.cmd.AMD_Session_submit __cb,
omero.cmd.Request req,
Ice.Current current) |
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 String clientId
public final Glacier2.SessionControlPrx control
protected final AtomicBoolean reusedSession
protected boolean doClose
protected omero.api.ClientCallbackPrx callback
public final ServantHolder holder
public final SessionManager sessionManager
public final 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 Principal principal
public final OmeroContext context
public final Ice.ObjectAdapter adapter
public final String token
public SessionI(boolean reusedSession, Ice.Current current, ServantHolder holder, Glacier2.SessionControlPrx control, OmeroContext context, SessionManager sessionManager, Executor executor, Principal principal, String token) throws omero.ApiUsageException
omero.ApiUsageException
public Ice.ObjectAdapter getAdapter()
public Principal getPrincipal()
public Executor getExecutor()
public void submit_async(omero.cmd.AMD_Session_submit __cb, omero.cmd.Request req, Ice.Current current)
public void destroy(Ice.Current current)
destroy
in interface Glacier2._SessionOperations
current
- The Current object for the invocation.public void handleCallbackException(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, 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(Object obj) throws omero.ServerError
omero.ServerError
public static Ice.Current newCurrent(Ice.Identity id, String method, Ice.ObjectAdapter adapter, String clientId)
public Ice.Current newCurrent(Ice.Identity id, String method)
public void allow(Ice.ObjectPrx prx)
protected Ice.Object createServantDelegate(String name) throws omero.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()
.omero.ServerError
public void configureServant(Ice.Object servant) throws omero.ServerError
servant
- the servantomero.ServerError
- if the configuration or tying failedpublic Ice.ObjectPrx registerServant(Ice.Identity id, Ice.Object servant) throws omero.ServerError
omero.ServerError
protected Ice.Object callContextWrapper(Ice.Object servant)
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(String name)
public static Ice.Identity sessionId(String clientId, String uuid)
"session-<CLIENTID>/<UUID>"
public Ice.Identity sessionId()
Identity
for this instance as defined by
sessionId(String, String)
public static String clientId(Ice.Current current) throws omero.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)omero.ApiUsageException
Version: 5.3.3-ice35-b63
Copyright © 2017 The University of Dundee & Open Microscopy Environment. All Rights Reserved.