Rename the cache's BundleRevision class to BundleArchiveRevision to avoid
confusion with the new OSGi BundleRevision interface. (FELIX-2950)
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1134341 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/main/java/org/apache/felix/framework/cache/BundleArchive.java b/framework/src/main/java/org/apache/felix/framework/cache/BundleArchive.java
index 4f0d6bf..a09b96d 100644
--- a/framework/src/main/java/org/apache/felix/framework/cache/BundleArchive.java
+++ b/framework/src/main/java/org/apache/felix/framework/cache/BundleArchive.java
@@ -101,8 +101,8 @@
private long m_refreshCount = -1;
// Maps a Long revision number to a BundleRevision.
- private final SortedMap<Long, BundleRevision> m_revisions
- = new TreeMap<Long, BundleRevision>();
+ private final SortedMap<Long, BundleArchiveRevision> m_revisions
+ = new TreeMap<Long, BundleArchiveRevision>();
/**
* <p>
@@ -486,7 +486,7 @@
* </p>
* @return the current revision object for the archive.
**/
- public synchronized BundleRevision getCurrentRevision()
+ public synchronized BundleArchiveRevision getCurrentRevision()
{
return (m_revisions.isEmpty()) ? null : m_revisions.get(m_revisions.lastKey());
}
@@ -541,7 +541,7 @@
}
// Create a bundle revision for revision number.
- BundleRevision revision = createRevisionFromLocation(location, is, revNum);
+ BundleArchiveRevision revision = createRevisionFromLocation(location, is, revNum);
if (revision == null)
{
throw new Exception("Unable to revise archive.");
@@ -577,7 +577,7 @@
}
Long revNum = m_revisions.lastKey();
- BundleRevision revision = m_revisions.remove(revNum);
+ BundleArchiveRevision revision = m_revisions.remove(revNum);
try
{
@@ -645,7 +645,7 @@
public synchronized void close()
{
// Get the current revision count.
- for (BundleRevision revision : m_revisions.values())
+ for (BundleArchiveRevision revision : m_revisions.values())
{
// Dispose of the revision, but this might be null in certain
// circumstances, such as if this bundle archive was created
@@ -744,7 +744,7 @@
m_revisions.clear();
// Recreate the revision for the current location.
- BundleRevision revision = createRevisionFromLocation(
+ BundleArchiveRevision revision = createRevisionFromLocation(
getRevisionLocation(currentRevNum), null, currentRevNum);
// Add new revision to the revision map.
m_revisions.put(currentRevNum, revision);
@@ -806,7 +806,7 @@
* </p>
* @return the location string associated with this archive.
**/
- private BundleRevision createRevisionFromLocation(
+ private BundleArchiveRevision createRevisionFromLocation(
String location, InputStream is, Long revNum)
throws Exception
{
@@ -822,7 +822,7 @@
File revisionRootDir = new File(m_archiveRootDir,
REVISION_DIRECTORY + getRefreshCount() + "." + revNum.toString());
- BundleRevision result = null;
+ BundleArchiveRevision result = null;
try
{
diff --git a/framework/src/main/java/org/apache/felix/framework/cache/BundleRevision.java b/framework/src/main/java/org/apache/felix/framework/cache/BundleArchiveRevision.java
similarity index 96%
rename from framework/src/main/java/org/apache/felix/framework/cache/BundleRevision.java
rename to framework/src/main/java/org/apache/felix/framework/cache/BundleArchiveRevision.java
index ff88bf6..d1a5664 100644
--- a/framework/src/main/java/org/apache/felix/framework/cache/BundleRevision.java
+++ b/framework/src/main/java/org/apache/felix/framework/cache/BundleArchiveRevision.java
@@ -39,7 +39,7 @@
* @see org.apache.felix.framework.cache.BundleCache
* @see org.apache.felix.framework.cache.BundleArchive
**/
-public abstract class BundleRevision
+public abstract class BundleArchiveRevision
{
private final Logger m_logger;
private final Map m_configMap;
@@ -64,7 +64,7 @@
* @param trustedCaCerts the trusted CA certificates if any.
* @throws Exception if any errors occur.
**/
- public BundleRevision(Logger logger, Map configMap, File revisionRootDir, String location)
+ public BundleArchiveRevision(Logger logger, Map configMap, File revisionRootDir, String location)
throws Exception
{
m_logger = logger;
diff --git a/framework/src/main/java/org/apache/felix/framework/cache/DirectoryRevision.java b/framework/src/main/java/org/apache/felix/framework/cache/DirectoryRevision.java
index 54ee13f..efaf855 100644
--- a/framework/src/main/java/org/apache/felix/framework/cache/DirectoryRevision.java
+++ b/framework/src/main/java/org/apache/felix/framework/cache/DirectoryRevision.java
@@ -34,7 +34,7 @@
* execute the bundle and does not copy the bundle content at all.
* </p>
**/
-class DirectoryRevision extends BundleRevision
+class DirectoryRevision extends BundleArchiveRevision
{
private final File m_refDir;
diff --git a/framework/src/main/java/org/apache/felix/framework/cache/JarRevision.java b/framework/src/main/java/org/apache/felix/framework/cache/JarRevision.java
index 064d4e5..b953767 100644
--- a/framework/src/main/java/org/apache/felix/framework/cache/JarRevision.java
+++ b/framework/src/main/java/org/apache/felix/framework/cache/JarRevision.java
@@ -44,7 +44,7 @@
* directory, such as embedded JAR files and native libraries.
* </p>
**/
-class JarRevision extends BundleRevision
+class JarRevision extends BundleArchiveRevision
{
private static final transient String BUNDLE_JAR_FILE = "bundle.jar";
@@ -193,9 +193,9 @@
private static final ThreadLocal m_defaultBuffer = new ThreadLocal();
private static final int DEFAULT_BUFFER = 1024 * 64;
-
- // Parse the main attributes of the manifest of the given jarfile.
- // The idea is to not open the jar file as a java.util.jarfile but
+
+ // Parse the main attributes of the manifest of the given jarfile.
+ // The idea is to not open the jar file as a java.util.jarfile but
// read the mainfest from the zipfile directly and parse it manually
// to use less memory and be faster.
private static void getMainAttributes(Map result, ZipFileX zipFile) throws Exception
@@ -204,7 +204,7 @@
// Get a buffer for this thread if there is one already otherwise,
// create one of size DEFAULT_BUFFER (64K) if the manifest is less
- // than 64k or of the size of the manifest.
+ // than 64k or of the size of the manifest.
SoftReference ref = (SoftReference) m_defaultBuffer.get();
byte[] bytes = null;
if (ref != null)
@@ -224,8 +224,8 @@
}
// Now read in the manifest in one go into the bytes array.
- // The InputStream is already
- // buffered and can handle up to 64K buffers in one go.
+ // The InputStream is already
+ // buffered and can handle up to 64K buffers in one go.
InputStream is = null;
try
{
@@ -241,11 +241,11 @@
is.close();
}
- // Now parse the main attributes. The idea is to do that
+ // Now parse the main attributes. The idea is to do that
// without creating new byte arrays. Therefore, we read through
- // the manifest bytes inside the bytes array and write them back into
+ // the manifest bytes inside the bytes array and write them back into
// the same array unless we don't need them (e.g., \r\n and \n are skipped).
- // That allows us to create the strings from the bytes array without the skipped
+ // That allows us to create the strings from the bytes array without the skipped
// chars. We stopp as soon as we see a blankline as that denotes that the main
//attributes part is finished.
String key = null;
@@ -253,7 +253,7 @@
int current = 0;
for (int i = 0; i < size; i++)
{
- // skip \r and \n if it is follows by another \n
+ // skip \r and \n if it is follows by another \n
// (we catch the blank line case in the next iteration)
if (bytes[i] == '\r')
{
@@ -286,7 +286,7 @@
"Manifest error: Missing space separator - " + key);
}
}
- // if we are at the end of a line
+ // if we are at the end of a line
if (bytes[i] == '\n')
{
// and it is a blank line stop parsing (main attributes are done)
@@ -294,10 +294,10 @@
{
break;
}
- // Otherwise, parse the value and add it to the map (we throw an
+ // Otherwise, parse the value and add it to the map (we throw an
// exception if we don't have a key or the key already exist.
String value = new String(bytes, last, (current - last), "UTF-8");
- if (key == null)
+ if (key == null)
{
throw new Exception("Manifst error: Missing attribute name - " + value);
}