You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Richard S. Hall" <he...@ungoverned.org> on 2007/08/15 15:49:44 UTC
Re: svn commit: r566083 [1/2] - in /felix/trunk: framework/src/main/java/org/apache/felix/framework/cache/
framework/src/main/java/org/apache/felix/framework/searchpolicy/ framework/src/main/java/org/apache/felix/framework/util/
framework/src/main/java/org...
cziegeler@apache.org wrote:
> Author: cziegeler
> Date: Wed Aug 15 03:03:15 2007
> New Revision: 566083
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=566083
> Log:
> Organize imports
>
> 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/BundleRevision.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
> felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4SearchPolicyCore.java
> felix/trunk/framework/src/main/java/org/apache/felix/framework/util/EventDispatcher.java
> felix/trunk/framework/src/main/java/org/osgi/framework/AdminPermission.java
> felix/trunk/metatype/src/main/java/org/apache/felix/metatype/internal/MetaTypeInformationImpl.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?view=diff&rev=566083&r1=566082&r2=566083
> ==============================================================================
> --- 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 Wed Aug 15 03:03:15 2007
> @@ -18,7 +18,17 @@
> */
> package org.apache.felix.framework.cache;
>
> -import java.io.*;
> +import java.io.BufferedReader;
> +import java.io.BufferedWriter;
> +import java.io.File;
> +import java.io.FileNotFoundException;
> +import java.io.IOException;
> +import java.io.InputStream;
> +import java.io.InputStreamReader;
> +import java.io.ObjectOutputStream;
> +import java.io.OutputStream;
> +import java.io.OutputStreamWriter;
> +import java.io.Serializable;
>
> import org.apache.felix.framework.Logger;
> import org.apache.felix.framework.util.ObjectInputStreamX;
> @@ -126,21 +136,21 @@
> public BundleArchive(Logger logger, File archiveRootDir, long id,
> String location, InputStream is) throws Exception
> {
> - m_logger = logger;
> - m_archiveRootDir = archiveRootDir;
> - m_id = id;
> - if (m_id <= 0)
> + this.m_logger = logger;
> + this.m_archiveRootDir = archiveRootDir;
> + this.m_id = id;
> + if (this.m_id <= 0)
>
Ahhh!!!!!
The whole point of using "m_" is that there is no longer any need to do
"this."
Please revert all of the "this." all over the place.
-> richard
> {
> throw new IllegalArgumentException(
> "Bundle ID cannot be less than or equal to zero.");
> }
> - m_originalLocation = location;
> + this.m_originalLocation = location;
>
> // Save state.
> - initialize();
> + this.initialize();
>
> // Add a revision for the content.
> - revise(m_originalLocation, is);
> + this.revise(this.m_originalLocation, is);
> }
>
> /**
> @@ -158,8 +168,8 @@
> public BundleArchive(Logger logger, File archiveRootDir)
> throws Exception
> {
> - m_logger = logger;
> - m_archiveRootDir = archiveRootDir;
> + this.m_logger = logger;
> + this.m_archiveRootDir = archiveRootDir;
>
> // Add a revision for each one that already exists in the file
> // system. The file system might contain more than one revision
> @@ -173,8 +183,8 @@
> // Count the number of existing revision directories, which
> // will be in a directory named like:
> // "${REVISION_DIRECTORY)${refresh-count}.${revision-count}"
> - File revisionRootDir = new File(m_archiveRootDir,
> - REVISION_DIRECTORY + getRefreshCount() + "." + revisionCount);
> + File revisionRootDir = new File(this.m_archiveRootDir,
> + REVISION_DIRECTORY + this.getRefreshCount() + "." + revisionCount);
> if (!BundleCache.getSecureAction().fileExists(revisionRootDir))
> {
> break;
> @@ -191,14 +201,14 @@
> // revisions since they will be purged immediately on framework startup.
> if (revisionCount > 1)
> {
> - m_revisions = new BundleRevision[revisionCount - 1];
> + this.m_revisions = new BundleRevision[revisionCount - 1];
> }
>
> // Add the revision object for the most recent revision. We first try
> // to read the location from the current revision - if that fails we
> // likely have an old bundle cache and read the location the old way.
> // The next revision will update the bundle cache.
> - revise(getRevisionLocation(revisionCount - 1), null);
> + this.revise(this.getRevisionLocation(revisionCount - 1), null);
> }
>
> /**
> @@ -210,9 +220,9 @@
> **/
> public synchronized long getId() throws Exception
> {
> - if (m_id > 0)
> + if (this.m_id > 0)
> {
> - return m_id;
> + return this.m_id;
> }
>
> // Read bundle location.
> @@ -221,9 +231,9 @@
> try
> {
> is = BundleCache.getSecureAction()
> - .getFileInputStream(new File(m_archiveRootDir, BUNDLE_ID_FILE));
> + .getFileInputStream(new File(this.m_archiveRootDir, BUNDLE_ID_FILE));
> br = new BufferedReader(new InputStreamReader(is));
> - m_id = Long.parseLong(br.readLine());
> + this.m_id = Long.parseLong(br.readLine());
> }
> catch (FileNotFoundException ex)
> {
> @@ -232,8 +242,8 @@
> // identifier numbers. This is a hack to deal with old archives that
> // did not save their bundle identifier, but instead had it passed
> // into them. Eventually, this can be removed.
> - m_id = Long.parseLong(
> - m_archiveRootDir.getName().substring(
> + this.m_id = Long.parseLong(
> + this.m_archiveRootDir.getName().substring(
> BundleCache.BUNDLE_DIR_PREFIX.length()));
> }
> finally
> @@ -242,7 +252,7 @@
> if (is != null) is.close();
> }
>
> - return m_id;
> + return this.m_id;
> }
>
> /**
> @@ -254,9 +264,9 @@
> **/
> public synchronized String getLocation() throws Exception
> {
> - if (m_originalLocation != null)
> + if (this.m_originalLocation != null)
> {
> - return m_originalLocation;
> + return this.m_originalLocation;
> }
>
> // Read bundle location.
> @@ -265,10 +275,10 @@
> try
> {
> is = BundleCache.getSecureAction()
> - .getFileInputStream(new File(m_archiveRootDir, BUNDLE_LOCATION_FILE));
> + .getFileInputStream(new File(this.m_archiveRootDir, BUNDLE_LOCATION_FILE));
> br = new BufferedReader(new InputStreamReader(is));
> - m_originalLocation = br.readLine();
> - return m_originalLocation;
> + this.m_originalLocation = br.readLine();
> + return this.m_originalLocation;
> }
> finally
> {
> @@ -288,13 +298,13 @@
> **/
> public synchronized int getPersistentState() throws Exception
> {
> - if (m_persistentState >= 0)
> + if (this.m_persistentState >= 0)
> {
> - return m_persistentState;
> + return this.m_persistentState;
> }
>
> // Get bundle state file.
> - File stateFile = new File(m_archiveRootDir, BUNDLE_STATE_FILE);
> + File stateFile = new File(this.m_archiveRootDir, BUNDLE_STATE_FILE);
>
> // If the state file doesn't exist, then
> // assume the bundle was installed.
> @@ -314,17 +324,17 @@
> String s = br.readLine();
> if (s.equals(ACTIVE_STATE))
> {
> - m_persistentState = Bundle.ACTIVE;
> + this.m_persistentState = Bundle.ACTIVE;
> }
> else if (s.equals(UNINSTALLED_STATE))
> {
> - m_persistentState = Bundle.UNINSTALLED;
> + this.m_persistentState = Bundle.UNINSTALLED;
> }
> else
> {
> - m_persistentState = Bundle.INSTALLED;
> + this.m_persistentState = Bundle.INSTALLED;
> }
> - return m_persistentState;
> + return this.m_persistentState;
> }
> finally
> {
> @@ -350,7 +360,7 @@
> try
> {
> os = BundleCache.getSecureAction()
> - .getFileOutputStream(new File(m_archiveRootDir, BUNDLE_STATE_FILE));
> + .getFileOutputStream(new File(this.m_archiveRootDir, BUNDLE_STATE_FILE));
> bw = new BufferedWriter(new OutputStreamWriter(os));
> String s = null;
> switch (state)
> @@ -366,13 +376,13 @@
> break;
> }
> bw.write(s, 0, s.length());
> - m_persistentState = state;
> + this.m_persistentState = state;
> }
> catch (IOException ex)
> {
> - m_logger.log(
> + this.m_logger.log(
> Logger.LOG_ERROR,
> - getClass().getName() + ": Unable to record state - " + ex);
> + this.getClass().getName() + ": Unable to record state - " + ex);
> throw ex;
> }
> finally
> @@ -391,13 +401,13 @@
> **/
> public synchronized int getStartLevel() throws Exception
> {
> - if (m_startLevel >= 0)
> + if (this.m_startLevel >= 0)
> {
> - return m_startLevel;
> + return this.m_startLevel;
> }
>
> // Get bundle start level file.
> - File levelFile = new File(m_archiveRootDir, BUNDLE_START_LEVEL_FILE);
> + File levelFile = new File(this.m_archiveRootDir, BUNDLE_START_LEVEL_FILE);
>
> // If the start level file doesn't exist, then
> // return an error.
> @@ -414,8 +424,8 @@
> is = BundleCache.getSecureAction()
> .getFileInputStream(levelFile);
> br = new BufferedReader(new InputStreamReader(is));
> - m_startLevel = Integer.parseInt(br.readLine());
> - return m_startLevel;
> + this.m_startLevel = Integer.parseInt(br.readLine());
> + return this.m_startLevel;
> }
> finally
> {
> @@ -439,17 +449,17 @@
> try
> {
> os = BundleCache.getSecureAction()
> - .getFileOutputStream(new File(m_archiveRootDir, BUNDLE_START_LEVEL_FILE));
> + .getFileOutputStream(new File(this.m_archiveRootDir, BUNDLE_START_LEVEL_FILE));
> bw = new BufferedWriter(new OutputStreamWriter(os));
> String s = Integer.toString(level);
> bw.write(s, 0, s.length());
> - m_startLevel = level;
> + this.m_startLevel = level;
> }
> catch (IOException ex)
> {
> - m_logger.log(
> + this.m_logger.log(
> Logger.LOG_ERROR,
> - getClass().getName() + ": Unable to record start level - " + ex);
> + this.getClass().getName() + ": Unable to record start level - " + ex);
> throw ex;
> }
> finally
> @@ -468,13 +478,13 @@
> **/
> public synchronized long getLastModified() throws Exception
> {
> - if (m_lastModified >= 0)
> + if (this.m_lastModified >= 0)
> {
> - return m_lastModified;
> + return this.m_lastModified;
> }
>
> // Get bundle last modification time file.
> - File lastModFile = new File(m_archiveRootDir, BUNDLE_LASTMODIFIED_FILE);
> + File lastModFile = new File(this.m_archiveRootDir, BUNDLE_LASTMODIFIED_FILE);
>
> // If the last modification file doesn't exist, then
> // return an error.
> @@ -490,8 +500,8 @@
> {
> is = BundleCache.getSecureAction().getFileInputStream(lastModFile);
> br = new BufferedReader(new InputStreamReader(is));
> - m_lastModified = Long.parseLong(br.readLine());
> - return m_lastModified;
> + this.m_lastModified = Long.parseLong(br.readLine());
> + return this.m_lastModified;
> }
> finally
> {
> @@ -518,17 +528,17 @@
> try
> {
> os = BundleCache.getSecureAction()
> - .getFileOutputStream(new File(m_archiveRootDir, BUNDLE_LASTMODIFIED_FILE));
> + .getFileOutputStream(new File(this.m_archiveRootDir, BUNDLE_LASTMODIFIED_FILE));
> bw = new BufferedWriter(new OutputStreamWriter(os));
> String s = Long.toString(lastModified);
> bw.write(s, 0, s.length());
> - m_lastModified = lastModified;
> + this.m_lastModified = lastModified;
> }
> catch (IOException ex)
> {
> - m_logger.log(
> + this.m_logger.log(
> Logger.LOG_ERROR,
> - getClass().getName() + ": Unable to record last modification time - " + ex);
> + this.getClass().getName() + ": Unable to record last modification time - " + ex);
> throw ex;
> }
> finally
> @@ -555,7 +565,7 @@
> throw new IllegalArgumentException("The data file path cannot contain a reference to the \"..\" directory.");
>
> // Get bundle data directory.
> - File dataDir = new File(m_archiveRootDir, DATA_DIRECTORY);
> + File dataDir = new File(this.m_archiveRootDir, DATA_DIRECTORY);
> // Create the data directory if necessary.
> if (!BundleCache.getSecureAction().fileExists(dataDir))
> {
> @@ -581,7 +591,7 @@
> throws Exception
> {
> // Get bundle activator file.
> - File activatorFile = new File(m_archiveRootDir, BUNDLE_ACTIVATOR_FILE);
> + File activatorFile = new File(this.m_archiveRootDir, BUNDLE_ACTIVATOR_FILE);
> // If the activator file doesn't exist, then
> // assume there isn't one.
> if (!BundleCache.getSecureAction().fileExists(activatorFile))
> @@ -602,9 +612,9 @@
> }
> catch (Exception ex)
> {
> - m_logger.log(
> + this.m_logger.log(
> Logger.LOG_ERROR,
> - getClass().getName() + ": Trying to deserialize - " + ex);
> + this.getClass().getName() + ": Trying to deserialize - " + ex);
> }
> finally
> {
> @@ -635,15 +645,15 @@
> try
> {
> os = BundleCache.getSecureAction()
> - .getFileOutputStream(new File(m_archiveRootDir, BUNDLE_ACTIVATOR_FILE));
> + .getFileOutputStream(new File(this.m_archiveRootDir, BUNDLE_ACTIVATOR_FILE));
> oos = new ObjectOutputStream(os);
> oos.writeObject(obj);
> }
> catch (IOException ex)
> {
> - m_logger.log(
> + this.m_logger.log(
> Logger.LOG_ERROR,
> - getClass().getName() + ": Unable to serialize activator - " + ex);
> + this.getClass().getName() + ": Unable to serialize activator - " + ex);
> throw ex;
> }
> finally
> @@ -661,7 +671,7 @@
> **/
> public synchronized int getRevisionCount()
> {
> - return (m_revisions == null) ? 0 : m_revisions.length;
> + return (this.m_revisions == null) ? 0 : this.m_revisions.length;
> }
>
> /**
> @@ -672,9 +682,9 @@
> **/
> public synchronized BundleRevision getRevision(int i)
> {
> - if ((i >= 0) && (i < getRevisionCount()))
> + if ((i >= 0) && (i < this.getRevisionCount()))
> {
> - return m_revisions[i];
> + return this.m_revisions[i];
> }
> return null;
> }
> @@ -698,25 +708,25 @@
> {
> location = "inputstream:";
> }
> - BundleRevision revision = createRevisionFromLocation(location, is);
> + BundleRevision revision = this.createRevisionFromLocation(location, is);
> if (revision == null)
> {
> throw new Exception("Unable to revise archive.");
> }
>
> - setRevisionLocation(location, (m_revisions == null) ? 0 : m_revisions.length);
> + this.setRevisionLocation(location, (this.m_revisions == null) ? 0 : this.m_revisions.length);
>
> // Add new revision to revision array.
> - if (m_revisions == null)
> + if (this.m_revisions == null)
> {
> - m_revisions = new BundleRevision[] { revision };
> + this.m_revisions = new BundleRevision[] { revision };
> }
> else
> {
> - BundleRevision[] tmp = new BundleRevision[m_revisions.length + 1];
> - System.arraycopy(m_revisions, 0, tmp, 0, m_revisions.length);
> - tmp[m_revisions.length] = revision;
> - m_revisions = tmp;
> + BundleRevision[] tmp = new BundleRevision[this.m_revisions.length + 1];
> + System.arraycopy(this.m_revisions, 0, tmp, 0, this.m_revisions.length);
> + tmp[this.m_revisions.length] = revision;
> + this.m_revisions = tmp;
> }
> }
>
> @@ -735,33 +745,33 @@
> public synchronized boolean undoRevise() throws Exception
> {
> // Can only undo the revision if there is more than one.
> - if (getRevisionCount() <= 1)
> + if (this.getRevisionCount() <= 1)
> {
> return false;
> }
>
> - String location = getRevisionLocation(m_revisions.length - 2);
> + String location = this.getRevisionLocation(this.m_revisions.length - 2);
>
> try
> {
> - m_revisions[m_revisions.length - 1].dispose();
> + this.m_revisions[this.m_revisions.length - 1].dispose();
> }
> catch(Exception ex)
> {
> - m_logger.log(Logger.LOG_ERROR, getClass().getName() +
> + this.m_logger.log(Logger.LOG_ERROR, this.getClass().getName() +
> ": Unable to dispose latest revision", ex);
> }
>
> - File revisionDir = new File(m_archiveRootDir, REVISION_DIRECTORY +
> - getRefreshCount() + "." + (m_revisions.length - 1));
> + File revisionDir = new File(this.m_archiveRootDir, REVISION_DIRECTORY +
> + this.getRefreshCount() + "." + (this.m_revisions.length - 1));
>
> if (BundleCache.getSecureAction().fileExists(revisionDir))
> {
> BundleCache.deleteDirectoryTree(revisionDir);
> }
>
> - BundleRevision[] tmp = new BundleRevision[m_revisions.length - 1];
> - System.arraycopy(m_revisions, 0, tmp, 0, m_revisions.length - 1);
> + BundleRevision[] tmp = new BundleRevision[this.m_revisions.length - 1];
> + System.arraycopy(this.m_revisions, 0, tmp, 0, this.m_revisions.length - 1);
>
> return true;
> }
> @@ -773,8 +783,8 @@
> try
> {
> is = BundleCache.getSecureAction().getFileInputStream(new File(
> - new File(m_archiveRootDir, REVISION_DIRECTORY +
> - getRefreshCount() + "." + revision), REVISION_LOCATION_FILE));
> + new File(this.m_archiveRootDir, REVISION_DIRECTORY +
> + this.getRefreshCount() + "." + revision), REVISION_LOCATION_FILE));
>
> br = new BufferedReader(new InputStreamReader(is));
> return br.readLine();
> @@ -795,8 +805,8 @@
> {
> os = BundleCache.getSecureAction()
> .getFileOutputStream(new File(
> - new File(m_archiveRootDir, REVISION_DIRECTORY +
> - getRefreshCount() + "." + revision), REVISION_LOCATION_FILE));
> + new File(this.m_archiveRootDir, REVISION_DIRECTORY +
> + this.getRefreshCount() + "." + revision), REVISION_LOCATION_FILE));
> bw = new BufferedWriter(new OutputStreamWriter(os));
> bw.write(location, 0, location.length());
> }
> @@ -817,9 +827,9 @@
> public synchronized void purge() throws Exception
> {
> // Get the current refresh count.
> - long refreshCount = getRefreshCount();
> + long refreshCount = this.getRefreshCount();
> // Get the current revision count.
> - int count = getRevisionCount();
> + int count = this.getRevisionCount();
>
> // Dispose and delete all but the current revision.
> File revisionDir = null;
> @@ -829,11 +839,11 @@
> // circumstances, such as if this bundle archive was created
> // for an existing bundle that was updated, but not refreshed
> // due to a system crash; see the constructor code for details.
> - if (m_revisions[i] != null)
> + if (this.m_revisions[i] != null)
> {
> - m_revisions[i].dispose();
> + this.m_revisions[i].dispose();
> }
> - revisionDir = new File(m_archiveRootDir, REVISION_DIRECTORY + refreshCount + "." + i);
> + revisionDir = new File(this.m_archiveRootDir, REVISION_DIRECTORY + refreshCount + "." + i);
> if (BundleCache.getSecureAction().fileExists(revisionDir))
> {
> BundleCache.deleteDirectoryTree(revisionDir);
> @@ -843,27 +853,27 @@
> // We still need to dispose the current revision, but we
> // don't want to delete it, because we want to rename it
> // to the new refresh level.
> - m_revisions[count - 1].dispose();
> + this.m_revisions[count - 1].dispose();
>
> // Save the current revision location for use later when
> // we recreate the revision.
> - String location = getRevisionLocation(count -1);
> + String location = this.getRevisionLocation(count -1);
>
> // Increment the refresh count.
> - setRefreshCount(refreshCount + 1);
> + this.setRefreshCount(refreshCount + 1);
>
> // Rename the current revision directory to be the zero revision
> // of the new refresh level.
> - File currentDir = new File(m_archiveRootDir, REVISION_DIRECTORY + (refreshCount + 1) + ".0");
> - revisionDir = new File(m_archiveRootDir, REVISION_DIRECTORY + refreshCount + "." + (count - 1));
> + File currentDir = new File(this.m_archiveRootDir, REVISION_DIRECTORY + (refreshCount + 1) + ".0");
> + revisionDir = new File(this.m_archiveRootDir, REVISION_DIRECTORY + refreshCount + "." + (count - 1));
> BundleCache.getSecureAction().renameFile(revisionDir, currentDir);
>
> // Null the revision array since they are all invalid now.
> - m_revisions = null;
> + this.m_revisions = null;
> // Finally, recreate the revision for the current location.
> - BundleRevision revision = createRevisionFromLocation(location, null);
> + BundleRevision revision = this.createRevisionFromLocation(location, null);
> // Create new revision array.
> - m_revisions = new BundleRevision[] { revision };
> + this.m_revisions = new BundleRevision[] { revision };
> }
>
> /**
> @@ -874,13 +884,13 @@
> **/
> /* package */ void dispose() throws Exception
> {
> - if (!BundleCache.deleteDirectoryTree(m_archiveRootDir))
> + if (!BundleCache.deleteDirectoryTree(this.m_archiveRootDir))
> {
> - m_logger.log(
> + this.m_logger.log(
> Logger.LOG_ERROR,
> - getClass().getName()
> + this.getClass().getName()
> + ": Unable to delete archive directory - "
> - + m_archiveRootDir);
> + + this.m_archiveRootDir);
> }
> }
>
> @@ -900,33 +910,33 @@
> {
> // If the archive directory exists, then we don't
> // need to initialize since it has already been done.
> - if (BundleCache.getSecureAction().fileExists(m_archiveRootDir))
> + if (BundleCache.getSecureAction().fileExists(this.m_archiveRootDir))
> {
> return;
> }
>
> // Create archive directory, if it does not exist.
> - if (!BundleCache.getSecureAction().mkdir(m_archiveRootDir))
> + if (!BundleCache.getSecureAction().mkdir(this.m_archiveRootDir))
> {
> - m_logger.log(
> + this.m_logger.log(
> Logger.LOG_ERROR,
> - getClass().getName() + ": Unable to create archive directory.");
> + this.getClass().getName() + ": Unable to create archive directory.");
> throw new IOException("Unable to create archive directory.");
> }
>
> // Save id.
> os = BundleCache.getSecureAction()
> - .getFileOutputStream(new File(m_archiveRootDir, BUNDLE_ID_FILE));
> + .getFileOutputStream(new File(this.m_archiveRootDir, BUNDLE_ID_FILE));
> bw = new BufferedWriter(new OutputStreamWriter(os));
> - bw.write(Long.toString(m_id), 0, Long.toString(m_id).length());
> + bw.write(Long.toString(this.m_id), 0, Long.toString(this.m_id).length());
> bw.close();
> os.close();
>
> // Save location string.
> os = BundleCache.getSecureAction()
> - .getFileOutputStream(new File(m_archiveRootDir, BUNDLE_LOCATION_FILE));
> + .getFileOutputStream(new File(this.m_archiveRootDir, BUNDLE_LOCATION_FILE));
> bw = new BufferedWriter(new OutputStreamWriter(os));
> - bw.write(m_originalLocation, 0, m_originalLocation.length());
> + bw.write(this.m_originalLocation, 0, this.m_originalLocation.length());
> }
> finally
> {
> @@ -948,9 +958,9 @@
> **/
> private String getCurrentLocation() throws Exception
> {
> - if (m_currentLocation != null)
> + if (this.m_currentLocation != null)
> {
> - return m_currentLocation;
> + return this.m_currentLocation;
> }
>
> // Read current location.
> @@ -959,14 +969,14 @@
> try
> {
> is = BundleCache.getSecureAction()
> - .getFileInputStream(new File(m_archiveRootDir, CURRENT_LOCATION_FILE));
> + .getFileInputStream(new File(this.m_archiveRootDir, CURRENT_LOCATION_FILE));
> br = new BufferedReader(new InputStreamReader(is));
> - m_currentLocation = br.readLine();
> - return m_currentLocation;
> + this.m_currentLocation = br.readLine();
> + return this.m_currentLocation;
> }
> catch (FileNotFoundException ex)
> {
> - return getLocation();
> + return this.getLocation();
> }
> finally
> {
> @@ -993,10 +1003,10 @@
> try
> {
> os = BundleCache.getSecureAction()
> - .getFileOutputStream(new File(m_archiveRootDir, CURRENT_LOCATION_FILE));
> + .getFileOutputStream(new File(this.m_archiveRootDir, CURRENT_LOCATION_FILE));
> bw = new BufferedWriter(new OutputStreamWriter(os));
> bw.write(location, 0, location.length());
> - m_currentLocation = location;
> + this.m_currentLocation = location;
> }
> finally
> {
> @@ -1022,8 +1032,8 @@
> // native libraries so that we can reload them. Thus, we use the
> // refresh counter as a way to change the name of the revision
> // directory to give native libraries new absolute names.
> - File revisionRootDir = new File(m_archiveRootDir,
> - REVISION_DIRECTORY + getRefreshCount() + "." + getRevisionCount());
> + File revisionRootDir = new File(this.m_archiveRootDir,
> + REVISION_DIRECTORY + this.getRefreshCount() + "." + this.getRevisionCount());
>
> BundleRevision result = null;
>
> @@ -1051,22 +1061,22 @@
> // flag set to true.
> if (BundleCache.getSecureAction().isFileDirectory(file))
> {
> - result = new DirectoryRevision(m_logger, revisionRootDir, location);
> + result = new DirectoryRevision(this.m_logger, revisionRootDir, location);
> }
> else
> {
> - result = new JarRevision(m_logger, revisionRootDir, location, true);
> + result = new JarRevision(this.m_logger, revisionRootDir, location, true);
> }
> }
> else if (location.startsWith(INPUTSTREAM_PROTOCOL))
> {
> // Assume all input streams point to JAR files.
> - result = new JarRevision(m_logger, revisionRootDir, location, false, is);
> + result = new JarRevision(this.m_logger, revisionRootDir, location, false, is);
> }
> else
> {
> // Anything else is assumed to be a URL to a JAR file.
> - result = new JarRevision(m_logger, revisionRootDir, location, false);
> + result = new JarRevision(this.m_logger, revisionRootDir, location, false);
> }
> }
> catch (Exception ex)
> @@ -1075,9 +1085,9 @@
> {
> if (!BundleCache.deleteDirectoryTree(revisionRootDir))
> {
> - m_logger.log(
> + this.m_logger.log(
> Logger.LOG_ERROR,
> - getClass().getName()
> + this.getClass().getName()
> + ": Unable to delete revision directory - "
> + revisionRootDir);
> }
> @@ -1106,13 +1116,13 @@
> {
> // If we have already read the refresh counter file,
> // then just return the result.
> - if (m_refreshCount >= 0)
> + if (this.m_refreshCount >= 0)
> {
> - return m_refreshCount;
> + return this.m_refreshCount;
> }
>
> // Get refresh counter file.
> - File counterFile = new File(m_archiveRootDir, REFRESH_COUNTER_FILE);
> + File counterFile = new File(this.m_archiveRootDir, REFRESH_COUNTER_FILE);
>
> // If the refresh counter file doesn't exist, then
> // assume the counter is at zero.
> @@ -1157,7 +1167,7 @@
> throws Exception
> {
> // Get refresh counter file.
> - File counterFile = new File(m_archiveRootDir, REFRESH_COUNTER_FILE);
> + File counterFile = new File(this.m_archiveRootDir, REFRESH_COUNTER_FILE);
>
> // Write the refresh counter.
> OutputStream os = null;
> @@ -1169,13 +1179,13 @@
> bw = new BufferedWriter(new OutputStreamWriter(os));
> String s = Long.toString(counter);
> bw.write(s, 0, s.length());
> - m_refreshCount = counter;
> + this.m_refreshCount = counter;
> }
> catch (IOException ex)
> {
> - m_logger.log(
> + this.m_logger.log(
> Logger.LOG_ERROR,
> - getClass().getName() + ": Unable to write refresh counter: " + ex);
> + this.getClass().getName() + ": Unable to write refresh counter: " + ex);
> throw ex;
> }
> finally
>
> Modified: 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/BundleRevision.java?view=diff&rev=566083&r1=566082&r2=566083
> ==============================================================================
> --- 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/BundleRevision.java Wed Aug 15 03:03:15 2007
> @@ -19,10 +19,7 @@
> package org.apache.felix.framework.cache;
>
> import java.io.File;
> -import java.io.InputStream;
> -import java.security.cert.*;
> -import java.util.*;
> -import java.util.jar.*;
> +import java.util.Map;
>
> import org.apache.felix.framework.Logger;
> import org.apache.felix.moduleloader.IContent;
> @@ -70,9 +67,9 @@
> public BundleRevision(Logger logger, File revisionRootDir, String location)
> throws Exception
> {
> - m_logger = logger;
> - m_revisionRootDir = revisionRootDir;
> - m_location = location;
> + this.m_logger = logger;
> + this.m_revisionRootDir = revisionRootDir;
> + this.m_location = location;
> }
>
>
> @@ -84,7 +81,7 @@
> **/
> public Logger getLogger()
> {
> - return m_logger;
> + return this.m_logger;
> }
>
> /**
> @@ -95,7 +92,7 @@
> **/
> public File getRevisionRootDir()
> {
> - return m_revisionRootDir;
> + return this.m_revisionRootDir;
> }
>
> /**
> @@ -106,7 +103,7 @@
> **/
> public String getLocation()
> {
> - return m_location;
> + return this.m_location;
> }
>
> /**
>
> 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?view=diff&rev=566083&r1=566082&r2=566083
> ==============================================================================
> --- 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 Wed Aug 15 03:03:15 2007
> @@ -18,17 +18,21 @@
> */
> package org.apache.felix.framework.cache;
>
> -import java.io.*;
> -import java.net.MalformedURLException;
> -import java.security.cert.X509Certificate;
> -import java.util.*;
> -import java.util.jar.*;
> +import java.io.File;
> +import java.io.IOException;
> +import java.io.InputStream;
> +import java.util.ArrayList;
> +import java.util.List;
> +import java.util.Map;
> +import java.util.jar.Manifest;
>
> import org.apache.felix.framework.Logger;
> import org.apache.felix.framework.util.FelixConstants;
> import org.apache.felix.framework.util.StringMap;
> import org.apache.felix.framework.util.manifestparser.ManifestParser;
> -import org.apache.felix.moduleloader.*;
> +import org.apache.felix.moduleloader.DirectoryContent;
> +import org.apache.felix.moduleloader.IContent;
> +import org.apache.felix.moduleloader.JarContent;
>
> /**
> * <p>
> @@ -48,13 +52,13 @@
> Logger logger, File revisionRootDir, String location) throws Exception
> {
> super(logger, revisionRootDir, location);
> - m_refDir = new File(location.substring(
> + this.m_refDir = new File(location.substring(
> location.indexOf(BundleArchive.FILE_PROTOCOL)
> + BundleArchive.FILE_PROTOCOL.length()));
>
> // If the revision directory exists, then we don't
> // need to initialize since it has already been done.
> - if (BundleCache.getSecureAction().fileExists(getRevisionRootDir()))
> + if (BundleCache.getSecureAction().fileExists(this.getRevisionRootDir()))
> {
> return;
> }
> @@ -62,11 +66,11 @@
> // Create revision directory, we only need this to store the
> // revision location, since nothing else needs to be extracted
> // since we are referencing a read directory already.
> - if (!BundleCache.getSecureAction().mkdir(getRevisionRootDir()))
> + if (!BundleCache.getSecureAction().mkdir(this.getRevisionRootDir()))
> {
> - getLogger().log(
> + this.getLogger().log(
> Logger.LOG_ERROR,
> - getClass().getName() + ": Unable to create revision directory.");
> + this.getClass().getName() + ": Unable to create revision directory.");
> throw new IOException("Unable to create archive directory.");
> }
> }
> @@ -74,9 +78,9 @@
> public synchronized Map getManifestHeader()
> throws Exception
> {
> - if (m_header != null)
> + if (this.m_header != null)
> {
> - return m_header;
> + return this.m_header;
> }
>
> // Read the header file from the reference directory.
> @@ -86,7 +90,7 @@
> {
> // Open manifest file.
> is = BundleCache.getSecureAction()
> - .getFileInputStream(new File(m_refDir, "META-INF/MANIFEST.MF"));
> + .getFileInputStream(new File(this.m_refDir, "META-INF/MANIFEST.MF"));
> // Error if no jar file.
> if (is == null)
> {
> @@ -96,8 +100,8 @@
> // Get manifest.
> Manifest mf = new Manifest(is);
> // Create a case insensitive map of manifest attributes.
> - m_header = new StringMap(mf.getMainAttributes(), false);
> - return m_header;
> + this.m_header = new StringMap(mf.getMainAttributes(), false);
> + return this.m_header;
> }
> finally
> {
> @@ -107,7 +111,7 @@
>
> public IContent getContent() throws Exception
> {
> - return new DirectoryContent(m_refDir);
> + return new DirectoryContent(this.m_refDir);
> }
>
> public synchronized IContent[] getContentPath() throws Exception
> @@ -118,7 +122,7 @@
> // objects for everything on the class path.
>
> // Get the bundle's manifest header.
> - Map map = getManifestHeader();
> + Map map = this.getManifestHeader();
>
> // Find class path meta-data.
> String classPath = (map == null)
> @@ -134,7 +138,7 @@
> }
>
> // Create the bundles class path.
> - IContent self = new DirectoryContent(m_refDir);
> + IContent self = new DirectoryContent(this.m_refDir);
> List contentList = new ArrayList();
> for (int i = 0; i < classPathStrings.length; i++)
> {
> @@ -145,7 +149,7 @@
> else
> {
> // Determine if the class path entry is a file or directory.
> - File file = new File(m_refDir, classPathStrings[i]);
> + File file = new File(this.m_refDir, classPathStrings[i]);
> if (BundleCache.getSecureAction().isFileDirectory(file))
> {
> contentList.add(new DirectoryContent(file));
> @@ -174,7 +178,7 @@
> // TODO: This will need to consider security.
> public String findLibrary(String libName) throws Exception
> {
> - return BundleCache.getSecureAction().getAbsolutePath(new File(m_refDir, libName));
> + return BundleCache.getSecureAction().getAbsolutePath(new File(this.m_refDir, libName));
> }
>
> public void dispose() throws Exception
>
> 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?view=diff&rev=566083&r1=566082&r2=566083
> ==============================================================================
> --- 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 Wed Aug 15 03:03:15 2007
> @@ -18,12 +18,18 @@
> */
> package org.apache.felix.framework.cache;
>
> -import java.io.*;
> -import java.net.*;
> +import java.io.BufferedInputStream;
> +import java.io.File;
> +import java.io.IOException;
> +import java.io.InputStream;
> +import java.net.URL;
> +import java.net.URLConnection;
> import java.security.PrivilegedActionException;
> -import java.security.cert.X509Certificate;
> -import java.util.*;
> -import java.util.jar.*;
> +import java.util.ArrayList;
> +import java.util.List;
> +import java.util.Map;
> +import java.util.jar.JarFile;
> +import java.util.jar.Manifest;
> import java.util.zip.ZipEntry;
>
> import org.apache.felix.framework.Logger;
> @@ -31,7 +37,9 @@
> import org.apache.felix.framework.util.StringMap;
> import org.apache.felix.framework.util.Util;
> import org.apache.felix.framework.util.manifestparser.ManifestParser;
> -import org.apache.felix.moduleloader.*;
> +import org.apache.felix.moduleloader.ContentDirectoryContent;
> +import org.apache.felix.moduleloader.IContent;
> +import org.apache.felix.moduleloader.JarContent;
>
> /**
> * <p>
> @@ -69,24 +77,24 @@
>
> if (byReference)
> {
> - m_bundleFile = new File(location.substring(
> + this.m_bundleFile = new File(location.substring(
> location.indexOf(BundleArchive.FILE_PROTOCOL)
> + BundleArchive.FILE_PROTOCOL.length()));
> }
> else
> {
> - m_bundleFile = new File(getRevisionRootDir(), BUNDLE_JAR_FILE);
> + this.m_bundleFile = new File(this.getRevisionRootDir(), BUNDLE_JAR_FILE);
> }
>
> // Save and process the bundle JAR.
> - initialize(byReference, is);
> + this.initialize(byReference, is);
> }
>
> public synchronized Map getManifestHeader() throws Exception
> {
> - if (m_header != null)
> + if (this.m_header != null)
> {
> - return m_header;
> + return this.m_header;
> }
>
> // Get the embedded resource.
> @@ -95,7 +103,7 @@
> try
> {
> // Open bundle JAR file.
> - jarFile = BundleCache.getSecureAction().openJAR(m_bundleFile);
> + jarFile = BundleCache.getSecureAction().openJAR(this.m_bundleFile);
> // Error if no jar file.
> if (jarFile == null)
> {
> @@ -104,8 +112,8 @@
> // Get manifest.
> Manifest mf = jarFile.getManifest();
> // Create a case insensitive map of manifest attributes.
> - m_header = new StringMap(mf.getMainAttributes(), false);
> - return m_header;
> + this.m_header = new StringMap(mf.getMainAttributes(), false);
> + return this.m_header;
>
> }
> finally
> @@ -116,7 +124,7 @@
>
> public IContent getContent() throws Exception
> {
> - return new JarContent(m_bundleFile);
> + return new JarContent(this.m_bundleFile);
> }
>
> public synchronized IContent[] getContentPath() throws Exception
> @@ -126,10 +134,10 @@
> // is on the bundle's class path and then creating content
> // objects for everything on the class path.
>
> - File embedDir = new File(getRevisionRootDir(), EMBEDDED_DIRECTORY);
> + File embedDir = new File(this.getRevisionRootDir(), EMBEDDED_DIRECTORY);
>
> // Get the bundle's manifest header.
> - Map map = getManifestHeader();
> + Map map = this.getManifestHeader();
>
> // Find class path meta-data.
> String classPath = (map == null)
> @@ -148,8 +156,8 @@
> JarFile bundleJar = null;
> try
> {
> - bundleJar = BundleCache.getSecureAction().openJAR(m_bundleFile);
> - IContent self = new JarContent(m_bundleFile);
> + bundleJar = BundleCache.getSecureAction().openJAR(this.m_bundleFile);
> + IContent self = new JarContent(this.m_bundleFile);
> List contentList = new ArrayList();
> for (int i = 0; i < classPathStrings.length; i++)
> {
> @@ -197,7 +205,7 @@
> public synchronized String findLibrary(String libName) throws Exception
> {
> // Get bundle lib directory.
> - File libDir = new File(getRevisionRootDir(), LIBRARY_DIRECTORY);
> + File libDir = new File(this.getRevisionRootDir(), LIBRARY_DIRECTORY);
> // Get lib file.
> File libFile = new File(libDir, File.separatorChar + libName);
> // Make sure that the library's parent directory exists;
> @@ -219,7 +227,7 @@
>
> try
> {
> - bundleJar = BundleCache.getSecureAction().openJAR(m_bundleFile);
> + bundleJar = BundleCache.getSecureAction().openJAR(this.m_bundleFile);
> ZipEntry ze = bundleJar.getEntry(libName);
> if (ze == null)
> {
> @@ -263,17 +271,17 @@
> {
> // If the revision directory exists, then we don't
> // need to initialize since it has already been done.
> - if (BundleCache.getSecureAction().fileExists(getRevisionRootDir()))
> + if (BundleCache.getSecureAction().fileExists(this.getRevisionRootDir()))
> {
> return;
> }
>
> // Create revision directory.
> - if (!BundleCache.getSecureAction().mkdir(getRevisionRootDir()))
> + if (!BundleCache.getSecureAction().mkdir(this.getRevisionRootDir()))
> {
> - getLogger().log(
> + this.getLogger().log(
> Logger.LOG_ERROR,
> - getClass().getName() + ": Unable to create revision directory.");
> + this.getClass().getName() + ": Unable to create revision directory.");
> throw new IOException("Unable to create archive directory.");
> }
>
> @@ -283,7 +291,7 @@
> {
> // Do it the manual way to have a chance to
> // set request properties such as proxy auth.
> - URL url = new URL(getLocation());
> + URL url = new URL(this.getLocation());
> URLConnection conn = url.openConnection();
>
> // Support for http proxy authentication.
> @@ -303,10 +311,10 @@
> }
>
> // Save the bundle jar file.
> - BundleCache.copyStreamToFile(is, m_bundleFile);
> + BundleCache.copyStreamToFile(is, this.m_bundleFile);
> }
>
> - preprocessBundleJar();
> + this.preprocessBundleJar();
> }
> finally
> {
> @@ -327,7 +335,7 @@
> // for their existence all the time.
> //
>
> - File embedDir = new File(getRevisionRootDir(), EMBEDDED_DIRECTORY);
> + File embedDir = new File(this.getRevisionRootDir(), EMBEDDED_DIRECTORY);
> if (!BundleCache.getSecureAction().fileExists(embedDir))
> {
> if (!BundleCache.getSecureAction().mkdir(embedDir))
> @@ -336,7 +344,7 @@
> }
> }
>
> - File libDir = new File(getRevisionRootDir(), LIBRARY_DIRECTORY);
> + File libDir = new File(this.getRevisionRootDir(), LIBRARY_DIRECTORY);
> if (!BundleCache.getSecureAction().fileExists(libDir))
> {
> if (!BundleCache.getSecureAction().mkdir(libDir))
> @@ -352,7 +360,7 @@
> try
> {
> // Get the bundle's manifest header.
> - Map map = getManifestHeader();
> + Map map = this.getManifestHeader();
>
> // Find class path meta-data.
> String classPath = (map == null)
> @@ -371,14 +379,14 @@
> {
> if (!classPathStrings[i].equals(FelixConstants.CLASS_PATH_DOT))
> {
> - extractEmbeddedJar(classPathStrings[i]);
> + this.extractEmbeddedJar(classPathStrings[i]);
> }
> }
>
> }
> catch (PrivilegedActionException ex)
> {
> - throw ((PrivilegedActionException) ex).getException();
> + throw (ex).getException();
> }
> }
>
> @@ -397,7 +405,7 @@
>
> // If JAR is already extracted, then don't re-extract it...
> File jarFile = new File(
> - getRevisionRootDir(), EMBEDDED_DIRECTORY + File.separatorChar + jarPath);
> + this.getRevisionRootDir(), EMBEDDED_DIRECTORY + File.separatorChar + jarPath);
>
> if (!BundleCache.getSecureAction().fileExists(jarFile))
> {
> @@ -406,13 +414,13 @@
> try
> {
> // Make sure class path entry is a JAR file.
> - bundleJar = BundleCache.getSecureAction().openJAR(m_bundleFile);
> + bundleJar = BundleCache.getSecureAction().openJAR(this.m_bundleFile);
> ZipEntry ze = bundleJar.getEntry(jarPath);
> if (ze == null)
> {
> // TODO: FRAMEWORK - Per the spec, this should fire a FrameworkEvent.INFO event;
> // need to create an "Eventer" class like "Logger" perhaps.
> - getLogger().log(Logger.LOG_INFO, "Class path entry not found: " + jarPath);
> + this.getLogger().log(Logger.LOG_INFO, "Class path entry not found: " + jarPath);
> return;
> }
> // If the zip entry is a directory, then ignore it since
>
>
>