sk.robotics.rlcs.security
Class Restricted

java.lang.Object
  extended by java.lang.Thread
      extended by sk.robotics.rlcs.security.Restricted
All Implemented Interfaces:
java.lang.Runnable

public class Restricted
extends java.lang.Thread

This class provides a way to execude some code in a restricted thread. The thread will have either no permissions at all, or only those of a specified agent class. Of course, only privileged threads are allowed to create (and execute) threads 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
Restricted(java.lang.Runnable target, java.lang.String name, java.lang.Class agentClass)
          Creates a restricted thread object.
 
Method Summary
 void exec()
          Executes the thread, waiting for it to finish before returning.
 java.lang.Class getAgentClass()
          Get agent class, associated with this thread.
 void run()
           
 
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

Restricted

public Restricted(java.lang.Runnable target,
                  java.lang.String name,
                  java.lang.Class agentClass)
Creates a restricted thread object. Call exec method to (synchronously) execute the thread.

Method Detail

getAgentClass

public java.lang.Class getAgentClass()
Get agent class, associated with this thread.


exec

public void exec()
Executes the thread, waiting for it to finish before returning. If it throws any RuntimeException, this method will rethrow it.


run

public void run()
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread