You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by ri...@apache.org on 2011/06/10 17:26:22 UTC

svn commit: r1134341 - in /felix/trunk/framework/src/main/java/org/apache/felix/framework/cache: BundleArchive.java BundleArchiveRevision.java BundleRevision.java DirectoryRevision.java JarRevision.java

Author: rickhall
Date: Fri Jun 10 15:26:22 2011
New Revision: 1134341

URL: http://svn.apache.org/viewvc?rev=1134341&view=rev
Log:
Rename the cache's BundleRevision class to BundleArchiveRevision to avoid
confusion with the new OSGi BundleRevision interface. (FELIX-2950)

Added:
    felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/BundleArchiveRevision.java
      - copied, changed from r1134340, felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/BundleRevision.java
Removed:
    felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/BundleRevision.java
Modified:
    felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/BundleArchive.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/DirectoryRevision.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/JarRevision.java

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/BundleArchive.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/BundleArchive.java?rev=1134341&r1=1134340&r2=1134341&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/BundleArchive.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/BundleArchive.java Fri Jun 10 15:26:22 2011
@@ -101,8 +101,8 @@ public class BundleArchive
     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 @@ public class BundleArchive
      * </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 @@ public class BundleArchive
         }
 
         // 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 @@ public class BundleArchive
         }
 
         Long revNum = m_revisions.lastKey();
-        BundleRevision revision = m_revisions.remove(revNum);
+        BundleArchiveRevision revision = m_revisions.remove(revNum);
 
         try
         {
@@ -645,7 +645,7 @@ public class BundleArchive
     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 @@ public class BundleArchive
         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 @@ public class BundleArchive
      * </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 @@ public class BundleArchive
         File revisionRootDir = new File(m_archiveRootDir,
             REVISION_DIRECTORY + getRefreshCount() + "." + revNum.toString());
 
-        BundleRevision result = null;
+        BundleArchiveRevision result = null;
 
         try
         {

Copied: felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/BundleArchiveRevision.java (from r1134340, felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/BundleRevision.java)
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/BundleArchiveRevision.java?p2=felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/BundleArchiveRevision.java&p1=felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/BundleRevision.java&r1=1134340&r2=1134341&rev=1134341&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/BundleRevision.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/BundleArchiveRevision.java Fri Jun 10 15:26:22 2011
@@ -39,7 +39,7 @@ import org.apache.felix.framework.Logger
  * @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 @@ public abstract class BundleRevision
      * @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;

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/DirectoryRevision.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/DirectoryRevision.java?rev=1134341&r1=1134340&r2=1134341&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/DirectoryRevision.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/DirectoryRevision.java Fri Jun 10 15:26:22 2011
@@ -34,7 +34,7 @@ import org.apache.felix.framework.util.S
  * 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;
 

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/JarRevision.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/JarRevision.java?rev=1134341&r1=1134340&r2=1134341&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/JarRevision.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/JarRevision.java Fri Jun 10 15:26:22 2011
@@ -44,7 +44,7 @@ import org.apache.felix.framework.util.U
  * 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 @@ class JarRevision extends BundleRevision
 
     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 @@ class JarRevision extends BundleRevision
 
         // 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 @@ class JarRevision extends BundleRevision
         }
 
         // 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 @@ class JarRevision extends BundleRevision
             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 @@ class JarRevision extends BundleRevision
         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 @@ class JarRevision extends BundleRevision
                         "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 @@ class JarRevision extends BundleRevision
                 {
                     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);
                 }