ome.services.util
Class Executor.Impl

java.lang.Object
  extended by ome.services.util.Executor.Impl
All Implemented Interfaces:
Executor, org.springframework.context.ApplicationContextAware
Enclosing interface:
Executor

public static class Executor.Impl
extends Object
implements Executor


Nested Class Summary
 
Nested classes/interfaces inherited from interface ome.services.util.Executor
Executor.Impl, Executor.SimpleStatelessWork, Executor.SimpleWork, Executor.StatelessWork, Executor.Work
 
Field Summary
protected  List<Advice> advices
           
protected  OmeroContext context
           
protected  org.hibernate.SessionFactory factory
           
protected  org.springframework.jdbc.core.simple.SimpleJdbcOperations jdbcOps
           
protected  CurrentDetails principalHolder
           
protected  String[] proxyNames
           
protected  ExecutorService service
           
 
Constructor Summary
Executor.Impl(CurrentDetails principalHolder, org.hibernate.SessionFactory factory, org.springframework.jdbc.core.simple.SimpleJdbcOperations jdbc, String[] proxyNames)
           
Executor.Impl(CurrentDetails principalHolder, org.hibernate.SessionFactory factory, org.springframework.jdbc.core.simple.SimpleJdbcOperations jdbc, String[] proxyNames, ExecutorService service)
           
 
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 in transaction.
<T> T
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 setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
           
<T> Future<T>
submit(Callable<T> callable)
          Simple submission method which can be used in conjunction with a call to Executor.execute(Principal, Work) to overcome the no-multiple-login rule.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

context

protected OmeroContext context

advices

protected final List<Advice> advices

principalHolder

protected final CurrentDetails principalHolder

proxyNames

protected final String[] proxyNames

factory

protected final org.hibernate.SessionFactory factory

jdbcOps

protected final org.springframework.jdbc.core.simple.SimpleJdbcOperations jdbcOps

service

protected final ExecutorService service
Constructor Detail

Executor.Impl

public Executor.Impl(CurrentDetails principalHolder,
                     org.hibernate.SessionFactory factory,
                     org.springframework.jdbc.core.simple.SimpleJdbcOperations jdbc,
                     String[] proxyNames)

Executor.Impl

public Executor.Impl(CurrentDetails principalHolder,
                     org.hibernate.SessionFactory factory,
                     org.springframework.jdbc.core.simple.SimpleJdbcOperations jdbc,
                     String[] proxyNames,
                     ExecutorService service)
Method Detail

setApplicationContext

public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
                           throws org.springframework.beans.BeansException
Specified by:
setApplicationContext in interface org.springframework.context.ApplicationContextAware
Throws:
org.springframework.beans.BeansException

getContext

public OmeroContext getContext()
Description copied from interface: Executor
Provides access to the context for Work-API consumers who need to publish events, etc.

Specified by:
getContext in interface Executor

principal

public Principal principal()
Description copied from interface: Executor
Returns a Principal representing your current session or null, if none is active.

Specified by:
principal in interface Executor

execute

public Object execute(Principal p,
                      Executor.Work work)
Executes a Executor.Work instance wrapped in two layers of AOP. The first is intended to acquire the proper arguments for Work#doWork(TransactionStatus, Session, ServiceFactory) for 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.

Specified by:
execute in interface Executor
Parameters:
p -
work -

submit

public <T> Future<T> submit(Callable<T> callable)
Description copied from interface: Executor
Simple submission method which can be used in conjunction with a call to Executor.execute(Principal, Work) to overcome the no-multiple-login rule.

Specified by:
submit in interface Executor

get

public <T> T get(Future<T> future)
Description copied from interface: Executor
Helper method to perform 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.

Specified by:
get in interface Executor

executeStateless

public Object executeStateless(Executor.StatelessWork work)
Executes a Executor.StatelessWork in transaction.

Specified by:
executeStateless in interface Executor
Parameters:
work - Non-null.
Returns:


OmeroJava Api

Version: Beta-4.1.1-r5927-b91

Copyright © 2009 The University of Dundee. All Rights Reserved.