1 9 package org.ozoneDB.core; 10 11 import org.ozoneDB.core.DbRemote.CommandThread; 12 import java.io.*; 13 import java.net.*; 14 15 16 public class OzoneSecurityManager extends SecurityManager { 17 18 static boolean enabled = false; 19 20 21 Thread thread() { 22 return Thread.currentThread(); 23 } 24 25 26 public void enable( boolean value ) { 27 enabled = value; 28 } 29 30 31 boolean is3XThread() { 32 return !isTransaction(); 33 } 34 35 36 boolean isTransaction() { 37 if (thread() instanceof CommandThread) { 38 return ((CommandThread)thread()).transaction() != null; 39 } else { 40 return false; 41 } 42 } 43 44 45 void standardSecurity() { 46 if (enabled) { 47 if (isTransaction()) { 48 throw new SecurityException (); 49 } 50 } 51 } 52 53 54 public OzoneSecurityManager() { 55 } 56 57 58 public void checkAccept( String host, int port ) { 59 standardSecurity(); 60 } 61 62 63 public void checkAccess( Thread thread ) { 64 standardSecurity(); 65 } 66 67 68 public void checkAccess( ThreadGroup threadGroup ) { 69 standardSecurity(); 70 } 71 72 73 public void checkAwtEventQueueAccess() { 74 standardSecurity(); 75 } 76 77 78 public void checkConnect( String host, int port ) { 79 standardSecurity(); 80 } 81 82 83 public void checkConnect( String host, int port, Object obj ) { 84 standardSecurity(); 85 } 86 87 88 public void checkCreateClassLoader() { 89 standardSecurity(); 90 } 91 92 93 public void checkDelete( String file ) { 94 standardSecurity(); 95 } 96 97 98 public void checkExec( String command ) { 99 standardSecurity(); 100 } 101 102 103 public void checkExit( int code ) { 104 if (enabled) { 105 throw new SecurityException (); 106 } 107 } 108 109 110 public void checkLink( String library ) { 111 standardSecurity(); 112 } 113 114 115 public void checkListen( int port ) { 116 standardSecurity(); 117 } 118 119 120 public void checkMemberAccess( Class clazz, int which ) { 121 } 122 123 124 public void checkMulitcast( InetAddress add, byte ip ) { 125 standardSecurity(); 126 } 127 128 129 public void checkPackageAccess( String pkg ) { 130 } 131 132 133 public void checkPackageDefinition( String pkg ) { 134 } 135 136 137 public void checkPermission( java.security.Permission perm, Object context ) { 138 } 139 140 141 144 public void checkPermission( java.security.Permission perm ) { 145 } 146 147 148 public void checkPrintJobAccess() { 149 } 150 151 152 public void checkPropertiesAccess() { 153 } 154 155 156 public void checkPropertyAccess( String prop ) { 157 } 158 159 160 public void checkRead( FileDescriptor fd ) { 161 } 162 163 164 public void checkRead( String file ) { 165 } 166 167 168 public void checkRead( String file, Object obj ) { 169 } 170 171 172 public void checkSecurityAccess( String action ) { 173 } 174 175 176 public void checkSetFactory() { 177 } 178 179 180 public void checkSystemClipboardAccess() { 181 } 182 183 184 public boolean checkTopLevelWindow( Object window ) { 185 return true; 189 } 190 191 192 public void checkWrite( FileDescriptor fd ) { 193 } 194 195 196 public void checkWrite( String file ) { 197 } 198 } 199 | Popular Tags |