avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-avalon-excalibur/loader/src/java/org/apache/excalibur/policy/runtime AbstractPolicy.java
Date Sun, 15 Sep 2002 13:36:26 GMT
donaldp     2002/09/15 06:36:26

  Modified:    loader/src/java/org/apache/excalibur/policy/runtime
                        AbstractPolicy.java
  Log:
  
  
  Revision  Changes    Path
  1.5       +46 -0     jakarta-avalon-excalibur/loader/src/java/org/apache/excalibur/policy/runtime/AbstractPolicy.java
  
  Index: AbstractPolicy.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/loader/src/java/org/apache/excalibur/policy/runtime/AbstractPolicy.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- AbstractPolicy.java	15 Sep 2002 13:29:12 -0000	1.4
  +++ AbstractPolicy.java	15 Sep 2002 13:36:26 -0000	1.5
  @@ -22,6 +22,7 @@
   import java.security.cert.Certificate;
   import java.util.ArrayList;
   import java.util.Enumeration;
  +import java.util.PropertyPermission;
   
   /**
    * Abstract Policy class that makes it easy to add permission
  @@ -273,6 +274,51 @@
           {
               return new UnresolvedPermission( type, target, actions, signers );
           }
  +    }
  +
  +    /**
  +     * Setup the default permissions in a form that is identical
  +     * to normal java.policy setup
  +     */
  +    protected final void setupDefaultPermissions()
  +    {
  +        //these properties straight out ot ${java.home}/lib/security/java.policy
  +
  +        //Create a URL that covers whole file system.
  +        final URL url;
  +        try
  +        {
  +            url = new URL( "file:/-" );
  +        }
  +        catch( final MalformedURLException mue )
  +        {
  +            //will never happen
  +            throw new IllegalStateException( mue.getMessage() );
  +        }
  +        final Permissions permissions = createPermissionSetFor( url, null );
  +
  +        permissions.add( new PropertyPermission( "os.name", "read" ) );
  +        permissions.add( new PropertyPermission( "os.arch", "read" ) );
  +        permissions.add( new PropertyPermission( "os.version", "read" ) );
  +        permissions.add( new PropertyPermission( "file.separator", "read" ) );
  +        permissions.add( new PropertyPermission( "path.separator", "read" ) );
  +        permissions.add( new PropertyPermission( "line.separator", "read" ) );
  +
  +        permissions.add( new PropertyPermission( "java.version", "read" ) );
  +        permissions.add( new PropertyPermission( "java.vendor", "read" ) );
  +        permissions.add( new PropertyPermission( "java.vendor.url", "read" ) );
  +
  +        permissions.add( new PropertyPermission( "java.class.version", "read" ) );
  +        permissions.add( new PropertyPermission( "java.vm.version", "read" ) );
  +        permissions.add( new PropertyPermission( "java.vm.vendor", "read" ) );
  +        permissions.add( new PropertyPermission( "java.vm.name", "read" ) );
  +
  +        permissions.add( new PropertyPermission( "java.specification.version", "read" )
);
  +        permissions.add( new PropertyPermission( "java.specification.vendor", "read" )
);
  +        permissions.add( new PropertyPermission( "java.specification.name", "read" ) );
  +        permissions.add( new PropertyPermission( "java.vm.specification.version", "read"
) );
  +        permissions.add( new PropertyPermission( "java.vm.specification.vendor", "read"
) );
  +        permissions.add( new PropertyPermission( "java.vm.specification.name", "read" )
);
       }
   
       /**
  
  
  

--
To unsubscribe, e-mail:   <mailto:avalon-cvs-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-cvs-help@jakarta.apache.org>


Mime
View raw message