org.argouml.application.security
Class ExitSecurityManager

java.lang.Object
  extended byjava.lang.SecurityManager
      extended byorg.argouml.application.security.ExitSecurityManager

public final class ExitSecurityManager
extends SecurityManager

The Argo custom security manager. Since Argo is an open-source product, the concept of a security manager may seem odd. This class is not intended to provide security in the standard way that Java programmers think of, in the context of Applets, for example. Rather, it is intended to protect Argo from accidental modifications to its own environment by external modules. One of the areas this is necessary is to protect from the System.exit(int) or Runtime.exit(int) calls. Another is to prevent modules from replacing the awt exception trapping hook so that we are able to properly catch any ArgoSecurityExceptions and prevent the stack trace when we desire.

Since:
0.9.4

Field Summary
private  boolean allowExit
          true if we are allowed to exit.
private static Logger LOG
           
private static ExitSecurityManager SINGLETON
          The only allowed instance.
 
Fields inherited from class java.lang.SecurityManager
inCheck
 
Constructor Summary
private ExitSecurityManager()
          Don't allow it to be instantiated from the outside.
 
Method Summary
 void checkPermission(Permission perm)
           
 boolean getAllowExit()
           
static ExitSecurityManager getInstance()
          Accessor for the instance.
 void setAllowExit(boolean myAllowExit)
           
 
Methods inherited from class java.lang.SecurityManager
checkAccept, checkAccess, checkAccess, checkAwtEventQueueAccess, checkConnect, checkConnect, checkCreateClassLoader, checkDelete, checkExec, checkExit, checkLink, checkListen, checkMemberAccess, checkMulticast, checkMulticast, checkPackageAccess, checkPackageDefinition, checkPermission, checkPrintJobAccess, checkPropertiesAccess, checkPropertyAccess, checkRead, checkRead, checkRead, checkSecurityAccess, checkSetFactory, checkSystemClipboardAccess, checkTopLevelWindow, checkWrite, checkWrite, classDepth, classLoaderDepth, currentClassLoader, currentLoadedClass, getClassContext, getInCheck, getSecurityContext, getThreadGroup, inClass, inClassLoader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

private static final Logger LOG

allowExit

private boolean allowExit
true if we are allowed to exit.

This is set to false from main() just before we start the ball rolling for the GUI.

This means that all applications that doesn't start from main i.e. when running JUnit test cases and batch commands, are allowed to exit immediatly.


SINGLETON

private static final ExitSecurityManager SINGLETON
The only allowed instance.

Constructor Detail

ExitSecurityManager

private ExitSecurityManager()
Don't allow it to be instantiated from the outside.

Method Detail

getInstance

public static final ExitSecurityManager getInstance()
Accessor for the instance.

Returns:
the signleton

checkPermission

public void checkPermission(Permission perm)
See Also:
SecurityManager.checkPermission(java.security.Permission)

getAllowExit

public boolean getAllowExit()
Returns:
true if we may exit

setAllowExit

public void setAllowExit(boolean myAllowExit)
Parameters:
myAllowExit - true if we may exit


ArgoUML © 1996-2004 (20050222)ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook