Adapt to latest felix version.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@718382 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework.security/pom.xml b/framework.security/pom.xml
index feb016d..cd44ab3 100644
--- a/framework.security/pom.xml
+++ b/framework.security/pom.xml
@@ -34,12 +34,12 @@
<dependency>
<groupId>${pom.groupId}</groupId>
<artifactId>org.osgi.core</artifactId>
- <version>1.1.0-SNAPSHOT</version>
+ <version>1.2.0</version>
</dependency>
<dependency>
<groupId>${pom.groupId}</groupId>
<artifactId>org.apache.felix.framework</artifactId>
- <version>1.0.4</version>
+ <version>1.5.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
diff --git a/framework.security/src/main/java/org/apache/felix/framework/SecurityProviderImpl.java b/framework.security/src/main/java/org/apache/felix/framework/SecurityProviderImpl.java
index bb31fff..58efc4c 100644
--- a/framework.security/src/main/java/org/apache/felix/framework/SecurityProviderImpl.java
+++ b/framework.security/src/main/java/org/apache/felix/framework/SecurityProviderImpl.java
@@ -68,8 +68,8 @@
BundleInfo info = ((FelixBundle) bundle).getInfo();
m_parser.checkDNChains(
- (Long.toString(bundle.getBundleId()) + "-" + info.getArchive()
- .getLastModified()), info.getCurrentModule().getContentLoader());
+ (Long.toString(bundle.getBundleId()) + "-" + info.getLastModified()),
+ info.getCurrentModule().getContentLoader());
}
/**
@@ -77,8 +77,10 @@
*/
public Object getSignerMatcher(final Bundle bundle)
{
- return new SignerMatcher(Long.toString(bundle.getBundleId()),
- ((FelixBundle) bundle).getInfo().getArchive(), m_parser);
+ return new SignerMatcher(Long.toString(bundle.getBundleId()),
+ ((FelixBundle) bundle).getInfo().getLastModified(),
+ ((FelixBundle) bundle).getInfo().getCurrentModule().getContentLoader(),
+ m_parser);
}
/**
@@ -122,7 +124,7 @@
return m_cpai.hasPermission(bundle,
info.getCurrentModule().getContentLoader(),
bundle.getBundleId() + "-" +
- info.getArchive().getLastModified(),null, pd,
+ info.getLastModified(),null, pd,
permission, direct, m_pai);
}
catch (Exception e)
diff --git a/framework.security/src/main/java/org/apache/felix/framework/security/util/LocalPermissions.java b/framework.security/src/main/java/org/apache/felix/framework/security/util/LocalPermissions.java
index 917dedd..39f9a01 100644
--- a/framework.security/src/main/java/org/apache/felix/framework/security/util/LocalPermissions.java
+++ b/framework.security/src/main/java/org/apache/felix/framework/security/util/LocalPermissions.java
@@ -30,6 +30,8 @@
import java.util.Map;
import java.util.Map.Entry;
+import org.apache.felix.framework.security.util.Permissions;
+import org.apache.felix.framework.security.util.PropertiesCache;
import org.apache.felix.moduleloader.IContent;
import org.apache.felix.moduleloader.IContentLoader;
import org.osgi.framework.Bundle;
@@ -95,8 +97,6 @@
{
content = loader.getContent();
- content.open();
-
in = content.getEntryAsStream("OSGI-INF/permissions.perm");
if (in != null)
{
diff --git a/framework.security/src/main/java/org/apache/felix/framework/security/verifier/BundleDNParser.java b/framework.security/src/main/java/org/apache/felix/framework/security/verifier/BundleDNParser.java
index c50dcfc..73a751e 100644
--- a/framework.security/src/main/java/org/apache/felix/framework/security/verifier/BundleDNParser.java
+++ b/framework.security/src/main/java/org/apache/felix/framework/security/verifier/BundleDNParser.java
@@ -135,7 +135,7 @@
}
}
- public String[] getDNChains(String root, BundleRevision bundleRevision)
+ public String[] getDNChains(String root, IContentLoader bundleRevision)
{
synchronized (m_cache)
{
@@ -156,7 +156,6 @@
try
{
content = bundleRevision.getContent();
- content.open();
result = _getDNChains(root, content);
}
catch (Exception ex)
@@ -181,7 +180,7 @@
}
return result;
- }
+ }
private String[] _getDNChains(String root, IContent content)
throws IOException
diff --git a/framework.security/src/main/java/org/apache/felix/framework/security/verifier/SignerMatcher.java b/framework.security/src/main/java/org/apache/felix/framework/security/verifier/SignerMatcher.java
index 19924e1..a2d6915 100644
--- a/framework.security/src/main/java/org/apache/felix/framework/security/verifier/SignerMatcher.java
+++ b/framework.security/src/main/java/org/apache/felix/framework/security/verifier/SignerMatcher.java
@@ -22,14 +22,16 @@
import java.util.Locale;
import java.util.Map;
-import org.apache.felix.framework.cache.BundleArchive;
+import org.apache.felix.moduleloader.IContentLoader;
+import org.apache.felix.moduleloader.IModule;
public final class SignerMatcher
{
private final String m_filter;
private final String m_root;
- private final BundleArchive m_archive;
+ private final IContentLoader m_archive;
private final BundleDNParser m_parser;
+ private final long m_lastModified;
public SignerMatcher(String filter)
{
@@ -37,14 +39,16 @@
m_root = null;
m_archive = null;
m_parser = null;
+ m_lastModified = 0;
}
- public SignerMatcher(String root, BundleArchive archive, BundleDNParser parser)
+ public SignerMatcher(String root, long lastModified, IContentLoader archive, BundleDNParser parser)
{
m_filter = null;
m_root = root;
m_archive = archive;
m_parser = parser;
+ m_lastModified = lastModified;
}
public boolean equals(Object o)
@@ -69,8 +73,7 @@
String[] dns;
try
{
- dns = m_parser.getDNChains(m_root + "-" + m_archive.getLastModified(),
- m_archive.getRevision(m_archive.getRevisionCount() -1));
+ dns = m_parser.getDNChains(m_root + "-" + m_lastModified, m_archive);
}
catch (Exception ex)
{