sk.robotics.rlcs.security
Class Trusted

java.lang.Object
  extended by java.lang.Thread
      extended by sk.robotics.rlcs.security.Trusted
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
Agent.Cfg.Validator, Agent.ThreadCreator

public class Trusted
extends java.lang.Thread

This class provides a way to execude some code in a thread with more privileges than the calling thread.

Of course, threads of this class have no permissions, only subclasses explicitely allowed in SecurityManager are granted permissions specified through methods of this class.

Threads of this class, as opposed to Restricted threads, are not spawned on demand, because that would require special permissions from the calling thread. Instead, multiple request are queued (serialized) and executed in single instance of a thread of this class.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
protected Trusted(java.lang.String name, java.security.Permissions perms)
          Constructor creates and starts the thread, initializing set of permissions.
 
Method Summary
 void exec(java.lang.Runnable target)
          Execute a Runnable target in this thread.
 java.security.Permissions getPermissions()
          Get set of permissions associated with this thread.
 void run()
          The thread function.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Trusted

protected Trusted(java.lang.String name,
                  java.security.Permissions perms)
Constructor creates and starts the thread, initializing set of permissions.

Method Detail

getPermissions

public java.security.Permissions getPermissions()
Get set of permissions associated with this thread. These permissions are granted to this thread, but only if it is explicitely allowed in SecurityManager.


run

public void run()
The thread function. Waits for requests, and executes them. Stores finished targets, along with exceptions they throw, in the finished map.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

exec

public void exec(java.lang.Runnable target)
Execute a Runnable target in this thread. Waits for the target to get executed, and rethrows any RuntimeException it might throw.