junit.extensions.jfcunit
Class JFCTestCase.JFCSecurityManager

java.lang.Object
  extended byjava.lang.SecurityManager
      extended byjunit.extensions.jfcunit.JFCTestCase.JFCSecurityManager
Enclosing class:
JFCTestCase

class JFCTestCase.JFCSecurityManager
extends java.lang.SecurityManager

Security manager which proxies all calls to the original security manager. If the checkExit is called and the setAssertExit(true) then the SecurityException is thrown.


Field Summary
private  java.lang.SecurityManager m_delegate
          Original Security manager.
 
Fields inherited from class java.lang.SecurityManager
inCheck
 
Constructor Summary
JFCTestCase.JFCSecurityManager(java.lang.SecurityManager delegate)
          Constructor.
 
Method Summary
 void checkAccept(java.lang.String host, int port)
          Throws a SecurityException if the calling thread is not permitted to accept a socket connection from the specified host and port number.
 void checkAccess(java.lang.Thread t)
          Throws a SecurityException if the calling thread is not allowed to modify the thread argument.
 void checkAccess(java.lang.ThreadGroup g)
          Throws a SecurityException if the calling thread is not allowed to modify the thread group argument.
 void checkAwtEventQueueAccess()
          Throws a SecurityException if the calling thread is not allowed to access the AWT event queue.
 void checkConnect(java.lang.String host, int port)
          Throws a SecurityException if the calling thread is not allowed to open a socket connection to the specified host and port number.
 void checkConnect(java.lang.String host, int port, java.lang.Object context)
          Throws a SecurityException if the specified security context is not allowed to open a socket connection to the specified host and port number.
 void checkCreateClassLoader()
          Throws a SecurityException if the calling thread is not allowed to create a new class loader.
 void checkDelete(java.lang.String file)
          Throws a SecurityException if the calling thread is not allowed to delete the specified file.
 void checkExec(java.lang.String cmd)
          Throws a SecurityException if the calling thread is not allowed to create a subprocess.
 void checkExit(int status)
           
 void checkLink(java.lang.String lib)
          Throws a SecurityException if the calling thread is not allowed to dynamic link the library code specified by the string argument file.
 void checkListen(int port)
          Throws a SecurityException if the calling thread is not allowed to wait for a connection request on the specified local port number.
 void checkMemberAccess(java.lang.Class clazz, int which)
          Throws a SecurityException if the calling thread is not allowed to access members.
 void checkMulticast(java.net.InetAddress maddr)
          Throws a SecurityException if the calling thread is not allowed to use (join/leave/send/receive) IP multicast.
 void checkPackageAccess(java.lang.String pkg)
          Throws a SecurityException if the calling thread is not allowed to access the package specified by the argument.
 void checkPackageDefinition(java.lang.String pkg)
          Throws a SecurityException if the calling thread is not allowed to define classes in the package specified by the argument.
 void checkPermission(java.security.Permission perm)
           
 void checkPermission(java.security.Permission perm, java.lang.Object context)
          Throws a SecurityException if the specified security context is denied access to the resource specified by the given permission.
 void checkPrintJobAccess()
          Throws a SecurityException if the calling thread is not allowed to initiate a print job request.
 void checkPropertiesAccess()
          Throws a SecurityException if the calling thread is not allowed to access or modify the system properties.
 void checkPropertyAccess(java.lang.String key)
          Throws a SecurityException if the calling thread is not allowed to access the system property with the specified key name.
 void checkRead(java.io.FileDescriptor fd)
          Throws a SecurityException if the calling thread is not allowed to read from the specified file descriptor.
 void checkRead(java.lang.String file)
          Throws a SecurityException if the calling thread is not allowed to read the file specified by the string argument.
 void checkRead(java.lang.String file, java.lang.Object context)
          Throws a SecurityException if the specified security context is not allowed to read the file specified by the string argument.
 void checkSecurityAccess(java.lang.String target)
          Determines whether the permission with the specified permission target name should be granted or denied.
 void checkSetFactory()
          Throws a SecurityException if the calling thread is not allowed to set the socket factory used by ServerSocket or Socket, or the stream handler factory used by URL.
 void checkSystemClipboardAccess()
          Throws a SecurityException if the calling thread is not allowed to access the system clipboard.
 boolean checkTopLevelWindow(java.lang.Object window)
          Returns false if the calling thread is not trusted to bring up the top-level window indicated by the window argument.
 void checkWrite(java.io.FileDescriptor fd)
          Throws a SecurityException if the calling thread is not allowed to write to the specified file descriptor.
 void checkWrite(java.lang.String file)
          Throws a SecurityException if the calling thread is not allowed to write to the file specified by the string argument.
 java.lang.Object getSecurityContext()
          Creates an object that encapsulates the current execution environment.
 java.lang.ThreadGroup getThreadGroup()
          Returns the thread group into which to instantiate any new thread being created at the time this is being called.
 
Methods inherited from class java.lang.SecurityManager
checkMulticast, classDepth, classLoaderDepth, currentClassLoader, currentLoadedClass, getClassContext, getInCheck, inClass, inClassLoader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_delegate

private java.lang.SecurityManager m_delegate
Original Security manager.

Constructor Detail

JFCTestCase.JFCSecurityManager

public JFCTestCase.JFCSecurityManager(java.lang.SecurityManager delegate)
Constructor.

Parameters:
delegate - Delegate security manager.
Method Detail

checkExit

public void checkExit(int status)
Parameters:
status - Status to be used.
See Also:
SecurityManager.checkExit(int)

checkPermission

public void checkPermission(java.security.Permission perm)
Parameters:
perm - Permission to be checked.
See Also:
SecurityManager.checkPermission(java.security.Permission)

checkAccept

public void checkAccept(java.lang.String host,
                        int port)
Throws a SecurityException if the calling thread is not permitted to accept a socket connection from the specified host and port number.

Parameters:
host - the host name of the socket connection.
port - the port number of the socket connection.

checkAccess

public void checkAccess(java.lang.Thread t)
Throws a SecurityException if the calling thread is not allowed to modify the thread argument.

Parameters:
t - the thread to be checked.

checkAccess

public void checkAccess(java.lang.ThreadGroup g)
Throws a SecurityException if the calling thread is not allowed to modify the thread group argument.

Parameters:
g - the thread group to be checked.

checkAwtEventQueueAccess

public void checkAwtEventQueueAccess()
Throws a SecurityException if the calling thread is not allowed to access the AWT event queue.


checkConnect

public void checkConnect(java.lang.String host,
                         int port)
Throws a SecurityException if the calling thread is not allowed to open a socket connection to the specified host and port number.

Parameters:
host - the host name port to connect to.
port - the protocol port to connect to.

checkConnect

public void checkConnect(java.lang.String host,
                         int port,
                         java.lang.Object context)
Throws a SecurityException if the specified security context is not allowed to open a socket connection to the specified host and port number.

Parameters:
host - the host name port to connect to.
port - the protocol port to connect to.
context - a system-dependent security context.

checkCreateClassLoader

public void checkCreateClassLoader()
Throws a SecurityException if the calling thread is not allowed to create a new class loader.


checkDelete

public void checkDelete(java.lang.String file)
Throws a SecurityException if the calling thread is not allowed to delete the specified file.

Parameters:
file - the system-dependent filename.

checkExec

public void checkExec(java.lang.String cmd)
Throws a SecurityException if the calling thread is not allowed to create a subprocess.

Parameters:
cmd - the specified system command.

checkLink

public void checkLink(java.lang.String lib)
Throws a SecurityException if the calling thread is not allowed to dynamic link the library code specified by the string argument file.

Parameters:
lib - the name of the library.

checkListen

public void checkListen(int port)
Throws a SecurityException if the calling thread is not allowed to wait for a connection request on the specified local port number.

Parameters:
port - the local port.

checkMemberAccess

public void checkMemberAccess(java.lang.Class clazz,
                              int which)
Throws a SecurityException if the calling thread is not allowed to access members.

Parameters:
clazz - the class that reflection is to be performed on.
which - type of access, PUBLIC or DECLARED.

checkMulticast

public void checkMulticast(java.net.InetAddress maddr)
Throws a SecurityException if the calling thread is not allowed to use (join/leave/send/receive) IP multicast.

Parameters:
maddr - Internet group address to be used.

checkPackageAccess

public void checkPackageAccess(java.lang.String pkg)
Throws a SecurityException if the calling thread is not allowed to access the package specified by the argument.

Parameters:
pkg - the package name.

checkPackageDefinition

public void checkPackageDefinition(java.lang.String pkg)
Throws a SecurityException if the calling thread is not allowed to define classes in the package specified by the argument.

Parameters:
pkg - the package name.

checkPermission

public void checkPermission(java.security.Permission perm,
                            java.lang.Object context)
Throws a SecurityException if the specified security context is denied access to the resource specified by the given permission.

Parameters:
perm - the specified permission
context - a system-dependent security context.

checkPrintJobAccess

public void checkPrintJobAccess()
Throws a SecurityException if the calling thread is not allowed to initiate a print job request.


checkPropertiesAccess

public void checkPropertiesAccess()
Throws a SecurityException if the calling thread is not allowed to access or modify the system properties.


checkPropertyAccess

public void checkPropertyAccess(java.lang.String key)
Throws a SecurityException if the calling thread is not allowed to access the system property with the specified key name.

Parameters:
key - a system property key.

checkRead

public void checkRead(java.io.FileDescriptor fd)
Throws a SecurityException if the calling thread is not allowed to read from the specified file descriptor.

Parameters:
fd - the system-dependent file descriptor.

checkRead

public void checkRead(java.lang.String file)
Throws a SecurityException if the calling thread is not allowed to read the file specified by the string argument.

Parameters:
file - the system-dependent file name.

checkRead

public void checkRead(java.lang.String file,
                      java.lang.Object context)
Throws a SecurityException if the specified security context is not allowed to read the file specified by the string argument.

Parameters:
file - the system-dependent filename.
context - a system-dependent security context.

checkSecurityAccess

public void checkSecurityAccess(java.lang.String target)
Determines whether the permission with the specified permission target name should be granted or denied.

Parameters:
target - the target name of the SecurityPermission.

checkSetFactory

public void checkSetFactory()
Throws a SecurityException if the calling thread is not allowed to set the socket factory used by ServerSocket or Socket, or the stream handler factory used by URL.


checkSystemClipboardAccess

public void checkSystemClipboardAccess()
Throws a SecurityException if the calling thread is not allowed to access the system clipboard.


checkTopLevelWindow

public boolean checkTopLevelWindow(java.lang.Object window)
Returns false if the calling thread is not trusted to bring up the top-level window indicated by the window argument.

Parameters:
window - the new window that is being created.
Returns:
true if the calling thread is trusted to put up top-level windows; false otherwise.

checkWrite

public void checkWrite(java.io.FileDescriptor fd)
Throws a SecurityException if the calling thread is not allowed to write to the specified file descriptor.

Parameters:
fd - the system-dependent file descriptor.

checkWrite

public void checkWrite(java.lang.String file)
Throws a SecurityException if the calling thread is not allowed to write to the file specified by the string argument.

Parameters:
file - the system-dependent filename.

getSecurityContext

public java.lang.Object getSecurityContext()
Creates an object that encapsulates the current execution environment.

Returns:
an implementation-dependent object that encapsulates sufficient information about the current execution environment to perform some security checks later.

getThreadGroup

public java.lang.ThreadGroup getThreadGroup()
Returns the thread group into which to instantiate any new thread being created at the time this is being called.

Returns:
ThreadGroup that new threads are instantiated into


Licensed under: GNU Lesser General Public License, Ver 2.1, February 1999