Version: 1.1.1

org.biomoby.service.dashboard
Class ExitSecurityManager

java.lang.Object
  extended by java.lang.SecurityManager
      extended by org.biomoby.service.dashboard.ExitSecurityManager

public class ExitSecurityManager
extends SecurityManager

A security manager allowing to enable and disable usage of System.exit() calls.

Everybody can enable and disable it - so it is not strictly speaking too secure but the purpose is not to prevent against malicious classes but to allow to embed code and libraries that use System.exit() - such as the Ant classes - without breaking wrapping code.

Version:
$Id: ExitSecurityManager.java,v 1.2 2006/02/19 18:42:55 senger Exp $
Author:
Martin Senger

Constructor Summary
ExitSecurityManager()
          Default constructor.
 
Method Summary
 void checkExit(int status)
           
 void checkPermission(Permission perm)
           
 void checkPermission(Permission perm, Object context)
           
static ExitSecurityManager createAndInstall()
          Create and install an instance of this exit manager as a new security manager.
 void setExitForbidden(boolean enabled)
          Enable od disable usage of System.exit().
 
Methods inherited from class java.lang.SecurityManager
checkAccept, checkAccess, checkAccess, checkAwtEventQueueAccess, checkConnect, checkConnect, checkCreateClassLoader, checkDelete, checkExec, checkLink, checkListen, checkMemberAccess, checkMulticast, checkMulticast, checkPackageAccess, checkPackageDefinition, checkPrintJobAccess, checkPropertiesAccess, checkPropertyAccess, checkRead, checkRead, checkRead, checkSecurityAccess, checkSetFactory, checkSystemClipboardAccess, checkTopLevelWindow, checkWrite, checkWrite, getInCheck, getSecurityContext, getThreadGroup
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExitSecurityManager

public ExitSecurityManager()
Default constructor. By default, the System.exit() calls are disabled.

Method Detail

createAndInstall

public static ExitSecurityManager createAndInstall()
Create and install an instance of this exit manager as a new security manager. It prints a warning message (into a log) if installing was notr allowed because there is already another security manager installed.

Returns:
a new security manager (even if it was not possible to install it; it never returns null)

setExitForbidden

public void setExitForbidden(boolean enabled)
Enable od disable usage of System.exit(). If it is disbaled and then called, the call will raise an ExitException.

Parameters:
enabled - true enables System.exit() calls

checkExit

public void checkExit(int status)
Overrides:
checkExit in class SecurityManager
Throws:
org.apache.tools.ant.ExitException - if System.exit() was called and was not allowed. The exception has an exit code taken from this System.exit() call.

checkPermission

public void checkPermission(Permission perm,
                            Object context)
Overrides:
checkPermission in class SecurityManager

checkPermission

public void checkPermission(Permission perm)
Overrides:
checkPermission in class SecurityManager

Version: 1.1.1

Submit a bug or feature
Generated: Sat May 29 04:26:35 EDT 2010