001: /* Copyright (C) 2004 - 2007 db4objects Inc. http://www.db4o.com
002:
003: This file is part of the db4o open source object database.
004:
005: db4o is free software; you can redistribute it and/or modify it under
006: the terms of version 2 of the GNU General Public License as published
007: by the Free Software Foundation and as clarified by db4objects' GPL
008: interpretation policy, available at
009: http://www.db4o.com/about/company/legalpolicies/gplinterpretation/
010: Alternatively you can write to db4objects, Inc., 1900 S Norfolk Street,
011: Suite 350, San Mateo, CA 94403, USA.
012:
013: db4o is distributed in the hope that it will be useful, but WITHOUT ANY
014: WARRANTY; without even the implied warranty of MERCHANTABILITY or
015: FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
016: for more details.
017:
018: You should have received a copy of the GNU General Public License along
019: with this program; if not, write to the Free Software Foundation, Inc.,
020: 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
021: package EDU.purdue.cs.bloat.benchmark;
022:
023: import java.io.*;
024:
025: /**
026: * The <tt>BenchmarkSecurityManager</tt> allows us to execute a "main" method
027: * multiple times without the virtual machine exiting. If exit is not allowed,
028: * the <tt>checkExit</tt> method will throw a <tt>SecurityException</tt>
029: * that can be caught, thus allowing execution to continue.
030: *
031: * @see Shade
032: * @see Stats
033: */
034: public class BenchmarkSecurityManager extends SecurityManager {
035: boolean allowExit = false;
036:
037: /**
038: * A <tt>SecurityException</tt> is thrown if we do not allow the virtual
039: * machine to exit.
040: */
041: public void checkExit(final int status) {
042: if (!allowExit) {
043: System.err.println("exit " + status);
044: throw new SecurityException("Tried to exit (status="
045: + status + ")");
046: }
047: }
048:
049: public void checkCreateClassLoader() {
050: }
051:
052: public void checkAccess(final Thread t) {
053: }
054:
055: public void checkAccess(final ThreadGroup g) {
056: }
057:
058: public void checkExec(final String cmd) {
059: }
060:
061: public void checkLink(final String lib) {
062: }
063:
064: public void checkRead(final FileDescriptor fd) {
065: }
066:
067: public void checkRead(final String file) {
068: }
069:
070: public void checkRead(final String file, final Object context) {
071: }
072:
073: public void checkWrite(final FileDescriptor fd) {
074: }
075:
076: public void checkWrite(final String file) {
077: }
078:
079: public void checkDelete(final String file) {
080: }
081:
082: public void checkConnect(final String host, final int port) {
083: }
084:
085: public void checkConnect(final String host, final int port,
086: final Object context) {
087: }
088:
089: public void checkListen(final int port) {
090: }
091:
092: public void checkAccept(final String host, final int port) {
093: }
094:
095: public void checkPropertiesAccess() {
096: }
097:
098: public void checkPropertyAccess(final String key) {
099: }
100:
101: public void checkPropertyAccess(final String key, final String val) {
102: }
103:
104: public boolean checkTopLevelWindow(final Object window) {
105: return true;
106: }
107:
108: public void checkPackageAccess(final String pkg) {
109: }
110:
111: public void checkPackageDefinition(final String pkg) {
112: }
113:
114: public void checkSetFactory() {
115: }
116: }
|