home *** CD-ROM | disk | FTP | other *** search
/ Performance Now / PFE4.iso / worldnet / ns3230d / disk2 / java.z / java_30 / java / lang / SecurityManager.class (.txt) < prev    next >
Encoding:
Java Class File  |  1996-08-15  |  5.7 KB  |  248 lines

  1. package java.lang;
  2.  
  3. import java.io.FileDescriptor;
  4.  
  5. public abstract class SecurityManager {
  6.    protected boolean inCheck;
  7.    private boolean initialized = false;
  8.    private static SecurityManager security;
  9.  
  10.    public synchronized boolean getInCheck() {
  11.       return this.inCheck;
  12.    }
  13.  
  14.    protected SecurityManager() {
  15.       if (System.getSecurityManager() != null) {
  16.          throw new SecurityException("can't create SecurityManager");
  17.       } else {
  18.          this.initialized = true;
  19.       }
  20.    }
  21.  
  22.    protected native Class[] getClassContext();
  23.  
  24.    protected native ClassLoader currentClassLoader();
  25.  
  26.    protected native int classDepth(String var1);
  27.  
  28.    protected native int classLoaderDepth();
  29.  
  30.    protected native boolean checkClassLoader(int var1);
  31.  
  32.    protected boolean inClass(String name) {
  33.       this.checkInitialized();
  34.       return this.classDepth(name) >= 0;
  35.    }
  36.  
  37.    protected boolean inClassLoader() {
  38.       this.checkInitialized();
  39.       return this.currentClassLoader() != null;
  40.    }
  41.  
  42.    public Object getSecurityContext() {
  43.       return null;
  44.    }
  45.  
  46.    public void checkCreateClassLoader(int caller_depth) {
  47.       throw new SecurityException();
  48.    }
  49.  
  50.    public void checkCreateClassLoader() {
  51.       this.checkCreateClassLoader(2);
  52.    }
  53.  
  54.    public void checkAccess(Thread g, int caller_depth) {
  55.       throw new SecurityException();
  56.    }
  57.  
  58.    public void checkAccess(Thread g, Throwable o, int caller_depth) {
  59.       throw new SecurityException();
  60.    }
  61.  
  62.    public void checkAccess(Thread g) {
  63.       this.checkAccess((Thread)g, 2);
  64.    }
  65.  
  66.    public void checkAccess(ThreadGroup g, int caller_depth) {
  67.       throw new SecurityException();
  68.    }
  69.  
  70.    public void checkAccess(ThreadGroup g) {
  71.       this.checkAccess((ThreadGroup)g, 4);
  72.    }
  73.  
  74.    public void checkExit(int status) {
  75.       throw new SecurityException();
  76.    }
  77.  
  78.    public void checkExec(String cmd) {
  79.       throw new SecurityException();
  80.    }
  81.  
  82.    public void checkLink(String lib, int caller_depth) {
  83.       throw new SecurityException();
  84.    }
  85.  
  86.    public void checkLink(String lib) {
  87.       this.checkLink(lib, 2);
  88.       this.checkLink(lib, 3);
  89.    }
  90.  
  91.    public void checkRead(FileDescriptor fd) {
  92.       throw new SecurityException();
  93.    }
  94.  
  95.    public void checkRead(String file) {
  96.       throw new SecurityException();
  97.    }
  98.  
  99.    public void checkRead(String file, Object context) {
  100.       throw new SecurityException();
  101.    }
  102.  
  103.    public void checkWrite(FileDescriptor fd) {
  104.       throw new SecurityException();
  105.    }
  106.  
  107.    public void checkWrite(String file) {
  108.       throw new SecurityException();
  109.    }
  110.  
  111.    public void checkDelete(String file) {
  112.       throw new SecurityException();
  113.    }
  114.  
  115.    public void checkConnect(String host, int port) {
  116.       throw new SecurityException();
  117.    }
  118.  
  119.    public void checkConnect(String host, int port, Object context) {
  120.       throw new SecurityException();
  121.    }
  122.  
  123.    public void checkListen(int port) {
  124.       throw new SecurityException();
  125.    }
  126.  
  127.    public void checkAccept(String host, int port) {
  128.       throw new SecurityException();
  129.    }
  130.  
  131.    public void checkPropertiesAccess(int caller_depth) {
  132.       throw new SecurityException();
  133.    }
  134.  
  135.    public void checkPropertiesAccess() {
  136.       this.checkPropertiesAccess(2);
  137.    }
  138.  
  139.    public void checkPropertyAccess(String key, int caller_depth) {
  140.       throw new SecurityException();
  141.    }
  142.  
  143.    public void checkPropertyAccess(String key) {
  144.       this.checkPropertyAccess(key, 2);
  145.    }
  146.  
  147.    public void checkPropertyAccess(String key, String def) {
  148.       throw new SecurityException();
  149.    }
  150.  
  151.    public boolean checkTopLevelWindow(Object window) {
  152.       return false;
  153.    }
  154.  
  155.    public void checkPackageAccess(String pkg) {
  156.       throw new SecurityException();
  157.    }
  158.  
  159.    public void checkPackageDefinition(String pkg) {
  160.       throw new SecurityException();
  161.    }
  162.  
  163.    public void checkSetFactory() {
  164.       throw new SecurityException();
  165.    }
  166.  
  167.    private native boolean checkInitialized();
  168.  
  169.    public static void setSecurityManager() {
  170.       if (security != null) {
  171.          throw new SecurityException("SecurityManager already set");
  172.       } else {
  173.          security = System.getSecurityManager();
  174.       }
  175.    }
  176.  
  177.    public static void checksCreateClassLoader(int caller_depth) {
  178.       if (security != null) {
  179.          security.checkCreateClassLoader(caller_depth + 1);
  180.       }
  181.  
  182.    }
  183.  
  184.    public static void checksExit(int status) {
  185.       if (security != null) {
  186.          security.checkExit(status);
  187.       }
  188.  
  189.    }
  190.  
  191.    public static void checksExec(String cmd) {
  192.       if (security != null) {
  193.          security.checkExec(cmd);
  194.       }
  195.  
  196.    }
  197.  
  198.    public static void checksLink(String lib, int caller_depth) {
  199.       if (security != null) {
  200.          security.checkLink(lib, caller_depth + 1);
  201.       }
  202.  
  203.    }
  204.  
  205.    public static void checksPropertiesAccess(int caller_depth) {
  206.       if (security != null) {
  207.          security.checkPropertiesAccess(caller_depth + 1);
  208.       }
  209.  
  210.    }
  211.  
  212.    public static void checksPropertyAccess(String key, int caller_depth) {
  213.       if (security != null) {
  214.          security.checkPropertyAccess(key, caller_depth + 1);
  215.       }
  216.  
  217.    }
  218.  
  219.    public static void checksAccess(Thread t, int caller_depth) {
  220.       if (security != null) {
  221.          security.checkAccess(t, caller_depth + 1);
  222.       }
  223.  
  224.    }
  225.  
  226.    public static void checksAccess(Thread t, Throwable o, int caller_depth) {
  227.       if (security != null) {
  228.          security.checkAccess(t, o, caller_depth + 1);
  229.       }
  230.  
  231.    }
  232.  
  233.    public static void checksAccess(ThreadGroup g, int caller_depth) {
  234.       if (security != null) {
  235.          security.checkAccess(g, caller_depth + 1);
  236.       }
  237.  
  238.    }
  239.  
  240.    public native boolean checkScopePermission(int var1);
  241.  
  242.    public static native void setScopePermission();
  243.  
  244.    public static native void setAppletScopePermission();
  245.  
  246.    public static native void resetScopePermission();
  247. }
  248.