Hi!
Like a scheduler within the webapp? this way i can have orchestra to
keep
EntityManager round to do
lazy loading of a huge object.
No, many of Orchestra's data-structures are kept in the session scope
which is not available during a non http request.
After thinking about again it I realized that I wrote nonsense here.
In fact Orchestra WILL work in non servlet environments .... for
example, we startup a compatible environment for our junit tests.
And it sould be simple - it is all about the FrameworkAdapter.
I've copied our mock class over to the core and now there is a
org.apache.myfaces.orchestra.frameworkAdapter.local.LocalFrameworkAdapter
class which should help you to solve the problem.
Use it with something like this:
LocalFrameworkAdapter frameworkAdapter = new
LocalFrameworkAdapter();
frameworkAdapter.setApplicationContext(applicationContext); //
<= the Spring application context you have to gather from somewhere
FrameworkAdapter.setInstance(frameworkAdapter);
Notice, FrameworkAdapter.setInstance is thread bound, so you'll have to
do this for each thread going to use Orchestra.
If you use a fresh frameworkAdapter per run or share it over multiple
runs is up to you, depending if you have conversations running longer
than one sheduler task, however, the LocalFrameworkAdapter is not thread
safe. If you need such a feature, just copy over the
LocalFrameworkAdapter and synchronized the maps, however (2), the entity
manager itself is not thread safe.
I don't know how your sheduler works, but you also could configure this
FrameworkAdapter as prototype in Spring and get the ApplicationContext
injected ... automatically.
Ciao,
Mario