org.openmrs.api.context
Class Daemon
java.lang.Object
org.openmrs.api.context.Daemon
public class Daemon
- extends java.lang.Object
This class allows certain tasks to run with elevated privileges. Primary use is scheduling and
module startup when there is no user to authenticate as.
Field Summary |
protected static java.lang.String |
DAEMON_USER_UUID
The uuid defined for the daemon user object |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DAEMON_USER_UUID
protected static final java.lang.String DAEMON_USER_UUID
- The uuid defined for the daemon user object
- See Also:
- Constant Field Values
Daemon
public Daemon()
startModule
public static Module startModule(Module module)
throws ModuleException
- This method should not be called directly. The
ModuleFactory.startModule(Module)
method uses this to start the given module in a new thread that is authenticated as the
daemon user
- Parameters:
module
- the module to start
- Throws:
ModuleException
executeScheduledTask
public static void executeScheduledTask(Task task)
throws java.lang.Throwable
- Executes the given task in a new thread that is authenticated as the daemon user.
This can only be called from TimerSchedulerTask
during actual task execution
- Parameters:
task
- the task to run
- Throws:
java.lang.Throwable
- Expected behavior:
- not be called from other methods other than TimerSchedulerTask, not throw error if called from a TimerSchedulerTask class
isDaemonThread
public static boolean isDaemonThread()
- Returns:
- true if the current thread was started by this class and so is a daemon thread that
has all privileges
- See Also:
Context.hasPrivilege(String)
Generated Apr 27 2012 10:06 PM. NOTE - these libraries are in active development and subject to change