home *** CD-ROM | disk | FTP | other *** search
/ The Net: Ultimate Internet Guide / WWLCD1.ISO / pc / java / un2maiq4 / pjjava / src / pj / lang / emptysecuritymanager.java next >
Encoding:
Java Source  |  1996-08-14  |  3.4 KB  |  128 lines

  1. /*---------------------------------------------------------------------------
  2.  
  3.     Written by the Personal Journal developers of Dow Jones & Company, Inc.
  4.  
  5.     Dow Jones makes no representations or warranties about 
  6.     the suitability of this software, either express or 
  7.     implied, including but not limited to the implied warranties 
  8.     of merchantability, fitness for a particular purpose, 
  9.     or non-infringement.  Dow Jones will not be liable for 
  10.     any damages suffered by a user as a result of using, 
  11.     modifying or distributing this software or its derivatives.
  12.  
  13.  
  14.     @(#)EmptySecurityManager.java  0.00 19-Jan-96
  15.  
  16.         A workaround for a bug in the beta 2 JDK.
  17.         Used primarily by RemoteImage in pj.net package.
  18.  
  19.     Authors:
  20.  
  21.         rphall   Rick Hall
  22.  
  23.     Version Ident:
  24.  
  25.         $Header: /PjJavaClient/src/pj/lang/EmptySecurityManager.java 2     1/21/96 3:40p Rphall $
  26.  
  27.     History:
  28.  
  29.         0.00 19-Jan-96  rphall   Initial Creation
  30.  
  31. ---------------------------------------------------------------------------*/
  32.  
  33. package pj.lang;
  34.  
  35.  
  36. import java.io.FileDescriptor;
  37. import java.lang.SecurityManager;
  38.  
  39. /**
  40.  * A workaround for a bug in the beta 2 JDK.
  41.  * Used primarily by RemoteImage in pj.net package.
  42.  *
  43.  * @see        pj.net.RemoteImage
  44.  * @version    0.00 19-Jan-96
  45.  * @author     rphall
  46. */
  47. public final class EmptySecurityManager extends SecurityManager
  48.     {
  49.  
  50.     // --- Class variables
  51.     private static Object theEmptySecurityManager = null;
  52.  
  53.     // --- Public operations
  54.  
  55.     public final void checkCreateClassLoader() {} 
  56.         
  57.     public final void checkAccess(Thread g) {} 
  58.         
  59.     public final void checkAccess(ThreadGroup g) {}
  60.  
  61.     public final void checkExit(int status) {}
  62.  
  63.     public final void checkExec(String cmd) {}
  64.  
  65.     public final void checkLink(String lib) {}
  66.  
  67.     public final void checkRead(FileDescriptor fd) {}
  68.  
  69.     public final void checkRead(String file) {}
  70.  
  71.     public final void checkRead(String file, Object context) {}
  72.  
  73.     public final void checkWrite(FileDescriptor fd) {}
  74.  
  75.     public final void checkWrite(String file) {}
  76.  
  77.     public final void checkDelete(String file) {}
  78.  
  79.     public final void checkConnect(String host, int port) {}
  80.  
  81.     public final void checkConnect(String host, int port, Object context) {}
  82.  
  83.     public final void checkListen(int port) {}
  84.  
  85.     public final void checkAccept(String host, int port) {}
  86.  
  87.     public final void checkPropertiesAccess() {}
  88.  
  89.     public final void checkPropertyAccess(String key) {}
  90.  
  91.     public final void checkPropertyAccess(String key, String def) {}
  92.  
  93.     public final boolean checkTopLevelWindow(Object window) 
  94.         {
  95.         return true;
  96.         }
  97.  
  98.     public final void checkPackageAccess(String pkg) {}
  99.  
  100.     public final void checkPackageDefinition(String pkg) {}
  101.  
  102.     public final void checkSetFactory() {}
  103.  
  104.     
  105.  
  106.     public final static void install()
  107.         {
  108.         if (theEmptySecurityManager == null)
  109.             theEmptySecurityManager = new EmptySecurityManager();
  110.  
  111.         try {
  112.             System.setSecurityManager((SecurityManager)theEmptySecurityManager);
  113.             }
  114.         catch (SecurityException e)
  115.             {
  116.             System.out.println("Caught SecurityException trying to set Security manager");
  117.             }
  118.  
  119.         } // install
  120.  
  121.     // --- Private constructors
  122.  
  123.     private EmptySecurityManager() {}
  124.  
  125.     
  126.  
  127.     } // EmptySecurityManager
  128.