dummy SecurityManager and related classes added

This commit is contained in:
Zsombor Gegesy 2010-08-15 14:47:45 +02:00
parent 6985e81503
commit 7376425b24
7 changed files with 105 additions and 2 deletions

View File

@ -0,0 +1,30 @@
/* Copyright (c) 2010, Avian Contributors
Permission to use, copy, modify, and/or distribute this software
for any purpose with or without fee is hereby granted, provided
that the above copyright notice and this permission notice appear
in all copies.
There is NO WARRANTY for this software. See license.txt for
details. */
package java.lang;
import java.security.AccessController;
import java.security.Permission;
import java.security.SecurityPermission;
public class SecurityManager {
public SecurityManager() {
}
public void checkPermission(Permission perm) {
AccessController.checkPermission(perm);
}
public void checkSecurityAccess(String target) {
checkPermission(new SecurityPermission(target));
}
}

View File

@ -22,6 +22,7 @@ import java.util.Properties;
public abstract class System {
private static Property properties;
private static SecurityManager securityManager;
// static {
// loadLibrary("natives");
// }
@ -118,6 +119,14 @@ public abstract class System {
public static void exit(int code) {
Runtime.getRuntime().exit(code);
}
public static SecurityManager getSecurityManager() {
return securityManager;
}
public static void setSecurityManager(SecurityManager securityManager) {
System.securityManager = securityManager;
}
private static class Property {
public final String name;

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2008, Avian Contributors
/* Copyright (c) 2008, 2010 Avian Contributors
Permission to use, copy, modify, and/or distribute this software
for any purpose with or without fee is hereby granted, provided
@ -21,5 +21,9 @@ public class AccessController {
public static Object doPrivileged (PrivilegedAction action) {
return action.run();
}
public static void checkPermission(Permission perm) throws AccessControlException {
}
}

View File

@ -10,4 +10,10 @@
package java.security;
public class AllPermission extends Permission { }
public class AllPermission extends Permission {
public AllPermission() {
super("<all>");
}
}

View File

@ -0,0 +1,19 @@
/* Copyright (c) 2010, Avian Contributors
Permission to use, copy, modify, and/or distribute this software
for any purpose with or without fee is hereby granted, provided
that the above copyright notice and this permission notice appear
in all copies.
There is NO WARRANTY for this software. See license.txt for
details. */
package java.security;
public class BasicPermission extends Permission {
public BasicPermission(String name) {
super(name);
}
}

View File

@ -11,6 +11,22 @@
package java.security;
public abstract class Permission {
protected String name;
public Permission(String name) {
this.name = name;
}
public String getName() {
return name;
}
@Override
public String toString() {
return this.getClass().getSimpleName() + '['+name+']';
}
public PermissionCollection newPermissionCollection() {
return null;
}

View File

@ -0,0 +1,19 @@
/* Copyright (c) 2010, Avian Contributors
Permission to use, copy, modify, and/or distribute this software
for any purpose with or without fee is hereby granted, provided
that the above copyright notice and this permission notice appear
in all copies.
There is NO WARRANTY for this software. See license.txt for
details. */
package java.security;
public class SecurityPermission extends BasicPermission {
public SecurityPermission(String name) {
super(name);
}
}