home *** CD-ROM | disk | FTP | other *** search
/ Dynamic HTML Construction Kit / Dynamic HTML Construction Kit.iso / earthlink / nscomm / java40.jar / java / lang / SecurityManager.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-11-03  |  6.6 KB  |  429 lines

  1. package java.lang;
  2.  
  3. import java.io.FileDescriptor;
  4. import java.net.InetAddress;
  5. import java.net.URL;
  6.  
  7. public abstract class SecurityManager {
  8.    protected boolean inCheck;
  9.    private boolean initialized = false;
  10.    private static SecurityManager security;
  11.  
  12.    public synchronized boolean getInCheck() {
  13.       return this.inCheck;
  14.    }
  15.  
  16.    protected SecurityManager() {
  17.       if (security != null) {
  18.          security.checkCreateSecurityManagerAccess(1);
  19.       }
  20.  
  21.       this.initialized = true;
  22.    }
  23.  
  24.    protected native Class[] getClassContext();
  25.  
  26.    protected ClassLoader currentClassLoader() {
  27.       this.checkInitialized();
  28.       return this.currentClassLoader0();
  29.    }
  30.  
  31.    private native ClassLoader currentClassLoader0();
  32.  
  33.    protected Class currentLoadedClass() {
  34.       this.checkInitialized();
  35.       return this.currentLoadedClass0();
  36.    }
  37.  
  38.    protected int classDepth(String var1) {
  39.       this.checkInitialized();
  40.       return this.classDepth0(var1);
  41.    }
  42.  
  43.    private native int classDepth0(String var1);
  44.  
  45.    protected int classLoaderDepth() {
  46.       this.checkInitialized();
  47.       return this.classLoaderDepth0();
  48.    }
  49.  
  50.    private native int classLoaderDepth0();
  51.  
  52.    protected boolean inClass(String var1) {
  53.       this.checkInitialized();
  54.       return this.classDepth(var1) >= 0;
  55.    }
  56.  
  57.    protected boolean inClassLoader() {
  58.       this.checkInitialized();
  59.       return this.currentClassLoader() != null;
  60.    }
  61.  
  62.    public Object getSecurityContext() {
  63.       return null;
  64.    }
  65.  
  66.    public void checkCreateClassLoader() {
  67.       this.checkCreateClassLoader(2);
  68.    }
  69.  
  70.    protected void checkCreateClassLoader(int var1) {
  71.       throw new SecurityException();
  72.    }
  73.  
  74.    public void checkAccess(Thread var1) {
  75.       this.checkAccess((Thread)var1, 2);
  76.    }
  77.  
  78.    protected void checkAccess(Thread var1, int var2) {
  79.       throw new SecurityException();
  80.    }
  81.  
  82.    public void checkAccess(ThreadGroup var1) {
  83.       this.checkAccess((ThreadGroup)var1, 2);
  84.    }
  85.  
  86.    protected void checkAccess(ThreadGroup var1, int var2) {
  87.       throw new SecurityException();
  88.    }
  89.  
  90.    public void checkExit(int var1) {
  91.       this.checkExit(var1, 2);
  92.    }
  93.  
  94.    protected void checkExit(int var1, int var2) {
  95.       throw new SecurityException();
  96.    }
  97.  
  98.    public void checkExec(String var1) {
  99.       this.checkExec(var1, 2);
  100.    }
  101.  
  102.    protected void checkExec(String var1, int var2) {
  103.       throw new SecurityException();
  104.    }
  105.  
  106.    public void checkLink(String var1) {
  107.       this.checkLink(var1, 2);
  108.    }
  109.  
  110.    protected void checkLink(String var1, int var2) {
  111.       throw new SecurityException();
  112.    }
  113.  
  114.    public void checkRead(FileDescriptor var1) {
  115.       this.checkRead((FileDescriptor)var1, 2);
  116.    }
  117.  
  118.    protected void checkRead(FileDescriptor var1, int var2) {
  119.       throw new SecurityException();
  120.    }
  121.  
  122.    public void checkRead(String var1) {
  123.       this.checkRead((String)var1, 2);
  124.    }
  125.  
  126.    protected void checkRead(String var1, int var2) {
  127.       throw new SecurityException();
  128.    }
  129.  
  130.    public void checkRead(String var1, Object var2) {
  131.       this.checkRead(var1, var2, 2);
  132.    }
  133.  
  134.    protected void checkRead(String var1, Object var2, int var3) {
  135.       throw new SecurityException();
  136.    }
  137.  
  138.    public void checkWrite(FileDescriptor var1) {
  139.       this.checkWrite((FileDescriptor)var1, 2);
  140.    }
  141.  
  142.    protected void checkWrite(FileDescriptor var1, int var2) {
  143.       throw new SecurityException();
  144.    }
  145.  
  146.    public void checkWrite(String var1) {
  147.       this.checkWrite((String)var1, 2);
  148.    }
  149.  
  150.    protected void checkWrite(String var1, int var2) {
  151.       throw new SecurityException();
  152.    }
  153.  
  154.    public void checkDelete(String var1) {
  155.       this.checkDelete(var1, 2);
  156.    }
  157.  
  158.    protected void checkDelete(String var1, int var2) {
  159.       throw new SecurityException();
  160.    }
  161.  
  162.    public void checkConnect(String var1, int var2) {
  163.       this.checkConnect(var1, var2, 2);
  164.    }
  165.  
  166.    protected void checkConnect(String var1, int var2, int var3) {
  167.       throw new SecurityException();
  168.    }
  169.  
  170.    public void checkConnect(String var1, int var2, Object var3) {
  171.       this.checkConnect(var1, var2, var3, 2);
  172.    }
  173.  
  174.    protected void checkConnect(String var1, String var2, int var3) {
  175.       throw new SecurityException();
  176.    }
  177.  
  178.    protected void checkConnect(String var1, int var2, Object var3, int var4) {
  179.       throw new SecurityException();
  180.    }
  181.  
  182.    public void checkListen(int var1) {
  183.       this.checkListen(var1, 2);
  184.    }
  185.  
  186.    protected void checkListen(int var1, int var2) {
  187.       throw new SecurityException();
  188.    }
  189.  
  190.    public void checkAccept(String var1, int var2) {
  191.       this.checkAccept(var1, var2, 2);
  192.    }
  193.  
  194.    protected void checkAccept(String var1, int var2, int var3) {
  195.       throw new SecurityException();
  196.    }
  197.  
  198.    public void checkMulticast(InetAddress var1) {
  199.       this.checkMulticast(var1, (int)2);
  200.    }
  201.  
  202.    protected void checkMulticast(InetAddress var1, int var2) {
  203.       throw new SecurityException();
  204.    }
  205.  
  206.    public void checkMulticast(InetAddress var1, byte var2) {
  207.       this.checkMulticast(var1, var2, 2);
  208.    }
  209.  
  210.    protected void checkMulticast(InetAddress var1, byte var2, int var3) {
  211.       throw new SecurityException();
  212.    }
  213.  
  214.    public void checkPropertiesAccess() {
  215.       this.checkPropertiesAccess(2);
  216.    }
  217.  
  218.    protected void checkPropertiesAccess(int var1) {
  219.       throw new SecurityException();
  220.    }
  221.  
  222.    public void checkPropertyAccess(String var1) {
  223.       this.checkPropertyAccess(var1, 2);
  224.    }
  225.  
  226.    protected void checkPropertyAccess(String var1, int var2) {
  227.       throw new SecurityException();
  228.    }
  229.  
  230.    public boolean checkTopLevelWindow(Object var1) {
  231.       return false;
  232.    }
  233.  
  234.    public void checkPrintJobAccess() {
  235.       this.checkPrintJobAccess(2);
  236.    }
  237.  
  238.    protected void checkPrintJobAccess(int var1) {
  239.       throw new SecurityException();
  240.    }
  241.  
  242.    public void checkSystemClipboardAccess() {
  243.       this.checkSystemClipboardAccess(2);
  244.    }
  245.  
  246.    protected void checkSystemClipboardAccess(int var1) {
  247.       throw new SecurityException();
  248.    }
  249.  
  250.    public void checkAwtEventQueueAccess() {
  251.       this.checkAwtEventQueueAccess(2);
  252.    }
  253.  
  254.    protected void checkAwtEventQueueAccess(int var1) {
  255.       throw new SecurityException();
  256.    }
  257.  
  258.    public void checkPackageAccess(String var1) {
  259.       this.checkPackageAccess(var1, 2);
  260.    }
  261.  
  262.    protected void checkPackageAccess(String var1, int var2) {
  263.       throw new SecurityException();
  264.    }
  265.  
  266.    public void checkPackageDefinition(String var1) {
  267.       this.checkPackageDefinition(var1, 2);
  268.    }
  269.  
  270.    protected void checkPackageDefinition(String var1, int var2) {
  271.       throw new SecurityException();
  272.    }
  273.  
  274.    public void checkSetFactory() {
  275.       this.checkSetFactory(2);
  276.    }
  277.  
  278.    protected void checkSetFactory(int var1) {
  279.       throw new SecurityException();
  280.    }
  281.  
  282.    public void checkMemberAccess(Class var1, int var2) {
  283.       this.checkMemberAccess(var1, var2, 2);
  284.    }
  285.  
  286.    protected void checkMemberAccess(Class var1, int var2, int var3) {
  287.       throw new SecurityException();
  288.    }
  289.  
  290.    public void checkSecurityAccess(String var1) {
  291.       this.checkSecurityAccess(var1, 2);
  292.    }
  293.  
  294.    protected void checkSecurityAccess(String var1, int var2) {
  295.       throw new SecurityException();
  296.    }
  297.  
  298.    protected void checkCreateSecurityManagerAccess(int var1) {
  299.       throw new SecurityException();
  300.    }
  301.  
  302.    public void checkCreateSecurityManagerAccess() {
  303.       this.checkCreateSecurityManagerAccess(2);
  304.    }
  305.  
  306.    private native Class currentLoadedClass0();
  307.  
  308.    public ThreadGroup getThreadGroup() {
  309.       return Thread.currentThread().getThreadGroup();
  310.    }
  311.  
  312.    protected boolean checkClassLoader(int var1) {
  313.       this.checkInitialized();
  314.       return this.checkClassLoader0(var1 + 1);
  315.    }
  316.  
  317.    private native boolean checkClassLoader0(int var1);
  318.  
  319.    public void checkURLConnect(URL var1) {
  320.       this.checkURLConnect(var1, 2);
  321.    }
  322.  
  323.    protected void checkURLConnect(URL var1, int var2) {
  324.       throw new SecurityException();
  325.    }
  326.  
  327.    public void checkURLConnect(URL var1, URL var2) {
  328.       this.checkURLConnect(var1, var2, 2);
  329.    }
  330.  
  331.    protected void checkURLConnect(URL var1, URL var2, int var3) {
  332.       throw new SecurityException();
  333.    }
  334.  
  335.    protected void checkAccess(Thread var1, Throwable var2, int var3) {
  336.       throw new SecurityException();
  337.    }
  338.  
  339.    public void checkAccess(Thread var1, Throwable var2) {
  340.       this.checkAccess(var1, var2, 2);
  341.    }
  342.  
  343.    public void checkResourceAccess(String var1) {
  344.       this.checkResourceAccess(var1, 2);
  345.    }
  346.  
  347.    protected void checkResourceAccess(String var1, int var2) {
  348.       throw new SecurityException();
  349.    }
  350.  
  351.    public boolean checkMatchPrincipalAlways(int var1) {
  352.       throw new SecurityException();
  353.    }
  354.  
  355.    private void checkInitialized() {
  356.       if (!this.initialized) {
  357.          throw new SecurityException("Attempted us of uninitialized security manager");
  358.       }
  359.    }
  360.  
  361.    public static void setSecurityManager() {
  362.       if (security != null) {
  363.          throw new SecurityException("SecurityManager already set");
  364.       } else {
  365.          security = System.getSecurityManager();
  366.       }
  367.    }
  368.  
  369.    public static boolean checksMatchPrincipalAlways(int var0) {
  370.       return security != null && !(security instanceof NullSecurityManager) ? security.checkMatchPrincipalAlways(var0 + 1) : true;
  371.    }
  372.  
  373.    protected boolean securityCheckScopePermission(int var1) {
  374.       throw new SecurityException();
  375.    }
  376.  
  377.    public static boolean checkScopePermission(int var0) {
  378.       return security != null && !(security instanceof NullSecurityManager) ? security.securityCheckScopePermission(var0 + 1) : true;
  379.    }
  380.  
  381.    public static void enablePrivilege(String var0) {
  382.       enablePrivilege(var0, 1);
  383.    }
  384.  
  385.    private static void enablePrivilege(String var0, int var1) {
  386.       if (security != null && !(security instanceof NullSecurityManager)) {
  387.          Object var2 = security.securitySetScopePermission(var1 + 1, var0);
  388.          setScopePermissionInternal(var2, var1 + 1);
  389.       }
  390.  
  391.    }
  392.  
  393.    public static boolean isPrivilegeEnabled(String var0) {
  394.       return security != null && !(security instanceof NullSecurityManager) ? security.isPrivilegeEnabled(var0, 1) : true;
  395.    }
  396.  
  397.    protected boolean isPrivilegeEnabled(String var1, int var2) {
  398.       throw new SecurityException();
  399.    }
  400.  
  401.    public static void revertPrivilege() {
  402.       if (security != null && !(security instanceof NullSecurityManager)) {
  403.          setScopePermissionInternal((Object)null, 1);
  404.       }
  405.  
  406.    }
  407.  
  408.    protected Object securitySetScopePermission(int var1) {
  409.       throw new SecurityException();
  410.    }
  411.  
  412.    protected Object securitySetScopePermission(int var1, String var2) {
  413.       throw new SecurityException();
  414.    }
  415.  
  416.    private static native void setScopePermissionInternal(Object var0, int var1);
  417.  
  418.    public static void setScopePermission() {
  419.       enablePrivilege("30Capabilities", 1);
  420.    }
  421.  
  422.    public static void resetScopePermission() {
  423.       if (security != null && !(security instanceof NullSecurityManager)) {
  424.          setScopePermissionInternal((Object)null, 1);
  425.       }
  426.  
  427.    }
  428. }
  429.