Package java.util

Examples of java.util.PropertyPermission


    }

    public static String setProperty(String key, String value) {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null)
      sm.checkPermission(new PropertyPermission(key, "write")); //$NON-NLS-1$
      return (String) properties.put(key, value);
    }
View Full Code Here


    }

    public static String clearProperty(String key) {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null)
      sm.checkPermission(new PropertyPermission(key, "write")); //$NON-NLS-1$
        return (String) properties.remove(key);
    }   
View Full Code Here

   
    public void engineSecured() throws Exception {
        Permissions perms = new Permissions();
        //we need to be able to read files and props so that the default module source provider can work
        perms.add(new FilePermission("<<ALL FILES>>", "read"));
        perms.add(new PropertyPermission("*", "read"));
       
        ScriptEngine eng = new JsEngineInitializer().instantiate(Collections.<String>emptySet(), perms);
       
        try {
            eng.eval("java.lang.System.exit(1)");
View Full Code Here

        //guard what is writeable and what is not.
        add(new FilePermission("<<ALL FILES>>", "read,write,execute,delete"));
       
        //we don't suppose the serverside scripts to be malevolent, so let's
        //give them the read access to the system properties.
        add(new PropertyPermission("*", "read"));
       
        add(new ReflectPermission("suppressAccessChecks"));
       
        //these are required for server-side scripts to be able to
        //invoke remote EJBs.
View Full Code Here

   *
   * @param key
   *            the name of the property to be accessed.
   */
  public void checkPropertyAccess(String key) {
    checkPermission(new PropertyPermission(key, "read"));
  }
View Full Code Here

     *
     * @param key
     *            the name of the property to be accessed.
     */
    public void checkPropertyAccess(String key) {
        checkPermission(new PropertyPermission(key, "read")); //$NON-NLS-1$
    }
View Full Code Here

     * @throws SecurityException
     *             if the calling thread is not allowed to access the {@code
     *             key} system property.
     */
    public void checkPropertyAccess(String key) {
        checkPermission(new PropertyPermission(key, "read")); //$NON-NLS-1$
    }
View Full Code Here

     */
    private Permission[] getDefaultPermissions()
    {
        final ArrayList list = new ArrayList();
        //these properties straight out ot ${java.home}/lib/security/java.policy
        list.add( new PropertyPermission( "os.name", "read" ) );
        list.add( new PropertyPermission( "os.arch", "read" ) );
        list.add( new PropertyPermission( "os.version", "read" ) );
        list.add( new PropertyPermission( "file.separator", "read" ) );
        list.add( new PropertyPermission( "path.separator", "read" ) );
        list.add( new PropertyPermission( "line.separator", "read" ) );

        list.add( new PropertyPermission( "java.version", "read" ) );
        list.add( new PropertyPermission( "java.vendor", "read" ) );
        list.add( new PropertyPermission( "java.vendor.url", "read" ) );

        list.add( new PropertyPermission( "java.class.version", "read" ) );
        list.add( new PropertyPermission( "java.vm.version", "read" ) );
        list.add( new PropertyPermission( "java.vm.vendor", "read" ) );
        list.add( new PropertyPermission( "java.vm.name", "read" ) );

        list.add( new PropertyPermission( "java.specification.version", "read" ) );
        list.add( new PropertyPermission( "java.specification.vendor", "read" ) );
        list.add( new PropertyPermission( "java.specification.name", "read" ) );
        list.add( new PropertyPermission( "java.vm.specification.version", "read" ) );
        list.add( new PropertyPermission( "java.vm.specification.vendor", "read" ) );
        list.add( new PropertyPermission( "java.vm.specification.name", "read" ) );

        return (Permission[])list.toArray( new Permission[ list.size() ] );
    }
View Full Code Here

     */
    public static String setProperty(String key, String value) {
        checkKey(key);
        SecurityManager sm = getSecurityManager();
        if (sm != null) {
            sm.checkPermission(new PropertyPermission(key,
                SecurityConstants.PROPERTY_WRITE_ACTION));
        }

        return (String) props.setProperty(key, value);
    }
View Full Code Here

     */
    public static String clearProperty(String key) {
        checkKey(key);
        SecurityManager sm = getSecurityManager();
        if (sm != null) {
            sm.checkPermission(new PropertyPermission(key, "write"));
        }

        return (String) props.remove(key);
    }
View Full Code Here

TOP

Related Classes of java.util.PropertyPermission

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.