|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Executor
Simple execution/work interface which can be used for internal tasks
which need to have a full working implementation. The
execute(Principal, ome.services.util.Executor.Work)
method
ensures that SecuritySystem.login(Principal)
is called before the
task, that a TransactionCallback
and a HibernateCallback
surround the call, and that subsequently SecuritySystem.logout()
is
called.
Nested Class Summary | |
---|---|
static class |
Executor.Descriptive
|
static class |
Executor.Impl
|
static class |
Executor.SimpleStatelessWork
Simple adapter which takes a String for Executor.Descriptive.description |
static class |
Executor.SimpleWork
Simple adapter which takes a String for Executor.Descriptive.description |
static interface |
Executor.StatelessWork
Work SPI to perform actions related to stateless
sessions. |
static interface |
Executor.Work
Work SPI to perform actions within the server as if they were fully wrapped in our service logic. |
Method Summary | ||
---|---|---|
Object |
execute(Principal p,
Executor.Work work)
Executes a Executor.Work instance wrapped in two layers of AOP. |
|
Object |
executeStateless(Executor.StatelessWork work)
Executes a Executor.StatelessWork wrapped with a transaction. |
|
|
get(Future<T> future)
Helper method to perform Future.get() and properly unwrap the
exceptions. |
|
OmeroContext |
getContext()
Provides access to the context for Work-API consumers who need to publish events, etc. |
|
Principal |
principal()
Returns a Principal representing your current session or null,
if none is active. |
|
void |
resetCallGroup()
Delegates to CurrentDetails.resetCallGroup() . |
|
void |
setCallGroup(long gid)
Delegates to CurrentDetails.setCallGroup(Long) to permit thread-specific
setting of the group. |
|
|
submit(Callable<T> callable)
Simple submission method which can be used in conjunction with a call to execute(Principal, Work) to overcome the no-multiple-login rule. |
Methods inherited from interface org.springframework.context.ApplicationContextAware |
---|
setApplicationContext |
Method Detail |
---|
OmeroContext getContext()
Principal principal()
Principal
representing your current session or null,
if none is active.
void setCallGroup(long gid)
CurrentDetails.setCallGroup(Long)
to permit thread-specific
setting of the group.
gid
- ticket:1434
void resetCallGroup()
CurrentDetails.resetCallGroup()
.
setCallGroup(long)
,
ticket:1434
Object execute(Principal p, Executor.Work work)
Executor.Work
instance wrapped in two layers of AOP. The first
is intended to acquire the proper arguments for
Executor.Work.doWork(Session, ServiceFactory)
from the
OmeroContext
, and the second performs all the standard service
actions for any normal method call.
If the Principal
argument is not null, then additionally, a
login/logout sequence will be performed in a try/finally block.
Executor.Work
implementation must be annotated with Transactional
in order to properly specify isolation, read-only status, etc.
p
- Possibly null.work
- Not null.<T> Future<T> submit(Callable<T> callable)
execute(Principal, Work)
to overcome the no-multiple-login rule.
<T> T get(Future<T> future)
Future.get()
and properly unwrap the
exceptions. Any RuntimeException
which was thrown during
execution will be rethrown. All other exceptions will be wrapped in an
InternalException
.
Object executeStateless(Executor.StatelessWork work)
Executor.StatelessWork
wrapped with a transaction. Since
StatelessSession
does not return proxies, there is less concern
about returned values, but this method completely overrides
OMERO security, and should be used very carefully. *
As with execute(Principal, Work)
the Executor.StatelessWork
instance must be properly marked with an Transactional
annotation.
work
- Non-null.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Version: Beta4.2.1-r8614-Beta4.2-b41
Copyright © 2009 The University of Dundee. All Rights Reserved.