Organize imports
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@566083 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 bd9268f..c3320df 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
@@ -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)
{
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
diff --git a/framework/src/main/java/org/apache/felix/framework/cache/BundleRevision.java b/framework/src/main/java/org/apache/felix/framework/cache/BundleRevision.java
index 3c77884..9a81987 100644
--- a/framework/src/main/java/org/apache/felix/framework/cache/BundleRevision.java
+++ b/framework/src/main/java/org/apache/felix/framework/cache/BundleRevision.java
@@ -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;
}
/**
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 52a4a43..3347e83 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
@@ -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
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 ced4faf..2ef27dc 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
@@ -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
diff --git a/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4SearchPolicyCore.java b/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4SearchPolicyCore.java
index ebaab48..3e3beb7 100755
--- a/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4SearchPolicyCore.java
+++ b/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4SearchPolicyCore.java
@@ -22,13 +22,36 @@
import java.lang.reflect.Proxy;
import java.net.URL;
import java.security.ProtectionDomain;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
import org.apache.felix.framework.Logger;
-import org.apache.felix.framework.util.*;
-import org.apache.felix.framework.util.manifestparser.*;
-import org.apache.felix.moduleloader.*;
-import org.osgi.framework.*;
+import org.apache.felix.framework.util.SecurityManagerEx;
+import org.apache.felix.framework.util.Util;
+import org.apache.felix.framework.util.manifestparser.Capability;
+import org.apache.felix.framework.util.manifestparser.ManifestParser;
+import org.apache.felix.framework.util.manifestparser.R4Directive;
+import org.apache.felix.framework.util.manifestparser.R4Library;
+import org.apache.felix.framework.util.manifestparser.Requirement;
+import org.apache.felix.moduleloader.ICapability;
+import org.apache.felix.moduleloader.IModule;
+import org.apache.felix.moduleloader.IModuleFactory;
+import org.apache.felix.moduleloader.IRequirement;
+import org.apache.felix.moduleloader.IWire;
+import org.apache.felix.moduleloader.ModuleEvent;
+import org.apache.felix.moduleloader.ModuleImpl;
+import org.apache.felix.moduleloader.ModuleListener;
+import org.apache.felix.moduleloader.ResourceNotFoundException;
+import org.osgi.framework.Constants;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.PackagePermission;
+import org.osgi.framework.Version;
public class R4SearchPolicyCore implements ModuleListener
{
@@ -61,39 +84,39 @@
public R4SearchPolicyCore(Logger logger, Map configMap)
{
- m_logger = logger;
- m_configMap = configMap;
+ this.m_logger = logger;
+ this.m_configMap = configMap;
// Read the boot delegation property and parse it.
- String s = (String) m_configMap.get(Constants.FRAMEWORK_BOOTDELEGATION);
+ String s = (String) this.m_configMap.get(Constants.FRAMEWORK_BOOTDELEGATION);
s = (s == null) ? "java.*" : s + ",java.*";
StringTokenizer st = new StringTokenizer(s, " ,");
- m_bootPkgs = new String[st.countTokens()];
- m_bootPkgWildcards = new boolean[m_bootPkgs.length];
- for (int i = 0; i < m_bootPkgs.length; i++)
+ this.m_bootPkgs = new String[st.countTokens()];
+ this.m_bootPkgWildcards = new boolean[this.m_bootPkgs.length];
+ for (int i = 0; i < this.m_bootPkgs.length; i++)
{
s = st.nextToken();
if (s.endsWith("*"))
{
- m_bootPkgWildcards[i] = true;
+ this.m_bootPkgWildcards[i] = true;
s = s.substring(0, s.length() - 1);
}
- m_bootPkgs[i] = s;
+ this.m_bootPkgs[i] = s;
}
}
public IModuleFactory getModuleFactory()
{
- return m_factory;
+ return this.m_factory;
}
public void setModuleFactory(IModuleFactory factory)
throws IllegalStateException
{
- if (m_factory == null)
+ if (this.m_factory == null)
{
- m_factory = factory;
- m_factory.addModuleListener(this);
+ this.m_factory = factory;
+ this.m_factory.addModuleListener(this);
}
else
{
@@ -104,17 +127,17 @@
protected synchronized boolean isResolved(IModule module)
{
- ModuleData data = (ModuleData) m_moduleDataMap.get(module);
+ ModuleData data = (ModuleData) this.m_moduleDataMap.get(module);
return (data == null) ? false : data.m_resolved;
}
protected synchronized void setResolved(IModule module, boolean resolved)
{
- ModuleData data = (ModuleData) m_moduleDataMap.get(module);
+ ModuleData data = (ModuleData) this.m_moduleDataMap.get(module);
if (data == null)
{
data = new ModuleData(module);
- m_moduleDataMap.put(module, data);
+ this.m_moduleDataMap.put(module, data);
}
data.m_resolved = resolved;
}
@@ -149,7 +172,7 @@
{
try
{
- return (Class) findClassOrResource(module, name, true);
+ return (Class) this.findClassOrResource(module, name, true);
}
catch (ResourceNotFoundException ex)
{
@@ -157,7 +180,7 @@
}
catch (ClassNotFoundException ex)
{
- String msg = diagnoseClassLoadError(module, name);
+ String msg = this.diagnoseClassLoadError(module, name);
throw new ClassNotFoundException(msg, ex);
}
@@ -170,7 +193,7 @@
{
try
{
- return (URL) findClassOrResource(module, name, false);
+ return (URL) this.findClassOrResource(module, name, false);
}
catch (ClassNotFoundException ex)
{
@@ -194,7 +217,7 @@
// for each class load.
try
{
- resolve(module);
+ this.resolve(module);
}
catch (ResolveException ex)
{
@@ -222,7 +245,7 @@
// not take a stand on this issue.
if (pkgName.length() > 0)
{
- for (int i = 0; i < m_bootPkgs.length; i++)
+ for (int i = 0; i < this.m_bootPkgs.length; i++)
{
// A wildcarded boot delegation package will be in the form of
// "foo.", so if the package is wildcarded do a startsWith() or a
@@ -230,14 +253,14 @@
// request should be delegated to the parent class loader. If the
// package is not wildcarded, then simply do an equals() test to
// see if the request should be delegated to the parent class loader.
- if ((m_bootPkgWildcards[i] &&
- (pkgName.startsWith(m_bootPkgs[i]) ||
- m_bootPkgs[i].regionMatches(0, pkgName, 0, pkgName.length())))
- || (!m_bootPkgWildcards[i] && m_bootPkgs[i].equals(pkgName)))
+ if ((this.m_bootPkgWildcards[i] &&
+ (pkgName.startsWith(this.m_bootPkgs[i]) ||
+ this.m_bootPkgs[i].regionMatches(0, pkgName, 0, pkgName.length())))
+ || (!this.m_bootPkgWildcards[i] && this.m_bootPkgs[i].equals(pkgName)))
{
try
{
- urls = getClass().getClassLoader().getResources(name);
+ urls = this.getClass().getClassLoader().getResources(name);
return urls;
}
catch (IOException ex)
@@ -278,7 +301,7 @@
// At this point, the module's imports were searched and so was the
// the module's content. Now we make an attempt to load the
// class/resource via a dynamic import, if possible.
- IWire wire = attemptDynamicImport(module, pkgName);
+ IWire wire = this.attemptDynamicImport(module, pkgName);
if (wire != null)
{
urls = wire.getResources(name);
@@ -300,7 +323,7 @@
// for each class load.
try
{
- resolve(module);
+ this.resolve(module);
}
catch (ResolveException ex)
{
@@ -338,7 +361,7 @@
// Delegate any packages listed in the boot delegation
// property to the parent class loader.
- for (int i = 0; i < m_bootPkgs.length; i++)
+ for (int i = 0; i < this.m_bootPkgs.length; i++)
{
// A wildcarded boot delegation package will be in the form of "foo.",
// so if the package is wildcarded do a startsWith() or a regionMatches()
@@ -351,14 +374,14 @@
// Only consider delegation if we have a package name, since
// we don't want to promote the default package. The spec does
// not take a stand on this issue.
- if ((m_bootPkgWildcards[i] &&
- (pkgName.startsWith(m_bootPkgs[i]) ||
- m_bootPkgs[i].regionMatches(0, pkgName, 0, pkgName.length())))
- || (!m_bootPkgWildcards[i] && m_bootPkgs[i].equals(pkgName)))
+ if ((this.m_bootPkgWildcards[i] &&
+ (pkgName.startsWith(this.m_bootPkgs[i]) ||
+ this.m_bootPkgs[i].regionMatches(0, pkgName, 0, pkgName.length())))
+ || (!this.m_bootPkgWildcards[i] && this.m_bootPkgs[i].equals(pkgName)))
{
return (isClass)
- ? (Object) getClass().getClassLoader().loadClass(name)
- : (Object) getClass().getClassLoader().getResource(name);
+ ? (Object) this.getClass().getClassLoader().loadClass(name)
+ : (Object) this.getClass().getClassLoader().getResource(name);
}
}
}
@@ -366,7 +389,7 @@
// Look in the module's imports. Note that the search may
// be aborted if this method throws an exception, otherwise
// it continues if a null is returned.
- Object result = searchImports(module, name, isClass);
+ Object result = this.searchImports(module, name, isClass);
// If not found, try the module's own class path.
if (result == null)
@@ -378,7 +401,7 @@
// If still not found, then try the module's dynamic imports.
if (result == null)
{
- result = searchDynamicImports(module, name, pkgName, isClass);
+ result = this.searchDynamicImports(module, name, pkgName, isClass);
}
}
@@ -424,7 +447,7 @@
// At this point, the module's imports were searched and so was the
// the module's content. Now we make an attempt to load the
// class/resource via a dynamic import, if possible.
- IWire wire = attemptDynamicImport(module, pkgName);
+ IWire wire = this.attemptDynamicImport(module, pkgName);
// If the dynamic import was successful, then this initial
// time we must directly return the result from dynamically
@@ -562,12 +585,12 @@
try
{
// Lock module manager instance to ensure that nothing changes.
- synchronized (m_factory)
+ synchronized (this.m_factory)
{
// Get "in use" and "available" candidates and put
// the "in use" candidates first.
- PackageSource[] inuse = getInUseCandidates(req);
- PackageSource[] available = getUnusedCandidates(req);
+ PackageSource[] inuse = this.getInUseCandidates(req);
+ PackageSource[] available = this.getUnusedCandidates(req);
PackageSource[] candidates = new PackageSource[inuse.length + available.length];
System.arraycopy(inuse, 0, candidates, 0, inuse.length);
System.arraycopy(available, 0, candidates, inuse.length, available.length);
@@ -579,7 +602,7 @@
{
try
{
- if (resolveDynamicImportCandidate(
+ if (this.resolveDynamicImportCandidate(
candidates[candIdx].m_module, importer))
{
candidate = candidates[candIdx];
@@ -610,14 +633,14 @@
importer, dynamics[i], candidate.m_module, candidate.m_capability);
newWires[newWires.length - 1] = wire;
((ModuleImpl) importer).setWires(newWires);
-m_logger.log(Logger.LOG_DEBUG, "WIRE: " + newWires[newWires.length - 1]);
+this.m_logger.log(Logger.LOG_DEBUG, "WIRE: " + newWires[newWires.length - 1]);
return wire;
}
}
}
catch (Exception ex)
{
- m_logger.log(Logger.LOG_ERROR, "Unable to dynamically import package.", ex);
+ this.m_logger.log(Logger.LOG_ERROR, "Unable to dynamically import package.", ex);
}
}
}
@@ -635,21 +658,21 @@
// provider. If there is no consistent class space, then a resolve
// exception is thrown.
Map candidatesMap = new HashMap();
- if (!isResolved(provider))
+ if (!this.isResolved(provider))
{
- populateCandidatesMap(candidatesMap, provider);
- findConsistentClassSpace(candidatesMap, provider);
+ this.populateCandidatesMap(candidatesMap, provider);
+ this.findConsistentClassSpace(candidatesMap, provider);
}
// If the provider can be successfully resolved, then verify that
// its class space is consistent with the existing class space of the
// module that instigated the dynamic import.
Map moduleMap = new HashMap();
- Map importerPkgMap = getModulePackages(moduleMap, importer, candidatesMap);
+ Map importerPkgMap = this.getModulePackages(moduleMap, importer, candidatesMap);
// Now we need to calculate the "uses" constraints of every package
// accessible to the provider module based on its current candidates.
- Map usesMap = usesMap = calculateUsesConstraints(provider, moduleMap, candidatesMap);
+ Map usesMap = this.calculateUsesConstraints(provider, moduleMap, candidatesMap);
// Verify that none of the provider's implied "uses" constraints
// in the uses map conflict with anything in the importing module's
@@ -696,7 +719,7 @@
}
else
{
- m_logger.log(
+ this.m_logger.log(
Logger.LOG_DEBUG,
"Constraint violation for " + importer
+ " detected; module can see "
@@ -707,7 +730,7 @@
}
}
- Map resolvedModuleWireMap = createWires(candidatesMap, provider);
+ Map resolvedModuleWireMap = this.createWires(candidatesMap, provider);
// Fire resolved events for all resolved modules;
// the resolved modules array will only be set if the resolve
@@ -717,7 +740,7 @@
Iterator iter = resolvedModuleWireMap.entrySet().iterator();
while (iter.hasNext())
{
- fireModuleResolved((IModule) ((Map.Entry) iter.next()).getKey());
+ this.fireModuleResolved((IModule) ((Map.Entry) iter.next()).getKey());
}
}
@@ -749,14 +772,14 @@
{
// Synchronized on the module manager to make sure that no
// modules are added, removed, or resolved.
- synchronized (m_factory)
+ synchronized (this.m_factory)
{
PackageSource[] candidates = m_emptySources;
if (req.getNamespace().equals(ICapability.PACKAGE_NAMESPACE) &&
(((Requirement) req).getPackageName() != null))
{
String pkgName = ((Requirement) req).getPackageName();
- IModule[] modules = (IModule[]) m_inUsePkgIndexMap.get(pkgName);
+ IModule[] modules = (IModule[]) this.m_inUsePkgIndexMap.get(pkgName);
for (int modIdx = 0; (modules != null) && (modIdx < modules.length); modIdx++)
{
ICapability inUseCap = Util.getSatisfyingCapability(modules[modIdx], req);
@@ -768,7 +791,7 @@
new PackagePermission(pkgName,
PackagePermission.EXPORT)))
{
- m_logger.log(Logger.LOG_DEBUG,
+ this.m_logger.log(Logger.LOG_DEBUG,
"PackagePermission.EXPORT denied for "
+ pkgName
+ "from " + modules[modIdx].getId());
@@ -786,7 +809,7 @@
}
else
{
- Iterator i = m_inUseCapMap.entrySet().iterator();
+ Iterator i = this.m_inUseCapMap.entrySet().iterator();
while (i.hasNext())
{
Map.Entry entry = (Map.Entry) i.next();
@@ -804,7 +827,7 @@
(String) inUseCaps[capIdx].getProperties().get(ICapability.PACKAGE_PROPERTY),
PackagePermission.EXPORT)))
{
- m_logger.log(Logger.LOG_DEBUG,
+ this.m_logger.log(Logger.LOG_DEBUG,
"PackagePermission.EXPORT denied for "
+ inUseCaps[capIdx].getProperties().get(ICapability.PACKAGE_PROPERTY)
+ "from " + module.getId());
@@ -827,7 +850,7 @@
private boolean isCapabilityInUse(IModule module, ICapability cap)
{
- ICapability[] caps = (ICapability[]) m_inUseCapMap.get(module);
+ ICapability[] caps = (ICapability[]) this.m_inUseCapMap.get(module);
for (int i = 0; (caps != null) && (i < caps.length); i++)
{
if (caps[i].equals(cap))
@@ -842,18 +865,18 @@
{
// Synchronized on the module manager to make sure that no
// modules are added, removed, or resolved.
- synchronized (m_factory)
+ synchronized (this.m_factory)
{
// Get all modules.
IModule[] modules = null;
if (req.getNamespace().equals(ICapability.PACKAGE_NAMESPACE) &&
(((Requirement) req).getPackageName() != null))
{
- modules = (IModule[]) m_availPkgIndexMap.get(((Requirement) req).getPackageName());
+ modules = (IModule[]) this.m_availPkgIndexMap.get(((Requirement) req).getPackageName());
}
else
{
- modules = m_factory.getModules();
+ modules = this.m_factory.getModules();
}
// Create list of compatible providers.
@@ -864,7 +887,7 @@
ICapability cap = Util.getSatisfyingCapability(modules[modIdx], req);
// If compatible and it is not currently used, then add
// the available candidate to the list.
- if ((cap != null) && !isCapabilityInUse(modules[modIdx], cap))
+ if ((cap != null) && !this.isCapabilityInUse(modules[modIdx], cap))
{
PackageSource[] tmp = new PackageSource[candidates.length + 1];
System.arraycopy(candidates, 0, tmp, 0, candidates.length);
@@ -881,7 +904,7 @@
throws ResolveException
{
// If the module is already resolved, then we can just return.
- if (isResolved(rootModule))
+ if (this.isResolved(rootModule))
{
return;
}
@@ -901,7 +924,7 @@
// Synchronize on the module manager, because we don't want
// any modules being added or removed while we are in the
// middle of this operation.
- synchronized (m_factory)
+ synchronized (this.m_factory)
{
// The first step is to populate the candidates map. This
// will use the target module to populate the candidates map
@@ -914,7 +937,7 @@
// this map will be resolved, only the target module and
// any candidates selected to resolve its requirements and the
// transitive requirements this implies.
- populateCandidatesMap(candidatesMap, rootModule);
+ this.populateCandidatesMap(candidatesMap, rootModule);
// The next step is to use the candidates map to determine if
// the class space for the root module is consistent. This
@@ -926,7 +949,7 @@
// a consistent set of candidates; otherwise, a resolve exception
// is thrown if it exhausts all possible combinations and could
// not find a consistent class space.
- findConsistentClassSpace(candidatesMap, rootModule);
+ this.findConsistentClassSpace(candidatesMap, rootModule);
// The final step is to create the wires for the root module and
// transitively all modules that are to be resolved from the
@@ -936,7 +959,7 @@
// to fire resolved events outside of the synchronized block.
// The resolved module wire map maps a module to its array of
// wires.
- resolvedModuleWireMap = createWires(candidatesMap, rootModule);
+ resolvedModuleWireMap = this.createWires(candidatesMap, rootModule);
//dumpUsedPackages();
} // End of synchronized block on module manager.
@@ -949,7 +972,7 @@
Iterator iter = resolvedModuleWireMap.entrySet().iterator();
while (iter.hasNext())
{
- fireModuleResolved((IModule) ((Map.Entry) iter.next()).getKey());
+ this.fireModuleResolved((IModule) ((Map.Entry) iter.next()).getKey());
}
}
}
@@ -981,8 +1004,8 @@
// package maps. Candidates "in use" have higher priority
// than "available" ones, so put the "in use" candidates
// at the front of the list of candidates.
- PackageSource[] inuse = getInUseCandidates(reqs[reqIdx]);
- PackageSource[] available = getUnusedCandidates(reqs[reqIdx]);
+ PackageSource[] inuse = this.getInUseCandidates(reqs[reqIdx]);
+ PackageSource[] available = this.getUnusedCandidates(reqs[reqIdx]);
PackageSource[] candidates = new PackageSource[inuse.length + available.length];
System.arraycopy(inuse, 0, candidates, 0, inuse.length);
System.arraycopy(available, 0, candidates, inuse.length, available.length);
@@ -998,9 +1021,9 @@
{
// Only populate the resolver map with modules that
// are not already resolved.
- if (!isResolved(candidates[candIdx].m_module))
+ if (!this.isResolved(candidates[candIdx].m_module))
{
- populateCandidatesMap(candidatesMap, candidates[candIdx].m_module);
+ this.populateCandidatesMap(candidatesMap, candidates[candIdx].m_module);
}
}
catch (ResolveException ex)
@@ -1052,7 +1075,7 @@
synchronized (this)
{
System.out.println("PACKAGES IN USE MAP:");
- for (Iterator i = m_inUseCapMap.entrySet().iterator(); i.hasNext(); )
+ for (Iterator i = this.m_inUseCapMap.entrySet().iterator(); i.hasNext(); )
{
Map.Entry entry = (Map.Entry) i.next();
ICapability[] caps = (ICapability[]) entry.getValue();
@@ -1096,7 +1119,7 @@
// Test the current potential candidates to determine if they
// are consistent. Keep looping until we find a consistent
// set or an exception is thrown.
- while (!isClassSpaceConsistent(rootModule, moduleMap, cycleMap, candidatesMap))
+ while (!this.isClassSpaceConsistent(rootModule, moduleMap, cycleMap, candidatesMap))
{
// The incrementCandidateConfiguration() method requires
// ordered access to the candidates map, so we will create
@@ -1107,12 +1130,12 @@
for (Iterator iter = candidatesMap.entrySet().iterator();
iter.hasNext(); )
{
- candidatesList.add((List) ((Map.Entry) iter.next()).getValue());
+ candidatesList.add(((Map.Entry) iter.next()).getValue());
}
}
// Increment the candidate configuration so we can test again.
- incrementCandidateConfiguration(candidatesList);
+ this.incrementCandidateConfiguration(candidatesList);
// Clear the module map.
moduleMap.clear();
@@ -1141,11 +1164,11 @@
Map pkgMap = null;
try
{
- pkgMap = getModulePackages(moduleMap, targetModule, candidatesMap);
+ pkgMap = this.getModulePackages(moduleMap, targetModule, candidatesMap);
}
catch (ResolveException ex)
{
- m_logger.log(
+ this.m_logger.log(
Logger.LOG_DEBUG,
"Constraint violation for " + targetModule + " detected.",
ex);
@@ -1164,7 +1187,7 @@
for (int srcIdx = 0; srcIdx < rp.m_sourceList.size(); srcIdx++)
{
PackageSource ps = (PackageSource) rp.m_sourceList.get(srcIdx);
- if (!isClassSpaceConsistent(ps.m_module, moduleMap, cycleMap, candidatesMap))
+ if (!this.isClassSpaceConsistent(ps.m_module, moduleMap, cycleMap, candidatesMap))
{
return false;
}
@@ -1176,11 +1199,11 @@
Map usesMap = null;
try
{
- usesMap = calculateUsesConstraints(targetModule, moduleMap, candidatesMap);
+ usesMap = this.calculateUsesConstraints(targetModule, moduleMap, candidatesMap);
}
catch (ResolveException ex)
{
- m_logger.log(
+ this.m_logger.log(
Logger.LOG_DEBUG,
"Constraint violation for " + targetModule + " detected.",
ex);
@@ -1231,7 +1254,7 @@
}
else
{
- m_logger.log(
+ this.m_logger.log(
Logger.LOG_DEBUG,
"Constraint violation for " + targetModule
+ " detected; module can see "
@@ -1261,7 +1284,7 @@
Map cycleMap = new HashMap();
// Get all packages accessible by the target module.
- Map pkgMap = getModulePackages(moduleMap, targetModule, candidatesMap);
+ Map pkgMap = this.getModulePackages(moduleMap, targetModule, candidatesMap);
// Each package accessible from the target module is potentially
// comprised of one or more modules, called package sources. The
@@ -1274,7 +1297,7 @@
ResolvedPackage rp = (ResolvedPackage) entry.getValue();
for (int srcIdx = 0; srcIdx < rp.m_sourceList.size(); srcIdx++)
{
- usesMap = calculateUsesConstraints(
+ usesMap = this.calculateUsesConstraints(
(PackageSource) rp.m_sourceList.get(srcIdx),
moduleMap, usesMap, cycleMap, candidatesMap);
}
@@ -1299,7 +1322,7 @@
// Get all packages accessible from the module of the
// target package source.
- Map pkgMap = getModulePackages(moduleMap, psTarget.m_module, candidatesMap);
+ Map pkgMap = this.getModulePackages(moduleMap, psTarget.m_module, candidatesMap);
// Get capability (i.e., package) of the target package source.
Capability cap = (Capability) psTarget.m_capability;
@@ -1322,7 +1345,7 @@
// and combine the "uses" constraints for each package source.
for (int srcIdx = 0; srcIdx < rp.m_sourceList.size(); srcIdx++)
{
- usesMap = calculateUsesConstraints(
+ usesMap = this.calculateUsesConstraints(
(PackageSource) rp.m_sourceList.get(srcIdx),
moduleMap, usesMap, cycleMap, candidatesMap);
}
@@ -1350,7 +1373,7 @@
if (map == null)
{
- map = calculateModulePackages(module, candidatesMap);
+ map = this.calculateModulePackages(module, candidatesMap);
moduleMap.put(module, map);
//if (!module.getId().equals("0"))
//{
@@ -1379,9 +1402,9 @@
throws ResolveException
{
//System.out.println("calculateModulePackages("+module+")");
- Map importedPackages = calculateImportedPackages(module, candidatesMap);
- Map exportedPackages = calculateExportedPackages(module);
- Map requiredPackages = calculateRequiredPackages(module, candidatesMap);
+ Map importedPackages = this.calculateImportedPackages(module, candidatesMap);
+ Map exportedPackages = this.calculateExportedPackages(module);
+ Map requiredPackages = this.calculateRequiredPackages(module, candidatesMap);
// Merge exported packages into required packages. If a package is both
// exported and required, then append the exported source to the end of
@@ -1418,8 +1441,8 @@
throws ResolveException
{
return (candidatesMap.get(targetModule) == null)
- ? calculateImportedPackagesResolved(targetModule)
- : calculateImportedPackagesUnresolved(targetModule, candidatesMap);
+ ? this.calculateImportedPackagesResolved(targetModule)
+ : this.calculateImportedPackagesUnresolved(targetModule, candidatesMap);
}
private Map calculateImportedPackagesUnresolved(IModule targetModule, Map candidatesMap)
@@ -1455,7 +1478,7 @@
// of our imported package, unless we are the provider.
if (!targetModule.equals(ps.m_module))
{
- Map implicitPkgMap = calculateImplicitImportedPackages(
+ Map implicitPkgMap = this.calculateImplicitImportedPackages(
ps.m_module, ps.m_capability, candidatesMap, new HashMap());
// Merge the implicitly imported packages with our imports and
// verify that there is no overlap.
@@ -1513,7 +1536,7 @@
// of our imported package, unless we are the provider.
if (!targetModule.equals(wires[wireIdx].getExporter()))
{
- Map implicitPkgMap = calculateImplicitImportedPackagesResolved(
+ Map implicitPkgMap = this.calculateImplicitImportedPackagesResolved(
wires[wireIdx].getExporter(), wires[wireIdx].getCapability(), new HashMap());
// Merge the implicitly imported packages with our imports.
// No need to verify overlap since this is resolved and should
@@ -1535,10 +1558,10 @@
Map candidatesMap, Map cycleMap)
{
return (candidatesMap.get(targetModule) == null)
- ? calculateImplicitImportedPackagesResolved(
+ ? this.calculateImplicitImportedPackagesResolved(
targetModule, targetCapability, cycleMap)
- : calculateImplicitImportedPackagesUnresolved(
- targetModule, targetCapability, candidatesMap, cycleMap);
+ : this.calculateImplicitImportedPackagesUnresolved(
+ targetModule, targetCapability, candidatesMap, cycleMap);
}
// TODO: EXPERIMENTAL - This is currently not defined recursively, but it should be.
@@ -1614,11 +1637,11 @@
{
Map cycleMap = new HashMap();
cycleMap.put(module, module);
- return calculateImplicitImportedPackages(
+ return this.calculateImplicitImportedPackages(
psTarget.m_module, psTarget.m_capability, candidatesMap, cycleMap);
}
- return null;
+ return null;
}
private Map calculateExportedPackages(IModule targetModule)
@@ -1648,8 +1671,8 @@
private Map calculateRequiredPackages(IModule targetModule, Map candidatesMap)
{
return (candidatesMap.get(targetModule) == null)
- ? calculateRequiredPackagesResolved(targetModule)
- : calculateRequiredPackagesUnresolved(targetModule, candidatesMap);
+ ? this.calculateRequiredPackagesResolved(targetModule)
+ : this.calculateRequiredPackagesUnresolved(targetModule, candidatesMap);
}
private Map calculateRequiredPackagesUnresolved(IModule targetModule, Map candidatesMap)
@@ -1672,7 +1695,7 @@
Map cycleMap = new HashMap();
cycleMap.put(targetModule, targetModule);
Map requireMap =
- calculateExportedAndReexportedPackages(
+ this.calculateExportedAndReexportedPackages(
ps, candidatesMap, cycleMap);
// Take the flattened required package map for the current
@@ -1720,7 +1743,7 @@
Map cycleMap = new HashMap();
cycleMap.put(targetModule, targetModule);
Map requireMap =
- calculateExportedAndReexportedPackagesResolved(
+ this.calculateExportedAndReexportedPackagesResolved(
wires[i].getExporter(), cycleMap);
// Take the flattened required package map for the current
@@ -1752,8 +1775,8 @@
PackageSource psTarget, Map candidatesMap, Map cycleMap)
{
return (candidatesMap.get(psTarget.m_module) == null)
- ? calculateExportedAndReexportedPackagesResolved(psTarget.m_module, cycleMap)
- : calculateExportedAndReexportedPackagesUnresolved(psTarget, candidatesMap, cycleMap);
+ ? this.calculateExportedAndReexportedPackagesResolved(psTarget.m_module, cycleMap)
+ : this.calculateExportedAndReexportedPackagesUnresolved(psTarget, candidatesMap, cycleMap);
}
private Map calculateExportedAndReexportedPackagesUnresolved(
@@ -1800,7 +1823,7 @@
// Recursively calculate the required packages for the
// current candidate.
- Map requiredMap = calculateExportedAndReexportedPackages(ps, candidatesMap, cycleMap);
+ Map requiredMap = this.calculateExportedAndReexportedPackages(ps, candidatesMap, cycleMap);
// Merge the candidate's exported and required packages
// into the complete set of required packages.
@@ -1916,7 +1939,7 @@
// Recursively calculate the required packages for the
// wire's exporting module.
- Map requiredMap = calculateExportedAndReexportedPackagesResolved(wires[i].getExporter(), cycleMap);
+ Map requiredMap = this.calculateExportedAndReexportedPackagesResolved(wires[i].getExporter(), cycleMap);
// Merge the wires exported and re-exported packages
// into the complete set of required packages.
@@ -1997,7 +2020,7 @@
//System.out.println("calculateCandidateRequiredPackages("+module+")");
Map cycleMap = new HashMap();
cycleMap.put(module, module);
- return calculateExportedAndReexportedPackages(psTarget, candidatesMap, cycleMap);
+ return this.calculateExportedAndReexportedPackages(psTarget, candidatesMap, cycleMap);
}
private void incrementCandidateConfiguration(List resolverList)
@@ -2032,7 +2055,7 @@
private Map createWires(Map candidatesMap, IModule rootModule)
{
Map resolvedModuleWireMap =
- populateWireMap(candidatesMap, rootModule, new HashMap());
+ this.populateWireMap(candidatesMap, rootModule, new HashMap());
Iterator iter = resolvedModuleWireMap.entrySet().iterator();
while (iter.hasNext())
{
@@ -2041,7 +2064,7 @@
IWire[] wires = (IWire[]) entry.getValue();
// Set the module's resolved and wiring attribute.
- setResolved(module, true);
+ this.setResolved(module, true);
// Only add wires attribute if some exist; export
// only modules may not have wires.
if (wires.length > 0)
@@ -2056,11 +2079,11 @@
(wires != null) && (wireIdx < wires.length);
wireIdx++)
{
-m_logger.log(Logger.LOG_DEBUG, "WIRE: " + wires[wireIdx]);
+this.m_logger.log(Logger.LOG_DEBUG, "WIRE: " + wires[wireIdx]);
// Add the exporter module of the wire to the "in use" capability map.
- ICapability[] inUseCaps = (ICapability[]) m_inUseCapMap.get(wires[wireIdx].getExporter());
+ ICapability[] inUseCaps = (ICapability[]) this.m_inUseCapMap.get(wires[wireIdx].getExporter());
inUseCaps = addCapabilityToArray(inUseCaps, wires[wireIdx].getCapability());
- m_inUseCapMap.put(wires[wireIdx].getExporter(), inUseCaps);
+ this.m_inUseCapMap.put(wires[wireIdx].getExporter(), inUseCaps);
// If the capability is a package, then add the exporter module
// of the wire to the "in use" package index and remove it
@@ -2071,15 +2094,15 @@
String pkgName = (String)
wires[wireIdx].getCapability().getProperties().get(ICapability.PACKAGE_PROPERTY);
// Add to "in use" package index.
- indexPackageCapability(
- m_inUsePkgIndexMap,
+ this.indexPackageCapability(
+ this.m_inUsePkgIndexMap,
wires[wireIdx].getExporter(),
wires[wireIdx].getCapability());
// Remove from "available" package index.
- m_availPkgIndexMap.put(
+ this.m_availPkgIndexMap.put(
pkgName,
removeModuleFromArray(
- (IModule[]) m_availPkgIndexMap.get(pkgName),
+ (IModule[]) this.m_availPkgIndexMap.get(pkgName),
wires[wireIdx].getExporter()));
}
}
@@ -2107,9 +2130,9 @@
}
if (!matched)
{
- ICapability[] inUseCaps = (ICapability[]) m_inUseCapMap.get(module);
+ ICapability[] inUseCaps = (ICapability[]) this.m_inUseCapMap.get(module);
inUseCaps = addCapabilityToArray(inUseCaps, caps[capIdx]);
- m_inUseCapMap.put(module, inUseCaps);
+ this.m_inUseCapMap.put(module, inUseCaps);
// If the capability is a package, then add the exporter module
// of the wire to the "in use" package index and remove it
@@ -2120,15 +2143,15 @@
String pkgName = (String)
caps[capIdx].getProperties().get(ICapability.PACKAGE_PROPERTY);
// Add to "in use" package index.
- indexPackageCapability(
- m_inUsePkgIndexMap,
+ this.indexPackageCapability(
+ this.m_inUsePkgIndexMap,
module,
caps[capIdx]);
// Remove from "available" package index.
- m_availPkgIndexMap.put(
+ this.m_availPkgIndexMap.put(
pkgName,
removeModuleFromArray(
- (IModule[]) m_availPkgIndexMap.get(pkgName),
+ (IModule[]) this.m_availPkgIndexMap.get(pkgName),
module));
}
}
@@ -2142,7 +2165,7 @@
{
// If the module is already resolved or it is part of
// a cycle, then just return the wire map.
- if (isResolved(importer) || (wireMap.get(importer) != null))
+ if (this.isResolved(importer) || (wireMap.get(importer) != null))
{
return wireMap;
}
@@ -2172,7 +2195,7 @@
cs.m_requirement,
cs.m_candidates[cs.m_idx].m_module,
cs.m_candidates[cs.m_idx].m_capability,
- calculateCandidateRequiredPackages(importer, cs.m_candidates[cs.m_idx], candidatesMap)));
+ this.calculateCandidateRequiredPackages(importer, cs.m_candidates[cs.m_idx], candidatesMap)));
}
else
{
@@ -2183,11 +2206,11 @@
cs.m_candidates[cs.m_idx].m_module,
cs.m_candidates[cs.m_idx].m_capability));
- // TODO: EXPERIMENTAL - The following is part of an experimental
+ // TODO: EXPERIMENTAL - The following is part of an experimental
// implicit imported wire concept. The above code is how
// the wire should normally be created.
// Add wires for any implicitly imported package from provider.
- Map pkgMap = calculateCandidateImplicitImportedPackages(
+ Map pkgMap = this.calculateCandidateImplicitImportedPackages(
importer, cs.m_candidates[cs.m_idx], candidatesMap);
if (pkgMap != null)
{
@@ -2205,7 +2228,7 @@
}
// Create any necessary wires for the selected candidate module.
- wireMap = populateWireMap(
+ wireMap = this.populateWireMap(
candidatesMap, cs.m_candidates[cs.m_idx].m_module, wireMap);
}
@@ -2237,9 +2260,9 @@
synchronized (m_emptyListeners)
{
// If we have no listeners, then just add the new listener.
- if (m_listeners == m_emptyListeners)
+ if (this.m_listeners == m_emptyListeners)
{
- m_listeners = new ResolveListener[] { l };
+ this.m_listeners = new ResolveListener[] { l };
}
// Otherwise, we need to do some array copying.
// Notice, the old array is always valid, so if
@@ -2248,10 +2271,10 @@
// and is not affected by the new value.
else
{
- ResolveListener[] newList = new ResolveListener[m_listeners.length + 1];
- System.arraycopy(m_listeners, 0, newList, 0, m_listeners.length);
- newList[m_listeners.length] = l;
- m_listeners = newList;
+ ResolveListener[] newList = new ResolveListener[this.m_listeners.length + 1];
+ System.arraycopy(this.m_listeners, 0, newList, 0, this.m_listeners.length);
+ newList[this.m_listeners.length] = l;
+ this.m_listeners = newList;
}
}
}
@@ -2273,9 +2296,9 @@
{
// Try to find the instance in our list.
int idx = -1;
- for (int i = 0; i < m_listeners.length; i++)
+ for (int i = 0; i < this.m_listeners.length; i++)
{
- if (m_listeners[i].equals(l))
+ if (this.m_listeners[i].equals(l))
{
idx = i;
break;
@@ -2286,9 +2309,9 @@
if (idx >= 0)
{
// If this is the last listener, then point to empty list.
- if (m_listeners.length == 1)
+ if (this.m_listeners.length == 1)
{
- m_listeners = m_emptyListeners;
+ this.m_listeners = m_emptyListeners;
}
// Otherwise, we need to do some array copying.
// Notice, the old array is always valid, so if
@@ -2297,14 +2320,14 @@
// and is not affected by the new value.
else
{
- ResolveListener[] newList = new ResolveListener[m_listeners.length - 1];
- System.arraycopy(m_listeners, 0, newList, 0, idx);
+ ResolveListener[] newList = new ResolveListener[this.m_listeners.length - 1];
+ System.arraycopy(this.m_listeners, 0, newList, 0, idx);
if (idx < newList.length)
{
- System.arraycopy(m_listeners, idx + 1, newList, idx,
+ System.arraycopy(this.m_listeners, idx + 1, newList, idx,
newList.length - idx);
}
- m_listeners = newList;
+ this.m_listeners = newList;
}
}
}
@@ -2321,7 +2344,7 @@
// Get a copy of the listener array, which is guaranteed
// to not be null.
- ResolveListener[] listeners = m_listeners;
+ ResolveListener[] listeners = this.m_listeners;
// Loop through listeners and fire events.
for (int i = 0; i < listeners.length; i++)
@@ -2329,7 +2352,7 @@
// Lazily create event.
if (event == null)
{
- event = new ModuleEvent(m_factory, module);
+ event = new ModuleEvent(this.m_factory, module);
}
listeners[i].moduleResolved(event);
}
@@ -2347,7 +2370,7 @@
// Get a copy of the listener array, which is guaranteed
// to not be null.
- ResolveListener[] listeners = m_listeners;
+ ResolveListener[] listeners = this.m_listeners;
// Loop through listeners and fire events.
for (int i = 0; i < listeners.length; i++)
@@ -2355,7 +2378,7 @@
// Lazily create event.
if (event == null)
{
- event = new ModuleEvent(m_factory, module);
+ event = new ModuleEvent(this.m_factory, module);
}
listeners[i].moduleUnresolved(event);
}
@@ -2367,7 +2390,7 @@
public void moduleAdded(ModuleEvent event)
{
- synchronized (m_factory)
+ synchronized (this.m_factory)
{
// When a module is added, create an aggregated list of available
// exports to simplify later processing when resolving bundles.
@@ -2379,7 +2402,7 @@
{
if (caps[i].getNamespace().equals(ICapability.PACKAGE_NAMESPACE))
{
- indexPackageCapability(m_availPkgIndexMap, module, caps[i]);
+ this.indexPackageCapability(this.m_availPkgIndexMap, module, caps[i]);
}
}
}
@@ -2393,7 +2416,7 @@
// Synchronize on the module manager, since we don't want any
// bundles to be installed or removed.
- synchronized (m_factory)
+ synchronized (this.m_factory)
{
// Remove exports from package maps.
ICapability[] caps = event.getModule().getDefinition().getCapabilities();
@@ -2405,19 +2428,19 @@
String pkgName = (String)
caps[i].getProperties().get(ICapability.PACKAGE_PROPERTY);
// Remove from "available" package map.
- IModule[] modules = (IModule[]) m_availPkgIndexMap.get(pkgName);
+ IModule[] modules = (IModule[]) this.m_availPkgIndexMap.get(pkgName);
if (modules != null)
{
modules = removeModuleFromArray(modules, event.getModule());
- m_availPkgIndexMap.put(pkgName, modules);
+ this.m_availPkgIndexMap.put(pkgName, modules);
}
// Remove from "in use" package map.
- modules = (IModule[]) m_inUsePkgIndexMap.get(pkgName);
+ modules = (IModule[]) this.m_inUsePkgIndexMap.get(pkgName);
if (modules != null)
{
modules = removeModuleFromArray(modules, event.getModule());
- m_inUsePkgIndexMap.put(pkgName, modules);
+ this.m_inUsePkgIndexMap.put(pkgName, modules);
}
}
}
@@ -2427,9 +2450,9 @@
((ModuleImpl) event.getModule()).setWires(null);
// Remove the module from the "in use" map.
// TODO: RB - Maybe this can be merged with ModuleData.
- m_inUseCapMap.remove(event.getModule());
+ this.m_inUseCapMap.remove(event.getModule());
// Finally, remove module data.
- m_moduleDataMap.remove(event.getModule());
+ this.m_moduleDataMap.remove(event.getModule());
}
}
@@ -2652,7 +2675,7 @@
public boolean m_resolved = false;
public ModuleData(IModule module)
{
- m_module = module;
+ this.m_module = module;
}
}
@@ -2665,12 +2688,12 @@
public boolean m_visited = false;
public CandidateSet(IModule module, IRequirement requirement, PackageSource[] candidates)
{
- m_module = module;
- m_requirement = requirement;
- m_candidates = candidates;
- if (isResolved(m_module))
+ this.m_module = module;
+ this.m_requirement = requirement;
+ this.m_candidates = candidates;
+ if (R4SearchPolicyCore.this.isResolved(this.m_module))
{
- m_visited = true;
+ this.m_visited = true;
}
}
}
@@ -2689,17 +2712,17 @@
public PackageSource(IModule module, ICapability capability)
{
- m_module = module;
- m_capability = capability;
+ this.m_module = module;
+ this.m_capability = capability;
}
public int compareTo(Object o)
{
PackageSource ps = (PackageSource) o;
- if (m_capability.getNamespace().equals(ICapability.PACKAGE_NAMESPACE))
+ if (this.m_capability.getNamespace().equals(ICapability.PACKAGE_NAMESPACE))
{
- Version thisVersion = ((Capability) m_capability).getPackageVersion();
+ Version thisVersion = ((Capability) this.m_capability).getPackageVersion();
Version version = ((Capability) ps.m_capability).getPackageVersion();
// Sort in reverse version order.
@@ -2715,7 +2738,7 @@
else
{
// Sort further by ascending bundle ID.
- long thisId = Util.getBundleIdFromModuleId(m_module.getId());
+ long thisId = Util.getBundleIdFromModuleId(this.m_module.getId());
long id = Util.getBundleIdFromModuleId(ps.m_module.getId());
if (thisId < id)
{
@@ -2738,8 +2761,8 @@
{
final int PRIME = 31;
int result = 1;
- result = PRIME * result + ((m_capability == null) ? 0 : m_capability.hashCode());
- result = PRIME * result + ((m_module == null) ? 0 : m_module.hashCode());
+ result = PRIME * result + ((this.m_capability == null) ? 0 : this.m_capability.hashCode());
+ result = PRIME * result + ((this.m_module == null) ? 0 : this.m_module.hashCode());
return result;
}
@@ -2753,12 +2776,12 @@
{
return false;
}
- if (getClass() != o.getClass())
+ if (this.getClass() != o.getClass())
{
return false;
}
PackageSource ps = (PackageSource) o;
- return (m_module.equals(ps.m_module) && (m_capability == ps.m_capability));
+ return (this.m_module.equals(ps.m_module) && (this.m_capability == ps.m_capability));
}
}
@@ -2776,28 +2799,28 @@
public ResolvedPackage(String name)
{
- m_name = name;
+ this.m_name = name;
}
public boolean isSubset(ResolvedPackage rp)
{
- if (m_sourceList.size() > rp.m_sourceList.size())
+ if (this.m_sourceList.size() > rp.m_sourceList.size())
{
return false;
}
- else if (!m_name.equals(rp.m_name))
+ else if (!this.m_name.equals(rp.m_name))
{
return false;
}
// Determine if the target set of source modules is a subset.
- return rp.m_sourceList.containsAll(m_sourceList);
+ return rp.m_sourceList.containsAll(this.m_sourceList);
}
public Object clone()
{
- ResolvedPackage rp = new ResolvedPackage(m_name);
- rp.m_sourceList.addAll(m_sourceList);
+ ResolvedPackage rp = new ResolvedPackage(this.m_name);
+ rp.m_sourceList.addAll(this.m_sourceList);
return rp;
}
@@ -2807,28 +2830,28 @@
// package sources and maintaining ordering.
for (int srcIdx = 0; srcIdx < rp.m_sourceList.size(); srcIdx++)
{
- if (!m_sourceList.contains(rp.m_sourceList.get(srcIdx)))
+ if (!this.m_sourceList.contains(rp.m_sourceList.get(srcIdx)))
{
- m_sourceList.add(rp.m_sourceList.get(srcIdx));
+ this.m_sourceList.add(rp.m_sourceList.get(srcIdx));
}
}
}
public String toString()
{
- return toString("", new StringBuffer()).toString();
+ return this.toString("", new StringBuffer()).toString();
}
public StringBuffer toString(String padding, StringBuffer sb)
{
sb.append(padding);
- sb.append(m_name);
+ sb.append(this.m_name);
sb.append(" from [");
- for (int i = 0; i < m_sourceList.size(); i++)
+ for (int i = 0; i < this.m_sourceList.size(); i++)
{
- PackageSource ps = (PackageSource) m_sourceList.get(i);
+ PackageSource ps = (PackageSource) this.m_sourceList.get(i);
sb.append(ps.m_module);
- if ((i + 1) < m_sourceList.size())
+ if ((i + 1) < this.m_sourceList.size())
{
sb.append(", ");
}
@@ -2951,9 +2974,9 @@
if (imp != null)
{
// Try to see if there is an exporter available.
- PackageSource[] exporters = getInUseCandidates(imp);
+ PackageSource[] exporters = this.getInUseCandidates(imp);
exporters = (exporters.length == 0)
- ? getUnusedCandidates(imp) : exporters;
+ ? this.getUnusedCandidates(imp) : exporters;
// An exporter might be available, but it may have attributes
// that do not match the importer's required attributes, so
@@ -2965,9 +2988,9 @@
{
IRequirement pkgReq = new Requirement(
ICapability.PACKAGE_NAMESPACE, "(package=" + pkgName + ")");
- exporters = getInUseCandidates(pkgReq);
+ exporters = this.getInUseCandidates(pkgReq);
exporters = (exporters.length == 0)
- ? getUnusedCandidates(pkgReq) : exporters;
+ ? this.getUnusedCandidates(pkgReq) : exporters;
}
catch (InvalidSyntaxException ex)
{
@@ -3016,14 +3039,14 @@
{
// This should never happen.
}
- PackageSource[] exporters = getInUseCandidates(pkgReq);
- exporters = (exporters.length == 0) ? getUnusedCandidates(pkgReq) : exporters;
+ PackageSource[] exporters = this.getInUseCandidates(pkgReq);
+ exporters = (exporters.length == 0) ? this.getUnusedCandidates(pkgReq) : exporters;
if (exporters.length > 0)
{
boolean classpath = false;
try
{
- getClass().getClassLoader().loadClass(name);
+ this.getClass().getClassLoader().loadClass(name);
classpath = true;
}
catch (Exception ex)
@@ -3072,7 +3095,7 @@
// class loader.
try
{
- getClass().getClassLoader().loadClass(name);
+ this.getClass().getClassLoader().loadClass(name);
StringBuffer sb = new StringBuffer("*** Package '");
sb.append(pkgName);
diff --git a/framework/src/main/java/org/apache/felix/framework/util/EventDispatcher.java b/framework/src/main/java/org/apache/felix/framework/util/EventDispatcher.java
index 1f97d09..9a7fa9c 100644
--- a/framework/src/main/java/org/apache/felix/framework/util/EventDispatcher.java
+++ b/framework/src/main/java/org/apache/felix/framework/util/EventDispatcher.java
@@ -1,4 +1,4 @@
-/*
+/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -20,11 +20,24 @@
import java.security.AccessController;
import java.security.PrivilegedAction;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.EventListener;
+import java.util.EventObject;
-import org.apache.felix.framework.Felix;
import org.apache.felix.framework.Logger;
-import org.osgi.framework.*;
+import org.osgi.framework.AllServiceListener;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleEvent;
+import org.osgi.framework.BundleListener;
+import org.osgi.framework.Constants;
+import org.osgi.framework.Filter;
+import org.osgi.framework.FrameworkEvent;
+import org.osgi.framework.FrameworkListener;
+import org.osgi.framework.ServiceEvent;
+import org.osgi.framework.ServiceListener;
+import org.osgi.framework.ServicePermission;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.SynchronousBundleListener;
public class EventDispatcher
{
@@ -59,7 +72,7 @@
private EventDispatcher(Logger logger)
{
- m_logger = logger;
+ this.m_logger = logger;
}
public static EventDispatcher start(Logger logger)
@@ -88,7 +101,7 @@
return eventDispatcher;
}
-
+
public static void shutdown()
{
synchronized (m_threadLock)
@@ -105,7 +118,7 @@
{
return;
}
-
+
// Signal dispatch thread.
m_stopping = true;
synchronized (m_requestList)
@@ -124,7 +137,7 @@
{
}
}
-
+
// remove the thread reference
m_thread = null;
}
@@ -145,7 +158,7 @@
// See if we can simply update the listener, if so then
// return immediately.
- if (updateListener(bundle, clazz, l, filter))
+ if (this.updateListener(bundle, clazz, l, filter))
{
return;
}
@@ -158,17 +171,17 @@
if (clazz == FrameworkListener.class)
{
- listeners = m_frameworkListeners;
+ listeners = this.m_frameworkListeners;
}
else if (clazz == BundleListener.class)
{
if (SynchronousBundleListener.class.isInstance(l))
{
- listeners = m_syncBundleListeners;
+ listeners = this.m_syncBundleListeners;
}
else
{
- listeners = m_bundleListeners;
+ listeners = this.m_bundleListeners;
}
}
else if (clazz == ServiceListener.class)
@@ -180,7 +193,7 @@
acc = ((SecurityManager) sm).getSecurityContext();
}
- listeners = m_serviceListeners;
+ listeners = this.m_serviceListeners;
}
else
{
@@ -216,22 +229,22 @@
if (clazz == FrameworkListener.class)
{
- m_frameworkListeners = listeners;
+ this.m_frameworkListeners = listeners;
}
else if (clazz == BundleListener.class)
{
if (SynchronousBundleListener.class.isInstance(l))
{
- m_syncBundleListeners = listeners;
+ this.m_syncBundleListeners = listeners;
}
else
{
- m_bundleListeners = listeners;
+ this.m_bundleListeners = listeners;
}
}
else if (clazz == ServiceListener.class)
{
- m_serviceListeners = listeners;
+ this.m_serviceListeners = listeners;
}
}
}
@@ -256,22 +269,22 @@
if (clazz == FrameworkListener.class)
{
- listeners = m_frameworkListeners;
+ listeners = this.m_frameworkListeners;
}
else if (clazz == BundleListener.class)
{
if (SynchronousBundleListener.class.isInstance(l))
{
- listeners = m_syncBundleListeners;
+ listeners = this.m_syncBundleListeners;
}
else
{
- listeners = m_bundleListeners;
+ listeners = this.m_bundleListeners;
}
}
else if (clazz == ServiceListener.class)
{
- listeners = m_serviceListeners;
+ listeners = this.m_serviceListeners;
}
else
{
@@ -320,22 +333,22 @@
if (clazz == FrameworkListener.class)
{
- m_frameworkListeners = listeners;
+ this.m_frameworkListeners = listeners;
}
else if (clazz == BundleListener.class)
{
if (SynchronousBundleListener.class.isInstance(l))
{
- m_syncBundleListeners = listeners;
+ this.m_syncBundleListeners = listeners;
}
else
{
- m_bundleListeners = listeners;
+ this.m_bundleListeners = listeners;
}
}
else if (clazz == ServiceListener.class)
{
- m_serviceListeners = listeners;
+ this.m_serviceListeners = listeners;
}
}
}
@@ -350,7 +363,7 @@
synchronized (this)
{
// Remove all framework listeners associated with the specified bundle.
- Object[] listeners = m_frameworkListeners;
+ Object[] listeners = this.m_frameworkListeners;
for (int i = listeners.length - LISTENER_ARRAY_INCREMENT;
i >= 0;
i -= LISTENER_ARRAY_INCREMENT)
@@ -362,12 +375,12 @@
{
Class clazz = (Class) listeners[i + LISTENER_CLASS_OFFSET];
EventListener l = (EventListener) listeners[i + LISTENER_OBJECT_OFFSET];
- removeListener(bundle, clazz, l);
+ this.removeListener(bundle, clazz, l);
}
}
// Remove all bundle listeners associated with the specified bundle.
- listeners = m_bundleListeners;
+ listeners = this.m_bundleListeners;
for (int i = listeners.length - LISTENER_ARRAY_INCREMENT;
i >= 0;
i -= LISTENER_ARRAY_INCREMENT)
@@ -379,13 +392,13 @@
{
Class clazz = (Class) listeners[i + LISTENER_CLASS_OFFSET];
EventListener l = (EventListener) listeners[i + LISTENER_OBJECT_OFFSET];
- removeListener(bundle, clazz, l);
+ this.removeListener(bundle, clazz, l);
}
}
// Remove all synchronous bundle listeners associated with
// the specified bundle.
- listeners = m_syncBundleListeners;
+ listeners = this.m_syncBundleListeners;
for (int i = listeners.length - LISTENER_ARRAY_INCREMENT;
i >= 0;
i -= LISTENER_ARRAY_INCREMENT)
@@ -397,12 +410,12 @@
{
Class clazz = (Class) listeners[i + LISTENER_CLASS_OFFSET];
EventListener l = (EventListener) listeners[i + LISTENER_OBJECT_OFFSET];
- removeListener(bundle, clazz, l);
+ this.removeListener(bundle, clazz, l);
}
}
// Remove all service listeners associated with the specified bundle.
- listeners = m_serviceListeners;
+ listeners = this.m_serviceListeners;
for (int i = listeners.length - LISTENER_ARRAY_INCREMENT;
i >= 0;
i -= LISTENER_ARRAY_INCREMENT)
@@ -414,7 +427,7 @@
{
Class clazz = (Class) listeners[i + LISTENER_CLASS_OFFSET];
EventListener l = (EventListener) listeners[i + LISTENER_OBJECT_OFFSET];
- removeListener(bundle, clazz, l);
+ this.removeListener(bundle, clazz, l);
}
}
}
@@ -428,24 +441,24 @@
if (clazz == FrameworkListener.class)
{
- listeners = m_frameworkListeners;
+ listeners = this.m_frameworkListeners;
}
else if (clazz == BundleListener.class)
{
if (SynchronousBundleListener.class.isInstance(l))
{
- listeners = m_syncBundleListeners;
+ listeners = this.m_syncBundleListeners;
}
else
{
- listeners = m_bundleListeners;
+ listeners = this.m_bundleListeners;
}
}
else if (clazz == ServiceListener.class)
{
- listeners = m_serviceListeners;
+ listeners = this.m_serviceListeners;
}
-
+
// See if the listener is already registered, if so then
// handle it according to the spec.
for (int i = 0; i < listeners.length; i += LISTENER_ARRAY_INCREMENT)
@@ -481,11 +494,11 @@
Object[] listeners = null;
synchronized (this)
{
- listeners = m_frameworkListeners;
+ listeners = this.m_frameworkListeners;
}
// Fire all framework listeners on a separate thread.
- fireEventAsynchronously(m_logger, Request.FRAMEWORK_EVENT, listeners, event);
+ this.fireEventAsynchronously(this.m_logger, Request.FRAMEWORK_EVENT, listeners, event);
}
public void fireBundleEvent(BundleEvent event)
@@ -495,12 +508,12 @@
Object[] syncListeners = null;
synchronized (this)
{
- listeners = m_bundleListeners;
- syncListeners = m_syncBundleListeners;
+ listeners = this.m_bundleListeners;
+ syncListeners = this.m_syncBundleListeners;
}
// Fire synchronous bundle listeners immediately on the calling thread.
- fireEventImmediately(m_logger, Request.BUNDLE_EVENT, syncListeners, event);
+ fireEventImmediately(this.m_logger, Request.BUNDLE_EVENT, syncListeners, event);
// The spec says that asynchronous bundle listeners do not get events
// of types STARTING or STOPPING.
@@ -508,7 +521,7 @@
(event.getType() != BundleEvent.STOPPING))
{
// Fire asynchronous bundle listeners on a separate thread.
- fireEventAsynchronously(m_logger, Request.BUNDLE_EVENT, listeners, event);
+ this.fireEventAsynchronously(this.m_logger, Request.BUNDLE_EVENT, listeners, event);
}
}
@@ -518,11 +531,11 @@
Object[] listeners = null;
synchronized (this)
{
- listeners = m_serviceListeners;
+ listeners = this.m_serviceListeners;
}
// Fire all service events immediately on the calling thread.
- fireEventImmediately(m_logger, Request.SERVICE_EVENT, listeners, event);
+ fireEventImmediately(this.m_logger, Request.SERVICE_EVENT, listeners, event);
}
private void fireEventAsynchronously(
@@ -685,7 +698,7 @@
if (objectClass != null)
{
boolean hasPermission = false;
-
+
Object sm = System.getSecurityManager();
if ((acc != null) && (sm != null))
{
@@ -693,15 +706,15 @@
!hasPermission && (i < objectClass.length);
i++)
{
- try
+ try
{
ServicePermission perm =
new ServicePermission(
objectClass[i], ServicePermission.GET);
((SecurityManager) sm).checkPermission(perm, acc);
hasPermission = true;
- }
- catch (Exception ex)
+ }
+ catch (Exception ex)
{
}
}
diff --git a/framework/src/main/java/org/osgi/framework/AdminPermission.java b/framework/src/main/java/org/osgi/framework/AdminPermission.java
index e03a6e8..6cd7b10 100644
--- a/framework/src/main/java/org/osgi/framework/AdminPermission.java
+++ b/framework/src/main/java/org/osgi/framework/AdminPermission.java
@@ -1,4 +1,4 @@
-/*
+/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -18,10 +18,19 @@
*/
package org.osgi.framework;
-import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
-import java.security.*;
-import java.util.*;
+import java.security.AccessController;
+import java.security.BasicPermission;
+import java.security.Permission;
+import java.security.PermissionCollection;
+import java.security.PrivilegedAction;
+import java.util.Collections;
+import java.util.Dictionary;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.StringTokenizer;
import org.apache.felix.framework.FilterImpl;
@@ -83,14 +92,14 @@
public AdminPermission(Bundle bundle, String actions)
{
this(createName(bundle), actions);
- m_bundle = bundle;
+ this.m_bundle = bundle;
}
// This constructor is only used when granting an admin permission.
public AdminPermission(String filter, String actions)
{
super((filter == null) || (filter.equals("*")) ? "(id=*)" : filter);
- m_actionMask = parseActions(actions);
+ this.m_actionMask = parseActions(actions);
}
// This constructor is only used by the admin permission collection
@@ -99,7 +108,7 @@
AdminPermission(String filter, int actionMask)
{
super((filter == null) || (filter.equals("*")) ? "(id=*)" : filter);
- m_actionMask = actionMask;
+ this.m_actionMask = actionMask;
}
public boolean equals(Object obj)
@@ -116,21 +125,21 @@
AdminPermission p = (AdminPermission) obj;
- return getName().equals(p.getName()) && (m_actionMask == p.m_actionMask);
+ return this.getName().equals(p.getName()) && (this.m_actionMask == p.m_actionMask);
}
public int hashCode()
{
- return getName().hashCode() ^ getActions().hashCode();
+ return this.getName().hashCode() ^ this.getActions().hashCode();
}
public String getActions()
{
- if (m_actions == null)
+ if (this.m_actions == null)
{
- m_actions = createActionString(m_actionMask);
+ this.m_actions = createActionString(this.m_actionMask);
}
- return m_actions;
+ return this.m_actions;
}
public boolean implies(Permission p)
@@ -151,7 +160,7 @@
}
// Make sure the action mask is a subset.
- if ((m_actionMask & admin.m_actionMask) != admin.m_actionMask)
+ if ((this.m_actionMask & admin.m_actionMask) != admin.m_actionMask)
{
return false;
}
@@ -161,23 +170,23 @@
// filter is "*".
if (admin.getName().equals("(id=*)"))
{
- return getName().equals("(id=*)");
+ return this.getName().equals("(id=*)");
}
// Next, if this object was create with a "*" we can return true
// (This way we avoid creating and matching a filter).
- if (getName().equals("(id=*)"))
+ if (this.getName().equals("(id=*)"))
{
return true;
}
// Otherwise, see if this permission's filter matches the
// dictionary of the passed in permission.
- if (m_filterImpl == null)
+ if (this.m_filterImpl == null)
{
try
{
- m_filterImpl = new FilterImpl(getName());
+ this.m_filterImpl = new FilterImpl(this.getName());
}
catch (InvalidSyntaxException ex)
{
@@ -185,7 +194,7 @@
}
}
- return m_filterImpl.match(admin.getBundleDictionary());
+ return this.m_filterImpl.match(admin.getBundleDictionary());
}
public PermissionCollection newPermissionCollection()
@@ -195,16 +204,16 @@
private Dictionary getBundleDictionary()
{
- if (m_bundleDict == null)
+ if (this.m_bundleDict == null)
{
// Add bundle properties to dictionary.
- m_bundleDict = new Hashtable();
- m_bundleDict.put("id", new Long(m_bundle.getBundleId()));
+ this.m_bundleDict = new Hashtable();
+ this.m_bundleDict.put("id", new Long(this.m_bundle.getBundleId()));
- String symbolicName = m_bundle.getSymbolicName();
+ String symbolicName = this.m_bundle.getSymbolicName();
if (symbolicName != null)
{
- m_bundleDict.put("name", symbolicName);
+ this.m_bundleDict.put("name", symbolicName);
}
// Add location in privileged block since it performs a security check.
if (System.getSecurityManager() != null)
@@ -213,20 +222,20 @@
{
public Object run()
{
- m_bundleDict.put("location", m_bundle.getLocation());
-
- createSigner(m_bundle, m_bundleDict);
+ AdminPermission.this.m_bundleDict.put("location", AdminPermission.this.m_bundle.getLocation());
+
+ createSigner(AdminPermission.this.m_bundle, AdminPermission.this.m_bundleDict);
return null;
}
});
}
else
{
- m_bundleDict.put("location", m_bundle.getLocation());
- createSigner(m_bundle, m_bundleDict);
+ this.m_bundleDict.put("location", this.m_bundle.getLocation());
+ createSigner(this.m_bundle, this.m_bundleDict);
}
}
- return m_bundleDict;
+ return this.m_bundleDict;
}
private static void createSigner(Bundle bundle, Dictionary dict)
@@ -236,9 +245,9 @@
Method method = bundle.getClass().getDeclaredMethod(
"getSignerMatcher", null);
method.setAccessible(true);
-
+
Object signer = method.invoke(bundle, null);
-
+
if (signer != null)
{
dict.put("signer", signer);
@@ -398,26 +407,26 @@
{
throw new IllegalArgumentException("Invalid permission: " + permission);
}
- else if (isReadOnly())
+ else if (this.isReadOnly())
{
throw new SecurityException(
"Cannot add to read-only permission collection.");
}
AdminPermission admin = (AdminPermission) permission;
- AdminPermission current = (AdminPermission) m_map.get(admin.getName());
+ AdminPermission current = (AdminPermission) this.m_map.get(admin.getName());
if (current != null)
{
if (admin.m_actionMask != current.m_actionMask)
{
- m_map.put(admin.getName(),
+ this.m_map.put(admin.getName(),
new AdminPermission(admin.getName(),
admin.m_actionMask | current.m_actionMask));
}
}
else
{
- m_map.put(admin.getName(), admin);
+ this.m_map.put(admin.getName(), admin);
}
}
@@ -428,7 +437,7 @@
return false;
}
- for (Iterator iter = m_map.values().iterator(); iter.hasNext(); )
+ for (Iterator iter = this.m_map.values().iterator(); iter.hasNext(); )
{
if (((AdminPermission) iter.next()).implies(permission))
{
@@ -441,6 +450,6 @@
public Enumeration elements()
{
- return Collections.enumeration(m_map.values());
+ return Collections.enumeration(this.m_map.values());
}
}
diff --git a/metatype/src/main/java/org/apache/felix/metatype/internal/MetaTypeInformationImpl.java b/metatype/src/main/java/org/apache/felix/metatype/internal/MetaTypeInformationImpl.java
index 3bf1ad1..b3f3c33 100644
--- a/metatype/src/main/java/org/apache/felix/metatype/internal/MetaTypeInformationImpl.java
+++ b/metatype/src/main/java/org/apache/felix/metatype/internal/MetaTypeInformationImpl.java
@@ -1,4 +1,4 @@
-/*
+/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -20,7 +20,6 @@
import java.util.Arrays;
import java.util.Collection;
-import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@@ -41,7 +40,7 @@
* The <code>MetaTypeInformationImpl</code> class implements the
* <code>MetaTypeInformation</code> interface returned from the
* <code>MetaTypeService</code>.
- *
+ *
* @author fmeschbe
*/
public class MetaTypeInformationImpl implements MetaTypeInformation {
@@ -69,68 +68,68 @@
/*
* (non-Javadoc)
- *
+ *
* @see org.osgi.service.metatype.MetaTypeInformation#getBundle()
*/
public Bundle getBundle() {
- return bundle;
+ return this.bundle;
}
/*
* (non-Javadoc)
- *
+ *
* @see org.osgi.service.metatype.MetaTypeInformation#getFactoryPids()
*/
public String[] getFactoryPids() {
- return (String[]) factoryPids.toArray(new String[factoryPids.size()]);
+ return (String[]) this.factoryPids.toArray(new String[this.factoryPids.size()]);
}
/*
* (non-Javadoc)
- *
+ *
* @see org.osgi.service.metatype.MetaTypeInformation#getPids()
*/
public String[] getPids() {
- return (String[]) pids.toArray(new String[pids.size()]);
+ return (String[]) this.pids.toArray(new String[this.pids.size()]);
}
/*
* (non-Javadoc)
- *
+ *
* @see org.osgi.service.metatype.MetaTypeProvider#getLocales()
*/
public String[] getLocales() {
- if (locales == null) {
+ if (this.locales == null) {
synchronized (this) {
Set newLocales = new TreeSet();
- for (Iterator mi = metaTypeProviders.values().iterator(); mi.hasNext();) {
+ for (Iterator mi = this.metaTypeProviders.values().iterator(); mi.hasNext();) {
MetaTypeProvider mtp = (MetaTypeProvider) mi.next();
- addValues(newLocales, mtp.getLocales());
+ this.addValues(newLocales, mtp.getLocales());
}
- locales = newLocales;
+ this.locales = newLocales;
}
}
- return (String[]) locales.toArray(new String[locales.size()]);
+ return (String[]) this.locales.toArray(new String[this.locales.size()]);
}
/*
* (non-Javadoc)
- *
+ *
* @see org.osgi.service.metatype.MetaTypeProvider#getObjectClassDefinition(java.lang.String,
* java.lang.String)
*/
public ObjectClassDefinition getObjectClassDefinition(String id,
String locale) {
- MetaTypeProvider mtp = (MetaTypeProvider) metaTypeProviders.get(id);
+ MetaTypeProvider mtp = (MetaTypeProvider) this.metaTypeProviders.get(id);
return (mtp != null) ? mtp.getObjectClassDefinition(id, locale) : null;
}
-
+
// ---------- internal support for metadata -------------------------------
Designate getDesignate( String pid )
{
- Object mto = metaTypeProviders.get( pid );
+ Object mto = this.metaTypeProviders.get( pid );
if ( mto instanceof DefaultMetaTypeProvider )
{
return ( ( DefaultMetaTypeProvider ) mto ).getDesignate( pid );
@@ -138,14 +137,14 @@
return null;
}
-
+
// ---------- setters to fill the values -----------------------------------
protected void addMetaData(MetaData md) {
if (md.getDesignates() != null) {
// meta type provide to register by PID
- DefaultMetaTypeProvider dmtp = new DefaultMetaTypeProvider(bundle, md);
-
+ DefaultMetaTypeProvider dmtp = new DefaultMetaTypeProvider(this.bundle, md);
+
Iterator designates = md.getDesignates().values().iterator();
while (designates.hasNext()) {
Designate designate = (Designate) designates.next();
@@ -164,19 +163,19 @@
}
// gather pids and factory pids
- pids.add(designate.getPid());
+ this.pids.add(designate.getPid());
if (designate.getFactoryPid() != null) {
- factoryPids.add( designate.getFactoryPid() );
+ this.factoryPids.add( designate.getFactoryPid() );
}
// register a metatype provider for the pid
- addMetaTypeProvider(designate.getPid(), dmtp);
+ this.addMetaTypeProvider(designate.getPid(), dmtp);
}
}
}
protected void addPids(String[] pids) {
- addValues(this.pids, pids);
+ this.addValues(this.pids, pids);
}
protected void removePid(String pid) {
@@ -184,7 +183,7 @@
}
protected void addFactoryPids(String[] factoryPids) {
- addValues(this.factoryPids, factoryPids);
+ this.addValues(this.factoryPids, factoryPids);
}
protected void removeFactoryPid(String factoryPid) {
@@ -193,15 +192,15 @@
protected void addMetaTypeProvider(String key, MetaTypeProvider mtp) {
if (key != null && mtp != null) {
- metaTypeProviders.put(key, mtp);
- locales = null;
+ this.metaTypeProviders.put(key, mtp);
+ this.locales = null;
}
}
protected MetaTypeProvider removeMetaTypeProvider(String key) {
if (key != null) {
- locales = null;
- return (MetaTypeProvider) metaTypeProviders.remove(key);
+ this.locales = null;
+ return (MetaTypeProvider) this.metaTypeProviders.remove(key);
}
return null;