mirror of
https://github.com/corda/corda.git
synced 2025-01-07 13:38:47 +00:00
implement stub versions of java.security classes
This commit is contained in:
parent
c5deeb2cda
commit
54ceb80116
@ -23,6 +23,8 @@ import java.io.InputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.security.ProtectionDomain;
|
||||
import java.security.Permissions;
|
||||
import java.security.AllPermission;
|
||||
|
||||
public final class Class <T> implements Type, GenericDeclaration {
|
||||
private static final int PrimitiveFlag = 1 << 4;
|
||||
@ -494,7 +496,9 @@ public final class Class <T> implements Type, GenericDeclaration {
|
||||
}
|
||||
|
||||
public ProtectionDomain getProtectionDomain() {
|
||||
throw new UnsupportedOperationException();
|
||||
Permissions p = new Permissions();
|
||||
p.add(new AllPermission());
|
||||
return new ProtectionDomain(null, p);
|
||||
}
|
||||
|
||||
// for GNU Classpath compatibility:
|
||||
|
13
classpath/java/security/AllPermission.java
Normal file
13
classpath/java/security/AllPermission.java
Normal file
@ -0,0 +1,13 @@
|
||||
/* Copyright (c) 2009, 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 AllPermission extends Permission { }
|
13
classpath/java/security/CodeSource.java
Normal file
13
classpath/java/security/CodeSource.java
Normal file
@ -0,0 +1,13 @@
|
||||
/* Copyright (c) 2009, 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 CodeSource { }
|
17
classpath/java/security/Permission.java
Normal file
17
classpath/java/security/Permission.java
Normal file
@ -0,0 +1,17 @@
|
||||
/* Copyright (c) 2009, 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 abstract class Permission {
|
||||
public PermissionCollection newPermissionCollection() {
|
||||
return null;
|
||||
}
|
||||
}
|
15
classpath/java/security/PermissionCollection.java
Normal file
15
classpath/java/security/PermissionCollection.java
Normal file
@ -0,0 +1,15 @@
|
||||
/* Copyright (c) 2009, 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 abstract class PermissionCollection {
|
||||
public abstract void add(Permission p);
|
||||
}
|
41
classpath/java/security/Permissions.java
Normal file
41
classpath/java/security/Permissions.java
Normal file
@ -0,0 +1,41 @@
|
||||
/* Copyright (c) 2009, 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;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.Set;
|
||||
import java.util.HashSet;
|
||||
|
||||
public class Permissions extends PermissionCollection {
|
||||
private final Map<Class,PermissionCollection> collections = new HashMap();
|
||||
|
||||
public void add(Permission p) {
|
||||
Class c = p.getClass();
|
||||
PermissionCollection pc = collections.get(c);
|
||||
if (pc == null) {
|
||||
pc = p.newPermissionCollection();
|
||||
if (pc == null) {
|
||||
pc = new MyPermissionCollection();
|
||||
}
|
||||
collections.put(c, pc);
|
||||
}
|
||||
pc.add(p);
|
||||
}
|
||||
|
||||
private static class MyPermissionCollection extends PermissionCollection {
|
||||
private final Set<Permission> permissions = new HashSet();
|
||||
|
||||
public void add(Permission p) {
|
||||
permissions.add(p);
|
||||
}
|
||||
}
|
||||
}
|
@ -10,4 +10,14 @@
|
||||
|
||||
package java.security;
|
||||
|
||||
public class ProtectionDomain { }
|
||||
public class ProtectionDomain {
|
||||
private final CodeSource codeSource;
|
||||
private final PermissionCollection permissions;
|
||||
|
||||
public ProtectionDomain(CodeSource codeSource,
|
||||
PermissionCollection permissions)
|
||||
{
|
||||
this.codeSource = codeSource;
|
||||
this.permissions = permissions;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user