Add a method to the external interface and fix hashcode, equals, and hashcode.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@633835 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/main/java/org/apache/felix/framework/BundleProtectionDomain.java b/framework/src/main/java/org/apache/felix/framework/BundleProtectionDomain.java
index 38876c7..9cf0b1f 100644
--- a/framework/src/main/java/org/apache/felix/framework/BundleProtectionDomain.java
+++ b/framework/src/main/java/org/apache/felix/framework/BundleProtectionDomain.java
@@ -21,7 +21,7 @@
import java.security.Permission;
import java.security.ProtectionDomain;
-class BundleProtectionDomain extends ProtectionDomain
+public class BundleProtectionDomain extends ProtectionDomain
{
private final Felix m_felix;
private final FelixBundle m_bundle;
@@ -38,6 +38,11 @@
return m_felix.impliesBundlePermission(this, permission, false);
}
+ public boolean impliesDirect(Permission permission)
+ {
+ return m_felix.impliesBundlePermission(this, permission, true);
+ }
+
FelixBundle getBundle()
{
return m_bundle;
@@ -50,6 +55,15 @@
public boolean equals(Object other)
{
- return m_bundle.equals(other);
+ if ((other == null) || other.getClass() != BundleProtectionDomain.class)
+ {
+ return false;
+ }
+ return m_bundle == ((BundleProtectionDomain) other).m_bundle;
+ }
+
+ public String toString()
+ {
+ return "[" + m_bundle + "]";
}
}
diff --git a/framework/src/main/java/org/apache/felix/framework/ext/SecurityProvider.java b/framework/src/main/java/org/apache/felix/framework/ext/SecurityProvider.java
index 4c8b0cb..b20e35b 100644
--- a/framework/src/main/java/org/apache/felix/framework/ext/SecurityProvider.java
+++ b/framework/src/main/java/org/apache/felix/framework/ext/SecurityProvider.java
@@ -28,4 +28,6 @@
boolean hasBundlePermission(ProtectionDomain pd, Permission p, boolean direct);
Object getSignerMatcher(Bundle bundle);
+
+ void checkBundle(Bundle bundle) throws Exception;
}