com.arsdigita.kernel
Class KernelExcursion

java.lang.Object
  extended bycom.arsdigita.kernel.KernelExcursion
All Implemented Interfaces:
Runnable

public abstract class KernelExcursion
extends Object
implements Runnable

A kernel excursion is a way of making your code execute under an alternative environment (context). Override the excurse method to create a KernelExcursion. For example: KernelExcursion rootExcursion = new KernelExcursion() { public void excurse() { // Set up specific context variables. setEffectiveParty(Kernel.getSystemParty()); // Execute code in new context. }}; rootExcursion.run();


Field Summary
static String versionId
           
 
Constructor Summary
KernelExcursion()
           
 
Method Summary
protected abstract  void excurse()
          When this method is called the current KernelContext is copied and the code inside the excurse() method is given the opportunity to modify the new context.
 void run()
           
protected  void setEffectiveParty(Party party)
           
protected  void setLocale(Locale locale)
           
protected  void setParty(Party party)
           
protected  void setResource(Resource app)
           
protected  void setSessionID(String sessionID)
           
protected  void setTransaction(DatabaseTransaction transaction)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

versionId

public static final String versionId
See Also:
Constant Field Values
Constructor Detail

KernelExcursion

public KernelExcursion()
Method Detail

run

public final void run()
Specified by:
run in interface Runnable

excurse

protected abstract void excurse()

When this method is called the current KernelContext is copied and the code inside the excurse() method is given the opportunity to modify the new context. Any code then called from within the excurse() method is executed in this new context. After the excurse() method completes the old context is restored exactly as it was before. This makes it unnecessary to write error prone code like this:

   Party oldParty = context.getParty();
   context.setParty(newParty);
   ...
   // do something
   ...
   context.setParty(oldParty); // If this is forgotten, bad
                               // things can happen.
 


setEffectiveParty

protected final void setEffectiveParty(Party party)

setParty

protected final void setParty(Party party)

setResource

protected final void setResource(Resource app)

setLocale

protected final void setLocale(Locale locale)

setSessionID

protected final void setSessionID(String sessionID)

setTransaction

protected final void setTransaction(DatabaseTransaction transaction)


Copyright (c) 2004 Red Hat, Inc. Corporation. All Rights Reserved. Generated at July 20 2004:2337 UTC