ozonesecuritymanager.java

来自「用Java写的面相对象的数据库管理系统」· Java 代码 · 共 199 行

JAVA
199
字号
// You can redistribute this software and/or modify it under the terms of// the Ozone Core License version 1 published by ozone-db.org.//// The original code and portions created by SMB are// Copyright (C) 1997-2000 by SMB GmbH. All rights reserved.//// $Id: OzoneSecurityManager.java,v 1.8 2000/10/28 16:55:17 daniela Exp $package org.ozoneDB.core;import org.ozoneDB.core.DbRemote.CommandThread;import java.io.*;import java.net.*;public class OzoneSecurityManager extends SecurityManager {        static boolean enabled = false;            Thread thread() {        return Thread.currentThread();    }             public void enable( boolean value ) {        enabled = value;    }             boolean is3XThread() {        return !isTransaction();    }             boolean isTransaction() {        if (thread() instanceof CommandThread) {            return ((CommandThread)thread()).transaction() != null;        } else {            return false;        }     }             void standardSecurity() {        if (enabled) {            if (isTransaction()) {                throw new SecurityException();            }         }     }             public OzoneSecurityManager() {    }            public void checkAccept( String host, int port ) {        standardSecurity();    }             public void checkAccess( Thread thread ) {        standardSecurity();    }             public void checkAccess( ThreadGroup threadGroup ) {        standardSecurity();    }             public void checkAwtEventQueueAccess() {        standardSecurity();    }             public void checkConnect( String host, int port ) {        standardSecurity();    }             public void checkConnect( String host, int port, Object obj ) {        standardSecurity();    }             public void checkCreateClassLoader() {        standardSecurity();    }             public void checkDelete( String file ) {        standardSecurity();    }             public void checkExec( String command ) {        standardSecurity();    }             public void checkExit( int code ) {        if (enabled) {            throw new SecurityException();        }     }             public void checkLink( String library ) {        standardSecurity();    }             public void checkListen( int port ) {        standardSecurity();    }             public void checkMemberAccess( Class clazz, int which ) {    }             public void checkMulitcast( InetAddress add, byte ip ) {        standardSecurity();    }             public void checkPackageAccess( String pkg ) {    }             public void checkPackageDefinition( String pkg ) {    }             public void checkPermission( java.security.Permission perm, Object context ) {    }             /**     * Allow ObjectOutputStream.enableReplceObject() to be set to true.     */    public void checkPermission( java.security.Permission perm ) {    }             public void checkPrintJobAccess() {    }             public void checkPropertiesAccess() {    }             public void checkPropertyAccess( String prop ) {    }             public void checkRead( FileDescriptor fd ) {    }             public void checkRead( String file ) {    }             public void checkRead( String file, Object obj ) {    }             public void checkSecurityAccess( String action ) {    }             public void checkSetFactory() {    }             public void checkSystemClipboardAccess() {    }             public boolean checkTopLevelWindow( Object window ) {        // in case of LocalDatabase this would also prevent the client        // from havin a GUI        // throw new SecurityException();        return true;    }             public void checkWrite( FileDescriptor fd ) {    }             public void checkWrite( String file ) {    } }

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?