Reformat Equinox code according to the Core formatter settings
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/AutomatedTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/AutomatedTests.java
index dd6ce1e..d42ccc9 100644
--- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/AutomatedTests.java
+++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/AutomatedTests.java
@@ -16,6 +16,7 @@
public class AutomatedTests extends TestCase {
public final static String PI_OSGI_TESTS = "org.eclipse.osgi.tests";
+
/**
* AllTests constructor comment.
* @param name java.lang.String
@@ -23,6 +24,7 @@
public AutomatedTests() {
super(null);
}
+
/**
* AllTests constructor comment.
* @param name java.lang.String
@@ -30,6 +32,7 @@
public AutomatedTests(String name) {
super(name);
}
+
public static Test suite() {
TestSuite suite = new TestSuite(AutomatedTests.class.getName());
suite.addTest(new TestSuite(SimpleTests.class));
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/BundleTestingHelper.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/BundleTestingHelper.java
index 0cebb73..d12eab1 100644
--- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/BundleTestingHelper.java
+++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/BundleTestingHelper.java
@@ -18,7 +18,7 @@
import org.osgi.framework.*;
import org.osgi.service.packageadmin.PackageAdmin;
-public class BundleTestingHelper {
+public class BundleTestingHelper {
private static final String TEST_FILES_ROOT = "test_files";
public static Bundle installBundle(String location) throws BundleException, MalformedURLException, IOException {
@@ -26,6 +26,7 @@
Bundle installed = InternalPlatform.getDefault().getBundleContext().installBundle(Platform.asLocalURL(entry).toExternalForm());
return installed;
}
+
/**
* Do PackageAdmin.refreshPackages() in a synchronous way. After installing
* all the requested bundles we need to do a refresh and want to ensure that
@@ -33,7 +34,7 @@
* @param bundles
*/
//copied from EclipseStarter
- public static void refreshPackages(BundleContext context, Bundle[] bundles) {
+ public static void refreshPackages(BundleContext context, Bundle[] bundles) {
if (bundles.length == 0)
return;
ServiceReference packageAdminRef = context.getServiceReference(PackageAdmin.class.getName());
@@ -70,5 +71,5 @@
context.removeFrameworkListener(listener);
context.ungetService(packageAdminRef);
}
-
+
}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/internal/plugins/InstallTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/internal/plugins/InstallTests.java
index 20b5066..ea3a7b2 100644
--- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/internal/plugins/InstallTests.java
+++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/internal/plugins/InstallTests.java
@@ -53,6 +53,7 @@
installed.uninstall();
}
}
+
public void testInstallLocationWithUnderscores() throws BundleException, IOException {
Bundle installed = null;
installed = BundleTestingHelper.installBundle("internal/plugins/installTests/bundle02_1.0.0");
@@ -64,5 +65,5 @@
// clean-up
installed.uninstall();
}
- }
+ }
}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/internal/state/AbstractStateTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/internal/state/AbstractStateTest.java
index 16f50bf..18b5a2e 100644
--- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/internal/state/AbstractStateTest.java
+++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/internal/state/AbstractStateTest.java
@@ -18,22 +18,27 @@
public abstract class AbstractStateTest extends EclipseWorkspaceTest {
protected PlatformAdmin platformAdmin;
+
protected void setUp() throws Exception {
super.setUp();
platformAdmin = new SimplePlatformAdmin(getRandomLocation().toFile());
}
+
AbstractStateTest(String testName) {
super(testName);
}
+
public static void assertContains(String tag, Object[] array, Object element) {
for (int i = 0; i < array.length; i++)
if (array[i] == element)
return;
fail(tag);
}
+
public static void assertEquals(State original, State copy) {
assertEquals("", original, copy);
}
+
public static void assertEquals(String tag, BundleDescription original, BundleDescription copy) {
assertEquals(tag + ".0", original.getBundleId(), copy.getBundleId());
assertEquals(tag + ".1", original.getUniqueId(), copy.getUniqueId());
@@ -57,6 +62,7 @@
for (int i = 0; i < originalRequiredBundles.length; i++)
assertEquals(tag + ".11." + i, originalRequiredBundles[i], copyRequiredBundles[i]);
}
+
public static void assertEquals(String tag, State original, State copy) {
BundleDescription[] originalBundles = original.getBundles();
BundleDescription[] copyBundles = copy.getBundles();
@@ -70,6 +76,7 @@
for (int i = 0; i < originalResolvedBundles.length; i++)
assertEquals(tag + ".5." + i, originalResolvedBundles[i], copyResolvedBundles[i]);
}
+
public static void assertEquals(String tag, VersionConstraint original, VersionConstraint copy) {
assertEquals(tag + ".0", original == null, copy == null);
if (original == null)
@@ -82,6 +89,7 @@
if (original.getSupplier() != null)
assertEquals(tag + ".6", original.getSupplier().getUniqueId(), copy.getSupplier().getUniqueId());
}
+
public static void assertFullyResolved(String tag, BundleDescription bundle) {
assertTrue(tag + "a", bundle.isResolved());
PackageSpecification[] packages = bundle.getPackages();
@@ -94,6 +102,7 @@
for (int i = 0; i < requiredBundles.length; i++)
assertNotNull(tag + "d_" + i, requiredBundles[i].getSupplier());
}
+
public static void assertFullyUnresolved(String tag, BundleDescription bundle) {
assertFalse(tag + "a", bundle.isResolved());
PackageSpecification[] packages = bundle.getPackages();
@@ -106,11 +115,13 @@
for (int i = 0; i < requiredBundles.length; i++)
assertNull(tag + "d_" + i, requiredBundles[i].getSupplier());
}
+
public static void assertIdentical(String tag, State original, State copy) {
assertEquals(tag + ".0a", original.isResolved(), copy.isResolved());
assertEquals(tag + ".0b", original.getTimeStamp(), copy.getTimeStamp());
assertEquals(tag, original, copy);
}
+
public State buildComplexState() throws BundleException {
State state = buildEmptyState();
/*
@@ -157,11 +168,13 @@
state.addBundle(b6);
return state;
}
+
public State buildEmptyState() {
State state = platformAdmin.getState();
state.setResolver(platformAdmin.getResolver());
return state;
}
+
public State buildInitialState() throws BundleException {
State state = buildEmptyState();
/*
@@ -173,6 +186,7 @@
state.addBundle(b0);
return state;
}
+
public State buildSimpleState() throws BundleException {
State state = buildEmptyState();
/*
@@ -198,6 +212,7 @@
state.addBundle(b3);
return state;
}
+
public static Dictionary parseManifest(String manifest) {
Dictionary entries = new Hashtable();
StringTokenizer tokenizer = new StringTokenizer(manifest, ":\n");
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/internal/state/AllTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/internal/state/AllTests.java
index 7c95476..d5b6253 100644
--- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/internal/state/AllTests.java
+++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/internal/state/AllTests.java
@@ -20,6 +20,7 @@
public AllTests() {
super(null);
}
+
/**
* AllTests constructor comment.
* @param name java.lang.String
@@ -27,11 +28,12 @@
public AllTests(String name) {
super(name);
}
+
public static Test suite() {
TestSuite suite = new TestSuite(AllTests.class.getName());
suite.addTest(PlatformAdminTest.suite());
suite.addTest(StateResolverTest.suite());
return suite;
}
-
-}
+
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/internal/state/PlatformAdminTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/internal/state/PlatformAdminTest.java
index 5116f6b..b27295c 100644
--- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/internal/state/PlatformAdminTest.java
+++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/internal/state/PlatformAdminTest.java
@@ -20,9 +20,11 @@
public static Test suite() {
return new TestSuite(PlatformAdminTest.class);
}
+
public PlatformAdminTest(String name) {
super(name);
}
+
private State storeAndRetrieve(State toStore) throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(baos);
@@ -31,6 +33,7 @@
DataInputStream dis = new DataInputStream(bais);
return toStore.getFactory().readState(dis);
}
+
public void testCache() throws IOException, BundleException {
State originalState = buildSimpleState();
State retrievedState = storeAndRetrieve(originalState);
@@ -40,6 +43,7 @@
retrievedState = storeAndRetrieve(originalState);
assertIdentical("2.0", originalState, retrievedState);
}
+
public void testClone() throws BundleException {
State original = buildSimpleState();
State newState = original.getFactory().createState(original);
@@ -48,6 +52,7 @@
newState = original.getFactory().createState(original);
assertEquals("2", original, newState);
}
+
public void testCommit() {
final String A1_LOCATION = "org.eclipse.a";
final String A1_MANIFEST = "Bundle-SymbolicName: org.eclipse.a\n" + "Bundle-Version: 1.0.0\n" + "Export-Package: org.eclipse.package1,org.eclipse.package2\n" + ";Import-Package: org.eclipse.package3";
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/internal/state/StateResolverTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/internal/state/StateResolverTest.java
index 8719d70..4463a4f 100644
--- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/internal/state/StateResolverTest.java
+++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/internal/state/StateResolverTest.java
@@ -21,9 +21,11 @@
public static Test suite() {
return new TestSuite(StateResolverTest.class);
}
+
public StateResolverTest(String name) {
super(name);
}
+
/**
* Tests adding 3 new bundles to an already resolved state and then
* resolving only one of the bundles. The result should be all 3 added
@@ -76,7 +78,7 @@
} catch (BundleException e) {
fail("Failed to create BundleDescription: " + e.getMessage());
}
- delta = state.resolve(new BundleDescription[]{state.getBundle(1)});
+ delta = state.resolve(new BundleDescription[] {state.getBundle(1)});
deltas = delta.getChanges();
assertEquals("1.0", 3, deltas.length);
Map deltasMap = new HashMap();
@@ -89,6 +91,7 @@
assertEquals("2.2", (BundleDelta.RESOLVED | BundleDelta.ADDED), ((BundleDelta) deltasMap.get(new Long(2))).getType());
assertEquals("2.3", (BundleDelta.RESOLVED | BundleDelta.ADDED), ((BundleDelta) deltasMap.get(new Long(3))).getType());
}
+
public void testBasicResolution() throws BundleException {
State state = buildSimpleState();
StateDelta delta = state.resolve();
@@ -116,6 +119,7 @@
assertFullyResolved("5.2", b2);
assertFullyUnresolved("5.3", b3);
}
+
public void testComplexResolution() throws BundleException {
State state = buildComplexState();
StateDelta delta = state.resolve();
@@ -155,20 +159,22 @@
assertFullyResolved("5.5", b5);
assertFullyResolved("5.6", b6);
}
+
public void testDependentBundles() throws BundleException {
State state = buildComplexState();
state.resolve();
BundleDescription[] dependent;
- dependent = platformAdmin.getStateHelper().getDependentBundles(new BundleDescription[]{state.getBundle(2)});
+ dependent = platformAdmin.getStateHelper().getDependentBundles(new BundleDescription[] {state.getBundle(2)});
assertEquals("1.0", 1, dependent.length);
assertEquals("1.1", state.getBundle(2), dependent[0]);
- dependent = platformAdmin.getStateHelper().getDependentBundles(new BundleDescription[]{state.getBundle(1)});
+ dependent = platformAdmin.getStateHelper().getDependentBundles(new BundleDescription[] {state.getBundle(1)});
assertEquals("2.0", 4, dependent.length);
assertContains("2.1", dependent, state.getBundle(1));
assertContains("2.2", dependent, state.getBundle(2));
assertContains("2.3", dependent, state.getBundle(4));
assertContains("2.4", dependent, state.getBundle(6));
}
+
public void testLinkageChange() throws BundleException {
State state = buildEmptyState();
// don't add b1 for now
@@ -218,6 +224,7 @@
assertFullyResolved("10.2", b2);
assertFullyResolved("10.3", b3);
}
+
public void testReinstall() throws BundleException {
State state = buildComplexState();
StateDelta delta = state.resolve();
@@ -237,6 +244,7 @@
assertEquals("4.0", 1, delta.getChanges(BundleDelta.RESOLVED, true).length);
assertEquals("4.1", 6, delta.getChanges(BundleDelta.RESOLVED, true)[0].getBundle().getBundleId());
}
+
public void testRemoval() throws BundleException {
String B1_LOCATION = "org.eclipse.b";
final String B1_MANIFEST = "Bundle-SymbolicName: org.eclipse.b1\n" + "Bundle-Version: 1.0\n";
@@ -257,6 +265,7 @@
assertEquals("2.1", b1, changes[0].getBundle());
assertEquals("2.2", BundleDelta.REMOVED | BundleDelta.UNRESOLVED, changes[0].getType());
}
+
public void testRemoveAndAdd() throws BundleException {
String B_LOCATION = "org.eclipse.b";
final String B_MANIFEST = "Bundle-SymbolicName: org.eclipse.b\n" + "Bundle-Version: 1.0\n";
@@ -280,6 +289,7 @@
assertEquals("2.3", 1, delta.getChanges(BundleDelta.RESOLVED | BundleDelta.ADDED, true).length);
assertEquals("2.3", b2, delta.getChanges(BundleDelta.RESOLVED | BundleDelta.ADDED, true)[0].getBundle());
}
+
public void testRemovalResolve() throws BundleException {
State state = buildInitialState();
StateDelta delta = state.resolve();
@@ -346,6 +356,7 @@
assertEquals("3.1", false, b2.isResolved());
assertEquals("3.2", false, b3.isResolved());
}
+
/**
* Tests adding 3 new bundles to an already resolved state and then
* resolving only one of the bundles. The result should be all 3 added
@@ -399,7 +410,7 @@
} catch (BundleException e) {
fail("Failed to create BundleDescription: " + e.getMessage());
}
- delta = state.resolve(new BundleDescription[]{state.getBundle(1)});
+ delta = state.resolve(new BundleDescription[] {state.getBundle(1)});
deltas = delta.getChanges();
assertEquals("1.0", 3, deltas.length);
Map deltasMap = new HashMap();
@@ -411,12 +422,13 @@
assertEquals("2.1", (BundleDelta.RESOLVED | BundleDelta.ADDED), ((BundleDelta) deltasMap.get(new Long(1))).getType());
assertEquals("2.2", (BundleDelta.RESOLVED | BundleDelta.ADDED), ((BundleDelta) deltasMap.get(new Long(2))).getType());
assertEquals("2.3", (BundleDelta.RESOLVED | BundleDelta.ADDED), ((BundleDelta) deltasMap.get(new Long(3))).getType());
- delta = state.resolve(new BundleDescription[]{state.getBundle(1)});
+ delta = state.resolve(new BundleDescription[] {state.getBundle(1)});
deltas = delta.getChanges();
assertEquals("3.0", 1, deltas.length);
assertEquals("3.1", 1, deltas[0].getBundle().getBundleId());
assertEquals("3.2", BundleDelta.RESOLVED, deltas[0].getType());
}
+
public void testUpdate() throws BundleException {
State state = buildEmptyState();
String B1_LOCATION = "org.eclipse.b";
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/datalocation/SimpleTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/datalocation/SimpleTests.java
index afcba70..e6be549 100644
--- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/datalocation/SimpleTests.java
+++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/datalocation/SimpleTests.java
@@ -38,7 +38,7 @@
protected void tearDown() throws Exception {
super.tearDown();
}
-
+
public void testAddRemove() {
assertEquals(null, manager1.lookup(TEST1));
assertEquals(-1, manager1.getId(TEST1));
@@ -99,10 +99,10 @@
private void update(FileManager manager, String filename) throws IOException {
writeFile(new File(base, filename));
manager.lock();
- manager.update(new String[] { TEST1}, new String[] { filename });
+ manager.update(new String[] {TEST1}, new String[] {filename});
manager.release();
}
-
+
private void writeFile(File filename) {
try {
FileOutputStream out = new FileOutputStream(filename);
@@ -111,4 +111,4 @@
} catch (IOException e) {
}
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/adaptor/BundleClassLoader.java b/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/adaptor/BundleClassLoader.java
index d58c96c..c647bc3 100644
--- a/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/adaptor/BundleClassLoader.java
+++ b/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/adaptor/BundleClassLoader.java
@@ -15,7 +15,6 @@
import java.security.ProtectionDomain;
import java.util.Enumeration;
-
/**
* The BundleClassLoader interface is used by the Framework to load local
* classes and resources from a Bundle. Classes that implement this
@@ -30,7 +29,6 @@
*/
public interface BundleClassLoader /*extends ClassLoader*/{
-
/**
* Initializes the ClassLoader. This is called after all currently resolved fragment
* bundles have been attached to the BundleClassLoader by the Framework.
@@ -80,6 +78,7 @@
* @return
*/
public URL getResource(String name);
+
/**
* This method will first search the parent class loader for the class;
* That failing, this method will invoke
diff --git a/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/adaptor/BundleData.java b/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/adaptor/BundleData.java
index 5d3d095..d6d9ab8 100644
--- a/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/adaptor/BundleData.java
+++ b/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/adaptor/BundleData.java
@@ -226,4 +226,4 @@
* @return the DynamicImport-Packaget for this BundleData.
*/
public String getDynamicImports();
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/adaptor/BundleOperation.java b/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/adaptor/BundleOperation.java
index 86ef7e0..6e237fd 100644
--- a/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/adaptor/BundleOperation.java
+++ b/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/adaptor/BundleOperation.java
@@ -71,4 +71,4 @@
*/
public abstract void undo() throws BundleException;
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/adaptor/BundleWatcher.java b/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/adaptor/BundleWatcher.java
index 60e7ea1..09bd50f 100644
--- a/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/adaptor/BundleWatcher.java
+++ b/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/adaptor/BundleWatcher.java
@@ -10,7 +10,9 @@
*******************************************************************************/
package org.eclipse.osgi.framework.adaptor;
-import org.osgi.framework.Bundle;;
+import org.osgi.framework.Bundle;
+
+;
/**
* Contains information about activated bundles and acts as the main
@@ -19,5 +21,6 @@
public interface BundleWatcher {
public void startActivation(Bundle bundle);
+
public void endActivation(Bundle bundle);
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/adaptor/ClassLoaderDelegate.java b/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/adaptor/ClassLoaderDelegate.java
index 2c74a83..39f0119 100644
--- a/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/adaptor/ClassLoaderDelegate.java
+++ b/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/adaptor/ClassLoaderDelegate.java
@@ -107,4 +107,4 @@
*/
public String findLibrary(String libraryname);
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/adaptor/EventPublisher.java b/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/adaptor/EventPublisher.java
index 9b4d7c8..34b5cc0 100644
--- a/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/adaptor/EventPublisher.java
+++ b/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/adaptor/EventPublisher.java
@@ -29,4 +29,4 @@
*/
public abstract void publishFrameworkEvent(int type, Bundle bundle, Throwable throwable);
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/adaptor/ImportClassNotFoundException.java b/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/adaptor/ImportClassNotFoundException.java
index 58630a2..e0b625e 100644
--- a/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/adaptor/ImportClassNotFoundException.java
+++ b/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/adaptor/ImportClassNotFoundException.java
@@ -34,4 +34,4 @@
public ImportClassNotFoundException(String s) {
super(s);
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/adaptor/ImportResourceNotFoundException.java b/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/adaptor/ImportResourceNotFoundException.java
index d169298..6325a06 100644
--- a/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/adaptor/ImportResourceNotFoundException.java
+++ b/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/adaptor/ImportResourceNotFoundException.java
@@ -34,4 +34,4 @@
public ImportResourceNotFoundException(String s) {
super(s);
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/adaptor/PermissionStorage.java b/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/adaptor/PermissionStorage.java
index be52acd..73f45a2 100644
--- a/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/adaptor/PermissionStorage.java
+++ b/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/adaptor/PermissionStorage.java
@@ -77,4 +77,4 @@
* @throws IOException If a failure occurs modifying peristent storage.
*/
public abstract void setPermissionData(String location, String[] data) throws IOException;
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/adaptor/ServiceRegistry.java b/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/adaptor/ServiceRegistry.java
index 726ff14..89cc402 100644
--- a/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/adaptor/ServiceRegistry.java
+++ b/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/adaptor/ServiceRegistry.java
@@ -66,4 +66,4 @@
*/
public Vector lookupServiceReferences(BundleContext context);
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/log/FrameworkLog.java b/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/log/FrameworkLog.java
index 694d23f..650a852 100644
--- a/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/log/FrameworkLog.java
+++ b/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/log/FrameworkLog.java
@@ -84,4 +84,4 @@
* no longer be logged to it.
*/
public void close();
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/log/FrameworkLogEntry.java b/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/log/FrameworkLogEntry.java
index 6a768be..7e0bc92 100644
--- a/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/log/FrameworkLogEntry.java
+++ b/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/log/FrameworkLogEntry.java
@@ -33,15 +33,17 @@
*
* @return Returns the children.
*/
- public FrameworkLogEntry[] getChildren(){
+ public FrameworkLogEntry[] getChildren() {
return children;
}
+
/**
* @return Returns the entry.
*/
public String getEntry() {
return entry;
}
+
/**
* @return Returns the message.
*/
@@ -55,10 +57,11 @@
public int getStackCode() {
return stackCode;
}
+
/**
* @return Returns the throwable.
*/
public Throwable getThrowable() {
return throwable;
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/util/Headers.java b/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/util/Headers.java
index 165a6ca..42cb9ad 100644
--- a/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/util/Headers.java
+++ b/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/util/Headers.java
@@ -33,280 +33,253 @@
* but the get operation is case-insensitive.
* </ul>
*/
-public class Headers extends Dictionary
-{
- /**
- * Dictionary of keys: Lower case key => Case preserved key.
- */
- protected Dictionary headers;
+public class Headers extends Dictionary {
+ /**
+ * Dictionary of keys: Lower case key => Case preserved key.
+ */
+ protected Dictionary headers;
- /**
- * Dictionary of values: Case preserved key => value.
- */
- protected Dictionary values;
+ /**
+ * Dictionary of values: Case preserved key => value.
+ */
+ protected Dictionary values;
- /**
- * Create an empty Headers dictionary.
- *
- * @param initialCapacity The initial capacity of this Headers object.
- */
- public Headers(int initialCapacity)
- {
- super();
+ /**
+ * Create an empty Headers dictionary.
+ *
+ * @param initialCapacity The initial capacity of this Headers object.
+ */
+ public Headers(int initialCapacity) {
+ super();
- headers = new Hashtable(initialCapacity);
- values = new Hashtable(initialCapacity);
- }
+ headers = new Hashtable(initialCapacity);
+ values = new Hashtable(initialCapacity);
+ }
- /**
- * Create a Headers dictionary from a Dictionary.
- *
- * @param values The initial dictionary for this Headers object.
- * @exception IllegalArgumentException If a case-variant of the key is
- * in the dictionary parameter.
- */
- public Headers(Dictionary values)
- {
- super();
+ /**
+ * Create a Headers dictionary from a Dictionary.
+ *
+ * @param values The initial dictionary for this Headers object.
+ * @exception IllegalArgumentException If a case-variant of the key is
+ * in the dictionary parameter.
+ */
+ public Headers(Dictionary values) {
+ super();
- headers = new Hashtable(values.size());
- this.values = values;
+ headers = new Hashtable(values.size());
+ this.values = values;
- /* initialize headers dictionary */
- Enumeration enum = values.keys();
+ /* initialize headers dictionary */
+ Enumeration enum = values.keys();
- while (enum.hasMoreElements())
- {
- Object key = enum.nextElement();
+ while (enum.hasMoreElements()) {
+ Object key = enum.nextElement();
- if (key instanceof String)
- {
- String header = ((String)key).toLowerCase();
+ if (key instanceof String) {
+ String header = ((String) key).toLowerCase();
- if (headers.put(header, key) != null) /* if case-variant already present */
- {
- throw new IllegalArgumentException(Msg.formatter.getString("HEADER_DUPLICATE_KEY_EXCEPTION", header));
- }
- }
- }
- }
+ if (headers.put(header, key) != null) /* if case-variant already present */
+ {
+ throw new IllegalArgumentException(Msg.formatter.getString("HEADER_DUPLICATE_KEY_EXCEPTION", header));
+ }
+ }
+ }
+ }
- /**
- * Case-preserved keys.
- */
- public synchronized Enumeration keys()
- {
- return(values.keys());
- }
+ /**
+ * Case-preserved keys.
+ */
+ public synchronized Enumeration keys() {
+ return (values.keys());
+ }
- /**
- * Values.
- */
- public synchronized Enumeration elements()
- {
- return(values.elements());
- }
+ /**
+ * Values.
+ */
+ public synchronized Enumeration elements() {
+ return (values.elements());
+ }
- /**
- * Support case-insensitivity for keys.
- *
- * @param key name.
- */
- public synchronized Object get(Object key)
- {
- Object value = values.get(key);
+ /**
+ * Support case-insensitivity for keys.
+ *
+ * @param key name.
+ */
+ public synchronized Object get(Object key) {
+ Object value = values.get(key);
- if ((value == null) && (key instanceof String))
- {
- Object keyLower = headers.get(((String)key).toLowerCase());
+ if ((value == null) && (key instanceof String)) {
+ Object keyLower = headers.get(((String) key).toLowerCase());
- if (keyLower != null)
- {
- value = values.get(keyLower);
- }
- }
+ if (keyLower != null) {
+ value = values.get(keyLower);
+ }
+ }
- return(value);
- }
+ return (value);
+ }
- /**
- * Set a header value.
- *
- * @param key Key name.
- * @param value Value of the key or null to remove key.
- * @return the previous value to which the key was mapped,
- * or null if the key did not have a previous mapping.
- *
- * @exception IllegalArgumentException If a case-variant of the key is
- * already present.
- */
- public synchronized Object set(Object key, Object value)
- {
- String header = (key instanceof String) ? ((String)key).toLowerCase() : null;
+ /**
+ * Set a header value.
+ *
+ * @param key Key name.
+ * @param value Value of the key or null to remove key.
+ * @return the previous value to which the key was mapped,
+ * or null if the key did not have a previous mapping.
+ *
+ * @exception IllegalArgumentException If a case-variant of the key is
+ * already present.
+ */
+ public synchronized Object set(Object key, Object value) {
+ String header = (key instanceof String) ? ((String) key).toLowerCase() : null;
- if (value == null) /* remove */
- {
- if (header != null) /* String key */
- {
- key = headers.remove(header);
+ if (value == null) /* remove */
+ {
+ if (header != null) /* String key */
+ {
+ key = headers.remove(header);
- if (key != null) /* is String key in hashtable? */
- {
- value = values.remove(key);
- }
- }
- else /* non-String key */
- {
- value = values.remove(key);
- }
+ if (key != null) /* is String key in hashtable? */
+ {
+ value = values.remove(key);
+ }
+ } else /* non-String key */
+ {
+ value = values.remove(key);
+ }
- return(value);
- }
- else /* put */
- {
- if (header != null) /* String key */
- {
- Object oldKey = headers.put(header, key);
+ return (value);
+ } else /* put */
+ {
+ if (header != null) /* String key */
+ {
+ Object oldKey = headers.put(header, key);
- if ((oldKey != null) && !header.equals(oldKey)) /* if case-variant already present */
- {
- headers.put(header, oldKey); /* put old case-variant back */
+ if ((oldKey != null) && !header.equals(oldKey)) /* if case-variant already present */
+ {
+ headers.put(header, oldKey); /* put old case-variant back */
- throw new IllegalArgumentException(Msg.formatter.getString("HEADER_DUPLICATE_KEY_EXCEPTION", header));
- }
+ throw new IllegalArgumentException(Msg.formatter.getString("HEADER_DUPLICATE_KEY_EXCEPTION", header));
+ }
- }
+ }
- return(values.put(key, value));
- }
+ return (values.put(key, value));
+ }
- }
+ }
- /**
- * Returns the number of entries (distinct keys) in this dictionary.
- *
- * @return the number of keys in this dictionary.
- */
- public synchronized int size()
- {
- return(values.size());
- }
+ /**
+ * Returns the number of entries (distinct keys) in this dictionary.
+ *
+ * @return the number of keys in this dictionary.
+ */
+ public synchronized int size() {
+ return (values.size());
+ }
- /**
- * Tests if this dictionary maps no keys to value. The general contract
- * for the <tt>isEmpty</tt> method is that the result is true if and only
- * if this dictionary contains no entries.
- *
- * @return <code>true</code> if this dictionary maps no keys to values;
- * <code>false</code> otherwise.
- */
- public synchronized boolean isEmpty()
- {
- return(values.isEmpty());
- }
+ /**
+ * Tests if this dictionary maps no keys to value. The general contract
+ * for the <tt>isEmpty</tt> method is that the result is true if and only
+ * if this dictionary contains no entries.
+ *
+ * @return <code>true</code> if this dictionary maps no keys to values;
+ * <code>false</code> otherwise.
+ */
+ public synchronized boolean isEmpty() {
+ return (values.isEmpty());
+ }
- /**
- * Always throws UnsupportedOperationException.
- *
- * @param key header name.
- * @param value header value.
- * @throws UnsupportedOperationException.
- */
- public Object put(Object key, Object value)
- {
- throw new UnsupportedOperationException();
- }
+ /**
+ * Always throws UnsupportedOperationException.
+ *
+ * @param key header name.
+ * @param value header value.
+ * @throws UnsupportedOperationException.
+ */
+ public Object put(Object key, Object value) {
+ throw new UnsupportedOperationException();
+ }
- /**
- * Always throws UnsupportedOperationException.
- *
- * @param key header name.
- * @throws UnsupportedOperationException.
- */
- public Object remove(Object key)
- {
- throw new UnsupportedOperationException();
- }
+ /**
+ * Always throws UnsupportedOperationException.
+ *
+ * @param key header name.
+ * @throws UnsupportedOperationException.
+ */
+ public Object remove(Object key) {
+ throw new UnsupportedOperationException();
+ }
- public String toString()
- {
- return(values.toString());
- }
+ public String toString() {
+ return (values.toString());
+ }
- public static Headers parseManifest(InputStream in) throws BundleException {
- try
- {
- Headers headers = new Headers(10);
- BufferedReader br;
- try
- {
- br = new BufferedReader(new InputStreamReader(in, "UTF8"));
- }
- catch (UnsupportedEncodingException e)
- {
- br = new BufferedReader(new InputStreamReader(in));
- }
+ public static Headers parseManifest(InputStream in) throws BundleException {
+ try {
+ Headers headers = new Headers(10);
+ BufferedReader br;
+ try {
+ br = new BufferedReader(new InputStreamReader(in, "UTF8"));
+ } catch (UnsupportedEncodingException e) {
+ br = new BufferedReader(new InputStreamReader(in));
+ }
- String header = null;
- StringBuffer value = new StringBuffer(256);
- boolean firstLine = true;
+ String header = null;
+ StringBuffer value = new StringBuffer(256);
+ boolean firstLine = true;
- while (true)
- {
- String line = br.readLine();
- /* The java.util.jar classes in JDK 1.3 use the value of the last
- * encountered manifest header. So we do the same to emulate
- * this behavior. We no longer throw a BundleException
- * for duplicate manifest headers.
- */
+ while (true) {
+ String line = br.readLine();
+ /* The java.util.jar classes in JDK 1.3 use the value of the last
+ * encountered manifest header. So we do the same to emulate
+ * this behavior. We no longer throw a BundleException
+ * for duplicate manifest headers.
+ */
- if ((line == null) || (line.length() == 0)) /* EOF or empty line */
- {
- if (!firstLine) /* flush last line */
- {
- headers.set(header, null); /* remove old attribute,if present */
- headers.set(header, value.toString().trim());
- }
- break; /* done processing main attributes */
- }
+ if ((line == null) || (line.length() == 0)) /* EOF or empty line */
+ {
+ if (!firstLine) /* flush last line */
+ {
+ headers.set(header, null); /* remove old attribute,if present */
+ headers.set(header, value.toString().trim());
+ }
+ break; /* done processing main attributes */
+ }
- if (line.charAt(0) == ' ') /* continuation */
- {
- if (firstLine) /* if no previous line */
- {
- throw new BundleException(Msg.formatter.getString("MANIFEST_INVALID_LINE_EXCEPTION", line));
- }
- value.append(line.substring(1));
- continue;
- }
+ if (line.charAt(0) == ' ') /* continuation */
+ {
+ if (firstLine) /* if no previous line */
+ {
+ throw new BundleException(Msg.formatter.getString("MANIFEST_INVALID_LINE_EXCEPTION", line));
+ }
+ value.append(line.substring(1));
+ continue;
+ }
- if (!firstLine)
- {
- headers.set(header, null); /* remove old attribute,if present */
- headers.set(header, value.toString().trim());
- value.setLength(0); /* clear StringBuffer */
- }
+ if (!firstLine) {
+ headers.set(header, null); /* remove old attribute,if present */
+ headers.set(header, value.toString().trim());
+ value.setLength(0); /* clear StringBuffer */
+ }
- int colon = line.indexOf(':');
- if (colon == -1) /* no colon */
- {
- throw new BundleException(Msg.formatter.getString("MANIFEST_INVALID_LINE_EXCEPTION", line));
- }
- header = line.substring(0, colon).trim();
- value.append(line.substring(colon+1));
- firstLine = false;
- }
- return headers;
- } catch (IOException e) {
+ int colon = line.indexOf(':');
+ if (colon == -1) /* no colon */
+ {
+ throw new BundleException(Msg.formatter.getString("MANIFEST_INVALID_LINE_EXCEPTION", line));
+ }
+ header = line.substring(0, colon).trim();
+ value.append(line.substring(colon + 1));
+ firstLine = false;
+ }
+ return headers;
+ } catch (IOException e) {
throw new BundleException(Msg.formatter.getString("MANIFEST_INVALID_LINE_EXCEPTION", ""), e);
- } finally {
- try
- {
- in.close();
- }
- catch (IOException ee)
- {
- }
- }
- }
-}
+ } finally {
+ try {
+ in.close();
+ } catch (IOException ee) {
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/util/SecureAction.java b/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/util/SecureAction.java
index 728a822..56e2b32 100644
--- a/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/util/SecureAction.java
+++ b/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/util/SecureAction.java
@@ -25,7 +25,7 @@
* @param property the property key.
* @return the value of the property or null if it does not exist.
*/
- public static String getProperty(final String property){
+ public static String getProperty(final String property) {
if (System.getSecurityManager() == null)
return System.getProperty(property);
else
@@ -44,13 +44,13 @@
* @return the value of the property or the def value if the property
* does not exist.
*/
- public static String getProperty(final String property, final String def){
+ public static String getProperty(final String property, final String def) {
if (System.getSecurityManager() == null)
- return System.getProperty(property,def);
+ return System.getProperty(property, def);
else
return (String) AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
- return System.getProperty(property,def);
+ return System.getProperty(property, def);
}
});
}
@@ -83,8 +83,8 @@
return new FileInputStream(file);
else
try {
- return (FileInputStream) AccessController.doPrivileged( new PrivilegedExceptionAction(){
- public Object run() throws FileNotFoundException{
+ return (FileInputStream) AccessController.doPrivileged(new PrivilegedExceptionAction() {
+ public Object run() throws FileNotFoundException {
return new FileInputStream(file);
}
});
@@ -103,19 +103,19 @@
*/
public static FileOutputStream getFileOutputStream(final File file, final boolean append) throws FileNotFoundException {
if (System.getSecurityManager() == null)
- return new FileOutputStream(file.getAbsolutePath(),append);
+ return new FileOutputStream(file.getAbsolutePath(), append);
else
try {
- return (FileOutputStream) AccessController.doPrivileged( new PrivilegedExceptionAction(){
- public Object run() throws FileNotFoundException{
- return new FileOutputStream(file.getAbsolutePath(),append);
+ return (FileOutputStream) AccessController.doPrivileged(new PrivilegedExceptionAction() {
+ public Object run() throws FileNotFoundException {
+ return new FileOutputStream(file.getAbsolutePath(), append);
}
});
} catch (PrivilegedActionException e) {
throw (FileNotFoundException) e.getException();
}
}
-
+
/**
* Creates a new Thread from a Runnable. Same as calling
* new Thread(target,name).
@@ -124,15 +124,15 @@
* @return The new Thread
*/
public static Thread createThread(final Runnable target, final String name) {
- if(System.getSecurityManager() == null)
+ if (System.getSecurityManager() == null)
return new Thread(target, name);
else {
- return (Thread) AccessController.doPrivileged( new PrivilegedAction(){
+ return (Thread) AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
return new Thread(target, name);
}
});
}
}
-
+
}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/util/SecurePermissionStorage.java b/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/util/SecurePermissionStorage.java
index d814f1d..91c0bb1 100644
--- a/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/util/SecurePermissionStorage.java
+++ b/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/util/SecurePermissionStorage.java
@@ -78,4 +78,4 @@
throw (IOException) e.getException();
}
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/util/Tokenizer.java b/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/util/Tokenizer.java
index d368de8..43fce27 100644
--- a/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/util/Tokenizer.java
+++ b/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/framework/util/Tokenizer.java
@@ -14,163 +14,139 @@
/**
* Simple tokenizer class. Used to parse data.
*/
-public class Tokenizer
-{
- protected char value[];
- protected int max;
- protected int cursor;
+public class Tokenizer {
+ protected char value[];
+ protected int max;
+ protected int cursor;
- public Tokenizer(String value)
- {
- this.value = value.toCharArray();
- max = this.value.length;
- cursor = 0;
- }
+ public Tokenizer(String value) {
+ this.value = value.toCharArray();
+ max = this.value.length;
+ cursor = 0;
+ }
- private void skipWhiteSpace()
- {
- char[] val = value;
- int cur = cursor;
+ private void skipWhiteSpace() {
+ char[] val = value;
+ int cur = cursor;
- for ( ;cur < max; cur++)
- {
- char c = val[cur];
- if ((c == ' ') || (c == '\t') || (c == '\n') || (c == '\r'))
- {
- continue;
- }
- break;
- }
- cursor = cur;
- }
+ for (; cur < max; cur++) {
+ char c = val[cur];
+ if ((c == ' ') || (c == '\t') || (c == '\n') || (c == '\r')) {
+ continue;
+ }
+ break;
+ }
+ cursor = cur;
+ }
- public String getToken(String terminals)
- {
- skipWhiteSpace();
- char[] val = value;
- int cur = cursor;
+ public String getToken(String terminals) {
+ skipWhiteSpace();
+ char[] val = value;
+ int cur = cursor;
- int begin = cur;
- for ( ;cur < max; cur++)
- {
- char c = val[cur];
- if ((terminals.indexOf(c) != -1))
- {
- break;
- }
- }
- cursor = cur;
- int count = cur-begin;
- if (count > 0)
- {
- skipWhiteSpace();
- while (count>0 && (val[begin+count-1] == ' ' || val[begin+count-1] == '\t'))
- count--;
- return(new String(val, begin, count));
- }
- return(null);
- }
+ int begin = cur;
+ for (; cur < max; cur++) {
+ char c = val[cur];
+ if ((terminals.indexOf(c) != -1)) {
+ break;
+ }
+ }
+ cursor = cur;
+ int count = cur - begin;
+ if (count > 0) {
+ skipWhiteSpace();
+ while (count > 0 && (val[begin + count - 1] == ' ' || val[begin + count - 1] == '\t'))
+ count--;
+ return (new String(val, begin, count));
+ }
+ return (null);
+ }
- public String getString(String terminals)
- {
- skipWhiteSpace();
- char[] val = value;
- int cur = cursor;
+ public String getString(String terminals) {
+ skipWhiteSpace();
+ char[] val = value;
+ int cur = cursor;
- if (cur < max)
- {
- if (val[cur] == '\"') /* if a quoted string */
- {
- cur++; /* skip quote */
- char c = '\0';
- int begin = cur;
- for ( ;cur < max; cur++)
- {
- c = val[cur];
- if (c == '\"')
- {
- break;
- }
- }
- int count = cur-begin;
- if (c == '\"')
- {
- cur++;
- }
- cursor = cur;
- if (count > 0)
- {
- skipWhiteSpace();
- return(new String(val, begin, count));
- }
- }
- else /* not a quoted string; same as token */
- {
- int begin = cur;
- for ( ;cur < max; cur++)
- {
- char c = val[cur];
- if (c=='\"') {
- // but there could be a quoted string in the middle of the string
- cur = cur+skipQuotedString(val,cur);
- } else if ((terminals.indexOf(c) != -1)) {
- break;
- }
- }
- cursor = cur;
- int count = cur-begin;
- if (count > 0)
- {
- skipWhiteSpace();
- while (count>0 && (val[begin+count-1] == ' ' || val[begin+count-1] == '\t'))
- count--;
- return(new String(val, begin, count));
- }
- }
- }
- return(null);
- }
-
- private int skipQuotedString(char[] val, int cur) {
- cur++; /* skip quote */
- char c = '\0';
- int begin = cur;
- for ( ;cur < max; cur++)
- {
- c = val[cur];
- if (c == '\"')
- {
- break;
- }
- }
- int count = cur-begin;
- if (c == '\"')
- {
- cur++;
- }
- cursor = cur;
- if (count > 0)
- {
- skipWhiteSpace();
- }
- return count;
- }
+ if (cur < max) {
+ if (val[cur] == '\"') /* if a quoted string */
+ {
+ cur++; /* skip quote */
+ char c = '\0';
+ int begin = cur;
+ for (; cur < max; cur++) {
+ c = val[cur];
+ if (c == '\"') {
+ break;
+ }
+ }
+ int count = cur - begin;
+ if (c == '\"') {
+ cur++;
+ }
+ cursor = cur;
+ if (count > 0) {
+ skipWhiteSpace();
+ return (new String(val, begin, count));
+ }
+ } else /* not a quoted string; same as token */
+ {
+ int begin = cur;
+ for (; cur < max; cur++) {
+ char c = val[cur];
+ if (c == '\"') {
+ // but there could be a quoted string in the middle of the string
+ cur = cur + skipQuotedString(val, cur);
+ } else if ((terminals.indexOf(c) != -1)) {
+ break;
+ }
+ }
+ cursor = cur;
+ int count = cur - begin;
+ if (count > 0) {
+ skipWhiteSpace();
+ while (count > 0 && (val[begin + count - 1] == ' ' || val[begin + count - 1] == '\t'))
+ count--;
+ return (new String(val, begin, count));
+ }
+ }
+ }
+ return (null);
+ }
- public char getChar()
- {
- int cur = cursor;
- if (cur < max)
- {
- cursor = cur+1;
- return(value[cur]);
- }
- return('\0'); /* end of value */
- }
-
- public boolean hasMoreTokens() {
- if (cursor<max) {
- return true;
- }
- return false;
- }
-}
+ private int skipQuotedString(char[] val, int cur) {
+ cur++; /* skip quote */
+ char c = '\0';
+ int begin = cur;
+ for (; cur < max; cur++) {
+ c = val[cur];
+ if (c == '\"') {
+ break;
+ }
+ }
+ int count = cur - begin;
+ if (c == '\"') {
+ cur++;
+ }
+ cursor = cur;
+ if (count > 0) {
+ skipWhiteSpace();
+ }
+ return count;
+ }
+
+ public char getChar() {
+ int cur = cursor;
+ if (cur < max) {
+ cursor = cur + 1;
+ return (value[cur]);
+ }
+ return ('\0'); /* end of value */
+ }
+
+ public boolean hasMoreTokens() {
+ if (cursor < max) {
+ return true;
+ }
+ return false;
+ }
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/util/ManifestElement.java b/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/util/ManifestElement.java
index 4df870b..ce5f923 100644
--- a/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/util/ManifestElement.java
+++ b/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/util/ManifestElement.java
@@ -108,7 +108,7 @@
* Each value component is delemited by a ';'.
* @return the String[] of value components
*/
- public String[] getValueComponents(){
+ public String[] getValueComponents() {
return valueComponents;
}
@@ -168,7 +168,7 @@
}
return attributes.keys();
}
-
+
/**
* Adds an attribute to this manifest element.
* @param key the key of the attribute
@@ -184,15 +184,13 @@
// create a list to contain multiple values
if (curValue instanceof ArrayList) {
newList = (ArrayList) curValue;
- }
- else {
+ } else {
newList = new ArrayList(5);
newList.add(curValue);
}
newList.add(value);
attributes.put(key, newList);
- }
- else {
+ } else {
attributes.put(key, value);
}
}
@@ -217,7 +215,7 @@
Tokenizer tokenizer = new Tokenizer(value);
- parseloop : while (true) {
+ parseloop: while (true) {
String next = tokenizer.getToken(";,");
if (next == null) {
throw new BundleException(Msg.formatter.getString("MANIFEST_INVALID_HEADER_EXCEPTION", header, value));
@@ -242,7 +240,7 @@
c = tokenizer.getChar();
- if (c == ';') /* more */ {
+ if (c == ';') /* more */{
headerValues.add(next);
headerValue.append(";").append(next);
@@ -275,7 +273,7 @@
c = tokenizer.getChar();
- if (c == ';') /* more */ {
+ if (c == ';') /* more */{
next = tokenizer.getToken("=");
if (next == null) {
@@ -292,11 +290,11 @@
Debug.println("");
}
- if (c == ',') /* another manifest element */ {
+ if (c == ',') /* another manifest element */{
continue parseloop;
}
- if (c == '\0') /* end of value */ {
+ if (c == '\0') /* end of value */{
break parseloop;
}
@@ -314,4 +312,4 @@
return (result);
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/console/CommandInterpreter.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/console/CommandInterpreter.java
index 55f859b..330a937 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/console/CommandInterpreter.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/console/CommandInterpreter.java
@@ -15,12 +15,12 @@
import org.eclipse.osgi.framework.internal.core.AbstractBundle;
/** A command interpreter is a shell that can interpret command
- * lines. This object is passed as parameter when a CommandProvider
- * is invoked.
-*/
+ * lines. This object is passed as parameter when a CommandProvider
+ * is invoked.
+ */
public interface CommandInterpreter {
public final static String NAME = "org.eclipse.osgi.framework.internal.core.command.CommandInterpreter";
-
+
/**
* Get the next argument in the input.
*
@@ -28,61 +28,60 @@
* will get "world" as the first argument.
*/
public String nextArgument();
-
+
/**
* Execute a command line as if it came from the end user
* and return the result.
- *
- * Throws any exceptions generated by the command that executed.
+ *
+ * Throws any exceptions generated by the command that executed.
*/
- public Object execute( String cmd );
-
- /**
- * Prints an object to the outputstream
- *
- * @param o the object to be printed
- */
- public void print(Object o);
+ public Object execute(String cmd);
- /**
- * Prints an empty line to the outputstream
- */
- public void println();
+ /**
+ * Prints an object to the outputstream
+ *
+ * @param o the object to be printed
+ */
+ public void print(Object o);
- /**
- * Prints an object to the output medium (appended with newline character).
- * <p>
- * If running on the target environment the user is prompted with '--more'
- * if more than the configured number of lines have been printed without user prompt.
- * That way the user of the program has control over the scrolling.
- * <p>
- * For this to work properly you should not embedded "\n" etc. into the string.
- *
- * @param o the object to be printed
- */
- public void println(Object o);
-
- /**
- * Print a stack trace including nested exceptions.
- * @param The offending exception
- */
- public void printStackTrace(Throwable t);
-
-
- /**
- * Prints the given dictionary sorted by keys.
- *
- * @param dic the dictionary to print
- * @param title the header to print above the key/value pairs
- */
- public void printDictionary(Dictionary dic, String title);
-
- /**
- * Prints the given bundle resource if it exists
- *
- * @param bundle the bundle containing the resource
- * @param resource the resource to print
- */
- public void printBundleResource(AbstractBundle bundle, String resource);
+ /**
+ * Prints an empty line to the outputstream
+ */
+ public void println();
+
+ /**
+ * Prints an object to the output medium (appended with newline character).
+ * <p>
+ * If running on the target environment the user is prompted with '--more'
+ * if more than the configured number of lines have been printed without user prompt.
+ * That way the user of the program has control over the scrolling.
+ * <p>
+ * For this to work properly you should not embedded "\n" etc. into the string.
+ *
+ * @param o the object to be printed
+ */
+ public void println(Object o);
+
+ /**
+ * Print a stack trace including nested exceptions.
+ * @param The offending exception
+ */
+ public void printStackTrace(Throwable t);
+
+ /**
+ * Prints the given dictionary sorted by keys.
+ *
+ * @param dic the dictionary to print
+ * @param title the header to print above the key/value pairs
+ */
+ public void printDictionary(Dictionary dic, String title);
+
+ /**
+ * Prints the given bundle resource if it exists
+ *
+ * @param bundle the bundle containing the resource
+ * @param resource the resource to print
+ */
+ public void printBundleResource(AbstractBundle bundle, String resource);
}
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/console/CommandProvider.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/console/CommandProvider.java
index 916998b..a66783e 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/console/CommandProvider.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/console/CommandProvider.java
@@ -12,33 +12,33 @@
package org.eclipse.osgi.framework.console;
/**
- When an object wants to provide a number of commands
- to the console, it should register an object with this
- interface. Some console can then pick this up and execute
- command lines.
- The SERVICE_RANKING registration property can be used to influence the
- order that a CommandProvider gets called. Specify a value less than
- Integer.MAXVALUE, where higher is more significant. The default value
- if SERVICE_RANKING is not set is 0.
- <p>
- The interface contains only methods for the help.
- The console should use inspection
- to find the commands. All public commands, starting with
- a '_' and taking a CommandInterpreter as parameter
- will be found. E.g.
- <pre>
- public Object _hello( CommandInterpreter intp ) {
- return "hello " + intp.nextArgument();
- }
- </pre>
-*/
+ When an object wants to provide a number of commands
+ to the console, it should register an object with this
+ interface. Some console can then pick this up and execute
+ command lines.
+ The SERVICE_RANKING registration property can be used to influence the
+ order that a CommandProvider gets called. Specify a value less than
+ Integer.MAXVALUE, where higher is more significant. The default value
+ if SERVICE_RANKING is not set is 0.
+ <p>
+ The interface contains only methods for the help.
+ The console should use inspection
+ to find the commands. All public commands, starting with
+ a '_' and taking a CommandInterpreter as parameter
+ will be found. E.g.
+ <pre>
+ public Object _hello( CommandInterpreter intp ) {
+ return "hello " + intp.nextArgument();
+ }
+ </pre>
+ */
public interface CommandProvider {
public final static String NAME = "org.eclipse.osgi.framework.internal.core.command.CommandProvider";
/**
- Answer a string (may be as many lines as you like) with help
- texts that explain the command.
- */
+ Answer a string (may be as many lines as you like) with help
+ texts that explain the command.
+ */
public String getHelp();
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/debug/Debug.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/debug/Debug.java
index 35e995f..7d638d7 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/debug/Debug.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/debug/Debug.java
@@ -69,60 +69,79 @@
public static void print(boolean x) {
out.print(x);
}
+
public static void print(char x) {
out.print(x);
}
+
public static void print(int x) {
out.print(x);
}
+
public static void print(long x) {
out.print(x);
}
+
public static void print(float x) {
out.print(x);
}
+
public static void print(double x) {
out.print(x);
}
+
public static void print(char x[]) {
out.print(x);
}
+
public static void print(String x) {
out.print(x);
}
+
public static void print(Object x) {
out.print(x);
}
+
public static void println(boolean x) {
out.println(x);
}
+
public static void println(char x) {
out.println(x);
}
+
public static void println(int x) {
out.println(x);
}
+
public static void println(long x) {
out.println(x);
}
+
public static void println(float x) {
out.println(x);
}
+
public static void println(double x) {
out.println(x);
}
+
public static void println(char x[]) {
out.println(x);
}
+
public static void println(String x) {
out.println(x);
}
+
public static void println(Object x) {
out.println(x);
}
+
public static void printStackTrace(Throwable x) {
printStackTrace(x, out);
}
+
private static void printStackTrace(Throwable t, PrintStream out) {
t.printStackTrace(out);
@@ -148,4 +167,4 @@
}
}
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/debug/DebugOptions.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/debug/DebugOptions.java
index 77e46e3..a0de34d 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/debug/DebugOptions.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/debug/DebugOptions.java
@@ -113,6 +113,7 @@
if (options.size() == 0)
options = null;
}
+
/**
* Helper method that creates an URL object from the given string
* representation. The string must correspond to a valid URL or file system
@@ -131,4 +132,4 @@
}
}
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/eventmgr/ListenerQueue.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/eventmgr/ListenerQueue.java
index ca44b20..b42ab5c 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/eventmgr/ListenerQueue.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/eventmgr/ListenerQueue.java
@@ -103,7 +103,7 @@
lists = queue.getElements();
}
EventThread eventThread = manager.getEventThread();
- synchronized (eventThread) { /* synchronize on the EventThread to ensure no interleaving of posting to the event thread */
+ synchronized (eventThread) { /* synchronize on the EventThread to ensure no interleaving of posting to the event thread */
int size = lists.length;
for (int i = 0; i < size; i++) { /* iterate over the list of listener lists */
ListElement list = lists[i];
@@ -129,7 +129,7 @@
readOnly = true;
lists = queue.getElements();
}
- synchronized (manager) { /* synchronize on the EventManager to ensure no interleaving of event delivery */
+ synchronized (manager) { /* synchronize on the EventManager to ensure no interleaving of event delivery */
int size = lists.length;
for (int i = 0; i < size; i++) { /* iterate over the list of listener lists */
ListElement list = lists[i];
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/AbstractBundle.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/AbstractBundle.java
index bce9b17..67f22ee 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/AbstractBundle.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/AbstractBundle.java
@@ -9,6 +9,7 @@
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.osgi.framework.internal.core;
+
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
@@ -20,6 +21,7 @@
import org.eclipse.osgi.framework.debug.Debug;
import org.eclipse.osgi.service.resolver.*;
import org.osgi.framework.*;
+
/**
* This object is given out to bundles and wraps the internal Bundle object. It
* is destroyed when a bundle is uninstalled and reused if a bundle is updated.
@@ -48,6 +50,7 @@
*/
protected String permissionMsg;
protected ManifestLocalization manifestLocalization = null;
+
/**
* Bundle object constructor. This constructor should not perform any real
* work.
@@ -63,6 +66,7 @@
else
return new BundleHost(bundledata, framework);
}
+
/**
* Bundle object constructor. This constructor should not perform any real
* work.
@@ -79,12 +83,14 @@
this.framework = framework;
bundledata.setBundle(this);
}
+
/**
* Load the bundle.
*
* @exception org.osgi.framework.BundleException
*/
protected abstract void load() throws BundleException;
+
/**
* Reload from a new bundle. This method must be called while holding the
* bundles lock.
@@ -96,6 +102,7 @@
* @exception org.osgi.framework.BundleException
*/
protected abstract boolean reload(AbstractBundle newBundle) throws BundleException;
+
/**
* Refresh the bundle. This is called by Framework.refreshPackages. This
* method must be called while holding the bundles lock.
@@ -107,6 +114,7 @@
* imported by a bundle
*/
protected abstract void refresh() throws BundleException;
+
/**
* Unload the bundle. This method must be called while holding the bundles
* lock.
@@ -115,6 +123,7 @@
* imported by a bundle
*/
protected abstract boolean unload();
+
/**
* Close the the Bundle's file.
*
@@ -128,6 +137,7 @@
}
state = UNINSTALLED;
}
+
/**
* Load and instantiate bundle's BundleActivator class
*/
@@ -148,6 +158,7 @@
}
return (null);
}
+
/**
* This method loads a class from the bundle.
*
@@ -160,6 +171,7 @@
* if the class definition was not found.
*/
protected abstract Class loadClass(String name, boolean checkPermission) throws ClassNotFoundException;
+
/**
* Find the specified resource in this bundle.
*
@@ -179,6 +191,7 @@
* If this bundle has been uninstalled.
*/
public abstract URL getResource(String name);
+
/**
* Returns the current state of the bundle.
*
@@ -189,6 +202,7 @@
public int getState() {
return (state);
}
+
/**
* Return true if the bundle is starting or active.
*
@@ -196,6 +210,7 @@
protected boolean isActive() {
return ((state & (ACTIVE | STARTING)) != 0);
}
+
/**
* Return true if the bundle is resolved.
*
@@ -203,6 +218,7 @@
protected boolean isResolved() {
return (state & (INSTALLED | UNINSTALLED)) == 0;
}
+
/**
* Start this bundle.
*
@@ -284,6 +300,7 @@
if (Debug.DEBUG && Debug.DEBUG_BUNDLE_TIME)
System.out.println("End starting " + getSymbolicName() + " " + (System.currentTimeMillis() - start));
}
+
/**
* Internal worker to start a bundle.
*
@@ -291,6 +308,7 @@
* if true persistently record the bundle was started.
*/
protected abstract void startWorker(boolean persistent) throws BundleException;
+
/**
* Start this bundle w/o marking is persistently started.
*
@@ -355,6 +373,7 @@
completeStateChange();
}
}
+
/**
* Stop this bundle.
*
@@ -425,6 +444,7 @@
completeStateChange();
}
}
+
/**
* Internal worker to stop a bundle.
*
@@ -432,6 +452,7 @@
* if true persistently record the bundle was stopped.
*/
protected abstract void stopWorker(boolean persistent) throws BundleException;
+
/**
* Set the persistent status bit for the bundle.
*
@@ -457,6 +478,7 @@
framework.publishFrameworkEvent(FrameworkEvent.ERROR, this, pae.getException());
}
}
+
/**
* Stop this bundle w/o marking is persistently stopped.
*
@@ -526,6 +548,7 @@
}
}
}
+
/**
* Update this bundle. If the bundle is {@link #ACTIVE}, the bundle will
* be stopped before the update and started after the update successfully
@@ -622,6 +645,7 @@
completeStateChange();
}
}
+
/**
* Update this bundle from an InputStream.
*
@@ -656,6 +680,7 @@
completeStateChange();
}
}
+
/**
* Update worker. Assumes the caller has the state change lock.
*/
@@ -701,6 +726,7 @@
}
}
}
+
/**
* Update worker. Assumes the caller has the state change lock.
*/
@@ -718,7 +744,7 @@
String symbolicName = newBundle.getSymbolicName();
AbstractBundle installedBundle = symbolicName == null ? null : framework.getBundleByUniqueId(symbolicName, newBundle.getVersion().toString());
if (installedBundle != null && installedBundle != this) {
- throw new BundleException(Msg.formatter.getString("BUNDLE_INSTALL_SAME_UNIQUEID", new Object[] {installedBundle.getSymbolicName(), installedBundle.getVersion(), installedBundle.getLocation()}));
+ throw new BundleException(Msg.formatter.getString("BUNDLE_INSTALL_SAME_UNIQUEID", new Object[] {installedBundle.getSymbolicName(), installedBundle.getVersion(), installedBundle.getLocation()}));
}
String[] nativepaths = framework.selectNativeCode(newBundle);
if (nativepaths != null) {
@@ -752,6 +778,7 @@
throw e;
}
}
+
/**
* Uninstall this bundle.
* <p>
@@ -818,6 +845,7 @@
completeStateChange();
}
}
+
/**
* Uninstall worker. Assumes the caller has the state change lock.
*/
@@ -879,6 +907,7 @@
}
framework.publishBundleEvent(BundleEvent.UNINSTALLED, this);
}
+
/**
* Uninstall worker. Assumes the caller has the state change lock.
*/
@@ -918,6 +947,7 @@
throw e;
}
}
+
/**
* Return the bundle's manifest headers and values from the manifest's
* preliminary section. That is all the manifest's headers and values prior
@@ -955,6 +985,7 @@
public Dictionary getHeaders() {
return getHeaders(Locale.getDefault().toString());
}
+
/**
* Returns this bundle's Manifest headers and values. This method returns
* all the Manifest headers and values from the main section of the
@@ -1004,6 +1035,7 @@
}
return manifestLocalization.getHeaders(localeString);
}
+
/**
* Retrieve the bundle's unique identifier, which the framework assigned to
* this bundle when it was installed.
@@ -1028,6 +1060,7 @@
public long getBundleId() {
return (bundledata.getBundleID());
}
+
/**
* Retrieve the location identifier of the bundle. This is typically the
* location passed to
@@ -1050,6 +1083,7 @@
framework.checkAdminPermission();
return (bundledata.getLocation());
}
+
/**
* Provides a list of {@link ServiceReferenceImpl}s for the services
* registered by this bundle or <code>null</code> if the bundle has no
@@ -1067,6 +1101,7 @@
* @see ServiceReferenceImpl
*/
public abstract org.osgi.framework.ServiceReference[] getRegisteredServices();
+
/**
* Provides a list of {@link ServiceReferenceImpl}s for the services this
* bundle is using, or <code>null</code> if the bundle is not using any
@@ -1084,6 +1119,7 @@
* @see ServiceReferenceImpl
*/
public abstract org.osgi.framework.ServiceReference[] getServicesInUse();
+
/**
* Determine whether the bundle has the requested permission.
*
@@ -1112,6 +1148,7 @@
}
return true;
}
+
/**
* This method marks the bundle's state as changing so that other calls to
* start/stop/suspend/update/uninstall can wait until the state change is
@@ -1140,11 +1177,11 @@
return;
}
if (doubleFault || (stateChanging == Thread.currentThread())) {
- throw new BundleException(Msg.formatter.getString("BUNDLE_STATE_CHANGE_EXCEPTION",getLocation(),stateChanging.getName())); //$NON-NLS-1$
+ throw new BundleException(Msg.formatter.getString("BUNDLE_STATE_CHANGE_EXCEPTION", getLocation(), stateChanging.getName())); //$NON-NLS-1$
}
try {
if (Debug.DEBUG && Debug.DEBUG_GENERAL) {
- Debug.println(" Waiting for state to change in bundle " + this); //$NON-NLS-1$
+ Debug.println(" Waiting for state to change in bundle " + this); //$NON-NLS-1$
}
long start = 0;
if (Debug.DEBUG)
@@ -1165,6 +1202,7 @@
}
}
}
+
/**
* This method completes the bundle state change by setting stateChanging
* to null and notifying one waiter that the state change has completed.
@@ -1180,6 +1218,7 @@
}
}
}
+
/**
* Return a string representation of this bundle.
*
@@ -1188,6 +1227,7 @@
public String toString() {
return (bundledata.getLocation() + " [" + getBundleId() + "]");
}
+
/**
* Answers an integer indicating the relative positions of the receiver and
* the argument in the natural order of elements of the receiver's class.
@@ -1210,6 +1250,7 @@
long idcomp = getBundleId() - ((AbstractBundle) obj).getBundleId();
return (idcomp < 0L) ? -1 : ((idcomp > 0L) ? 1 : 0);
}
+
/**
* This method checks that the bundle is not uninstalled. If the bundle is
* uninstalled, an IllegalStateException is thrown.
@@ -1222,6 +1263,7 @@
throw new IllegalStateException(Msg.formatter.getString("BUNDLE_UNINSTALLED_EXCEPTION"));
}
}
+
/**
* Get the bundle's ProtectionDomain.
*
@@ -1230,6 +1272,7 @@
protected ProtectionDomain getProtectionDomain() {
return domain;
}
+
/**
* The bundle must unresolve the permissions in these packages.
*
@@ -1246,17 +1289,21 @@
collection.unresolvePermissions(unresolvedPackages);
}
}
+
public org.osgi.framework.Bundle[] getFragments() {
checkValid();
return null;
}
+
public boolean isFragment() {
return false;
}
+
public org.osgi.framework.Bundle getHost() {
checkValid();
return null;
}
+
/*
* (non-Javadoc)
*
@@ -1265,6 +1312,7 @@
public Class loadClass(String classname) throws ClassNotFoundException {
return loadClass(classname, true);
}
+
/*
* (non-Javadoc)
*
@@ -1290,6 +1338,7 @@
}
});
}
+
/*
* (non-Javadoc)
*
@@ -1318,22 +1367,29 @@
}
});
}
+
public String getSymbolicName() {
return bundledata.getSymbolicName();
}
+
public BundleData getBundleData() {
return bundledata;
}
+
public Version getVersion() {
return bundledata.getVersion();
}
+
protected BundleDescription getBundleDescription() {
return framework.adaptor.getState().getBundle(getBundleId());
}
- protected int getStartLevel(){
+
+ protected int getStartLevel() {
return bundledata.getStartLevel();
}
+
public abstract BundleLoader getBundleLoader();
+
/**
* Mark this bundle as resolved.
*/
@@ -1354,13 +1410,16 @@
// to resolve if appropriate.
}
}
+
protected abstract boolean unresolve() throws BundleException;
+
/**
* Return the current context for this bundle.
*
* @return BundleContext for this bundle.
*/
abstract protected BundleContextImpl getContext();
+
protected String getResolutionFailureMessage() {
String defaultMessage = Msg.formatter.getString("BUNDLE_UNRESOLVED_EXCEPTION");
// don't spend time if debug info is not needed
@@ -1368,7 +1427,7 @@
return defaultMessage;
}
if (permissionMsg != null) {
- return permissionMsg; // do not null this field out until a successful resolve is done.
+ return permissionMsg; // do not null this field out until a successful resolve is done.
}
BundleDescription bundleDescription = getBundleDescription();
if (bundleDescription == null) {
@@ -1397,21 +1456,26 @@
missing.deleteCharAt(missing.length() - 1);
return Msg.formatter.getString("BUNDLE_UNRESOLVED_UNSATISFIED_CONSTRAINT_EXCEPTION", missing.toString());
}
+
private String toString(VersionConstraint constraint) {
org.eclipse.osgi.service.resolver.Version versionSpec = constraint.getVersionSpecification();
if (versionSpec == null)
return constraint.getName();
return constraint.getName() + '_' + versionSpec;
}
+
public int getKeyHashCode() {
return (int) getBundleId();
}
+
public boolean compare(KeyedElement other) {
return getBundleId() == ((AbstractBundle) other).getBundleId();
}
+
public Object getKey() {
return new Long(getBundleId());
}
+
protected boolean checkPermissions() {
permissionMsg = null;
BundleDescription bundleDesc = getBundleDescription();
@@ -1464,36 +1528,43 @@
}
return true;
}
+
protected boolean checkExportPackagePermission(String pkgName) {
if (domain != null)
return domain.implies(new PackagePermission(pkgName, PackagePermission.EXPORT));
return true;
}
+
protected boolean checkProvideBundlePermission(String symbolicName) {
if (domain != null)
return domain.implies(new BundlePermission(symbolicName, BundlePermission.PROVIDE_BUNDLE));
return true;
}
+
protected boolean checkImportPackagePermission(String pkgName) {
if (domain != null)
return domain.implies(new PackagePermission(pkgName, PackagePermission.IMPORT));
return true;
}
+
protected boolean checkRequireBundlePermission(String symbolicName) {
if (domain != null)
return domain.implies(new BundlePermission(symbolicName, BundlePermission.REQUIRE_BUNDLE));
return true;
}
+
protected boolean checkFragmentHostPermission(String symbolicName) {
if (domain != null)
return domain.implies(new BundlePermission(symbolicName, BundlePermission.FRAGMENT_HOST));
return true;
}
+
protected boolean checkFragmentBundlePermission(String symbolicName) {
if (domain != null)
return domain.implies(new BundlePermission(symbolicName, BundlePermission.FRAGMENT_BUNDLE));
return true;
}
+
/* This method is used by the Bundle Localization Service to obtain
* a ResourceBundle that resides in a bundle. This is not an OSGi
* defined method for org.osgi.framework.Bundle
@@ -1510,6 +1581,7 @@
}
return manifestLocalization.getResourceBundle(localeString);
}
+
private void initializeManifestLocalization() throws BundleException {
if (manifestLocalization == null) {
Dictionary rawHeaders;
@@ -1517,12 +1589,15 @@
manifestLocalization = new ManifestLocalization(this, rawHeaders);
}
}
+
public boolean testStateChanging(Object thread) {
return stateChanging == thread;
}
+
public Object getStateChangeLock() {
return statechangeLock;
}
+
public Thread getStateChanging() {
return stateChanging;
}
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/AliasMapper.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/AliasMapper.java
index de74667..8df39c7 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/AliasMapper.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/AliasMapper.java
@@ -9,23 +9,27 @@
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.osgi.framework.internal.core;
+
import java.io.*;
import java.util.Hashtable;
import java.util.Vector;
import org.eclipse.osgi.framework.debug.Debug;
import org.eclipse.osgi.framework.util.Tokenizer;
+
/**
* This class maps aliases.
*/
public class AliasMapper {
private static Hashtable processorAliasTable;
private static Hashtable osnameAliasTable;
+
/**
* Constructor.
*
*/
public AliasMapper() {
}
+
/**
* Return the master alias for the processor.
*
@@ -55,6 +59,7 @@
}
return (processor);
}
+
/**
* Return the master alias for the osname.
*
@@ -88,6 +93,7 @@
}
return (osname);
}
+
/**
* Read alias data and populate a Hashtable.
*
@@ -112,7 +118,7 @@
String master = tokenizer.getString("# \t");
if (master != null) {
aliases.put(master.toLowerCase(), master);
- parseloop : while (true) {
+ parseloop: while (true) {
String alias = tokenizer.getString("# \t");
if (alias == null) {
break parseloop;
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleCombinedPermissions.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleCombinedPermissions.java
index c3f85a7..5ce12f8 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleCombinedPermissions.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleCombinedPermissions.java
@@ -18,154 +18,133 @@
* A combination of two BundlePermissionCollection classes.
*
*/
-final class BundleCombinedPermissions extends BundlePermissionCollection
-{
- private BundlePermissionCollection assigned;
- private BundlePermissionCollection implied;
+final class BundleCombinedPermissions extends BundlePermissionCollection {
+ private BundlePermissionCollection assigned;
+ private BundlePermissionCollection implied;
- /**
- * Create a permission combiner class.
- *
- * @param implied The permissions a bundle always has.
- */
- BundleCombinedPermissions(BundlePermissionCollection implied)
- {
- this.implied = implied;
+ /**
+ * Create a permission combiner class.
+ *
+ * @param implied The permissions a bundle always has.
+ */
+ BundleCombinedPermissions(BundlePermissionCollection implied) {
+ this.implied = implied;
- setReadOnly(); /* this doesn't really mean anything */
- }
+ setReadOnly(); /* this doesn't really mean anything */
+ }
- /**
- * Assign the administrator defined permissions.
- *
- * @param assigned The permissions assigned by the administrator.
- */
- void setAssignedPermissions(BundlePermissionCollection assigned)
- {
- this.assigned = assigned;
- }
+ /**
+ * Assign the administrator defined permissions.
+ *
+ * @param assigned The permissions assigned by the administrator.
+ */
+ void setAssignedPermissions(BundlePermissionCollection assigned) {
+ this.assigned = assigned;
+ }
- /**
- * The Permission collection will unresolve the permissions in these packages.
- *
- * @param unresolvedPackages A list of the package which have been unresolved
- * as a result of a packageRefresh
- */
- void unresolvePermissions(Hashtable unresolvedPackages)
- {
- if (assigned != null)
- {
- assigned.unresolvePermissions(unresolvedPackages);
- }
+ /**
+ * The Permission collection will unresolve the permissions in these packages.
+ *
+ * @param unresolvedPackages A list of the package which have been unresolved
+ * as a result of a packageRefresh
+ */
+ void unresolvePermissions(Hashtable unresolvedPackages) {
+ if (assigned != null) {
+ assigned.unresolvePermissions(unresolvedPackages);
+ }
- if (implied != null)
- {
- implied.unresolvePermissions(unresolvedPackages);
- }
- }
+ if (implied != null) {
+ implied.unresolvePermissions(unresolvedPackages);
+ }
+ }
- /**
- * Adds the argument to the collection.
- *
- * @param permission java.security.Permission
- * the permission to add to the collection.
- * @exception SecurtityException
- * if the collection is read only.
- */
- public void add(Permission permission)
- {
- throw new SecurityException();
- }
- /**
- * Answers an enumeration of the permissions
- * in the receiver.
- *
- * @return Enumeration
- * the permissions in the receiver.
- */
- public Enumeration elements()
- {
- return new Enumeration() {
- private int i = 0;
- private Enumeration[] enums;
+ /**
+ * Adds the argument to the collection.
+ *
+ * @param permission java.security.Permission
+ * the permission to add to the collection.
+ * @exception SecurtityException
+ * if the collection is read only.
+ */
+ public void add(Permission permission) {
+ throw new SecurityException();
+ }
- {
- enums = new Enumeration[]
- {
- (assigned == null) ? null : assigned.elements(),
- (implied == null) ? null : implied.elements()
- };
- }
+ /**
+ * Answers an enumeration of the permissions
+ * in the receiver.
+ *
+ * @return Enumeration
+ * the permissions in the receiver.
+ */
+ public Enumeration elements() {
+ return new Enumeration() {
+ private int i = 0;
+ private Enumeration[] enums;
- /**
- * Answers if this Enumeration has more elements.
- *
- * @return true if there are more elements, false otherwise
- *
- * @see #nextElement
- */
- public boolean hasMoreElements()
- {
- while (i < enums.length)
- {
- Enumeration enum = enums[i];
- if ((enum != null) && enum.hasMoreElements())
- {
- return true;
- }
+ {
+ enums = new Enumeration[] {(assigned == null) ? null : assigned.elements(), (implied == null) ? null : implied.elements()};
+ }
- i++;
- }
+ /**
+ * Answers if this Enumeration has more elements.
+ *
+ * @return true if there are more elements, false otherwise
+ *
+ * @see #nextElement
+ */
+ public boolean hasMoreElements() {
+ while (i < enums.length) {
+ Enumeration enum = enums[i];
+ if ((enum != null) && enum.hasMoreElements()) {
+ return true;
+ }
- return false;
- }
- /**
- * Answers the next element in this Enumeration.
- *
- * @return the next element in this Enumeration
- *
- * @exception NoSuchElementException when there are no more elements
- *
- * @see #hasMoreElements
- */
- public Object nextElement()
- {
- while (i < enums.length)
- {
- try
- {
- Enumeration enum = enums[i];
- if (enum != null)
- {
- return enum.nextElement();
- }
- }
- catch (NoSuchElementException e)
- {
- }
- i++;
- }
+ i++;
+ }
- throw new NoSuchElementException();
- }
- };
- }
+ return false;
+ }
- /**
- * Indicates whether the argument permission is implied
- * by the permissions contained in the receiver.
- *
- * @return boolean
- * <code>true</code> if the argument permission
- * is implied by the permissions in the receiver,
- * and <code>false</code> if it is not.
- * @param permission java.security.Permission
- * the permission to check
- */
- public boolean implies(Permission permission)
- {
- return ((assigned != null) && assigned.implies(permission)) ||
- ((implied != null) && implied.implies(permission));
- }
+ /**
+ * Answers the next element in this Enumeration.
+ *
+ * @return the next element in this Enumeration
+ *
+ * @exception NoSuchElementException when there are no more elements
+ *
+ * @see #hasMoreElements
+ */
+ public Object nextElement() {
+ while (i < enums.length) {
+ try {
+ Enumeration enum = enums[i];
+ if (enum != null) {
+ return enum.nextElement();
+ }
+ } catch (NoSuchElementException e) {
+ }
+ i++;
+ }
+
+ throw new NoSuchElementException();
+ }
+ };
+ }
+
+ /**
+ * Indicates whether the argument permission is implied
+ * by the permissions contained in the receiver.
+ *
+ * @return boolean
+ * <code>true</code> if the argument permission
+ * is implied by the permissions in the receiver,
+ * and <code>false</code> if it is not.
+ * @param permission java.security.Permission
+ * the permission to check
+ */
+ public boolean implies(Permission permission) {
+ return ((assigned != null) && assigned.implies(permission)) || ((implied != null) && implied.implies(permission));
+ }
}
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleContextImpl.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleContextImpl.java
index 796bb92..08829ac 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleContextImpl.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleContextImpl.java
@@ -42,7 +42,7 @@
protected Framework framework;
/** Services that bundle has used. Key is ServiceReference,
- Value is ServiceUse */
+ Value is ServiceUse */
protected Hashtable servicesInUse;
/** Listener list for bundle's BundleListeners */
@@ -164,7 +164,7 @@
servicesInUse = null;
}
-
+
bundle = null;
}
@@ -605,7 +605,7 @@
if (!(service instanceof ServiceFactory)) {
PackageAdminImpl packageAdmin = framework.packageAdmin;
for (int i = 0; i < size; i++) {
- Class clazz = packageAdmin.loadServiceClass(clazzes[i],bundle);
+ Class clazz = packageAdmin.loadServiceClass(clazzes[i], bundle);
if (clazz == null) {
if (Debug.DEBUG && Debug.DEBUG_SERVICES) {
Debug.println(clazzes[i] + " class not found");
@@ -651,7 +651,7 @@
* @see #registerService(java.lang.String[], java.lang.Object, java.util.Dictionary)
*/
public org.osgi.framework.ServiceRegistration registerService(String clazz, Object service, Dictionary properties) {
- String[] clazzes = new String[] { clazz };
+ String[] clazzes = new String[] {clazz};
return (registerService(clazzes, service, properties));
}
@@ -744,7 +744,7 @@
int length = references.length;
- if (length > 1) /* if more than one service, select highest ranking */ {
+ if (length > 1) /* if more than one service, select highest ranking */{
int rankings[] = new int[length];
int count = 0;
int maxRanking = Integer.MIN_VALUE;
@@ -765,7 +765,7 @@
}
}
- if (count > 1) /* if still more than one service, select lowest id */ {
+ if (count > 1) /* if still more than one service, select lowest id */{
long minId = Long.MAX_VALUE;
for (int i = 0; i < length; i++) {
@@ -957,7 +957,7 @@
}
/* activator completed successfully. We must use this
- same activator object when we stop this bundle. */
+ same activator object when we stop this bundle. */
}
/**
@@ -987,7 +987,7 @@
String clazz = null;
clazz = bundleActivator.getClass().getName();
- throw new BundleException(Msg.formatter.getString("BUNDLE_ACTIVATOR_EXCEPTION", new Object[] { clazz, "start", bundle.getSymbolicName() == null ? "" + bundle.getBundleId() : bundle.getSymbolicName() }), t);
+ throw new BundleException(Msg.formatter.getString("BUNDLE_ACTIVATOR_EXCEPTION", new Object[] {clazz, "start", bundle.getSymbolicName() == null ? "" + bundle.getBundleId() : bundle.getSymbolicName()}), t);
}
}
@@ -1022,7 +1022,7 @@
String clazz = (activator == null) ? "" : activator.getClass().getName();
- throw new BundleException(Msg.formatter.getString("BUNDLE_ACTIVATOR_EXCEPTION", new Object[] { clazz, "stop", bundle.getSymbolicName() == null ? "" + bundle.getBundleId() : bundle.getSymbolicName() }, t));
+ throw new BundleException(Msg.formatter.getString("BUNDLE_ACTIVATOR_EXCEPTION", new Object[] {clazz, "stop", bundle.getSymbolicName() == null ? "" + bundle.getBundleId() : bundle.getSymbolicName()}, t));
} finally {
activator = null;
}
@@ -1146,7 +1146,7 @@
// to avoid interference from another thread closing this context
AbstractBundle tmpBundle = bundle;
try {
- if (isValid()) /* if context still valid */ {
+ if (isValid()) /* if context still valid */{
switch (action) {
case Framework.BUNDLEEVENT :
case Framework.BUNDLEEVENTSYNC :
@@ -1200,7 +1200,7 @@
Debug.printStackTrace(t);
}
- publisherror : {
+ publisherror: {
if (action == Framework.FRAMEWORKEVENT) {
FrameworkEvent event = (FrameworkEvent) object;
if (event.getType() == FrameworkEvent.ERROR) {
@@ -1267,14 +1267,13 @@
throw new IllegalStateException(Msg.formatter.getString("BUNDLE_CONTEXT_INVALID_EXCEPTION"));
}
}
-
+
/**
* This method checks that the context is still valid.
*
* @return true if the context is still valid; false otherwise
*/
- protected boolean isValid()
- {
+ protected boolean isValid() {
return valid;
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleFragment.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleFragment.java
index 86e447c..f7638e2 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleFragment.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleFragment.java
@@ -231,7 +231,7 @@
}
// cannot load a class from a fragment because there is no classloader
// associated with fragments.
- throw new ClassNotFoundException(Msg.formatter.getString("BUNDLE_FRAGMENT_CNFE",name));
+ throw new ClassNotFoundException(Msg.formatter.getString("BUNDLE_FRAGMENT_CNFE", name));
}
/**
@@ -415,4 +415,4 @@
// Fragments cannot have a BundleContext.
return null;
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleHost.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleHost.java
index 926a85f..cc9f82c 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleHost.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleHost.java
@@ -32,7 +32,7 @@
* The BundleLoader proxy; a lightweight object that acts as a proxy
* to the BundleLoader and allows lazy creation of the BundleLoader object
*/
- private BundleLoaderProxy proxy;
+ private BundleLoaderProxy proxy;
/** The BundleContext that represents this Bundle and all of its fragments */
protected BundleContextImpl context;
@@ -555,7 +555,7 @@
if (fragments == null)
return null;
org.osgi.framework.Bundle[] result = new org.osgi.framework.Bundle[fragments.length];
- System.arraycopy(fragments,0,result,0,result.length);
+ System.arraycopy(fragments, 0, result, 0, result.length);
return result;
}
}
@@ -575,19 +575,19 @@
boolean inserted = false;
// We must keep our fragments ordered by bundle ID; or
// install order.
- BundleFragment[] newFragments = new BundleFragment[fragments.length+1];
+ BundleFragment[] newFragments = new BundleFragment[fragments.length + 1];
for (int i = 0; i < fragments.length; i++) {
if (!inserted && fragment.getBundleId() < fragments[i].getBundleId()) {
// if the loader has already been created
// then we cannot attach a fragment into the middle
// of the fragment chain.
if (loader != null) {
- throw new BundleException(Msg.formatter.getString("BUNDLE_LOADER_ATTACHMENT_ERROR", fragments[i].getSymbolicName(),getSymbolicName())); //$NON-NLS-1$
+ throw new BundleException(Msg.formatter.getString("BUNDLE_LOADER_ATTACHMENT_ERROR", fragments[i].getSymbolicName(), getSymbolicName())); //$NON-NLS-1$
}
newFragments[i] = fragment;
inserted = true;
}
- newFragments[inserted ? i+1 : i] = fragments[i];
+ newFragments[inserted ? i + 1 : i] = fragments[i];
}
}
@@ -607,7 +607,7 @@
loader = new BundleLoader(this, getBundleDescription());
getLoaderProxy().setBundleLoader(loader);
} catch (BundleException e) {
- framework.publishFrameworkEvent(FrameworkEvent.ERROR,this,e);
+ framework.publishFrameworkEvent(FrameworkEvent.ERROR, this, e);
return null;
}
}
@@ -626,4 +626,4 @@
return proxy;
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleLoader.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleLoader.java
index 5929830..1ca4731 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleLoader.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleLoader.java
@@ -164,8 +164,8 @@
if (spec.isExported())
reexported[reexportIndex++] = i;
} else {
- BundleException be = new BundleException(Msg.formatter.getString("BUNDLE_MISSING_LOADER",bundleKey)); //$NON-NLS-1$
- bundle.framework.publishFrameworkEvent(FrameworkEvent.ERROR,bundle,be);
+ BundleException be = new BundleException(Msg.formatter.getString("BUNDLE_MISSING_LOADER", bundleKey)); //$NON-NLS-1$
+ bundle.framework.publishFrameworkEvent(FrameworkEvent.ERROR, bundle, be);
}
}
}
@@ -194,17 +194,17 @@
// init the dynamic imports tables
try {
String spec = bundle.getBundleData().getDynamicImports();
- ManifestElement[] imports = ManifestElement.parseHeader(Constants.DYNAMICIMPORT_PACKAGE,spec);
+ ManifestElement[] imports = ManifestElement.parseHeader(Constants.DYNAMICIMPORT_PACKAGE, spec);
addDynamicImportPackage(imports);
// ...and its fragments
for (int i = 0; i < fragments.length; i++)
if (fragments[i].isResolved()) {
spec = ((AbstractBundle) fragmentObjects[i]).getBundleData().getDynamicImports();
- imports = ManifestElement.parseHeader(Constants.DYNAMICIMPORT_PACKAGE,spec);
+ imports = ManifestElement.parseHeader(Constants.DYNAMICIMPORT_PACKAGE, spec);
addDynamicImportPackage(imports);
}
} catch (BundleException e) {
- bundle.framework.publishFrameworkEvent(FrameworkEvent.ERROR,bundle,e);
+ bundle.framework.publishFrameworkEvent(FrameworkEvent.ERROR, bundle, e);
}
}
@@ -215,44 +215,41 @@
if (packages != null && packages.length > 0)
for (int i = 0; i < packages.length; i++)
if (importedPackages == null || importedPackages.getByKey(packages[i].getName()) == null)
- throw new BundleException(Msg.formatter.getString("BUNDLE_FRAGMENT_IMPORT_CONFLICT",packages[i].getName()));
-
-
+ throw new BundleException(Msg.formatter.getString("BUNDLE_FRAGMENT_IMPORT_CONFLICT", packages[i].getName()));
// if the fragment requires a bundle not aready required throw an exception
BundleSpecification[] fragReqBundles = description.getRequiredBundles();
if (fragReqBundles != null && fragReqBundles.length > 0) {
- if (requiredBundles == null)
- throw new BundleException(Msg.formatter.getString("BUNDLE_FRAGMENT_REQUIRE_CONFLICT",fragReqBundles[0].getName()));
+ if (requiredBundles == null)
+ throw new BundleException(Msg.formatter.getString("BUNDLE_FRAGMENT_REQUIRE_CONFLICT", fragReqBundles[0].getName()));
- for (int i = 0; i < fragReqBundles.length; i++){
+ for (int i = 0; i < fragReqBundles.length; i++) {
boolean found = false;
- for (int j = 0; j < requiredBundles.length; j++){
+ for (int j = 0; j < requiredBundles.length; j++) {
String fragReqKey = new StringBuffer(fragReqBundles[i].getName()).append("_").append(fragReqBundles[i].getActualVersion().toString()).toString();
if (fragReqKey.equals(requiredBundles[j].getKey()))
found = true;
}
if (!found)
- throw new BundleException(Msg.formatter.getString("BUNDLE_FRAGMENT_REQUIRE_CONFLICT",fragReqBundles[i].getName()));
+ throw new BundleException(Msg.formatter.getString("BUNDLE_FRAGMENT_REQUIRE_CONFLICT", fragReqBundles[i].getName()));
}
}
-
// if the fragment dynamically imports a package not aready
// dynamically imported throw an exception.
try {
String spec = fragment.getBundleData().getDynamicImports();
- ManifestElement[] imports = ManifestElement.parseHeader(Constants.DYNAMICIMPORT_PACKAGE,spec);
- if (imports != null && imports.length > 0){
+ ManifestElement[] imports = ManifestElement.parseHeader(Constants.DYNAMICIMPORT_PACKAGE, spec);
+ if (imports != null && imports.length > 0) {
for (int i = 0; i < imports.length; i++) {
String name = imports[i].getValue();
if (!isDynamicallyImported(name))
- throw new BundleException(Msg.formatter.getString("BUNDLE_FRAGMENT_DYNAMICIMPORT_CONFLICT",imports[i]));
+ throw new BundleException(Msg.formatter.getString("BUNDLE_FRAGMENT_DYNAMICIMPORT_CONFLICT", imports[i]));
}
}
} catch (BundleException e) {
- bundle.framework.publishFrameworkEvent(FrameworkEvent.ERROR,bundle,e);
- }
+ bundle.framework.publishFrameworkEvent(FrameworkEvent.ERROR, bundle, e);
+ }
// init the provided packages
String[] provides = description.getProvidedPackages();
@@ -299,7 +296,7 @@
* This method loads a class from the bundle. The class is searched for in the
* same manner as it would if it was being loaded from a bundle (i.e. all
* hosts, fragments, import, required bundles and local resources are searched.
- *
+ *
* @param name the name of the desired Class.
* @return the resulting Class
* @exception java.lang.ClassNotFoundException if the class definition was not found.
@@ -324,20 +321,20 @@
/**
* Handle the lookup where provided classes can also be imported.
* In this case the exporter need to be consulted.
- */
- protected Class requireClass(String name, String packageName){
+ */
+ protected Class requireClass(String name, String packageName) {
Class result = null;
try {
result = findImportedClass(name, packageName);
} catch (ImportClassNotFoundException e) {
//Capture the exception and return null because we want to continue the lookup.
- return null;
+ return null;
}
if (result == null)
result = findLocalClass(name);
return result;
}
-
+
protected BundleClassLoader createClassLoader() {
if (classloader != null)
return classloader;
@@ -367,11 +364,11 @@
*/
protected Class findLocalClass(String name) {
if (Debug.DEBUG && Debug.DEBUG_LOADER)
- Debug.println("BundleLoader[" + this +"].findLocalClass(" + name + ")");
+ Debug.println("BundleLoader[" + this + "].findLocalClass(" + name + ")");
try {
Class clazz = createClassLoader().findLocalClass(name);
if (Debug.DEBUG && Debug.DEBUG_LOADER && clazz != null)
- Debug.println("BundleLoader[" + this +"] found local class " + name);
+ Debug.println("BundleLoader[" + this + "] found local class " + name);
return clazz;
} catch (ClassNotFoundException e) {
return null;
@@ -386,7 +383,7 @@
throw new ClassNotFoundException(name);
if (Debug.DEBUG && Debug.DEBUG_LOADER) {
- Debug.println("BundleLoader[" + this +"].loadBundleClass(" + name + ")");
+ Debug.println("BundleLoader[" + this + "].loadBundleClass(" + name + ")");
}
String packageName = getPackageName(name);
@@ -412,6 +409,7 @@
boolean isClosed() {
return bundle == null;
}
+
/**
* Finds the resource for a bundle. This method is used for delegation by the bundle's classloader.
*/
@@ -483,14 +481,14 @@
/**
* Handle the lookup where provided resources can also be imported.
* In this case the exporter need to be consulted.
- */
- protected URL requireResource(String name, String packageName){
+ */
+ protected URL requireResource(String name, String packageName) {
URL result = null;
try {
result = findImportedResource(name, packageName);
} catch (ImportResourceNotFoundException e) {
//Capture the exception and return null because we want to continue the lookup.
- return null;
+ return null;
}
if (result == null)
result = findLocalResource(name);
@@ -515,14 +513,14 @@
/**
* Handle the lookup where provided resources can also be imported.
* In this case the exporter need to be consulted.
- */
- protected Enumeration requireResources(String name, String packageName){
+ */
+ protected Enumeration requireResources(String name, String packageName) {
Enumeration result = null;
try {
result = findImportedResources(name, packageName);
} catch (ImportResourceNotFoundException e) {
//Capture the exception and return null because we want to continue the lookup.
- return null;
+ return null;
}
if (result == null)
result = findLocalResources(name);
@@ -585,20 +583,20 @@
/**
* Handle the lookup where provided resources can also be imported.
* In this case the exporter need to be consulted.
- */
- protected Object requireObject(String object, String packageName){
+ */
+ protected Object requireObject(String object, String packageName) {
Object result = null;
try {
result = findImportedObject(object, packageName);
} catch (ImportResourceNotFoundException e) {
//Capture the exception and return null because we want to continue the lookup.
- return null;
+ return null;
}
if (result == null)
result = findLocalObject(object);
return result;
}
-
+
protected Object findLocalObject(String object) {
return createClassLoader().findLocalObject(object);
}
@@ -650,11 +648,11 @@
private BundleClassLoader createBCLPrevileged(final ProtectionDomain pd, final String[] cp) {
// Create the classloader as previleged code if security manager is present.
if (System.getSecurityManager() == null)
- return createBCL(pd,cp);
+ return createBCL(pd, cp);
else
- return (BundleClassLoader)AccessController.doPrivileged(new PrivilegedAction() {
+ return (BundleClassLoader) AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
- return createBCL(pd,cp);
+ return createBCL(pd, cp);
}
});
@@ -669,15 +667,14 @@
AbstractBundle fragment = (AbstractBundle) fragments[i];
try {
bcl.attachFragment(fragment.getBundleData(), fragment.domain, getClassPath(fragment, SecureAction.getProperties()));
- }
- catch (BundleException be) {
+ } catch (BundleException be) {
bundle.framework.publishFrameworkEvent(FrameworkEvent.ERROR, bundle, be);
}
}
// finish the initialization of the classloader.
bcl.initialize();
-
+
return bcl;
}
@@ -786,7 +783,7 @@
*/
protected Class findImportedClass(String name, String packageName) throws ImportClassNotFoundException {
if (Debug.DEBUG && Debug.DEBUG_LOADER)
- Debug.println("ImportClassLoader[" + this +"].findImportedClass(" + name + ")");
+ Debug.println("ImportClassLoader[" + this + "].findImportedClass(" + name + ")");
Class result = null;
@@ -800,10 +797,10 @@
} finally {
if (result == null) {
if (Debug.DEBUG && Debug.DEBUG_LOADER)
- Debug.println("ImportClassLoader[" + this +"] class " + name + " not found in imported package " + packageName);
+ Debug.println("ImportClassLoader[" + this + "] class " + name + " not found in imported package " + packageName);
} else {
if (Debug.DEBUG && Debug.DEBUG_LOADER)
- Debug.println("BundleLoader[" + this +"] found imported class " + name);
+ Debug.println("BundleLoader[" + this + "] found imported class " + name);
}
}
return result;
@@ -815,7 +812,7 @@
// See if we locally provide the package.
PackageSource local = getProvidedPackage(packageName);
-
+
// Must search required bundles that are exported first.
if (requiredBundles != null) {
int size = reexportTable == null ? 0 : reexportTable.length;
@@ -826,8 +823,7 @@
// This allows a bundle to provide a package from a required bundle without
// re-exporting the whole required bundle.
requiredBundles[i].getBundleLoader().addExportedProvidersFor(packageName, result, visited);
- }
- else if (reexportIndex < size && reexportTable[reexportIndex] == i) {
+ } else if (reexportIndex < size && reexportTable[reexportIndex] == i) {
reexportIndex++;
requiredBundles[i].getBundleLoader().addExportedProvidersFor(packageName, result, visited);
}
@@ -902,19 +898,19 @@
*/
protected Class findRequiredClass(String name, String packageName) {
if (Debug.DEBUG && Debug.DEBUG_LOADER)
- Debug.println("ImportClassLoader[" + this +"].findRequiredClass(" + name + ")");
+ Debug.println("ImportClassLoader[" + this + "].findRequiredClass(" + name + ")");
PackageSource source = getProvidersFor(packageName);
if (source == null)
return null;
if (source.isMultivalued()) {
BundleLoaderProxy[] bundles = source.getSuppliers();
for (int i = 0; i < bundles.length; i++) {
- Class result = bundles[i].getBundleLoader().requireClass(name,packageName);
+ Class result = bundles[i].getBundleLoader().requireClass(name, packageName);
if (result != null)
return result;
}
} else
- return source.getSupplier().getBundleLoader().requireClass(name,packageName);
+ return source.getSupplier().getBundleLoader().requireClass(name, packageName);
return null;
}
@@ -933,7 +929,7 @@
*/
protected URL findImportedResource(String name, String packageName) {
if (Debug.DEBUG && Debug.DEBUG_LOADER)
- Debug.println("ImportClassLoader[" + this +"].findImportedResource(" + name + ")");
+ Debug.println("ImportClassLoader[" + this + "].findImportedResource(" + name + ")");
BundleLoader exporter = getPackageExporter(packageName);
if (exporter != null) {
@@ -941,7 +937,7 @@
if (url != null)
return url;
if (Debug.DEBUG && Debug.DEBUG_LOADER)
- Debug.println("ImportClassLoader[" + this +"] resource " + name + " not found in imported package " + packageName);
+ Debug.println("ImportClassLoader[" + this + "] resource " + name + " not found in imported package " + packageName);
throw new ImportResourceNotFoundException(name);
}
return null;
@@ -955,19 +951,19 @@
*/
protected URL findRequiredResource(String name, String packageName) {
if (Debug.DEBUG && Debug.DEBUG_LOADER)
- Debug.println("ImportClassLoader[" + this +"].findRequiredResource(" + name + ")");
+ Debug.println("ImportClassLoader[" + this + "].findRequiredResource(" + name + ")");
PackageSource source = getProvidersFor(packageName);
if (source == null)
return null;
if (source.isMultivalued()) {
BundleLoaderProxy[] bundles = source.getSuppliers();
for (int i = 0; i < bundles.length; i++) {
- URL result = bundles[i].getBundleLoader().requireResource(name,packageName);
+ URL result = bundles[i].getBundleLoader().requireResource(name, packageName);
if (result != null)
return result;
}
} else
- return source.getSupplier().getBundleLoader().requireResource(name,packageName);
+ return source.getSupplier().getBundleLoader().requireResource(name, packageName);
return null;
}
@@ -985,7 +981,7 @@
*/
protected Enumeration findImportedResources(String name, String packageName) {
if (Debug.DEBUG && Debug.DEBUG_LOADER)
- Debug.println("ImportClassLoader[" + this +"].findImportedResources(" + name + ")");
+ Debug.println("ImportClassLoader[" + this + "].findImportedResources(" + name + ")");
BundleLoader exporter = getPackageExporter(packageName);
if (exporter != null)
@@ -1009,19 +1005,19 @@
*/
protected Enumeration findRequiredResources(String name, String packageName) {
if (Debug.DEBUG && Debug.DEBUG_LOADER)
- Debug.println("ImportClassLoader[" + this +"].findRequiredResources(" + name + ")");
+ Debug.println("ImportClassLoader[" + this + "].findRequiredResources(" + name + ")");
PackageSource source = getProvidersFor(packageName);
if (source == null)
return null;
if (source.isMultivalued()) {
BundleLoaderProxy[] bundles = source.getSuppliers();
for (int i = 0; i < bundles.length; i++) {
- Enumeration result = bundles[i].getBundleLoader().requireResources(name,packageName);
+ Enumeration result = bundles[i].getBundleLoader().requireResources(name, packageName);
if (result != null)
return result;
}
} else
- return source.getSupplier().getBundleLoader().requireResources(name,packageName);
+ return source.getSupplier().getBundleLoader().requireResources(name, packageName);
return null;
}
@@ -1036,7 +1032,7 @@
*/
protected Object findImportedObject(String object, String packageName) {
if (Debug.DEBUG && Debug.DEBUG_LOADER)
- Debug.println("ImportClassLoader[" + this +"].findImportedObject(" + object + ")");
+ Debug.println("ImportClassLoader[" + this + "].findImportedObject(" + object + ")");
BundleLoader exporter = getPackageExporter(packageName);
if (exporter != null) {
@@ -1044,7 +1040,7 @@
if (result != null)
return result;
if (Debug.DEBUG && Debug.DEBUG_LOADER)
- Debug.println("ImportClassLoader[" + this +"] object " + object + " not found in imported package " + packageName);
+ Debug.println("ImportClassLoader[" + this + "] object " + object + " not found in imported package " + packageName);
throw new ImportResourceNotFoundException(object);
}
return null;
@@ -1058,19 +1054,19 @@
*/
protected Object findRequiredObject(String name, String packageName) {
if (Debug.DEBUG && Debug.DEBUG_LOADER)
- Debug.println("ImportClassLoader[" + this +"].findRequiredResource(" + name + ")");
+ Debug.println("ImportClassLoader[" + this + "].findRequiredResource(" + name + ")");
PackageSource source = getProvidersFor(packageName);
if (source == null)
return null;
if (source.isMultivalued()) {
BundleLoaderProxy[] bundles = source.getSuppliers();
for (int i = 0; i < bundles.length; i++) {
- Object result = bundles[i].getBundleLoader().requireObject(name,packageName);
+ Object result = bundles[i].getBundleLoader().requireObject(name, packageName);
if (result != null)
return result;
}
} else
- return source.getSupplier().getBundleLoader().requireObject(name,packageName);
+ return source.getSupplier().getBundleLoader().requireObject(name, packageName);
return null;
}
@@ -1147,7 +1143,7 @@
dynamicImportPackageStems = null;
}
- protected void attachFragment(BundleFragment fragment, Properties props) throws BundleException{
+ protected void attachFragment(BundleFragment fragment, Properties props) throws BundleException {
initializeFragment(fragment);
if (classloader == null)
return;
@@ -1166,7 +1162,7 @@
protected String[] getClassPath(AbstractBundle bundle, Properties props) throws BundleException {
String spec = bundle.getBundleData().getClassPath();
- ManifestElement[] classpathElements = ManifestElement.parseHeader(Constants.BUNDLE_CLASSPATH,spec);
+ ManifestElement[] classpathElements = ManifestElement.parseHeader(Constants.BUNDLE_CLASSPATH, spec);
return matchClassPath(classpathElements, props);
}
@@ -1175,7 +1171,7 @@
if (Debug.DEBUG && Debug.DEBUG_LOADER)
Debug.println(" no classpath");
/* create default BundleClassPath */
- return new String[] { "." };
+ return new String[] {"."};
}
ArrayList result = new ArrayList(classpath.length);
@@ -1187,7 +1183,7 @@
if (Debug.DEBUG && Debug.DEBUG_LOADER)
Debug.println(" found match for classpath entry " + classpath[i].getValueComponents());
String[] matchPaths = classpath[i].getValueComponents();
- for(int j=0; j<matchPaths.length; j++){
+ for (int j = 0; j < matchPaths.length; j++) {
result.add(matchPaths[j]);
}
}
@@ -1210,4 +1206,4 @@
return new FilterImpl(filterString);
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleLoaderProxy.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleLoaderProxy.java
index 7169333..27e83ab 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleLoaderProxy.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleLoaderProxy.java
@@ -27,15 +27,15 @@
* keeps track of the depedencies between the bundles installed in the
* Framework.
*/
-public class BundleLoaderProxy implements KeyedElement, NamedClassSpace{
+public class BundleLoaderProxy implements KeyedElement, NamedClassSpace {
/** The BundleLoader that this BundleLoaderProxy is managing */
private BundleLoader loader;
/** The Bundle that this BundleLoaderProxy is for*/
private BundleHost bundle;
/** The Symbolic Name of the Bundle; this must be cached incase the Bundle is updated */
- private String symbolicName;
+ private String symbolicName;
/** The Version of the Bundle; this must be cached incase the Bundle is updated */
- private Version version;
+ private Version version;
/** The unique hash key for this KeyedElemetn */
private String key;
/**
@@ -62,11 +62,13 @@
this.key = new StringBuffer(symbolicName).append("_").append(this.version.toString()).toString(); //$NON-NLS-1$
this.users = new KeyedHashSet(false);
}
+
public BundleLoader getBundleLoader() {
if (loader == null)
loader = bundle.getBundleLoader();
return loader;
}
+
public AbstractBundle getBundle() {
return bundle;
}
@@ -104,6 +106,7 @@
public void setStale() {
stale = true;
}
+
public boolean isStale() {
return stale;
}
@@ -131,12 +134,12 @@
String symbolicName = bundle.getSymbolicName();
StringBuffer sb = new StringBuffer(symbolicName == null ? bundle.getLocation() : symbolicName);
sb.append("; ").append(Constants.BUNDLE_VERSION_ATTRIBUTE); //$NON-NLS-1$
- sb.append("=\"").append(version.toString()).append("\""); //$NON-NLS-1$//$NON-NLS-2$
+ sb.append("=\"").append(version.toString()).append("\""); //$NON-NLS-1$//$NON-NLS-2$
return sb.toString();
}
protected void markDependencies() {
- if (markedUsedDependencies || !bundle.isResolved()) { //TODO Can we get a bundleLoaderProxy is we are unresolved. If we can get one when the bundle is unresolved is it correct?
+ if (markedUsedDependencies || !bundle.isResolved()) { //TODO Can we get a bundleLoaderProxy is we are unresolved. If we can get one when the bundle is unresolved is it correct?
return;
}
markedUsedDependencies = true;
@@ -199,6 +202,7 @@
return bundle;
}
+
public org.osgi.framework.Bundle[] getRequiringBundles() {
if (isStale())
return null;
@@ -210,19 +214,22 @@
BundleLoader requiringLoader = requiringProxy.getBundleLoader();
BundleLoaderProxy[] reqBundles = requiringLoader.requiredBundles;
if (reqBundles != null)
- for (int j=0; j<reqBundles.length; j++)
+ for (int j = 0; j < reqBundles.length; j++)
if (reqBundles[j] == this)
requiringBundles.add(requiringProxy.getBundle());
}
return (AbstractBundle[]) requiringBundles.toArray(new AbstractBundle[requiringBundles.size()]);
}
+
public String getName() {
return symbolicName;
}
+
public String getVersion() {
return version.toString();
}
+
public boolean isRemovalPending() {
return bundle.framework.packageAdmin.removalPending.contains(this);
}
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleNativeCode.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleNativeCode.java
index 776637c..b9f5e76 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleNativeCode.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleNativeCode.java
@@ -9,12 +9,14 @@
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.osgi.framework.internal.core;
+
import java.util.Enumeration;
import java.util.Vector;
import org.eclipse.osgi.service.resolver.Version;
import org.eclipse.osgi.util.ManifestElement;
import org.osgi.framework.Constants;
import org.osgi.framework.InvalidSyntaxException;
+
/**
* This class represents a description of native code.
*
@@ -120,6 +122,7 @@
* The AliasMapper used to alias OS Names.
*/
private static AliasMapper aliasMapper = Framework.aliasMapper;
+
/**
* Constructor for BundleNativeCode. It reads bundle native code data from
* the manifest file.
@@ -136,6 +139,7 @@
setAttribute(element, Constants.BUNDLE_NATIVECODE_LANGUAGE);
setAttribute(element, Constants.SELECTION_FILTER_ATTRIBUTE);
}
+
private void setAttribute(ManifestElement element, String attribute) {
String[] attrValues = element.getAttributes(attribute);
if (attrValues != null) {
@@ -144,6 +148,7 @@
}
}
}
+
/**
* Returns the native code paths.
*
@@ -157,6 +162,7 @@
nativepaths.toArray(paths);
return (paths);
}
+
/**
* addPath is used to add a new element to the list of native files.
*
@@ -169,6 +175,7 @@
}
nativepaths.addElement(nativepath);
}
+
/**
* addAttribute is used to add the specification-version string to the
* package description. It is the only key supported at this time.
@@ -214,6 +221,7 @@
return;
}
}
+
/**
* Override toString. Return a String representation of this object
*
@@ -267,6 +275,7 @@
}
return (sb.toString());
}
+
/**
* Return the match value for the given processor and os name. A higher
* value indicates a better match.
@@ -288,6 +297,7 @@
}
return (0);
}
+
/**
* Return the higest matching value for the given os version that is less
* than or equal to the given os version.
@@ -319,6 +329,7 @@
}
return result;
}
+
/**
* Return the match value for the given language. A higher value indicates
* a better match.
@@ -336,6 +347,7 @@
}
return (0);
}
+
public boolean matchFilter() {
if (filterString == null) {
return true;
@@ -349,6 +361,7 @@
}
return filter.match(System.getProperties());
}
+
/**
* Extension of Vector for attributes.
*/
@@ -360,6 +373,7 @@
Attribute() {
super(10, 10);
}
+
/**
* Perform an "OR" operation on equals.
*
@@ -385,6 +399,7 @@
}
return (false);
}
+
/**
* Add the object if it is not already in the vector.
*
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundlePermissionCollection.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundlePermissionCollection.java
index 056900e..6d74fc7 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundlePermissionCollection.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundlePermissionCollection.java
@@ -26,4 +26,4 @@
* as a result of a packageRefresh
*/
abstract void unresolvePermissions(Hashtable unresolvedPackages);
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundlePermissions.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundlePermissions.java
index c908dcd..f5d5a51 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundlePermissions.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundlePermissions.java
@@ -24,7 +24,7 @@
* Maps a Permission's class to an appropriate PermissionCollection.
* Class => PermissionCollection
*/
- private Hashtable collections = new Hashtable(8); //TODO How dynamic is this?
+ private Hashtable collections = new Hashtable(8); //TODO How dynamic is this?
/**
* Set to an AllPermissionCollection if this Permissions contains AllPermission.
@@ -180,7 +180,7 @@
// by loading it only from the proper classloader,
// i.e. the system classloader or and exporting bundle's
// classloader. Otherwise there is a security hole.
- clazz = packageAdmin.loadServiceClass(name,null);
+ clazz = packageAdmin.loadServiceClass(name, null);
if (clazz == null) {
return null;
}
@@ -285,4 +285,4 @@
}
}
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleRepository.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleRepository.java
index 0550774..1ee39f2 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleRepository.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleRepository.java
@@ -26,14 +26,14 @@
*/
public class BundleRepository {
/** bundles by install order */
- private ArrayList bundlesByInstallOrder; //TODO It does not seems to me that the users of this really care for the ordering. If this is confirmed this can be remove
+ private ArrayList bundlesByInstallOrder; //TODO It does not seems to me that the users of this really care for the ordering. If this is confirmed this can be remove
//and getBundles could either return an array (an array is preferable as one if the method calling method finally returns an array and the others do not care)
/** bundles keyed by bundle Id */
private KeyedHashSet bundlesById;
/** bundles keyed by SymbolicName */
- private Hashtable bundlesBySymbolicName; //TODO Does this need to be synchronized
+ private Hashtable bundlesBySymbolicName; //TODO Does this need to be synchronized
/** PackageAdmin */
private PackageAdminImpl packageAdmin;
@@ -163,7 +163,7 @@
bundlesBySymbolicName.put(symbolicName, newBundles);
}
}
-
+
return true;
}
@@ -199,4 +199,4 @@
}
user.markedUsedDependencies = false;
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleResourcePermission.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleResourcePermission.java
index 6b77601..3d54172 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleResourcePermission.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleResourcePermission.java
@@ -89,4 +89,4 @@
public int hashCode() {
return getName().hashCode();
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleSource.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleSource.java
index a431668..5e23a6e 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleSource.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleSource.java
@@ -36,4 +36,4 @@
public InputStream getInputStream() throws IOException {
return (in);
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Constants.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Constants.java
index 7789cc7..029068f 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Constants.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Constants.java
@@ -99,7 +99,7 @@
public static final String DEFAULT_OSGI_PROPERTIES = "osgi.properties";
public static final String OSGI_AUTOEXPORTSYSTEMPACKAGES = "osgi.autoExportSystemPackages";
public static final String OSGI_RESTRICTSERVICECLASSES = "osgi.restrictServiceClasses";
-
+
/** Properties set by the framework */
/** OSGI system package property */
@@ -112,4 +112,4 @@
/** Properties defaults */
public static final String DEFAULT_STARTLEVEL = "1";
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/ExportedPackageImpl.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/ExportedPackageImpl.java
index 2077f93..5884cc4 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/ExportedPackageImpl.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/ExportedPackageImpl.java
@@ -19,7 +19,6 @@
String specVersion;
-
public ExportedPackageImpl(PackageSpecification packageSpec, BundleLoaderProxy supplier) {
super(packageSpec.getName(), supplier);
Version version = packageSpec.getActualVersion();
@@ -85,4 +84,4 @@
}
return result.toString();
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/FilterImpl.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/FilterImpl.java
index 773c80d..243bb04 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/FilterImpl.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/FilterImpl.java
@@ -120,7 +120,7 @@
* data type will evaluate to <code>false</code> .
*/
-public class FilterImpl implements Filter /* since Framework 1.1 */ {
+public class FilterImpl implements Filter /* since Framework 1.1 */{
/* public methods in org.osgi.framework.Filter */
/**
@@ -231,9 +231,9 @@
for (int i = 0; i < size; i++) {
String substr = substrings[i];
- if (substr == null) /* * */ {
+ if (substr == null) /* * */{
filter.append('*');
- } else /* xxx */ {
+ } else /* xxx */{
filter.append(encodeValue(substr));
}
}
@@ -284,7 +284,7 @@
filter.append(')');
- if (topLevel) /* only hold onto String object at toplevel */ {
+ if (topLevel) /* only hold onto String object at toplevel */{
this.filter = filter.toString();
} else {
return (filter.toString());
@@ -723,13 +723,13 @@
for (int i = 0; i < size; i++) {
String substr = substrings[i];
- if (i + 1 < size) /* if this is not that last substr */ {
- if (substr == null) /* * */ {
+ if (i + 1 < size) /* if this is not that last substr */{
+ if (substr == null) /* * */{
String substr2 = substrings[i + 1];
- if (substr2 == null) /* ** */ {
+ if (substr2 == null) /* ** */{
continue; /* ignore first star */
- } else /* *xxx */ {
+ } else /* *xxx */{
if (Debug.DEBUG && Debug.DEBUG_FILTER) {
Debug.println("indexOf(\"" + substr2 + "\"," + pos + ")");
}
@@ -741,7 +741,7 @@
i++;
pos = index + substr2.length();
}
- } else /* xxx */ {
+ } else /* xxx */{
int len = substr.length();
if (Debug.DEBUG && Debug.DEBUG_FILTER) {
@@ -753,10 +753,10 @@
return (false);
}
}
- } else /* last substr */ {
- if (substr == null) /* * */ {
+ } else /* last substr */{
+ if (substr == null) /* * */{
return (true);
- } else /* xxx */ {
+ } else /* xxx */{
if (Debug.DEBUG && Debug.DEBUG_FILTER) {
Debug.println("regionMatches(" + pos + "," + substr + ")");
}
@@ -1159,7 +1159,7 @@
protected boolean compare_Comparable(int operation, Comparable value1, Object value2) {
try {
- java.lang.reflect.Constructor constructor = value1.getClass().getConstructor(new Class[] { value2.getClass()});
+ java.lang.reflect.Constructor constructor = value1.getClass().getConstructor(new Class[] {value2.getClass()});
value2 = constructor.newInstance(new Object[] {((String) value2).trim()});
} catch (Throwable t) {
return (false);
@@ -1473,7 +1473,7 @@
protected String parse_value() throws InvalidSyntaxException {
StringBuffer sb = new StringBuffer(filter.length - pos);
- parseloop : while (true) {
+ parseloop: while (true) {
char c = filter[pos];
switch (c) {
@@ -1515,7 +1515,7 @@
Vector operands = new Vector(10, 10);
- parseloop : while (true) {
+ parseloop: while (true) {
char c = filter[pos];
switch (c) {
@@ -1592,4 +1592,4 @@
}
}
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/FilteredServiceListener.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/FilteredServiceListener.java
index 9f942ae..8c6e449 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/FilteredServiceListener.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/FilteredServiceListener.java
@@ -14,64 +14,56 @@
import org.eclipse.osgi.framework.debug.Debug;
import org.osgi.framework.*;
-public class FilteredServiceListener implements ServiceListener
-{
- /** Filter for listener. */
- protected FilterImpl filter;
+public class FilteredServiceListener implements ServiceListener {
+ /** Filter for listener. */
+ protected FilterImpl filter;
- /** Real listener. */
- protected ServiceListener listener;
+ /** Real listener. */
+ protected ServiceListener listener;
- /**
- * Constructor.
- *
- * @param filterstring filter for this listener.
- * @param listener real listener.
- * @exception InvalidSyntaxException if the filter is invalid.
- */
- protected FilteredServiceListener(String filterstring, ServiceListener listener)
- throws InvalidSyntaxException
- {
- filter = new FilterImpl(filterstring);
- this.listener = listener;
- }
+ /**
+ * Constructor.
+ *
+ * @param filterstring filter for this listener.
+ * @param listener real listener.
+ * @exception InvalidSyntaxException if the filter is invalid.
+ */
+ protected FilteredServiceListener(String filterstring, ServiceListener listener) throws InvalidSyntaxException {
+ filter = new FilterImpl(filterstring);
+ this.listener = listener;
+ }
- /**
- * Receive notification that a service has had a
- * change occur in it's lifecycle.
- *
- * @param event The ServiceEvent.
- */
- public void serviceChanged(ServiceEvent event)
- {
- ServiceReferenceImpl reference = (ServiceReferenceImpl)event.getServiceReference();
+ /**
+ * Receive notification that a service has had a
+ * change occur in it's lifecycle.
+ *
+ * @param event The ServiceEvent.
+ */
+ public void serviceChanged(ServiceEvent event) {
+ ServiceReferenceImpl reference = (ServiceReferenceImpl) event.getServiceReference();
- if (Debug.DEBUG && Debug.DEBUG_EVENTS)
- {
- String listenerName = this.getClass().getName() + "@" + Integer.toHexString(this.hashCode());
- Debug.println("filterServiceEvent("+listenerName+", \""+filter+"\", "+reference.registration.properties+")");
- }
+ if (Debug.DEBUG && Debug.DEBUG_EVENTS) {
+ String listenerName = this.getClass().getName() + "@" + Integer.toHexString(this.hashCode());
+ Debug.println("filterServiceEvent(" + listenerName + ", \"" + filter + "\", " + reference.registration.properties + ")");
+ }
- if (filter.match(reference))
- {
- if (Debug.DEBUG && Debug.DEBUG_EVENTS)
- {
- String listenerName = listener.getClass().getName() + "@" + Integer.toHexString(listener.hashCode());
- Debug.println("dispatchFilteredServiceEvent("+listenerName+")");
- }
+ if (filter.match(reference)) {
+ if (Debug.DEBUG && Debug.DEBUG_EVENTS) {
+ String listenerName = listener.getClass().getName() + "@" + Integer.toHexString(listener.hashCode());
+ Debug.println("dispatchFilteredServiceEvent(" + listenerName + ")");
+ }
- listener.serviceChanged(event);
- }
- }
+ listener.serviceChanged(event);
+ }
+ }
- /**
- * Get the filter string used by this Filtered listener.
- *
- * @return The filter string used by this listener.
- */
- public String toString()
- {
- return(filter.toString());
- }
+ /**
+ * Get the filter string used by this Filtered listener.
+ *
+ * @return The filter string used by this listener.
+ */
+ public String toString() {
+ return (filter.toString());
+ }
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Framework.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Framework.java
index 1636ef6..d764310 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Framework.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Framework.java
@@ -9,6 +9,7 @@
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.osgi.framework.internal.core;
+
import java.io.*;
import java.net.URL;
import java.net.URLConnection;
@@ -23,6 +24,7 @@
import org.eclipse.osgi.service.resolver.*;
import org.eclipse.osgi.util.ManifestElement;
import org.osgi.framework.*;
+
/**
* Core OSGi Framework class.
*/
@@ -48,10 +50,10 @@
*/
protected StartLevelManager startLevelManager;
/** The ServiceRegistry */
- protected ServiceRegistry serviceRegistry; //TODO This is duplicated from the adaptor, do we really gain ?
+ protected ServiceRegistry serviceRegistry; //TODO This is duplicated from the adaptor, do we really gain ?
/** next free service id. */
protected long serviceid;
-
+
/*
* The following EventListeners objects keep track of event listeners
* by BundleContext. Each element is a EventListeners that is the list
@@ -83,6 +85,7 @@
* The AliasMapper used to alias OS Names.
*/
protected static AliasMapper aliasMapper = new AliasMapper();
+
/**
* Constructor for the Framework instance. This method initializes the
* framework to an unlaunched state.
@@ -91,6 +94,7 @@
public Framework(FrameworkAdaptor adaptor) {
initialize(adaptor);
}
+
/**
* Initialize the framework to an unlaunched state. This method is called
* by the Framework constructor.
@@ -178,6 +182,7 @@
if (Debug.DEBUG && Debug.DEBUG_GENERAL)
System.out.println("Initialize the framework: " + (System.currentTimeMillis() - start));
}
+
private void createSystemBundle() {
try {
systemBundle = new SystemBundle(this);
@@ -247,6 +252,7 @@
throw new RuntimeException(Msg.formatter.getString("OSGI_SYSTEMBUNDLE_CREATE_EXCEPTION", e.getMessage()));
}
}
+
/**
* Initialize the System properties by copying properties from the adaptor
* properties object. This method is called by the initialize method.
@@ -339,6 +345,7 @@
}
properties.put(Constants.FRAMEWORK_EXECUTIONENVIRONMENT, ee.toString());
}
+
/**
* This method return the state of the framework.
*
@@ -346,6 +353,7 @@
protected boolean isActive() {
return (active);
}
+
/**
* This method is called to destory the framework instance.
*
@@ -388,6 +396,7 @@
packageAdmin = null;
adaptor = null;
}
+
/**
* Start the framework.
*
@@ -421,6 +430,7 @@
publishFrameworkEvent(FrameworkEvent.ERROR, systemBundle, be);
}
}
+
/**
* Stop the framework.
*
@@ -463,6 +473,7 @@
/* mark framework as stopped */
active = false;
}
+
/**
* Create a new Bundle object.
*
@@ -479,6 +490,7 @@
verifyExecutionEnvironment(bundledata.getManifest());
return AbstractBundle.createBundle(bundledata, this);
}
+
/**
* Verifies that the framework supports one of the required Execution
* Environments
@@ -522,6 +534,7 @@
}
throw new BundleException(Msg.formatter.getString("BUNDLE_INSTALL_REQUIRED_EE_EXCEPTION", bundleEE.toString()));
}
+
/**
* Retrieve the value of the named environment property. Values are
* provided for the following properties:
@@ -552,6 +565,7 @@
public String getProperty(String key) {
return properties.getProperty(key);
}
+
/**
* Retrieve the value of the named environment property. Values are
* provided for the following properties:
@@ -584,6 +598,7 @@
protected String getProperty(String key, String def) {
return properties.getProperty(key, def);
}
+
/**
* Set a system property.
*
@@ -597,6 +612,7 @@
protected Object setProperty(String key, String value) {
return properties.put(key, value);
}
+
/**
* Install a bundle from a location.
*
@@ -621,6 +637,7 @@
}
});
}
+
/**
* Install a bundle from an InputStream.
*
@@ -649,6 +666,7 @@
}
});
}
+
/**
* Worker method to install a bundle. It obtains the reservation for the
* location and calls the specified action.
@@ -709,6 +727,7 @@
}
}
}
+
/**
* Worker method to install a bundle. It calls the FrameworkAdaptor object
* to install the bundle in persistent storage.
@@ -764,6 +783,7 @@
}
return bundle;
}
+
/**
* Selects a native code clause and return a list of the bundle entries for
* native code to be installed.
@@ -902,6 +922,7 @@
}
}
}
+
/**
* Retrieve the bundle that has the given unique identifier.
*
@@ -916,6 +937,7 @@
return bundles.getBundle(id);
}
}
+
/**
* Retrieve the bundle that has the given unique identifier.
*
@@ -929,6 +951,7 @@
return bundles.getBundle(uniqueId, version);
}
}
+
/**
* Retrieve the BundleRepository of all installed bundles. The list is
* valid at the time of the call to getBundles, but the framework is a very
@@ -940,6 +963,7 @@
protected BundleRepository getBundles() {
return (bundles);
}
+
/**
* Retrieve a list of all installed bundles. The list is valid at the time
* of the call to getBundleAlls, but the framework is a very dynamic
@@ -960,6 +984,7 @@
return (bundlelist);
}
}
+
/**
* Resume a bundle.
*
@@ -988,6 +1013,7 @@
publishFrameworkEvent(FrameworkEvent.ERROR, bundle, be);
}
}
+
/**
* Suspend a bundle.
*
@@ -1021,6 +1047,7 @@
}
return (changed);
}
+
/**
* Locate an installed bundle with a given identity.
*
@@ -1044,6 +1071,7 @@
}
return (null);
}
+
/**
* Locate an installed bundle with a given unique ID.
*
@@ -1057,6 +1085,7 @@
return bundles.getBundles(uniqueId);
}
}
+
/**
* Returns a list of <tt>ServiceReference</tt> objects. This method
* returns a list of <tt>ServiceReference</tt> objects for services which
@@ -1146,6 +1175,7 @@
}
return (references);
}
+
/**
* Method to return the next available service id. This method should be
* called while holding the registrations lock.
@@ -1157,6 +1187,7 @@
serviceid++;
return (id);
}
+
/**
* Creates a <code>File</code> object for a file in the persistent
* storage area provided for the bundle by the framework. If the adaptor
@@ -1175,6 +1206,7 @@
}
});
}
+
/**
* Check for AdminPermission.
*/
@@ -1187,6 +1219,7 @@
sm.checkPermission(adminPermission);
}
}
+
/**
* Check for permission to register a service.
*
@@ -1201,6 +1234,7 @@
}
}
}
+
/**
* Check for permission to get a service.
*
@@ -1222,6 +1256,7 @@
throw se;
}
}
+
/**
* Check for permission to get a service.
*/
@@ -1231,6 +1266,7 @@
sm.checkPermission(new ServicePermission(name, ServicePermission.GET));
}
}
+
/**
* This is necessary for running from a JXE, otherwise the SecurityManager
* is set much later than we would like!
@@ -1286,6 +1322,7 @@
}
}
}
+
public void publishFrameworkEventPrivileged(FrameworkEvent event) {
/* if the event is an error then it should be logged */
if (event.getType() == FrameworkEvent.ERROR) {
@@ -1307,6 +1344,7 @@
/* dispatch event to set of listeners */
listeners.dispatchEventAsynchronous(FRAMEWORKEVENT, event);
}
+
/**
* Deliver a BundleEvent to SynchronousBundleListeners (synchronous). and
* BundleListeners (asynchronous).
@@ -1331,6 +1369,7 @@
}
}
}
+
public void publishBundleEventPrivileged(BundleEvent event) {
/* Dispatch BundleEvent to SynchronousBundleListeners */
if (bundleEventSync != null) {
@@ -1365,6 +1404,7 @@
listeners.dispatchEventAsynchronous(BUNDLEEVENT, event);
}
}
+
/**
* Deliver a ServiceEvent.
*
@@ -1388,6 +1428,7 @@
}
}
}
+
public void publishServiceEventPrivileged(ServiceEvent event) {
/* queue to hold set of listeners */
ListenerQueue listeners = new ListenerQueue(eventManager);
@@ -1403,6 +1444,7 @@
/* dispatch event to set of listeners */
listeners.dispatchEventSynchronous(SERVICEEVENT, event);
}
+
/**
* Top level event dispatcher for the framework.
*
@@ -1448,7 +1490,7 @@
Debug.println("Exception in Top level event dispatcher: " + t.getMessage());
Debug.printStackTrace(t);
}
- publisherror : {
+ publisherror: {
if (action == FRAMEWORKEVENT) {
FrameworkEvent event = (FrameworkEvent) object;
if (event.getType() == FrameworkEvent.ERROR) {
@@ -1460,6 +1502,7 @@
}
}
}
+
private String[] noMatches(boolean optional) throws BundleException {
if (optional) {
return null;
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/KeyedElement.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/KeyedElement.java
index 30cc65d..317d5af 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/KeyedElement.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/KeyedElement.java
@@ -12,6 +12,8 @@
public interface KeyedElement {
public int getKeyHashCode();
+
public boolean compare(KeyedElement other);
+
public Object getKey();
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/KeyedHashSet.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/KeyedHashSet.java
index 2b77265..706329d 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/KeyedHashSet.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/KeyedHashSet.java
@@ -19,20 +19,25 @@
protected KeyedElement[] elements;
protected boolean replace;
private int capacity;
+
public KeyedHashSet() {
this(MINIMUM_SIZE, true);
}
+
public KeyedHashSet(boolean replace) {
this(MINIMUM_SIZE, replace);
}
+
public KeyedHashSet(int capacity) {
this(capacity, true);
}
+
public KeyedHashSet(int capacity, boolean replace) {
elements = new KeyedElement[Math.max(MINIMUM_SIZE, capacity * 2)];
this.replace = replace;
this.capacity = capacity;
}
+
public KeyedHashSet(KeyedHashSet original) {
elements = new KeyedElement[original.elements.length];
System.arraycopy(original.elements, 0, elements, 0, original.elements.length);
@@ -40,6 +45,7 @@
replace = original.replace;
capacity = original.capacity;
}
+
/**
* Adds an element to this set. If an element with the same key already exists,
* replaces it depending on the replace flag.
@@ -90,19 +96,24 @@
expand();
return add(element);
}
+
public void addAll(KeyedElement[] elements) {
for (int i = 0; i < elements.length; i++)
add(elements[i]);
}
+
public boolean contains(KeyedElement element) {
return get(element) != null;
}
+
public boolean containsKey(Object key) {
return getByKey(key) != null;
}
+
public KeyedElement[] elements() {
return (KeyedElement[]) elements(new KeyedElement[elementCount]);
}
+
public Object[] elements(Object[] result) {
int j = 0;
for (int i = 0; i < elements.length; i++) {
@@ -112,6 +123,7 @@
}
return result;
}
+
/**
* The array isn't large enough so double its size and rehash
* all its current values.
@@ -134,6 +146,7 @@
}
}
}
+
/**
* Returns the set element with the given id, or null
* if not found.
@@ -195,9 +208,11 @@
// nothing found so return null
return null;
}
+
public boolean isEmpty() {
return elementCount == 0;
}
+
/**
* The element at the given index has been removed so move
* elements to keep the set properly hashed.
@@ -227,6 +242,7 @@
}
elements[target] = null;
}
+
public boolean removeByKey(Object key) {
if (elementCount == 0)
return false;
@@ -256,6 +272,7 @@
return true;
}
+
public boolean remove(KeyedElement toRemove) {
if (elementCount == 0)
return false;
@@ -285,22 +302,28 @@
}
return false;
}
+
private int hash(KeyedElement key) {
return Math.abs(key.getKeyHashCode()) % elements.length;
}
+
private int keyHash(Object key) {
return Math.abs(key.hashCode()) % elements.length;
}
+
public void removeAll(KeyedElement[] elements) {
for (int i = 0; i < elements.length; i++)
remove(elements[i]);
}
+
private boolean shouldGrow() {
return elementCount > elements.length * 0.75;
}
+
public int size() {
return elementCount;
}
+
public String toString() {
StringBuffer result = new StringBuffer(100);
result.append("{");
@@ -349,9 +372,11 @@
class KeyedHashSetIterator implements Iterator {
private int currentIndex = -1;
private int found;
+
public boolean hasNext() {
return found < elementCount;
}
+
public Object next() {
if (!hasNext())
throw new NoSuchElementException();
@@ -363,13 +388,15 @@
// this would mean we have less elements than we thought
throw new NoSuchElementException();
}
+
public void remove() {
// as allowed by the API
throw new UnsupportedOperationException();
}
}
+
public void clear() {
elements = new KeyedElement[Math.max(MINIMUM_SIZE, capacity * 2)];
elementCount = 0;
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/ManifestLocalization.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/ManifestLocalization.java
index f6bce94..059192b 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/ManifestLocalization.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/ManifestLocalization.java
@@ -9,12 +9,14 @@
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.osgi.framework.internal.core;
+
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.*;
import org.eclipse.osgi.framework.util.Headers;
import org.osgi.framework.Constants;
+
/**
* This class is used by the Bundle Class to localize manifest headers.
*/
@@ -22,10 +24,12 @@
private AbstractBundle bundle = null;
private Dictionary rawHeaders = null;
private Headers defaultLocaleHeaders = null;
+
public ManifestLocalization(AbstractBundle bundle, Dictionary rawHeaders) {
this.bundle = bundle;
this.rawHeaders = rawHeaders;
}
+
protected Dictionary getHeaders(String localeString) {
boolean defaultLocale = false;
if (localeString == "") {
@@ -80,6 +84,7 @@
}
return (localeHeaders);
}
+
private String[] buildNLVariants(String nl) {
ArrayList result = new ArrayList();
int lastSeparator;
@@ -92,6 +97,7 @@
result.add(nl);
return (String[]) result.toArray(new String[result.size()]);
}
+
/*
* This method find the appropiate Manifest Localization file inside the bundle. If not found, return null.
*/
@@ -122,6 +128,7 @@
}
return resourceBundle;
}
+
/*
* This method searchs for properties file the same way the ResourceBundle algorithm
*/
@@ -145,9 +152,11 @@
return result;
return findInFragments(filename);
}
+
private URL findInBundle(String filePath) {
return this.bundle.getEntry(filePath);
}
+
private URL findInFragments(String filePath) {
org.osgi.framework.Bundle[] fragments = this.bundle.getFragments();
URL fileURL = null;
@@ -158,6 +167,7 @@
}
return fileURL;
}
+
private Dictionary stripPercents(Dictionary dictionary) {
//strip out the '%'s and return the raw headers without '%'s
Enumeration e = rawHeaders.keys();
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Msg.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Msg.java
index d12f0fb..91d3c60 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Msg.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Msg.java
@@ -36,4 +36,4 @@
static {
formatter = new org.eclipse.osgi.framework.msg.MessageFormat("org.eclipse.osgi.framework.internal.core.ExternalMessages");
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/MultiSourcePackage.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/MultiSourcePackage.java
index 956eaa1..e2d9123 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/MultiSourcePackage.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/MultiSourcePackage.java
@@ -30,4 +30,4 @@
return null;
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/NothingToUpdateException.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/NothingToUpdateException.java
index 495a7d8..6c84a0a 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/NothingToUpdateException.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/NothingToUpdateException.java
@@ -19,4 +19,4 @@
*/
public class NothingToUpdateException extends IOException {
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/NullPackageSource.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/NullPackageSource.java
index 14a5e7c..40ae82e 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/NullPackageSource.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/NullPackageSource.java
@@ -20,19 +20,24 @@
public NullPackageSource(String name) {
this.id = name;
}
+
public BundleLoaderProxy getSupplier() {
return null;
}
+
public boolean isMultivalued() {
return false;
}
+
public BundleLoaderProxy[] getSuppliers() {
return null;
}
+
public boolean isNullSource() {
return true;
}
+
public String toString() {
return id + " -> null";
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/OSGi.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/OSGi.java
index 6b38ca8..be4a2f2 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/OSGi.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/OSGi.java
@@ -96,12 +96,12 @@
*/
protected void displayBanner() {
System.out.println();
- System.out.print(Msg.formatter.getString("ECLIPSE_OSGI_NAME")); //$NON-NLS-1$
+ System.out.print(Msg.formatter.getString("ECLIPSE_OSGI_NAME")); //$NON-NLS-1$
System.out.print(" ");
- System.out.println(Msg.formatter.getString("ECLIPSE_OSGI_VERSION")); //$NON-NLS-1$
+ System.out.println(Msg.formatter.getString("ECLIPSE_OSGI_VERSION")); //$NON-NLS-1$
System.out.println();
- System.out.println(Msg.formatter.getString("OSGI_VERSION")); //$NON-NLS-1$
+ System.out.println(Msg.formatter.getString("OSGI_VERSION")); //$NON-NLS-1$
System.out.println();
- System.out.println(Msg.formatter.getString("ECLIPSE_COPYRIGHT")); //$NON-NLS-1$
+ System.out.println(Msg.formatter.getString("ECLIPSE_COPYRIGHT")); //$NON-NLS-1$
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/PackageAdminImpl.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/PackageAdminImpl.java
index bf617c3..79d07d9 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/PackageAdminImpl.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/PackageAdminImpl.java
@@ -91,8 +91,8 @@
continue;
AbstractBundle bundle = framework.getBundle(bundleSpec.getBundleId());
if (bundle == null) {
- BundleException be = new BundleException(Msg.formatter.getString("BUNDLE_NOT_IN_FRAMEWORK",bundleSpec)); //$NON-NLS-1$
- framework.publishFrameworkEvent(FrameworkEvent.ERROR,framework.systemBundle,be);
+ BundleException be = new BundleException(Msg.formatter.getString("BUNDLE_NOT_IN_FRAMEWORK", bundleSpec)); //$NON-NLS-1$
+ framework.publishFrameworkEvent(FrameworkEvent.ERROR, framework.systemBundle, be);
continue;
}
// check export permissions before getting the host;
@@ -107,8 +107,8 @@
continue;
bundle = framework.getBundle(bundleSpec.getBundleId());
if (bundle == null) {
- BundleException be = new BundleException(Msg.formatter.getString("BUNDLE_NOT_IN_FRAMEWORK",bundleSpec)); //$NON-NLS-1$
- framework.publishFrameworkEvent(FrameworkEvent.ERROR,framework.systemBundle,be);
+ BundleException be = new BundleException(Msg.formatter.getString("BUNDLE_NOT_IN_FRAMEWORK", bundleSpec)); //$NON-NLS-1$
+ framework.publishFrameworkEvent(FrameworkEvent.ERROR, framework.systemBundle, be);
continue;
}
}
@@ -681,9 +681,9 @@
for (int i = 0; i < descriptions.length; i++) {
long bundleId = descriptions[i].getBundleId();
AbstractBundle bundle = framework.getBundle(bundleId);
- if (bundle == null ) {
- BundleException be = new BundleException(Msg.formatter.getString("BUNDLE_NOT_IN_FRAMEWORK",descriptions[i])); //$NON-NLS-1$
- framework.publishFrameworkEvent(FrameworkEvent.ERROR,framework.systemBundle,be);
+ if (bundle == null) {
+ BundleException be = new BundleException(Msg.formatter.getString("BUNDLE_NOT_IN_FRAMEWORK", descriptions[i])); //$NON-NLS-1$
+ framework.publishFrameworkEvent(FrameworkEvent.ERROR, framework.systemBundle, be);
}
if (bundle != framework.systemBundle) {
if (descriptions[i].isResolved()) {
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/PackageSource.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/PackageSource.java
index 9897132..8419685 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/PackageSource.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/PackageSource.java
@@ -16,20 +16,26 @@
public String getId() {
return id;
}
+
public abstract boolean isMultivalued();
+
public abstract BundleLoaderProxy getSupplier();
+
public abstract BundleLoaderProxy[] getSuppliers();
public boolean compare(KeyedElement other) {
return id.equals(((PackageSource) other).getId());
}
+
public int getKeyHashCode() {
return id.hashCode();
}
+
public Object getKey() {
return id;
}
+
public boolean isNullSource() {
return false;
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/PermissionAdminImpl.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/PermissionAdminImpl.java
index aab5ed6..05c8949 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/PermissionAdminImpl.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/PermissionAdminImpl.java
@@ -476,13 +476,13 @@
while (true) {
String line = reader.readLine();
- if (line == null) /* EOF */ {
+ if (line == null) /* EOF */{
break;
}
line = line.trim();
- if ((line.length() == 0) || line.startsWith("#") || line.startsWith("//")) /* comments */ {
+ if ((line.length() == 0) || line.startsWith("#") || line.startsWith("//")) /* comments */{
continue;
}
@@ -540,14 +540,14 @@
if (!name.equals("<<ALL FILES>>")) {
File file = new File(name);
- if (!file.isAbsolute()) /* relative name */ {
- if (bundle == null) /* default permissions */ {
+ if (!file.isAbsolute()) /* relative name */{
+ if (bundle == null) /* default permissions */{
continue; /* no relative file permissions */
}
File target = framework.getDataFile(bundle, name);
- if (target == null) /* no bundle data file area */ {
+ if (target == null) /* no bundle data file area */{
continue; /* no relative file permissions */
}
@@ -605,4 +605,4 @@
return permission;
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/PermissionsHash.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/PermissionsHash.java
index b41c3e0..42059e3 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/PermissionsHash.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/PermissionsHash.java
@@ -100,4 +100,4 @@
return false;
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/ServiceReferenceImpl.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/ServiceReferenceImpl.java
index 3e118b5..df1b3da 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/ServiceReferenceImpl.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/ServiceReferenceImpl.java
@@ -208,10 +208,10 @@
int compare = this.getRanking() - other.getRanking();
- if (compare == 0) /* rankings are equal */ { /* check service id */
+ if (compare == 0) /* rankings are equal */{ /* check service id */
return (int) (other.getId() - this.getId());
}
return compare;
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/ServiceRegistrationImpl.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/ServiceRegistrationImpl.java
index c9ab324..3e3c43f 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/ServiceRegistrationImpl.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/ServiceRegistrationImpl.java
@@ -33,744 +33,654 @@
* ServiceRegistration object referenced.
*/
-public class ServiceRegistrationImpl implements ServiceRegistration
-{
- /** Reference to this registration. */
- protected ServiceReferenceImpl reference;
+public class ServiceRegistrationImpl implements ServiceRegistration {
+ /** Reference to this registration. */
+ protected ServiceReferenceImpl reference;
- /** Internal framework object. */
- protected Framework framework;
+ /** Internal framework object. */
+ protected Framework framework;
- /** context which registered this service. */
- protected BundleContextImpl context;
+ /** context which registered this service. */
+ protected BundleContextImpl context;
- /** bundle which registered this service. */
- protected AbstractBundle bundle;
+ /** bundle which registered this service. */
+ protected AbstractBundle bundle;
- /** list of contexts using the service.
- * Access to this should be protected by the registrationLock */
- protected Vector contextsUsing;
+ /** list of contexts using the service.
+ * Access to this should be protected by the registrationLock */
+ protected Vector contextsUsing;
- /** service classes for this registration. */
- protected String[] clazzes;
+ /** service classes for this registration. */
+ protected String[] clazzes;
- /** service object for this registration. */
- protected Object service;
+ /** service object for this registration. */
+ protected Object service;
- /** properties for this registration. */
- protected Properties properties;
+ /** properties for this registration. */
+ protected Properties properties;
- /** service id. */
- protected long serviceid;
+ /** service id. */
+ protected long serviceid;
- /** service ranking. */
- protected int serviceranking;
+ /** service ranking. */
+ protected int serviceranking;
- /* internal object to use for synchronization */
- protected Object registrationLock = new Object();
+ /* internal object to use for synchronization */
+ protected Object registrationLock = new Object();
- /** This boolean will be true when the service registration is unregistered */
- protected boolean unregistered;
+ /** This boolean will be true when the service registration is unregistered */
+ protected boolean unregistered;
- /**
- * Construct a ServiceRegistration and register the service
- * in the framework's service registry.
- *
- */
- protected ServiceRegistrationImpl(BundleContextImpl context, String[] clazzes, Object service, Dictionary properties)
- {
- this.context = context;
- this.bundle = context.bundle;
- this.framework = context.framework;
- this.clazzes = clazzes; /* must be set before calling createProperties. */
- this.service = service;
- this.contextsUsing = null;
- this.unregistered = false;
- this.reference = new ServiceReferenceImpl(this);
+ /**
+ * Construct a ServiceRegistration and register the service
+ * in the framework's service registry.
+ *
+ */
+ protected ServiceRegistrationImpl(BundleContextImpl context, String[] clazzes, Object service, Dictionary properties) {
+ this.context = context;
+ this.bundle = context.bundle;
+ this.framework = context.framework;
+ this.clazzes = clazzes; /* must be set before calling createProperties. */
+ this.service = service;
+ this.contextsUsing = null;
+ this.unregistered = false;
+ this.reference = new ServiceReferenceImpl(this);
- synchronized (framework.serviceRegistry)
- {
- serviceid = framework.getNextServiceId(); /* must be set before calling createProperties. */
- this.properties = createProperties(properties); /* must be valid after unregister is called. */
+ synchronized (framework.serviceRegistry) {
+ serviceid = framework.getNextServiceId(); /* must be set before calling createProperties. */
+ this.properties = createProperties(properties); /* must be valid after unregister is called. */
- if (Debug.DEBUG && Debug.DEBUG_SERVICES)
- {
- Debug.println("registerService["+bundle+"]("+this+")");
- }
+ if (Debug.DEBUG && Debug.DEBUG_SERVICES) {
+ Debug.println("registerService[" + bundle + "](" + this + ")");
+ }
- framework.serviceRegistry.publishService(context,this);
- }
+ framework.serviceRegistry.publishService(context, this);
+ }
- /* must not hold the registrations lock when this event is published */
- framework.publishServiceEvent(ServiceEvent.REGISTERED, reference);
- }
+ /* must not hold the registrations lock when this event is published */
+ framework.publishServiceEvent(ServiceEvent.REGISTERED, reference);
+ }
- /**
- * Unregister the service.
- * Remove a service registration from the framework's service
- * registry.
- * All {@link ServiceReferenceImpl} objects for this registration
- * can no longer be used to interact with the service.
- *
- * <p>The following steps are followed to unregister a service:
- * <ol>
- * <li>The service is removed from the framework's service
- * registry so that it may no longer be used.
- * {@link ServiceReferenceImpl}s for the service may no longer be used
- * to get a service object for the service.
- * <li>A {@link ServiceEvent} of type {@link ServiceEvent#UNREGISTERING}
- * is synchronously sent so that bundles using this service
- * may release their use of the service.
- * <li>For each bundle whose use count for this service is greater
- * than zero:
- * <ol>
- * <li>The bundle's use count for this service is set to zero.
- * <li>If the service was registered with a {@link ServiceFactory},
- * the {@link ServiceFactory#ungetService ServiceFactory.ungetService} method
- * is called to release the service object for the bundle.
- * </ol>
- * </ol>
- *
- * @exception java.lang.IllegalStateException If
- * this ServiceRegistration has already been unregistered.
- * @see BundleContextImpl#ungetService
- */
- public void unregister()
- {
- synchronized (registrationLock)
- {
- if (service == null) /* in the process of unregisterING */
- {
- throw new IllegalStateException(Msg.formatter.getString("SERVICE_ALREADY_UNREGISTERED_EXCEPTION"));
- }
+ /**
+ * Unregister the service.
+ * Remove a service registration from the framework's service
+ * registry.
+ * All {@link ServiceReferenceImpl} objects for this registration
+ * can no longer be used to interact with the service.
+ *
+ * <p>The following steps are followed to unregister a service:
+ * <ol>
+ * <li>The service is removed from the framework's service
+ * registry so that it may no longer be used.
+ * {@link ServiceReferenceImpl}s for the service may no longer be used
+ * to get a service object for the service.
+ * <li>A {@link ServiceEvent} of type {@link ServiceEvent#UNREGISTERING}
+ * is synchronously sent so that bundles using this service
+ * may release their use of the service.
+ * <li>For each bundle whose use count for this service is greater
+ * than zero:
+ * <ol>
+ * <li>The bundle's use count for this service is set to zero.
+ * <li>If the service was registered with a {@link ServiceFactory},
+ * the {@link ServiceFactory#ungetService ServiceFactory.ungetService} method
+ * is called to release the service object for the bundle.
+ * </ol>
+ * </ol>
+ *
+ * @exception java.lang.IllegalStateException If
+ * this ServiceRegistration has already been unregistered.
+ * @see BundleContextImpl#ungetService
+ */
+ public void unregister() {
+ synchronized (registrationLock) {
+ if (service == null) /* in the process of unregisterING */
+ {
+ throw new IllegalStateException(Msg.formatter.getString("SERVICE_ALREADY_UNREGISTERED_EXCEPTION"));
+ }
- /* remove this object from the service registry */
- if (Debug.DEBUG && Debug.DEBUG_SERVICES)
- {
- Debug.println("unregisterService["+bundle+"]("+this+")");
- }
+ /* remove this object from the service registry */
+ if (Debug.DEBUG && Debug.DEBUG_SERVICES) {
+ Debug.println("unregisterService[" + bundle + "](" + this + ")");
+ }
- synchronized (framework.serviceRegistry)
- {
- framework.serviceRegistry.unpublishService(context,this);
- }
+ synchronized (framework.serviceRegistry) {
+ framework.serviceRegistry.unpublishService(context, this);
+ }
- service = null; /* mark unregisterING */
- }
+ service = null; /* mark unregisterING */
+ }
- /* must not hold the registrationLock when this event is published */
- framework.publishServiceEvent(ServiceEvent.UNREGISTERING, reference);
+ /* must not hold the registrationLock when this event is published */
+ framework.publishServiceEvent(ServiceEvent.UNREGISTERING, reference);
- /* we have published the ServiceEvent, now mark the service fully unregistered */
- unregistered = true;
+ /* we have published the ServiceEvent, now mark the service fully unregistered */
+ unregistered = true;
- int size = 0;
- BundleContextImpl[] users = null;
+ int size = 0;
+ BundleContextImpl[] users = null;
- synchronized (registrationLock)
- {
- if (contextsUsing != null)
- {
- size = contextsUsing.size();
+ synchronized (registrationLock) {
+ if (contextsUsing != null) {
+ size = contextsUsing.size();
- if (size > 0)
- {
- if (Debug.DEBUG && Debug.DEBUG_SERVICES)
- {
- Debug.println("unregisterService: releasing users");
- }
+ if (size > 0) {
+ if (Debug.DEBUG && Debug.DEBUG_SERVICES) {
+ Debug.println("unregisterService: releasing users");
+ }
- users = new BundleContextImpl[size];
- contextsUsing.copyInto(users);
- }
- }
- }
+ users = new BundleContextImpl[size];
+ contextsUsing.copyInto(users);
+ }
+ }
+ }
- /* must not hold the registrationLock while releasing services */
- for (int i = 0; i < size; i++)
- {
- releaseService(users[i]);
- }
+ /* must not hold the registrationLock while releasing services */
+ for (int i = 0; i < size; i++) {
+ releaseService(users[i]);
+ }
- contextsUsing = null;
+ contextsUsing = null;
- reference = null; /* mark registration dead */
- context = null;
+ reference = null; /* mark registration dead */
+ context = null;
- /* These fields must be valid after unregister is called:
- * properties
- */
- }
+ /* These fields must be valid after unregister is called:
+ * properties
+ */
+ }
+ /**
+ * Returns a {@link ServiceReferenceImpl} object for this registration.
+ * The {@link ServiceReferenceImpl} object may be shared with other bundles.
+ *
+ * @exception java.lang.IllegalStateException If
+ * this ServiceRegistration has already been unregistered.
+ * @return A {@link ServiceReferenceImpl} object.
+ */
+ public org.osgi.framework.ServiceReference getReference() {
+ /* use reference instead of unregistered so that ServiceFactorys, called
+ * by releaseService after the registration is unregistered, can
+ * get the ServiceReference. Note this technically may voilate the spec
+ * but makes more sense.
+ */
+ if (reference == null) {
+ throw new IllegalStateException(Msg.formatter.getString("SERVICE_ALREADY_UNREGISTERED_EXCEPTION"));
+ }
- /**
- * Returns a {@link ServiceReferenceImpl} object for this registration.
- * The {@link ServiceReferenceImpl} object may be shared with other bundles.
- *
- * @exception java.lang.IllegalStateException If
- * this ServiceRegistration has already been unregistered.
- * @return A {@link ServiceReferenceImpl} object.
- */
- public org.osgi.framework.ServiceReference getReference()
- {
- /* use reference instead of unregistered so that ServiceFactorys, called
- * by releaseService after the registration is unregistered, can
- * get the ServiceReference. Note this technically may voilate the spec
- * but makes more sense.
- */
- if (reference == null)
- {
- throw new IllegalStateException(Msg.formatter.getString("SERVICE_ALREADY_UNREGISTERED_EXCEPTION"));
- }
+ return (reference);
+ }
- return(reference);
- }
+ /**
+ * Update the properties associated with this service.
+ *
+ * <p>The key "objectClass" cannot be modified by this method. It's
+ * value is set when the service is registered.
+ *
+ * <p>The following steps are followed to modify a service's properties:
+ * <ol>
+ * <li>The service's properties are replaced with the provided properties.
+ * <li>A {@link ServiceEvent} of type {@link ServiceEvent#MODIFIED}
+ * is synchronously sent.
+ * </ol>
+ *
+ * @param properties The properties for this service.
+ * Changes should not be made to this object after calling this method.
+ * To update the service's properties this method should be called again.
+ * @exception java.lang.IllegalStateException If
+ * this ServiceRegistration has already been unregistered.
+ *
+ * @exception IllegalArgumentException If the <tt>properties</tt>
+ * parameter contains case variants of the same key name.
+ */
+ public void setProperties(Dictionary props) {
+ synchronized (registrationLock) {
+ if (service == null) /* in the process of unregistering */
+ {
+ throw new IllegalStateException(Msg.formatter.getString("SERVICE_ALREADY_UNREGISTERED_EXCEPTION"));
+ }
- /**
- * Update the properties associated with this service.
- *
- * <p>The key "objectClass" cannot be modified by this method. It's
- * value is set when the service is registered.
- *
- * <p>The following steps are followed to modify a service's properties:
- * <ol>
- * <li>The service's properties are replaced with the provided properties.
- * <li>A {@link ServiceEvent} of type {@link ServiceEvent#MODIFIED}
- * is synchronously sent.
- * </ol>
- *
- * @param properties The properties for this service.
- * Changes should not be made to this object after calling this method.
- * To update the service's properties this method should be called again.
- * @exception java.lang.IllegalStateException If
- * this ServiceRegistration has already been unregistered.
- *
- * @exception IllegalArgumentException If the <tt>properties</tt>
- * parameter contains case variants of the same key name.
- */
- public void setProperties(Dictionary props)
- {
- synchronized (registrationLock)
- {
- if (service == null) /* in the process of unregistering */
- {
- throw new IllegalStateException(Msg.formatter.getString("SERVICE_ALREADY_UNREGISTERED_EXCEPTION"));
- }
+ this.properties = createProperties(props);
+ }
- this.properties = createProperties(props);
- }
+ /* must not hold the registrationLock when this event is published */
+ framework.publishServiceEvent(ServiceEvent.MODIFIED, reference);
+ }
- /* must not hold the registrationLock when this event is published */
- framework.publishServiceEvent(ServiceEvent.MODIFIED, reference);
- }
+ /**
+ * Construct a properties object from the dictionary for this
+ * ServiceRegistration.
+ *
+ * @param props The properties for this service.
+ * @return A Properties object for this ServiceRegistration.
+ */
+ protected Properties createProperties(Dictionary props) {
+ Properties properties = new Properties(props);
- /**
- * Construct a properties object from the dictionary for this
- * ServiceRegistration.
- *
- * @param props The properties for this service.
- * @return A Properties object for this ServiceRegistration.
- */
- protected Properties createProperties(Dictionary props)
- {
- Properties properties = new Properties(props);
+ properties.setProperty(Constants.OBJECTCLASS, null); /* remove user provided key if any */
+ properties.setProperty(Constants.OBJECTCLASS, clazzes);
- properties.setProperty(Constants.OBJECTCLASS, null); /* remove user provided key if any */
- properties.setProperty(Constants.OBJECTCLASS, clazzes);
+ properties.setProperty(Constants.SERVICE_ID, null); /* remove user provided key if any */
+ properties.setProperty(Constants.SERVICE_ID, new Long(serviceid));
- properties.setProperty(Constants.SERVICE_ID, null); /* remove user provided key if any */
- properties.setProperty(Constants.SERVICE_ID, new Long(serviceid));
+ Object ranking = properties.getProperty(Constants.SERVICE_RANKING);
- Object ranking = properties.getProperty(Constants.SERVICE_RANKING);
+ serviceranking = (ranking instanceof Integer) ? ((Integer) ranking).intValue() : 0;
- serviceranking = (ranking instanceof Integer) ?
- ((Integer)ranking).intValue() :
- 0;
+ return (properties);
+ }
- return(properties);
- }
+ /**
+ * Get the value of a service's property.
+ *
+ * <p>This method will continue to return property values after the
+ * service has been unregistered. This is so that references to
+ * unregistered service can be interrogated.
+ * (For example: ServiceReference objects stored in the log.)
+ *
+ * @param key Name of the property.
+ * @return Value of the property or <code>null</code> if there is
+ * no property by that name.
+ */
+ protected Object getProperty(String key) {
+ synchronized (registrationLock) {
+ return (properties.getProperty(key));
+ }
+ }
- /**
- * Get the value of a service's property.
- *
- * <p>This method will continue to return property values after the
- * service has been unregistered. This is so that references to
- * unregistered service can be interrogated.
- * (For example: ServiceReference objects stored in the log.)
- *
- * @param key Name of the property.
- * @return Value of the property or <code>null</code> if there is
- * no property by that name.
- */
- protected Object getProperty(String key)
- {
- synchronized (registrationLock)
- {
- return(properties.getProperty(key));
- }
- }
+ /**
+ * Get the list of key names for the service's properties.
+ *
+ * <p>This method will continue to return the keys after the
+ * service has been unregistered. This is so that references to
+ * unregistered service can be interrogated.
+ * (For example: ServiceReference objects stored in the log.)
+ *
+ * @return The list of property key names.
+ */
+ protected String[] getPropertyKeys() {
+ synchronized (registrationLock) {
+ return (properties.getPropertyKeys());
+ }
+ }
- /**
- * Get the list of key names for the service's properties.
- *
- * <p>This method will continue to return the keys after the
- * service has been unregistered. This is so that references to
- * unregistered service can be interrogated.
- * (For example: ServiceReference objects stored in the log.)
- *
- * @return The list of property key names.
- */
- protected String[] getPropertyKeys()
- {
- synchronized (registrationLock)
- {
- return(properties.getPropertyKeys());
- }
- }
+ /**
+ * Return the bundle which registered the service.
+ *
+ * <p>This method will always return <code>null</code> when the
+ * service has been unregistered. This can be used to
+ * determine if the service has been unregistered.
+ *
+ * @return The bundle which registered the service.
+ * @see BundleContextImpl.registerService
+ */
+ protected AbstractBundle getBundle() {
+ if (reference == null) {
+ return (null);
+ }
- /**
- * Return the bundle which registered the service.
- *
- * <p>This method will always return <code>null</code> when the
- * service has been unregistered. This can be used to
- * determine if the service has been unregistered.
- *
- * @return The bundle which registered the service.
- * @see BundleContextImpl.registerService
- */
- protected AbstractBundle getBundle()
- {
- if (reference == null)
- {
- return(null);
- }
+ return (bundle);
+ }
- return(bundle);
- }
+ /**
+ * Get a service object for the using BundleContext.
+ *
+ * @param user BundleContext using service.
+ * @return Service object
+ */
+ protected Object getService(BundleContextImpl user) {
+ synchronized (registrationLock) {
+ if (unregistered) /* service unregistered */
+ {
+ return (null);
+ }
- /**
- * Get a service object for the using BundleContext.
- *
- * @param user BundleContext using service.
- * @return Service object
- */
- protected Object getService(BundleContextImpl user)
- {
- synchronized (registrationLock)
- {
- if (unregistered) /* service unregistered */
- {
- return(null);
- }
+ if (Debug.DEBUG && Debug.DEBUG_SERVICES) {
+ Debug.println("getService[" + user.bundle + "](" + this + ")");
+ }
- if (Debug.DEBUG && Debug.DEBUG_SERVICES)
- {
- Debug.println("getService["+user.bundle+"]("+this+")");
- }
+ Hashtable servicesInUse = user.servicesInUse;
- Hashtable servicesInUse = user.servicesInUse;
+ ServiceUse use = (ServiceUse) servicesInUse.get(reference);
- ServiceUse use = (ServiceUse)servicesInUse.get(reference);
+ if (use == null) {
+ use = new ServiceUse(user, this);
- if (use == null)
- {
- use = new ServiceUse(user, this);
+ Object service = use.getService();
- Object service = use.getService();
+ if (service != null) {
+ servicesInUse.put(reference, use);
- if (service != null)
- {
- servicesInUse.put(reference, use);
+ if (contextsUsing == null) {
+ contextsUsing = new Vector(10, 10);
+ }
- if (contextsUsing == null)
- {
- contextsUsing = new Vector(10, 10);
- }
+ contextsUsing.addElement(user);
+ }
- contextsUsing.addElement(user);
- }
+ return (service);
+ } else {
+ return (use.getService());
+ }
+ }
+ }
- return(service);
- }
- else
- {
- return(use.getService());
- }
- }
- }
+ /**
+ * Unget a service for the using BundleContext.
+ *
+ * @param user BundleContext using service.
+ * @return <code>false</code> if the context bundle's use count for the service
+ * is zero or if the service has been unregistered,
+ * otherwise <code>true</code>.
+ */
+ protected boolean ungetService(BundleContextImpl user) {
+ synchronized (registrationLock) {
+ if (unregistered) {
+ return (false);
+ }
- /**
- * Unget a service for the using BundleContext.
- *
- * @param user BundleContext using service.
- * @return <code>false</code> if the context bundle's use count for the service
- * is zero or if the service has been unregistered,
- * otherwise <code>true</code>.
- */
- protected boolean ungetService(BundleContextImpl user)
- {
- synchronized (registrationLock)
- {
- if (unregistered)
- {
- return(false);
- }
+ if (Debug.DEBUG && Debug.DEBUG_SERVICES) {
+ String bundle = (user.bundle == null) ? "" : user.bundle.toString();
+ Debug.println("ungetService[" + bundle + "](" + this + ")");
+ }
- if (Debug.DEBUG && Debug.DEBUG_SERVICES)
- {
- String bundle = (user.bundle == null) ? "" : user.bundle.toString();
- Debug.println("ungetService["+bundle+"]("+this+")");
- }
+ Hashtable servicesInUse = user.servicesInUse;
- Hashtable servicesInUse = user.servicesInUse;
+ if (servicesInUse != null) {
+ ServiceUse use = (ServiceUse) servicesInUse.get(reference);
- if (servicesInUse != null)
- {
- ServiceUse use = (ServiceUse)servicesInUse.get(reference);
+ if (use != null) {
+ if (use.ungetService()) {
+ /* use count is now zero */
+ servicesInUse.remove(reference);
- if (use != null)
- {
- if (use.ungetService())
- {
- /* use count is now zero */
- servicesInUse.remove(reference);
+ contextsUsing.removeElement(user);
+ }
- contextsUsing.removeElement(user);
- }
+ return (true);
+ }
+ }
- return(true);
- }
- }
+ return (false);
+ }
+ }
- return(false);
- }
- }
+ /**
+ * Release the service for the using BundleContext.
+ *
+ * @param user BundleContext using service.
+ */
+ protected void releaseService(BundleContextImpl user) {
+ synchronized (registrationLock) {
+ if (reference == null) /* registration dead */
+ {
+ return;
+ }
- /**
- * Release the service for the using BundleContext.
- *
- * @param user BundleContext using service.
- */
- protected void releaseService(BundleContextImpl user)
- {
- synchronized (registrationLock)
- {
- if (reference == null) /* registration dead */
- {
- return;
- }
+ if (Debug.DEBUG && Debug.DEBUG_SERVICES) {
+ String bundle = (user.bundle == null) ? "" : user.bundle.toString();
+ Debug.println("releaseService[" + bundle + "](" + this + ")");
+ }
- if (Debug.DEBUG && Debug.DEBUG_SERVICES)
- {
- String bundle = (user.bundle == null) ? "" : user.bundle.toString();
- Debug.println("releaseService["+bundle+"]("+this+")");
- }
+ Hashtable servicesInUse = user.servicesInUse;
- Hashtable servicesInUse = user.servicesInUse;
+ if (servicesInUse != null) {
+ ServiceUse use = (ServiceUse) servicesInUse.remove(reference);
- if (servicesInUse != null)
- {
- ServiceUse use = (ServiceUse)servicesInUse.remove(reference);
+ if (use != null) {
+ use.releaseService();
- if (use != null)
- {
- use.releaseService();
+ contextsUsing.removeElement(user);
+ }
+ }
+ }
+ }
- contextsUsing.removeElement(user);
- }
- }
- }
- }
+ /**
+ * Return the list of bundle which are using this service.
+ *
+ * @return Array of Bundles using this service.
+ */
+ protected AbstractBundle[] getUsingBundles() {
+ synchronized (registrationLock) {
+ if (unregistered) /* service unregistered */
+ {
+ return (null);
+ }
- /**
- * Return the list of bundle which are using this service.
- *
- * @return Array of Bundles using this service.
- */
- protected AbstractBundle[] getUsingBundles()
- {
- synchronized (registrationLock)
- {
- if (unregistered) /* service unregistered */
- {
- return(null);
- }
+ if (contextsUsing == null) {
+ return (null);
+ }
- if (contextsUsing == null)
- {
- return(null);
- }
+ int size = contextsUsing.size();
- int size = contextsUsing.size();
+ if (size == 0) {
+ return (null);
+ }
- if (size == 0)
- {
- return(null);
- }
+ AbstractBundle[] bundles = new AbstractBundle[size];
- AbstractBundle[] bundles = new AbstractBundle[size];
+ /* Copy vector of BundleContext into an array of Bundle. */
+ for (int i = 0; i < size; i++) {
+ bundles[i] = ((BundleContextImpl) contextsUsing.elementAt(i)).bundle;
+ }
- /* Copy vector of BundleContext into an array of Bundle. */
- for (int i = 0; i < size; i++)
- {
- bundles[i] = ((BundleContextImpl)contextsUsing.elementAt(i)).bundle;
- }
+ return (bundles);
+ }
+ }
- return(bundles);
- }
- }
+ /**
+ * Return a String representation of this object.
+ *
+ * @return String representation of this object.
+ */
+ public String toString() {
+ String[] clazzes = this.clazzes;
+ int size = clazzes.length;
+ StringBuffer sb = new StringBuffer(50 * size);
- /**
- * Return a String representation of this object.
- *
- * @return String representation of this object.
- */
- public String toString()
- {
- String[] clazzes = this.clazzes;
- int size = clazzes.length;
- StringBuffer sb = new StringBuffer(50 * size);
+ sb.append('{');
- sb.append('{');
+ for (int i = 0; i < size; i++) {
+ if (i > 0) {
+ sb.append(", ");
+ }
+ sb.append(clazzes[i]);
+ }
- for (int i = 0; i < size; i++)
- {
- if (i > 0)
- {
- sb.append(", ");
- }
- sb.append(clazzes[i]);
- }
+ sb.append("}=");
+ sb.append(properties);
- sb.append("}=");
- sb.append(properties);
+ return (sb.toString());
+ }
- return(sb.toString());
- }
+ /**
+ * Hashtable for service properties.
+ */
+ static class Properties extends Headers {
+ /**
+ * Create a properties object for the service.
+ *
+ * @param properties The properties for this service.
+ */
+ private Properties(int size, Dictionary props) {
+ super((size << 1) + 1);
- /**
- * Hashtable for service properties.
- */
- static class Properties extends Headers
- {
- /**
- * Create a properties object for the service.
- *
- * @param properties The properties for this service.
- */
- private Properties(int size, Dictionary props)
- {
- super((size << 1) + 1);
+ if (props != null) {
+ synchronized (props) {
+ Enumeration enum = props.keys();
- if (props != null)
- {
- synchronized (props)
- {
- Enumeration enum = props.keys();
+ while (enum.hasMoreElements()) {
+ Object key = enum.nextElement();
- while (enum.hasMoreElements())
- {
- Object key = enum.nextElement();
+ if (key instanceof String) {
+ String header = (String) key;
- if (key instanceof String)
- {
- String header = (String)key;
+ setProperty(header, props.get(header));
+ }
+ }
+ }
+ }
+ }
- setProperty(header, props.get(header));
- }
- }
- }
- }
- }
- /**
- * Create a properties object for the service.
- *
- * @param properties The properties for this service.
- */
- protected Properties(Dictionary props)
- {
- this((props == null) ? 2 : Math.max(2, props.size()), props);
- }
+ /**
+ * Create a properties object for the service.
+ *
+ * @param properties The properties for this service.
+ */
+ protected Properties(Dictionary props) {
+ this((props == null) ? 2 : Math.max(2, props.size()), props);
+ }
- /**
- * Get a clone of the value of a service's property.
- *
- * @param key header name.
- * @return Clone of the value of the property or <code>null</code> if there is
- * no property by that name.
- */
- protected Object getProperty(String key)
- {
- return(cloneValue(get(key)));
- }
+ /**
+ * Get a clone of the value of a service's property.
+ *
+ * @param key header name.
+ * @return Clone of the value of the property or <code>null</code> if there is
+ * no property by that name.
+ */
+ protected Object getProperty(String key) {
+ return (cloneValue(get(key)));
+ }
- /**
- * Get the list of key names for the service's properties.
- *
- * @return The list of property key names.
- */
- protected synchronized String[] getPropertyKeys()
- {
- int size = size();
+ /**
+ * Get the list of key names for the service's properties.
+ *
+ * @return The list of property key names.
+ */
+ protected synchronized String[] getPropertyKeys() {
+ int size = size();
- String[] keynames = new String[size];
+ String[] keynames = new String[size];
- Enumeration enum = keys();
+ Enumeration enum = keys();
- for (int i = 0; i < size; i++)
- {
- keynames[i] = (String)enum.nextElement();
- }
+ for (int i = 0; i < size; i++) {
+ keynames[i] = (String) enum.nextElement();
+ }
- return(keynames);
- }
+ return (keynames);
+ }
- /**
- * Put a clone of the property value into this property object.
- *
- * @param key Name of property.
- * @param value Value of property.
- * @return previous property value.
- */
- protected synchronized Object setProperty(String key, Object value)
- {
- return(set(key, cloneValue(value)));
- }
+ /**
+ * Put a clone of the property value into this property object.
+ *
+ * @param key Name of property.
+ * @param value Value of property.
+ * @return previous property value.
+ */
+ protected synchronized Object setProperty(String key, Object value) {
+ return (set(key, cloneValue(value)));
+ }
- /**
- * Attempt to clone the value if necessary and possible.
- *
- * For some strange reason, you can test to see of an Object is
- * Cloneable but you can't call the clone method since it is
- * protected on Object!
- *
- * @param value object to be cloned.
- * @return cloned object or original object if we didn't clone it.
- */
- protected static Object cloneValue(Object value)
- {
- if (value != null)
- {
- if (value instanceof String) /* shortcut String */
- {
- return(value);
- }
+ /**
+ * Attempt to clone the value if necessary and possible.
+ *
+ * For some strange reason, you can test to see of an Object is
+ * Cloneable but you can't call the clone method since it is
+ * protected on Object!
+ *
+ * @param value object to be cloned.
+ * @return cloned object or original object if we didn't clone it.
+ */
+ protected static Object cloneValue(Object value) {
+ if (value != null) {
+ if (value instanceof String) /* shortcut String */
+ {
+ return (value);
+ }
- Class clazz = value.getClass();
+ Class clazz = value.getClass();
- if (clazz.isArray())
- {
- Class type = clazz.getComponentType();
+ if (clazz.isArray()) {
+ Class type = clazz.getComponentType();
- if (type.isPrimitive())
- {
- if (Integer.TYPE.isAssignableFrom(type))
- {
- return(((int[])value).clone());
- }
+ if (type.isPrimitive()) {
+ if (Integer.TYPE.isAssignableFrom(type)) {
+ return (((int[]) value).clone());
+ }
- if (Long.TYPE.isAssignableFrom(type))
- {
- return(((long[])value).clone());
- }
+ if (Long.TYPE.isAssignableFrom(type)) {
+ return (((long[]) value).clone());
+ }
- if (Byte.TYPE.isAssignableFrom(type))
- {
- return(((byte[])value).clone());
- }
+ if (Byte.TYPE.isAssignableFrom(type)) {
+ return (((byte[]) value).clone());
+ }
- if (Short.TYPE.isAssignableFrom(type))
- {
- return(((short[])value).clone());
- }
+ if (Short.TYPE.isAssignableFrom(type)) {
+ return (((short[]) value).clone());
+ }
- if (Character.TYPE.isAssignableFrom(type))
- {
- return(((char[])value).clone());
- }
+ if (Character.TYPE.isAssignableFrom(type)) {
+ return (((char[]) value).clone());
+ }
- if (Float.TYPE.isAssignableFrom(type))
- {
- return(((float[])value).clone());
- }
+ if (Float.TYPE.isAssignableFrom(type)) {
+ return (((float[]) value).clone());
+ }
- if (Double.TYPE.isAssignableFrom(type))
- {
- return(((double[])value).clone());
- }
+ if (Double.TYPE.isAssignableFrom(type)) {
+ return (((double[]) value).clone());
+ }
- if (Boolean.TYPE.isAssignableFrom(type))
- {
- return(((boolean[])value).clone());
- }
- }
- else /* non-primitive array object */
- {
- return(((Object[])value).clone());
- }
- }
- else /* non array object */
- {
- try
- {
- return(clazz.getMethod("clone", null).invoke(value, null));
- }
- catch (Exception e)
- {
- /* clone is not a public method on value's class */
- }
- catch (Error e)
- {
- /* JCL does not support reflection; try some well known types */
+ if (Boolean.TYPE.isAssignableFrom(type)) {
+ return (((boolean[]) value).clone());
+ }
+ } else /* non-primitive array object */
+ {
+ return (((Object[]) value).clone());
+ }
+ } else /* non array object */
+ {
+ try {
+ return (clazz.getMethod("clone", null).invoke(value, null));
+ } catch (Exception e) {
+ /* clone is not a public method on value's class */
+ } catch (Error e) {
+ /* JCL does not support reflection; try some well known types */
- if (value instanceof Vector)
- {
- return(((Vector)value).clone());
- }
+ if (value instanceof Vector) {
+ return (((Vector) value).clone());
+ }
- if (value instanceof Hashtable)
- {
- return(((Hashtable)value).clone());
- }
- }
- }
- }
+ if (value instanceof Hashtable) {
+ return (((Hashtable) value).clone());
+ }
+ }
+ }
+ }
- return(value);
- }
+ return (value);
+ }
- public synchronized String toString()
- {
- String keys[] = getPropertyKeys();
+ public synchronized String toString() {
+ String keys[] = getPropertyKeys();
- int size = keys.length;
+ int size = keys.length;
- StringBuffer sb = new StringBuffer(20 * size);
+ StringBuffer sb = new StringBuffer(20 * size);
- sb.append('{');
+ sb.append('{');
- int n = 0;
- for (int i = 0; i < size; i++)
- {
- String key = keys[i];
- if (!key.equals(Constants.OBJECTCLASS))
- {
- if (n > 0)
- {
- sb.append(", ");
- }
+ int n = 0;
+ for (int i = 0; i < size; i++) {
+ String key = keys[i];
+ if (!key.equals(Constants.OBJECTCLASS)) {
+ if (n > 0) {
+ sb.append(", ");
+ }
- sb.append(key);
- sb.append('=');
- sb.append(get(key));
- n++;
- }
- }
+ sb.append(key);
+ sb.append('=');
+ sb.append(get(key));
+ n++;
+ }
+ }
- sb.append('}');
+ sb.append('}');
- return(sb.toString());
- }
- }
+ return (sb.toString());
+ }
+ }
}
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/ServiceUse.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/ServiceUse.java
index 5d0d730..d0e1a6f 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/ServiceUse.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/ServiceUse.java
@@ -24,10 +24,10 @@
public class ServiceUse {
/** ServiceFactory object if the service instance represents a factory,
- null otherwise */
+ null otherwise */
protected ServiceFactory factory;
/** Service object either registered or that returned by
- ServiceFactory.getService() */
+ ServiceFactory.getService() */
protected Object service;
/** BundleContext associated with this service use */
protected BundleContextImpl context;
@@ -35,6 +35,7 @@
protected ServiceRegistrationImpl registration;
/** bundle's use count for this service */
protected int useCount;
+
/** Internal framework object. */
/**
@@ -134,7 +135,7 @@
int size = clazzes.length;
PackageAdminImpl packageAdmin = context.framework.packageAdmin;
for (int i = 0; i < size; i++) {
- Class clazz = packageAdmin.loadServiceClass(clazzes[i],factorybundle);
+ Class clazz = packageAdmin.loadServiceClass(clazzes[i], factorybundle);
if (clazz == null) {
if (Debug.DEBUG && Debug.DEBUG_SERVICES) {
Debug.println(clazzes[i] + " class not found");
@@ -263,4 +264,4 @@
useCount = 0;
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/SingleSourcePackage.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/SingleSourcePackage.java
index 657141e..dffcd20 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/SingleSourcePackage.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/SingleSourcePackage.java
@@ -27,10 +27,10 @@
}
public BundleLoaderProxy[] getSuppliers() {
- return new BundleLoaderProxy[] { supplier };
+ return new BundleLoaderProxy[] {supplier};
}
public String toString() {
return id + " -> " + supplier;
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/StartLevelImpl.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/StartLevelImpl.java
index db7f23f..484bc21 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/StartLevelImpl.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/StartLevelImpl.java
@@ -35,12 +35,12 @@
}
/**
- * Return the initial start level value that is assigned
- * to a Bundle when it is first installed.
- *
- * @return The initial start level value for Bundles.
- * @see #setInitialBundleStartLevel
- */
+ * Return the initial start level value that is assigned
+ * to a Bundle when it is first installed.
+ *
+ * @return The initial start level value for Bundles.
+ * @see #setInitialBundleStartLevel
+ */
public int getInitialBundleStartLevel() {
return manager.getInitialBundleStartLevel();
}
@@ -76,140 +76,141 @@
}
/**
- * Return the active start level value of the Framework.
- *
- * If the Framework is in the process of changing the start level
- * this method must return the active start level if this
- * differs from the requested start level.
- *
- * @return The active start level value of the Framework.
- */
+ * Return the active start level value of the Framework.
+ *
+ * If the Framework is in the process of changing the start level
+ * this method must return the active start level if this
+ * differs from the requested start level.
+ *
+ * @return The active start level value of the Framework.
+ */
public int getStartLevel() {
return manager.getStartLevel();
}
+
/**
- * Modify the active start level of the Framework.
- *
- * <p>The Framework will move to the requested start level. This method
- * will return immediately to the caller and the start level
- * change will occur asynchronously on another thread.
- *
- * <p>If the specified start level is
- * higher than the active start level, the
- * Framework will continue to increase the start level
- * until the Framework has reached the specified start level,
- * starting bundles at each
- * start level which are persistently marked to be started as described in the
- * <tt>Bundle.start</tt> method.
- *
- * At each intermediate start level value on the
- * way to and including the target start level, the framework must:
- * <ol>
- * <li>Change the active start level to the intermediate start level value.
- * <li>Start bundles at the intermediate start level in
- * ascending order by <tt>Bundle.getBundleId</tt>.
- * </ol>
- * When this process completes after the specified start level is reached,
- * the Framework will broadcast a Framework event of
- * type <tt>FrameworkEvent.STARTLEVEL_CHANGED</tt> to announce it has moved to the specified
- * start level.
- *
- * <p>If the specified start level is lower than the active start level, the
- * Framework will continue to decrease the start level
- * until the Framework has reached the specified start level
- * stopping bundles at each
- * start level as described in the <tt>Bundle.stop</tt> method except that their
- * persistently recorded state indicates that they must be restarted in the
- * future.
- *
- * At each intermediate start level value on the
- * way to and including the specified start level, the framework must:
- * <ol>
- * <li>Stop bundles at the intermediate start level in
- * descending order by <tt>Bundle.getBundleId</tt>.
- * <li>Change the active start level to the intermediate start level value.
- * </ol>
- * When this process completes after the specified start level is reached,
- * the Framework will broadcast a Framework event of
- * type <tt>FrameworkEvent.STARTLEVEL_CHANGED</tt> to announce it has moved to the specified
- * start level.
- *
- * <p>If the specified start level is equal to the active start level, then
- * no bundles are started or stopped, however, the Framework must broadcast
- * a Framework event of type <tt>FrameworkEvent.STARTLEVEL_CHANGED</tt> to
- * announce it has finished moving to the specified start level. This
- * event may arrive before the this method return.
- *
- * @param startlevel The requested start level for the Framework.
- * @throws IllegalArgumentException If the specified start level is less than or
- * equal to zero.
- * @throws SecurityException If the caller does not have the
- * <tt>AdminPermission</tt> and the Java runtime environment supports
- * permissions.
- */
+ * Modify the active start level of the Framework.
+ *
+ * <p>The Framework will move to the requested start level. This method
+ * will return immediately to the caller and the start level
+ * change will occur asynchronously on another thread.
+ *
+ * <p>If the specified start level is
+ * higher than the active start level, the
+ * Framework will continue to increase the start level
+ * until the Framework has reached the specified start level,
+ * starting bundles at each
+ * start level which are persistently marked to be started as described in the
+ * <tt>Bundle.start</tt> method.
+ *
+ * At each intermediate start level value on the
+ * way to and including the target start level, the framework must:
+ * <ol>
+ * <li>Change the active start level to the intermediate start level value.
+ * <li>Start bundles at the intermediate start level in
+ * ascending order by <tt>Bundle.getBundleId</tt>.
+ * </ol>
+ * When this process completes after the specified start level is reached,
+ * the Framework will broadcast a Framework event of
+ * type <tt>FrameworkEvent.STARTLEVEL_CHANGED</tt> to announce it has moved to the specified
+ * start level.
+ *
+ * <p>If the specified start level is lower than the active start level, the
+ * Framework will continue to decrease the start level
+ * until the Framework has reached the specified start level
+ * stopping bundles at each
+ * start level as described in the <tt>Bundle.stop</tt> method except that their
+ * persistently recorded state indicates that they must be restarted in the
+ * future.
+ *
+ * At each intermediate start level value on the
+ * way to and including the specified start level, the framework must:
+ * <ol>
+ * <li>Stop bundles at the intermediate start level in
+ * descending order by <tt>Bundle.getBundleId</tt>.
+ * <li>Change the active start level to the intermediate start level value.
+ * </ol>
+ * When this process completes after the specified start level is reached,
+ * the Framework will broadcast a Framework event of
+ * type <tt>FrameworkEvent.STARTLEVEL_CHANGED</tt> to announce it has moved to the specified
+ * start level.
+ *
+ * <p>If the specified start level is equal to the active start level, then
+ * no bundles are started or stopped, however, the Framework must broadcast
+ * a Framework event of type <tt>FrameworkEvent.STARTLEVEL_CHANGED</tt> to
+ * announce it has finished moving to the specified start level. This
+ * event may arrive before the this method return.
+ *
+ * @param startlevel The requested start level for the Framework.
+ * @throws IllegalArgumentException If the specified start level is less than or
+ * equal to zero.
+ * @throws SecurityException If the caller does not have the
+ * <tt>AdminPermission</tt> and the Java runtime environment supports
+ * permissions.
+ */
public void setStartLevel(int newSL) {
manager.setStartLevel(newSL, owner);
}
/**
- * Return the persistent state of the specified bundle.
- *
- * <p>This method returns the persistent state of a bundle.
- * The persistent state of a bundle indicates whether a bundle
- * is persistently marked to be started when it's start level is
- * reached.
- *
- * @return <tt>true</tt> if the bundle is persistently marked to be started,
- * <tt>false</tt> if the bundle is not persistently marked to be started.
- * @exception java.lang.IllegalArgumentException If the specified bundle has been uninstalled.
- */
+ * Return the persistent state of the specified bundle.
+ *
+ * <p>This method returns the persistent state of a bundle.
+ * The persistent state of a bundle indicates whether a bundle
+ * is persistently marked to be started when it's start level is
+ * reached.
+ *
+ * @return <tt>true</tt> if the bundle is persistently marked to be started,
+ * <tt>false</tt> if the bundle is not persistently marked to be started.
+ * @exception java.lang.IllegalArgumentException If the specified bundle has been uninstalled.
+ */
public boolean isBundlePersistentlyStarted(Bundle bundle) {
return manager.isBundlePersistentlyStarted(bundle);
}
/**
- * Return the assigned start level value for the specified Bundle.
- *
- * @param bundle The target bundle.
- * @return The start level value of the specified Bundle.
- * @exception java.lang.IllegalArgumentException If the specified bundle has been uninstalled.
- */
+ * Return the assigned start level value for the specified Bundle.
+ *
+ * @param bundle The target bundle.
+ * @return The start level value of the specified Bundle.
+ * @exception java.lang.IllegalArgumentException If the specified bundle has been uninstalled.
+ */
public int getBundleStartLevel(Bundle bundle) {
return manager.getBundleStartLevel(bundle);
}
/**
- * Assign a start level value to the specified Bundle.
- *
- * <p>The specified bundle will be assigned the specified start level. The
- * start level value assigned to the bundle will be persistently recorded
- * by the Framework.
- *
- * If the new start level for the bundle is lower than or equal to the active start level of
- * the Framework, the Framework will start the specified bundle as described
- * in the <tt>Bundle.start</tt> method if the bundle is persistently marked
- * to be started. The actual starting of this bundle must occur asynchronously.
- *
- * If the new start level for the bundle is higher than the active start level of
- * the Framework, the Framework will stop the specified bundle as described
- * in the <tt>Bundle.stop</tt> method except that the persistently recorded
- * state for the bundle indicates that the bundle must be restarted in the
- * future. The actual stopping of this bundle must occur asynchronously.
- *
- * @param bundle The target bundle.
- * @param startlevel The new start level for the specified Bundle.
- * @throws IllegalArgumentException
- * If the specified bundle has been uninstalled or
- * if the specified start level is less than or equal to zero, or the specified bundle is
- * the system bundle.
- * @throws SecurityException if the caller does not have the
- * <tt>AdminPermission</tt> and the Java runtime environment supports
- * permissions.
- */
+ * Assign a start level value to the specified Bundle.
+ *
+ * <p>The specified bundle will be assigned the specified start level. The
+ * start level value assigned to the bundle will be persistently recorded
+ * by the Framework.
+ *
+ * If the new start level for the bundle is lower than or equal to the active start level of
+ * the Framework, the Framework will start the specified bundle as described
+ * in the <tt>Bundle.start</tt> method if the bundle is persistently marked
+ * to be started. The actual starting of this bundle must occur asynchronously.
+ *
+ * If the new start level for the bundle is higher than the active start level of
+ * the Framework, the Framework will stop the specified bundle as described
+ * in the <tt>Bundle.stop</tt> method except that the persistently recorded
+ * state for the bundle indicates that the bundle must be restarted in the
+ * future. The actual stopping of this bundle must occur asynchronously.
+ *
+ * @param bundle The target bundle.
+ * @param startlevel The new start level for the specified Bundle.
+ * @throws IllegalArgumentException
+ * If the specified bundle has been uninstalled or
+ * if the specified start level is less than or equal to zero, or the specified bundle is
+ * the system bundle.
+ * @throws SecurityException if the caller does not have the
+ * <tt>AdminPermission</tt> and the Java runtime environment supports
+ * permissions.
+ */
public void setBundleStartLevel(Bundle bundle, int newSL) {
manager.setBundleStartLevel(bundle, newSL);
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/StartLevelManager.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/StartLevelManager.java
index 2dee051..4b6b1e6 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/StartLevelManager.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/StartLevelManager.java
@@ -89,21 +89,21 @@
}
/**
- * Return the initial start level value that is assigned
- * to a Bundle when it is first installed.
- *
- * @return The initial start level value for Bundles.
- * @see #setInitialBundleStartLevel
- */
+ * Return the initial start level value that is assigned
+ * to a Bundle when it is first installed.
+ *
+ * @return The initial start level value for Bundles.
+ * @see #setInitialBundleStartLevel
+ */
public int getInitialBundleStartLevel() {
return initialBundleStartLevel;
}
/**
- * Return the initial start level used when the framework is started.
- *
- * @return The framework start level.
- */
+ * Return the initial start level used when the framework is started.
+ *
+ * @return The framework start level.
+ */
public int getFrameworkStartLevel() {
return frameworkBeginningStartLevel;
}
@@ -142,78 +142,80 @@
initialBundleStartLevel = startlevel;
framework.adaptor.setInitialBundleStartLevel(startlevel);
}
+
/**
- * Return the active start level value of the Framework.
- *
- * If the Framework is in the process of changing the start level
- * this method must return the active start level if this
- * differs from the requested start level.
- *
- * @return The active start level value of the Framework.
- */
+ * Return the active start level value of the Framework.
+ *
+ * If the Framework is in the process of changing the start level
+ * this method must return the active start level if this
+ * differs from the requested start level.
+ *
+ * @return The active start level value of the Framework.
+ */
public int getStartLevel() {
return activeSL;
}
+
/**
- * Modify the active start level of the Framework.
- *
- * <p>The Framework will move to the requested start level. This method
- * will return immediately to the caller and the start level
- * change will occur asynchronously on another thread.
- *
- * <p>If the specified start level is
- * higher than the active start level, the
- * Framework will continue to increase the start level
- * until the Framework has reached the specified start level,
- * starting bundles at each
- * start level which are persistently marked to be started as described in the
- * <tt>Bundle.start</tt> method.
- *
- * At each intermediate start level value on the
- * way to and including the target start level, the framework must:
- * <ol>
- * <li>Change the active start level to the intermediate start level value.
- * <li>Start bundles at the intermediate start level in
- * ascending order by <tt>Bundle.getBundleId</tt>.
- * </ol>
- * When this process completes after the specified start level is reached,
- * the Framework will broadcast a Framework event of
- * type <tt>FrameworkEvent.STARTLEVEL_CHANGED</tt> to announce it has moved to the specified
- * start level.
- *
- * <p>If the specified start level is lower than the active start level, the
- * Framework will continue to decrease the start level
- * until the Framework has reached the specified start level
- * stopping bundles at each
- * start level as described in the <tt>Bundle.stop</tt> method except that their
- * persistently recorded state indicates that they must be restarted in the
- * future.
- *
- * At each intermediate start level value on the
- * way to and including the specified start level, the framework must:
- * <ol>
- * <li>Stop bundles at the intermediate start level in
- * descending order by <tt>Bundle.getBundleId</tt>.
- * <li>Change the active start level to the intermediate start level value.
- * </ol>
- * When this process completes after the specified start level is reached,
- * the Framework will broadcast a Framework event of
- * type <tt>FrameworkEvent.STARTLEVEL_CHANGED</tt> to announce it has moved to the specified
- * start level.
- *
- * <p>If the specified start level is equal to the active start level, then
- * no bundles are started or stopped, however, the Framework must broadcast
- * a Framework event of type <tt>FrameworkEvent.STARTLEVEL_CHANGED</tt> to
- * announce it has finished moving to the specified start level. This
- * event may arrive before the this method return.
- *
- * @param startlevel The requested start level for the Framework.
- * @throws IllegalArgumentException If the specified start level is less than or
- * equal to zero.
- * @throws SecurityException If the caller does not have the
- * <tt>AdminPermission</tt> and the Java runtime environment supports
- * permissions.
- */
+ * Modify the active start level of the Framework.
+ *
+ * <p>The Framework will move to the requested start level. This method
+ * will return immediately to the caller and the start level
+ * change will occur asynchronously on another thread.
+ *
+ * <p>If the specified start level is
+ * higher than the active start level, the
+ * Framework will continue to increase the start level
+ * until the Framework has reached the specified start level,
+ * starting bundles at each
+ * start level which are persistently marked to be started as described in the
+ * <tt>Bundle.start</tt> method.
+ *
+ * At each intermediate start level value on the
+ * way to and including the target start level, the framework must:
+ * <ol>
+ * <li>Change the active start level to the intermediate start level value.
+ * <li>Start bundles at the intermediate start level in
+ * ascending order by <tt>Bundle.getBundleId</tt>.
+ * </ol>
+ * When this process completes after the specified start level is reached,
+ * the Framework will broadcast a Framework event of
+ * type <tt>FrameworkEvent.STARTLEVEL_CHANGED</tt> to announce it has moved to the specified
+ * start level.
+ *
+ * <p>If the specified start level is lower than the active start level, the
+ * Framework will continue to decrease the start level
+ * until the Framework has reached the specified start level
+ * stopping bundles at each
+ * start level as described in the <tt>Bundle.stop</tt> method except that their
+ * persistently recorded state indicates that they must be restarted in the
+ * future.
+ *
+ * At each intermediate start level value on the
+ * way to and including the specified start level, the framework must:
+ * <ol>
+ * <li>Stop bundles at the intermediate start level in
+ * descending order by <tt>Bundle.getBundleId</tt>.
+ * <li>Change the active start level to the intermediate start level value.
+ * </ol>
+ * When this process completes after the specified start level is reached,
+ * the Framework will broadcast a Framework event of
+ * type <tt>FrameworkEvent.STARTLEVEL_CHANGED</tt> to announce it has moved to the specified
+ * start level.
+ *
+ * <p>If the specified start level is equal to the active start level, then
+ * no bundles are started or stopped, however, the Framework must broadcast
+ * a Framework event of type <tt>FrameworkEvent.STARTLEVEL_CHANGED</tt> to
+ * announce it has finished moving to the specified start level. This
+ * event may arrive before the this method return.
+ *
+ * @param startlevel The requested start level for the Framework.
+ * @throws IllegalArgumentException If the specified start level is less than or
+ * equal to zero.
+ * @throws SecurityException If the caller does not have the
+ * <tt>AdminPermission</tt> and the Java runtime environment supports
+ * permissions.
+ */
public void setStartLevel(int newSL, org.osgi.framework.Bundle callerBundle) {
if (newSL <= 0) {
throw new IllegalArgumentException(Msg.formatter.getString("STARTLEVEL_EXCEPTION_INVALID_REQUESTED_STARTLEVEL", "" + newSL));
@@ -300,17 +302,17 @@
}
/**
- * Return the persistent state of the specified bundle.
- *
- * <p>This method returns the persistent state of a bundle.
- * The persistent state of a bundle indicates whether a bundle
- * is persistently marked to be started when it's start level is
- * reached.
- *
- * @return <tt>true</tt> if the bundle is persistently marked to be started,
- * <tt>false</tt> if the bundle is not persistently marked to be started.
- * @exception java.lang.IllegalArgumentException If the specified bundle has been uninstalled.
- */
+ * Return the persistent state of the specified bundle.
+ *
+ * <p>This method returns the persistent state of a bundle.
+ * The persistent state of a bundle indicates whether a bundle
+ * is persistently marked to be started when it's start level is
+ * reached.
+ *
+ * @return <tt>true</tt> if the bundle is persistently marked to be started,
+ * <tt>false</tt> if the bundle is not persistently marked to be started.
+ * @exception java.lang.IllegalArgumentException If the specified bundle has been uninstalled.
+ */
public boolean isBundlePersistentlyStarted(org.osgi.framework.Bundle bundle) {
if (bundle.getState() == AbstractBundle.UNINSTALLED) {
@@ -320,13 +322,14 @@
int status = b.getBundleData().getStatus();
return ((status & org.eclipse.osgi.framework.internal.core.Constants.BUNDLE_STARTED) == Constants.BUNDLE_STARTED);
}
+
/**
- * Return the assigned start level value for the specified Bundle.
- *
- * @param bundle The target bundle.
- * @return The start level value of the specified Bundle.
- * @exception java.lang.IllegalArgumentException If the specified bundle has been uninstalled.
- */
+ * Return the assigned start level value for the specified Bundle.
+ *
+ * @param bundle The target bundle.
+ * @return The start level value of the specified Bundle.
+ * @exception java.lang.IllegalArgumentException If the specified bundle has been uninstalled.
+ */
public int getBundleStartLevel(org.osgi.framework.Bundle bundle) {
if (bundle.getState() == AbstractBundle.UNINSTALLED) {
@@ -336,33 +339,33 @@
}
/**
- * Assign a start level value to the specified Bundle.
- *
- * <p>The specified bundle will be assigned the specified start level. The
- * start level value assigned to the bundle will be persistently recorded
- * by the Framework.
- *
- * If the new start level for the bundle is lower than or equal to the active start level of
- * the Framework, the Framework will start the specified bundle as described
- * in the <tt>Bundle.start</tt> method if the bundle is persistently marked
- * to be started. The actual starting of this bundle must occur asynchronously.
- *
- * If the new start level for the bundle is higher than the active start level of
- * the Framework, the Framework will stop the specified bundle as described
- * in the <tt>Bundle.stop</tt> method except that the persistently recorded
- * state for the bundle indicates that the bundle must be restarted in the
- * future. The actual stopping of this bundle must occur asynchronously.
- *
- * @param bundle The target bundle.
- * @param startlevel The new start level for the specified Bundle.
- * @throws IllegalArgumentException
- * If the specified bundle has been uninstalled or
- * if the specified start level is less than or equal to zero, or the specified bundle is
- * the system bundle.
- * @throws SecurityException if the caller does not have the
- * <tt>AdminPermission</tt> and the Java runtime environment supports
- * permissions.
- */
+ * Assign a start level value to the specified Bundle.
+ *
+ * <p>The specified bundle will be assigned the specified start level. The
+ * start level value assigned to the bundle will be persistently recorded
+ * by the Framework.
+ *
+ * If the new start level for the bundle is lower than or equal to the active start level of
+ * the Framework, the Framework will start the specified bundle as described
+ * in the <tt>Bundle.start</tt> method if the bundle is persistently marked
+ * to be started. The actual starting of this bundle must occur asynchronously.
+ *
+ * If the new start level for the bundle is higher than the active start level of
+ * the Framework, the Framework will stop the specified bundle as described
+ * in the <tt>Bundle.stop</tt> method except that the persistently recorded
+ * state for the bundle indicates that the bundle must be restarted in the
+ * future. The actual stopping of this bundle must occur asynchronously.
+ *
+ * @param bundle The target bundle.
+ * @param startlevel The new start level for the specified Bundle.
+ * @throws IllegalArgumentException
+ * If the specified bundle has been uninstalled or
+ * if the specified start level is less than or equal to zero, or the specified bundle is
+ * the system bundle.
+ * @throws SecurityException if the caller does not have the
+ * <tt>AdminPermission</tt> and the Java runtime environment supports
+ * permissions.
+ */
public void setBundleStartLevel(org.osgi.framework.Bundle bundle, int newSL) {
String exceptionText = "";
@@ -756,4 +759,4 @@
*/
public void ungetService(Bundle owner, ServiceRegistration registration, Object service) {
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/SystemBundle.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/SystemBundle.java
index 04d30b1..58963b2 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/SystemBundle.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/SystemBundle.java
@@ -52,13 +52,14 @@
try {
loader = new SystemBundleLoader(this, getBundleDescription());
} catch (BundleException e) {
- framework.publishFrameworkEvent(FrameworkEvent.ERROR,this,e);
+ framework.publishFrameworkEvent(FrameworkEvent.ERROR, this, e);
return null;
}
}
}
return loader;
}
+
/**
* Load the bundle.
* This methods overrides the Bundle method and does nothing.
@@ -296,22 +297,28 @@
protected boolean checkExportPackagePermission(String pkgName) {
return true;
}
+
protected boolean checkFragmentBundlePermission(String symbolicName) {
return true;
}
+
protected boolean checkFragmentHostPermission(String symbolicName) {
return true;
}
+
protected boolean checkImportPackagePermission(String pkgName) {
return true;
}
+
protected boolean checkPermissions() {
return true;
}
+
protected boolean checkProvideBundlePermission(String symbolicName) {
return true;
}
+
protected boolean checkRequireBundlePermission(String symbolicName) {
return true;
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/SystemBundleActivator.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/SystemBundleActivator.java
index 478d0cc..b3fb3f2 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/SystemBundleActivator.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/SystemBundleActivator.java
@@ -103,4 +103,4 @@
return context.registerService(name, service, properties);
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/SystemBundleLoader.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/SystemBundleLoader.java
index 2bad113..f0b623f 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/SystemBundleLoader.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/SystemBundleLoader.java
@@ -33,6 +33,7 @@
protected synchronized static void clearSystemPackages() {
systemPackages = null;
}
+
protected static void setSystemPackages(String[] value) {
systemPackages = value;
}
@@ -100,7 +101,7 @@
/**
* This is not supported by the System Bundle.
*/
- public Object findObject(String object){
+ public Object findObject(String object) {
return null;
}
@@ -132,4 +133,4 @@
// Do nothing.
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/UnresolvedPermission.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/UnresolvedPermission.java
index a66d141..dd8d390 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/UnresolvedPermission.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/UnresolvedPermission.java
@@ -39,7 +39,7 @@
static {
Class string = String.class;
- constructorArgs = new Class[] { string, string };
+ constructorArgs = new Class[] {string, string};
}
/**
@@ -155,7 +155,7 @@
try {
Constructor constructor = clazz.getConstructor(constructorArgs);
- Permission permission = (Permission) constructor.newInstance(new Object[] { name, actions });
+ Permission permission = (Permission) constructor.newInstance(new Object[] {name, actions});
if (Debug.DEBUG && Debug.DEBUG_SECURITY) {
Debug.println("Resolved " + this);
@@ -173,4 +173,4 @@
return null;
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/UnresolvedPermissionCollection.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/UnresolvedPermissionCollection.java
index 41566e1..5091d6b 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/UnresolvedPermissionCollection.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/UnresolvedPermissionCollection.java
@@ -54,6 +54,7 @@
return (new Enumeration() {
Enumeration vEnum, pEnum = permissions.elements();
Object next = findNext();
+
private Object findNext() {
if (vEnum != null) {
if (vEnum.hasMoreElements())
@@ -64,9 +65,11 @@
vEnum = ((Vector) pEnum.nextElement()).elements();
return (vEnum.nextElement());
}
+
public boolean hasMoreElements() {
return (next != null);
}
+
public Object nextElement() {
Object result = next;
next = findNext();
@@ -82,4 +85,4 @@
Vector getPermissions(String name) {
return (Vector) permissions.get(name);
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Util.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Util.java
index bec733c..4afce10 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Util.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Util.java
@@ -204,4 +204,4 @@
stringBuffer.append(padding);
return stringBuffer.toString();
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/protocol/ContentHandlerFactory.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/protocol/ContentHandlerFactory.java
index f9b0104..3646580 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/protocol/ContentHandlerFactory.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/protocol/ContentHandlerFactory.java
@@ -108,4 +108,4 @@
return (proxy);
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/protocol/ContentHandlerProxy.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/protocol/ContentHandlerProxy.java
index 58b59cc..dbe46ee 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/protocol/ContentHandlerProxy.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/protocol/ContentHandlerProxy.java
@@ -98,18 +98,18 @@
if (reference == contentHandlerServiceReference) {
if (newrank < ranking) //The ContentHandler we are currently
- //using has dropped it's ranking below a ContentHandler registered for the same protocol.
- //We need to swap out ContentHandlers.
- //this should get us the highest ranked service, if available
- {
+ //using has dropped it's ranking below a ContentHandler registered for the same protocol.
+ //We need to swap out ContentHandlers.
+ //this should get us the highest ranked service, if available
+ {
ServiceReference newReference = contentHandlerServiceTracker.getServiceReference();
if (newReference != contentHandlerServiceReference && newReference != null) {
setNewHandler(newReference, ((Integer) newReference.getProperty(Constants.SERVICE_RANKING)).intValue());
}
}
} else if (newrank > ranking) //the service changed is another URLHandler that we are not currently using
- //If it's ranking is higher, we must swap it in.
- {
+ //If it's ranking is higher, we must swap it in.
+ {
setNewHandler(reference, newrank);
}
@@ -152,10 +152,10 @@
class DefaultContentHandler extends ContentHandler {
/**
- * @see java.net.ContentHandler#getContent(URLConnection)
- */
+ * @see java.net.ContentHandler#getContent(URLConnection)
+ */
public Object getContent(URLConnection uConn) throws IOException {
return uConn.getInputStream();
}
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/protocol/NullURLStreamHandlerService.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/protocol/NullURLStreamHandlerService.java
index 9c10360..3e426c3 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/protocol/NullURLStreamHandlerService.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/protocol/NullURLStreamHandlerService.java
@@ -105,4 +105,4 @@
throw new IllegalStateException();
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/protocol/ProtocolActivator.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/protocol/ProtocolActivator.java
index 6f8e5bc..f58af14 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/protocol/ProtocolActivator.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/protocol/ProtocolActivator.java
@@ -19,4 +19,4 @@
public void start(BundleContext context, FrameworkAdaptor adaptor);
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/protocol/StreamHandlerFactory.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/protocol/StreamHandlerFactory.java
index 55cb4ec..62aa3a4 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/protocol/StreamHandlerFactory.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/protocol/StreamHandlerFactory.java
@@ -134,4 +134,4 @@
return null;
}
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/protocol/URLStreamHandlerProxy.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/protocol/URLStreamHandlerProxy.java
index 5bd2dca..b0c7f8c 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/protocol/URLStreamHandlerProxy.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/protocol/URLStreamHandlerProxy.java
@@ -194,18 +194,18 @@
if (reference == urlStreamServiceReference) {
if (newRank < ranking) //The URLHandler we are currently
- //using has dropped it's ranking below a URLHandler registered for the same protocol.
- //We need to swap out URLHandlers.
- //this should get us the highest ranked service, if available
- {
+ //using has dropped it's ranking below a URLHandler registered for the same protocol.
+ //We need to swap out URLHandlers.
+ //this should get us the highest ranked service, if available
+ {
ServiceReference newReference = urlStreamHandlerServiceTracker.getServiceReference();
if (newReference != urlStreamServiceReference && newReference != null) {
setNewHandler(newReference, ((Integer) newReference.getProperty(Constants.SERVICE_RANKING)).intValue());
}
}
} else if (newRank > ranking) //the service changed is another URLHandler that we are not currently using
- //If it's ranking is higher, we must swap it in.
- {
+ //If it's ranking is higher, we must swap it in.
+ {
setNewHandler(reference, newRank);
}
}
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/launcher/Launcher.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/launcher/Launcher.java
index bc4d67d..a9b0118 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/launcher/Launcher.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/launcher/Launcher.java
@@ -72,7 +72,7 @@
* <ul>
* <li>with the Default FrameworkAdaptor
* <li>without a console window
- * <li>without the remote agent
+ * <li>without the remote agent
* </ul>
*/
public class Launcher {
@@ -278,7 +278,7 @@
// They may be enclosed in quotes.
// Store them in a vector until we know how many there are.
Vector v = new Vector();
- parseloop : while (true) {
+ parseloop: while (true) {
tok.getChar(); // advance to next token
String arg = tok.getString(":");
if (arg == null) {
@@ -299,11 +299,11 @@
}
/**
- * Remembers that the -application option has been requested. Parses off the application parameters
- * into a String []
- *
- * @param tok The rest of the -application parameter string that contains the application arguments
- */
+ * Remembers that the -application option has been requested. Parses off the application parameters
+ * into a String []
+ *
+ * @param tok The rest of the -application parameter string that contains the application arguments
+ */
protected void _application(String command) {
Tokenizer tok = new Tokenizer(command);
// first token is always "-adaptor"
@@ -312,7 +312,7 @@
// they may be enclosed in quotes
// store them in a vector until we know how many there are
Vector v = new Vector();
- parseloop : while (true) {
+ parseloop: while (true) {
tok.getChar(); // advance to next token
String arg = tok.getString(":");
if (arg == null) {
@@ -343,9 +343,9 @@
protected FrameworkAdaptor doAdaptor() throws Exception {
Class adaptorClass = Class.forName(adaptorClassName);
- Class[] constructorArgs = new Class[] { String[].class };
+ Class[] constructorArgs = new Class[] {String[].class};
Constructor constructor = adaptorClass.getConstructor(constructorArgs);
- return (FrameworkAdaptor) constructor.newInstance(new Object[] { adaptorArgs });
+ return (FrameworkAdaptor) constructor.newInstance(new Object[] {adaptorArgs});
}
/**
@@ -383,11 +383,11 @@
try {
Class osgiconsoleClass = Class.forName(osgiConsoleClazz);
if (consolePort.length() == 0) {
- parameterTypes = new Class[] { OSGi.class, String[].class };
- parameters = new Object[] { osgi, consoleArgs };
+ parameterTypes = new Class[] {OSGi.class, String[].class};
+ parameters = new Object[] {osgi, consoleArgs};
} else {
- parameterTypes = new Class[] { OSGi.class, int.class, String[].class };
- parameters = new Object[] { osgi, new Integer(consolePort), consoleArgs };
+ parameterTypes = new Class[] {OSGi.class, int.class, String[].class};
+ parameters = new Object[] {osgi, new Integer(consolePort), consoleArgs};
}
consoleConstructor = osgiconsoleClass.getConstructor(parameterTypes);
osgiconsole = consoleConstructor.newInstance(parameters);
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/service/debug/DebugOptions.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/service/debug/DebugOptions.java
index 6bb9839..46ae8c7 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/service/debug/DebugOptions.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/service/debug/DebugOptions.java
@@ -12,7 +12,10 @@
public interface DebugOptions {
public abstract boolean getBooleanOption(String option, boolean defaultValue);
+
public abstract String getOption(String option);
+
public abstract int getIntegerOption(String option, int defaultValue);
+
public abstract void setOption(String option, String value);
}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/adaptor/core/AbstractBundleData.java b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/adaptor/core/AbstractBundleData.java
index ace5110..b63cb1f 100644
--- a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/adaptor/core/AbstractBundleData.java
+++ b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/adaptor/core/AbstractBundleData.java
@@ -56,7 +56,7 @@
/** bundle location */
private String location;
-
+
/** bundle's file name */
private String fileName;
@@ -85,6 +85,7 @@
private String executionEnvironment;
private String dynamicImports;
private boolean fragment = false;
+
///////////////////// End values from Manifest /////////////////////
public AbstractBundleData(AbstractFrameworkAdaptor adaptor, long id) {
@@ -107,13 +108,13 @@
// make sure the manifest is still null after we have aquired the lock.
if (manifest == null) {
URL url = getEntry(Constants.OSGI_BUNDLE_MANIFEST);
- if (url == null){
- throw new BundleException(AdaptorMsg.formatter.getString("MANIFEST_NOT_FOUND_EXCEPTION",Constants.OSGI_BUNDLE_MANIFEST,getLocation())); //$NON-NLS-1$
+ if (url == null) {
+ throw new BundleException(AdaptorMsg.formatter.getString("MANIFEST_NOT_FOUND_EXCEPTION", Constants.OSGI_BUNDLE_MANIFEST, getLocation())); //$NON-NLS-1$
}
try {
manifest = Headers.parseManifest(url.openStream());
} catch (IOException e) {
- throw new BundleException(AdaptorMsg.formatter.getString("MANIFEST_NOT_FOUND_EXCEPTION",Constants.OSGI_BUNDLE_MANIFEST,getLocation()), e); //$NON-NLS-1$
+ throw new BundleException(AdaptorMsg.formatter.getString("MANIFEST_NOT_FOUND_EXCEPTION", Constants.OSGI_BUNDLE_MANIFEST, getLocation()), e); //$NON-NLS-1$
}
}
}
@@ -125,7 +126,7 @@
* Sets the Bundle object for this BundleData.
* @param bundle The Bundle Object for this BundleData.
*/
- public void setBundle(Bundle bundle){
+ public void setBundle(Bundle bundle) {
this.bundle = bundle;
}
@@ -162,11 +163,12 @@
return null;
}
try {
- return new URL(null, getBundleEntryURL(id,path), new Handler(entry));
+ return new URL(null, getBundleEntryURL(id, path), new Handler(entry));
} catch (MalformedURLException e) {
return null;
}
}
+
/**
* Gets all of the bundle entries that exist under the specified path. For
* example:
@@ -210,7 +212,6 @@
*/
abstract public File createGenerationDir();
-
/**
* Return the base BundleFile for this BundleData. The base BundleFile
* is the BundleFile that contains all the content of the bundle.
@@ -223,8 +224,7 @@
}
public static String getBundleEntryURL(long id, String path) {
- StringBuffer url = new StringBuffer(
- Constants.OSGI_ENTRY_URL_PROTOCOL);
+ StringBuffer url = new StringBuffer(Constants.OSGI_ENTRY_URL_PROTOCOL);
url.append("://").append(id);
if (path.length() == 0 || path.charAt(0) != '/') {
url.append('/');
@@ -237,13 +237,15 @@
public String getLocation() {
return location;
}
+
public void setLocation(String location) {
this.location = location;
- }
+ }
public String getFileName() {
return fileName;
}
+
public void setFileName(String fileName) {
this.fileName = fileName;
}
@@ -251,6 +253,7 @@
public String[] getNativePaths() {
return nativePaths;
}
+
public String getNativePathsString() {
if (nativePaths == null || nativePaths.length == 0)
return null;
@@ -262,9 +265,11 @@
}
return sb.toString();
}
+
public void setNativePaths(String[] nativePaths) {
this.nativePaths = nativePaths;
}
+
public void setNativePaths(String nativePaths) {
if (nativePaths == null)
return;
@@ -280,6 +285,7 @@
public int getGeneration() {
return generation;
}
+
public void setGeneration(int generation) {
this.generation = generation;
}
@@ -287,6 +293,7 @@
public int getStartLevel() {
return startLevel;
}
+
public void setStartLevel(int startLevel) {
this.startLevel = startLevel;
}
@@ -294,6 +301,7 @@
public int getStatus() {
return status;
}
+
public void setStatus(int status) {
this.status = status;
}
@@ -301,17 +309,19 @@
public boolean isReference() {
return reference;
}
+
public void setReference(boolean reference) {
this.reference = reference;
}
- ///////////////////// End Meta Data Accessor Methods ////////////////////
+ ///////////////////// End Meta Data Accessor Methods ////////////////////
///////////////////// Begin Manifest Value Accessor Methods /////////////////////
public String getSymbolicName() {
return symbolicName;
}
+
public void setSymbolicName(String symbolicName) {
this.symbolicName = symbolicName;
}
@@ -319,6 +329,7 @@
public Version getVersion() {
return version;
}
+
public void setVersion(Version version) {
this.version = version;
}
@@ -326,6 +337,7 @@
public String getActivator() {
return activator;
}
+
public void setActivator(String activator) {
this.activator = activator;
}
@@ -333,6 +345,7 @@
public String getClassPath() {
return classpath;
}
+
public void setClassPath(String classpath) {
this.classpath = classpath;
}
@@ -340,6 +353,7 @@
public String getExecutionEnvironment() {
return executionEnvironment;
}
+
public void setExecutionEnvironment(String executionEnvironment) {
this.executionEnvironment = executionEnvironment;
}
@@ -347,6 +361,7 @@
public String getDynamicImports() {
return dynamicImports;
}
+
public void setDynamicImports(String dynamicImports) {
this.dynamicImports = dynamicImports;
}
@@ -354,9 +369,10 @@
public boolean isFragment() {
return fragment;
}
+
public void setFragment(boolean fragment) {
this.fragment = fragment;
}
///////////////////// End Manifest Value Accessor Methods /////////////////////
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/adaptor/core/AbstractClassLoader.java b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/adaptor/core/AbstractClassLoader.java
index 8c7e1e3..2587e3f 100644
--- a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/adaptor/core/AbstractClassLoader.java
+++ b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/adaptor/core/AbstractClassLoader.java
@@ -236,14 +236,14 @@
closed = true;
}
- protected ClassLoader getParentPrivileged(){
+ protected ClassLoader getParentPrivileged() {
if (System.getSecurityManager() == null)
return getParent();
-
+
return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
return getParent();
}
});
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/adaptor/core/AbstractFrameworkAdaptor.java b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/adaptor/core/AbstractFrameworkAdaptor.java
index 132e070..0743975 100644
--- a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/adaptor/core/AbstractFrameworkAdaptor.java
+++ b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/adaptor/core/AbstractFrameworkAdaptor.java
@@ -50,7 +50,7 @@
/**
* The System Bundle's BundleContext.
*/
- protected BundleContext context; //TODO Rename to systemBundleContext
+ protected BundleContext context; //TODO Rename to systemBundleContext
/**
* The initial bundle start level.
@@ -119,8 +119,7 @@
/**
* @see org.eclipse.osgi.framework.adaptor.FrameworkAdaptor#frameworkStart(org.osgi.framework.BundleContext)
*/
- public void frameworkStart(BundleContext context) throws BundleException
- {
+ public void frameworkStart(BundleContext context) throws BundleException {
this.context = context;
BundleResourceHandler.setContext(context);
}
@@ -128,8 +127,7 @@
/**
* @see org.eclipse.osgi.framework.adaptor.FrameworkAdaptor#frameworkStop(org.osgi.framework.BundleContext)
*/
- public void frameworkStop(BundleContext context) throws BundleException
- {
+ public void frameworkStop(BundleContext context) throws BundleException {
this.context = null;
BundleResourceHandler.setContext(null);
}
@@ -143,8 +141,7 @@
/**
* @see org.eclipse.osgi.framework.adaptor.FrameworkAdaptor#getExportPackages()
*/
- public String getExportPackages()
- {
+ public String getExportPackages() {
if (manifest == null)
return null;
return (String) manifest.get(Constants.EXPORT_PACKAGE);
@@ -153,8 +150,7 @@
/**
* @see org.eclipse.osgi.framework.adaptor.FrameworkAdaptor#getExportServices()
*/
- public String getExportServices()
- {
+ public String getExportServices() {
if (manifest == null)
return null;
return (String) manifest.get(Constants.EXPORT_SERVICE);
@@ -170,7 +166,7 @@
* Returns the EventPublisher for this FrameworkAdaptor.
* @return The EventPublisher.
*/
- public EventPublisher getEventPublisher(){
+ public EventPublisher getEventPublisher() {
return eventPublisher;
}
@@ -203,48 +199,32 @@
String resource = System.getProperty(Constants.OSGI_PROPERTIES, Constants.DEFAULT_OSGI_PROPERTIES);
- try
- {
+ try {
InputStream in = null;
File file = new File(resource);
- if (file.exists())
- {
+ if (file.exists()) {
in = new FileInputStream(file);
}
- if (in == null)
- {
+ if (in == null) {
in = getClass().getResourceAsStream(resource);
}
-
- if (in != null)
- {
- try
- {
+ if (in != null) {
+ try {
properties.load(new BufferedInputStream(in));
- }
- finally
- {
- try
- {
+ } finally {
+ try {
in.close();
- }
- catch (IOException ee)
- {
+ } catch (IOException ee) {
}
}
- }
- else
- {
+ } else {
if (Debug.DEBUG && Debug.DEBUG_GENERAL)
Debug.println("Skipping osgi.properties: " + resource);
}
- }
- catch (IOException e)
- {
- if (Debug.DEBUG && Debug.DEBUG_GENERAL)
- {
+ } catch (IOException e) {
+ if (Debug.DEBUG && Debug.DEBUG_GENERAL) {
Debug.println("Unable to load osgi.properties: " + e.getMessage());
}
}
@@ -259,7 +239,7 @@
InputStream in = null;
// walk up the class hierarchy until we find the ADAPTOR_MANIFEST.
Class adaptorClazz = getClass();
- while (in == null && AbstractFrameworkAdaptor.class.isAssignableFrom(adaptorClazz) ) {
+ while (in == null && AbstractFrameworkAdaptor.class.isAssignableFrom(adaptorClazz)) {
in = adaptorClazz.getResourceAsStream(ADAPTOR_MANIFEST);
adaptorClazz = adaptorClazz.getSuperclass();
}
@@ -278,7 +258,7 @@
}
}
- public BundleData createSystemBundleData() throws BundleException{
+ public BundleData createSystemBundleData() throws BundleException {
return new SystemBundleData(this);
}
@@ -290,19 +270,18 @@
* @param outDir output directory to copy to.
* @throws IOException if any error occurs during the copy.
*/
- public static void copyDir(File inDir, File outDir) throws IOException{
+ public static void copyDir(File inDir, File outDir) throws IOException {
String[] files = inDir.list();
- if (files != null && files.length>0) {
+ if (files != null && files.length > 0) {
outDir.mkdir();
- for (int i=0; i<files.length; i++) {
- File inFile = new File(inDir,files[i]);
- File outFile = new File(outDir,files[i]);
+ for (int i = 0; i < files.length; i++) {
+ File inFile = new File(inDir, files[i]);
+ File outFile = new File(outDir, files[i]);
if (inFile.isDirectory()) {
- copyDir(inFile,outFile);
- }
- else {
+ copyDir(inFile, outFile);
+ } else {
InputStream in = new FileInputStream(inFile);
- readFile(in,outFile);
+ readFile(in, outFile);
}
}
}
@@ -311,10 +290,10 @@
/**
* Read a file from an InputStream and write it to the file system.
*
- * @param is InputStream from which to read.
- * @param file output file to create.
- * @exception IOException
- */
+ * @param is InputStream from which to read.
+ * @param file output file to create.
+ * @exception IOException
+ */
public static void readFile(InputStream in, File file) throws IOException {
FileOutputStream fos = null;
try {
@@ -353,7 +332,7 @@
}
throw e;
- }
+ }
}
public ClassLoader getBundleClassLoaderParent() {
@@ -369,4 +348,4 @@
super(null);
}
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/adaptor/core/AdaptorElementFactory.java b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/adaptor/core/AdaptorElementFactory.java
index 4571b7e..d12f380 100644
--- a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/adaptor/core/AdaptorElementFactory.java
+++ b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/adaptor/core/AdaptorElementFactory.java
@@ -23,4 +23,4 @@
public BundleClassLoader createClassLoader(ClassLoaderDelegate delegate, ProtectionDomain domain, String[] bundleclasspath, AbstractBundleData data);
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/adaptor/core/AdaptorMsg.java b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/adaptor/core/AdaptorMsg.java
index d504343..2164ffa 100644
--- a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/adaptor/core/AdaptorMsg.java
+++ b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/adaptor/core/AdaptorMsg.java
@@ -27,4 +27,4 @@
static {
formatter = new MessageFormat("org.eclipse.osgi.framework.adaptor.core.ExternalMessages");
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/adaptor/core/BundleEntry.java b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/adaptor/core/BundleEntry.java
index e27bf34..c06f45e 100644
--- a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/adaptor/core/BundleEntry.java
+++ b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/adaptor/core/BundleEntry.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.osgi.framework.adaptor.core;
+
import java.io.*;
import java.net.MalformedURLException;
import java.net.URL;
@@ -103,8 +104,9 @@
* @exception java.io.IOException
*/
public InputStream getInputStream() throws IOException {
- return (zipFile.getInputStream(zipEntry)); //TODO No secureAction call is made whereas one is made in FileBundleEntry
+ return (zipFile.getInputStream(zipEntry)); //TODO No secureAction call is made whereas one is made in FileBundleEntry
}
+
/**
* Return size of the uncompressed entry.
*
@@ -113,6 +115,7 @@
public long getSize() {
return (zipEntry.getSize());
}
+
/**
* Return name of the entry.
*
@@ -184,6 +187,7 @@
public InputStream getInputStream() throws IOException {
return SecureAction.getFileInputStream(file);
}
+
/**
* Return size of the uncompressed entry.
*
@@ -192,6 +196,7 @@
public long getSize() {
return (file.length());
}
+
/**
* Return name of the entry.
*
@@ -238,10 +243,11 @@
private BundleFile.ZipBundleFile bundleFile;
private String name;
- public DirZipBundleEntry(BundleFile.ZipBundleFile bundleFile, String name){
+ public DirZipBundleEntry(BundleFile.ZipBundleFile bundleFile, String name) {
this.name = name;
this.bundleFile = bundleFile;
}
+
public InputStream getInputStream() throws IOException {
return null;
}
@@ -276,4 +282,4 @@
}
}
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/adaptor/core/BundleFile.java b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/adaptor/core/BundleFile.java
index 14e1639..577d06f 100644
--- a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/adaptor/core/BundleFile.java
+++ b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/adaptor/core/BundleFile.java
@@ -32,7 +32,7 @@
/**
* The BundleData object for this bundle.
*/
- protected BundleData bundledata; //TODO This could be moved into Zip
+ protected BundleData bundledata; //TODO This could be moved into Zip
/**
* BundleFile constructor
@@ -98,6 +98,7 @@
* false otherwise.
*/
abstract public boolean containsDir(String dir);
+
/**
* Returns a URL to access the contents of the entry specified by the path
* @param path the path to the resource
@@ -149,11 +150,11 @@
return zipFile.getEntry(path);
}
- protected File extractDirectory(String dirName){
+ protected File extractDirectory(String dirName) {
Enumeration entries = zipFile.entries();
while (entries.hasMoreElements()) {
- String entryPath = ((ZipEntry)entries.nextElement()).getName();
- if(entryPath.startsWith(dirName) && !entryPath.endsWith("/"))
+ String entryPath = ((ZipEntry) entries.nextElement()).getName();
+ if (entryPath.startsWith(dirName) && !entryPath.endsWith("/"))
getFile(entryPath);
}
return getExtractFile(dirName);
@@ -163,7 +164,7 @@
if (!(bundledata instanceof AbstractBundleData)) {
return null;
}
- File bundleGenerationDir = ((AbstractBundleData)bundledata).createGenerationDir();
+ File bundleGenerationDir = ((AbstractBundleData) bundledata).createGenerationDir();
/* if the generation dir exists, then we have place to cache */
if (bundleGenerationDir != null && bundleGenerationDir.exists()) {
String path = ".cp"; /* put all these entries in this subdir */
@@ -173,10 +174,11 @@
} else {
path = path + File.separator + name;
}
- return new File(bundleGenerationDir, path);
+ return new File(bundleGenerationDir, path);
}
return null;
}
+
public File getFile(String entry) {
ZipEntry zipEntry = getZipEntry(entry);
if (zipEntry == null) {
@@ -196,28 +198,24 @@
if (zipEntry.getName().endsWith("/")) {
if (!nested.mkdirs()) {
if (Debug.DEBUG && Debug.DEBUG_GENERAL) {
- Debug.println("Unable to create directory: "
- + nested.getPath());
+ Debug.println("Unable to create directory: " + nested.getPath());
}
- throw new IOException(AdaptorMsg.formatter.getString("ADAPTOR_DIRECTORY_CREATE_EXCEPTION",nested.getAbsolutePath()));
+ throw new IOException(AdaptorMsg.formatter.getString("ADAPTOR_DIRECTORY_CREATE_EXCEPTION", nested.getAbsolutePath()));
}
extractDirectory(zipEntry.getName());
- }
- else {
+ } else {
InputStream in = zipFile.getInputStream(zipEntry);
if (in == null)
return null;
/* the entry has not been cached */
if (Debug.DEBUG && Debug.DEBUG_GENERAL) {
- Debug.println("Creating file: "
- + nested.getPath());
+ Debug.println("Creating file: " + nested.getPath());
}
/* create the necessary directories */
File dir = new File(nested.getParent());
if (!dir.exists() && !dir.mkdirs()) {
if (Debug.DEBUG && Debug.DEBUG_GENERAL) {
- Debug.println("Unable to create directory: "
- + dir.getPath());
+ Debug.println("Unable to create directory: " + dir.getPath());
}
throw new IOException(AdaptorMsg.formatter.getString("ADAPTOR_DIRECTORY_CREATE_EXCEPTION", dir.getAbsolutePath()));
}
@@ -240,15 +238,15 @@
if (dir == null)
return false;
- if (dir.length()==0)
+ if (dir.length() == 0)
return true;
if (dir.charAt(0) == '/')
dir = dir.substring(0);
-
- if (dir.length() > 0 && dir.charAt(dir.length()-1) != '/')
+
+ if (dir.length() > 0 && dir.charAt(dir.length() - 1) != '/')
dir = dir + '/';
-
+
Enumeration entries = zipFile.entries();
ZipEntry zipEntry;
String entryPath;
@@ -265,10 +263,10 @@
public BundleEntry getEntry(String path) {
ZipEntry zipEntry = getZipEntry(path);
if (zipEntry == null) {
- if (path.length()== 0 || path.charAt(path.length()-1) == '/') {
+ if (path.length() == 0 || path.charAt(path.length() - 1) == '/') {
// this is a directory request lets see if any entries exist in this directory
if (containsDir(path))
- return new BundleEntry.DirZipBundleEntry(this,path);
+ return new BundleEntry.DirZipBundleEntry(this, path);
}
return null;
}
@@ -282,10 +280,10 @@
throw new NullPointerException();
}
- if (path.length() > 0 && path.charAt(0)== '/') {
+ if (path.length() > 0 && path.charAt(0) == '/') {
path = path.substring(1);
}
- if (path.length() > 0 && path.charAt(path.length()-1) != '/') {
+ if (path.length() > 0 && path.charAt(path.length() - 1) != '/') {
path = new StringBuffer(path).append("/").toString();
}
@@ -366,16 +364,17 @@
public boolean hasMoreElements() {
return false;
}
+
public Object nextElement() {
throw new NoSuchElementException();
}
};
if (pathFile.isDirectory()) {
final String[] fileList = pathFile.list();
- final String dirPath = path.length() == 0 || path.charAt(path.length()-1) == '/'
- ? path : path + '/';
+ final String dirPath = path.length() == 0 || path.charAt(path.length() - 1) == '/' ? path : path + '/';
return new Enumeration() {
int cur = 0;
+
public boolean hasMoreElements() {
return cur < fileList.length;
}
@@ -396,9 +395,11 @@
} else {
return new Enumeration() {
int cur = 0;
+
public boolean hasMoreElements() {
return cur < 1;
}
+
public Object nextElement() {
if (cur == 0) {
cur = 1;
@@ -423,6 +424,7 @@
public static class DirZipBundleFile extends BundleFile {
ZipBundleFile zipBundlefile;
String cp;
+
public DirZipBundleFile(ZipBundleFile zipBundlefile, String cp) {
super(zipBundlefile.bundlefile, zipBundlefile.bundledata);
this.zipBundlefile = zipBundlefile;
@@ -443,7 +445,7 @@
return zipBundlefile.getEntry(newpath);
}
- public boolean containsDir(String dir){
+ public boolean containsDir(String dir) {
if (dir == null)
return false;
@@ -467,4 +469,4 @@
// do nothing
}
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/adaptor/core/BundleResourceHandler.java b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/adaptor/core/BundleResourceHandler.java
index 72c60d0..26e481b 100644
--- a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/adaptor/core/BundleResourceHandler.java
+++ b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/adaptor/core/BundleResourceHandler.java
@@ -25,8 +25,7 @@
* URLStreamHandler the bundleentry and bundleresource protocols.
*/
-public abstract class BundleResourceHandler extends URLStreamHandler
-{
+public abstract class BundleResourceHandler extends URLStreamHandler {
public static final String SECURITY_AUTHORIZED = "SECURITY_AUTHORIZED";
protected static BundleContext context;
protected BundleEntry bundleEntry;
@@ -34,182 +33,173 @@
/** Single object for permission checks */
protected AdminPermission adminPermission;
- /**
- * Constructor for a bundle protocol resource URLStreamHandler.
- */
- public BundleResourceHandler()
- {
- }
+ /**
+ * Constructor for a bundle protocol resource URLStreamHandler.
+ */
+ public BundleResourceHandler() {
+ }
- public BundleResourceHandler(BundleEntry bundleEntry) {
- this.bundleEntry = bundleEntry;
- }
+ public BundleResourceHandler(BundleEntry bundleEntry) {
+ this.bundleEntry = bundleEntry;
+ }
- /**
- * Parse reference URL.
- */
- protected void parseURL(URL url, String str, int start, int end)
- {
- if (end <= start)
- return;
-
+ /**
+ * Parse reference URL.
+ */
+ protected void parseURL(URL url, String str, int start, int end) {
+ if (end <= start)
+ return;
+
// Check the permission of the caller to see if they
// are allowed access to the resource.
checkAdminPermission();
- String spec = "";
- if (start < end)
- spec = str.substring(start, end);
- end -= start;
+ String spec = "";
+ if (start < end)
+ spec = str.substring(start, end);
+ end -= start;
- String path;
- String bundleId;
+ String path;
+ String bundleId;
- int refIdx = spec.indexOf('#');
- int pathEnd = refIdx >= 0 ? refIdx : end;
+ int refIdx = spec.indexOf('#');
+ int pathEnd = refIdx >= 0 ? refIdx : end;
- if (spec.length()>=2 && spec.charAt(0) == '/' || spec.charAt(1) == '/') {
- int slash = spec.indexOf("/",2);
- if (slash < 0) {
- throw new IllegalArgumentException(AdaptorMsg.formatter.getString("URL_NO_PATH"));
- }
- bundleId = spec.substring(2,slash);
- path = spec.substring(slash,pathEnd);
- }
- else {
- // A call to a URL constructor has been made that
- // uses an authorized URL as its context.
- bundleId = url.getHost();
- if (spec.length() > 0 && spec.charAt(0) == '/') {
- // does not specify a relative path.
- path = spec.substring(start,pathEnd);
- }
- else {
- // relative path specified.
- path = url.getPath() == null ? "" : url.getPath();
- int lastSlash = path.lastIndexOf('/');
- if (lastSlash >= 0)
- path = path.substring(0,lastSlash+1) + spec.substring(start,pathEnd);
- else
- path = spec.substring(start,pathEnd);
+ if (spec.length() >= 2 && spec.charAt(0) == '/' || spec.charAt(1) == '/') {
+ int slash = spec.indexOf("/", 2);
+ if (slash < 0) {
+ throw new IllegalArgumentException(AdaptorMsg.formatter.getString("URL_NO_PATH"));
}
- // null out bundleEntry because it will not be valid for the new path
- bundleEntry = null;
- }
+ bundleId = spec.substring(2, slash);
+ path = spec.substring(slash, pathEnd);
+ } else {
+ // A call to a URL constructor has been made that
+ // uses an authorized URL as its context.
+ bundleId = url.getHost();
+ if (spec.length() > 0 && spec.charAt(0) == '/') {
+ // does not specify a relative path.
+ path = spec.substring(start, pathEnd);
+ } else {
+ // relative path specified.
+ path = url.getPath() == null ? "" : url.getPath();
+ int lastSlash = path.lastIndexOf('/');
+ if (lastSlash >= 0)
+ path = path.substring(0, lastSlash + 1) + spec.substring(start, pathEnd);
+ else
+ path = spec.substring(start, pathEnd);
+ }
+ // null out bundleEntry because it will not be valid for the new path
+ bundleEntry = null;
+ }
- //modify path if there's any relative references
- int dotIndex;
- while ((dotIndex = path.indexOf("/./")) >= 0)
- path = path.substring(0, dotIndex + 1) + path.substring(dotIndex + 3);
- if (path.endsWith("/."))
- path = path.substring(0, path.length() - 1);
- while ((dotIndex = path.indexOf("/../")) >= 0) {
- if (dotIndex != 0)
- path = path.substring(0, path.lastIndexOf('/', dotIndex - 1)) + path.substring(dotIndex + 3);
- else
- path = path.substring(dotIndex + 3);
- }
- if (path.endsWith("/..") && path.length() > 3)
- path = path.substring(0, path.length() - 2 );
-
- // Setting the authority portion of the URL to SECURITY_ATHORIZED
- // ensures that this URL was created by using this parseURL
- // method. The openConnection method will only open URLs
- // that have the authority set to this.
- setURL(url, url.getProtocol(), bundleId, 0, SECURITY_AUTHORIZED, null, path, null, null);
- }
+ //modify path if there's any relative references
+ int dotIndex;
+ while ((dotIndex = path.indexOf("/./")) >= 0)
+ path = path.substring(0, dotIndex + 1) + path.substring(dotIndex + 3);
+ if (path.endsWith("/."))
+ path = path.substring(0, path.length() - 1);
+ while ((dotIndex = path.indexOf("/../")) >= 0) {
+ if (dotIndex != 0)
+ path = path.substring(0, path.lastIndexOf('/', dotIndex - 1)) + path.substring(dotIndex + 3);
+ else
+ path = path.substring(dotIndex + 3);
+ }
+ if (path.endsWith("/..") && path.length() > 3)
+ path = path.substring(0, path.length() - 2);
- /**
- * Establishes a connection to the resource specified by <code>URL</code>.
- * Since different protocols may have unique ways of connecting, it must be
- * overridden by the subclass.
- *
- * @return java.net.URLConnection
- * @param url java.net.URL
- *
- * @exception IOException thrown if an IO error occurs during connection establishment
- */
- protected URLConnection openConnection(URL url) throws IOException
- {
- String authority = url.getAuthority();
- // check to make sure that this URL was created using the
- // parseURL method. This ensures the security check was done
- // at URL construction.
- if (!url.getAuthority().equals(SECURITY_AUTHORIZED)) {
- // No admin security check was made better check now.
- checkAdminPermission();
- }
+ // Setting the authority portion of the URL to SECURITY_ATHORIZED
+ // ensures that this URL was created by using this parseURL
+ // method. The openConnection method will only open URLs
+ // that have the authority set to this.
+ setURL(url, url.getProtocol(), bundleId, 0, SECURITY_AUTHORIZED, null, path, null, null);
+ }
- if (bundleEntry != null){
- return (new BundleURLConnection(url,bundleEntry));
- }
- else {
- String bidString = url.getHost();
- if (bidString == null) {
- throw new IOException(AdaptorMsg.formatter.getString("URL_NO_BUNDLE_ID", url.toExternalForm()));
- }
- AbstractBundle bundle = null;
- try {
- Long bundleID = new Long(bidString);
- bundle = (AbstractBundle) context.getBundle(bundleID.longValue());
- } catch (NumberFormatException nfe) {
- throw new MalformedURLException(AdaptorMsg.formatter.getString("URL_INVALID_BUNDLE_ID", bidString));
- }
+ /**
+ * Establishes a connection to the resource specified by <code>URL</code>.
+ * Since different protocols may have unique ways of connecting, it must be
+ * overridden by the subclass.
+ *
+ * @return java.net.URLConnection
+ * @param url java.net.URL
+ *
+ * @exception IOException thrown if an IO error occurs during connection establishment
+ */
+ protected URLConnection openConnection(URL url) throws IOException {
+ String authority = url.getAuthority();
+ // check to make sure that this URL was created using the
+ // parseURL method. This ensures the security check was done
+ // at URL construction.
+ if (!url.getAuthority().equals(SECURITY_AUTHORIZED)) {
+ // No admin security check was made better check now.
+ checkAdminPermission();
+ }
- if (bundle == null) {
- throw new IOException(AdaptorMsg.formatter.getString("URL_NO_BUNDLE_FOUND", url.toExternalForm()));
- }
- return(new BundleURLConnection(url, findBundleEntry(url,bundle)));
- }
- }
+ if (bundleEntry != null) {
+ return (new BundleURLConnection(url, bundleEntry));
+ } else {
+ String bidString = url.getHost();
+ if (bidString == null) {
+ throw new IOException(AdaptorMsg.formatter.getString("URL_NO_BUNDLE_ID", url.toExternalForm()));
+ }
+ AbstractBundle bundle = null;
+ try {
+ Long bundleID = new Long(bidString);
+ bundle = (AbstractBundle) context.getBundle(bundleID.longValue());
+ } catch (NumberFormatException nfe) {
+ throw new MalformedURLException(AdaptorMsg.formatter.getString("URL_INVALID_BUNDLE_ID", bidString));
+ }
- /**
- * Finds the bundle entry for this protocal. This is handled
- * differently for Bundle.gerResource() and Bundle.getEntry()
- * because getResource uses the bundle classloader and getEntry
- * only used the base bundle file.
- * @param url The URL to find the BundleEntry for.
- * @return
- */
- abstract protected BundleEntry findBundleEntry(URL url,AbstractBundle bundle) throws IOException;
+ if (bundle == null) {
+ throw new IOException(AdaptorMsg.formatter.getString("URL_NO_BUNDLE_FOUND", url.toExternalForm()));
+ }
+ return (new BundleURLConnection(url, findBundleEntry(url, bundle)));
+ }
+ }
- /**
- * Converts a bundle URL to a String.
- *
- * @param url the URL.
- * @return a string representation of the URL.
- */
- protected String toExternalForm(URL url)
- {
- StringBuffer result = new StringBuffer(url.getProtocol());
- result.append("://");
+ /**
+ * Finds the bundle entry for this protocal. This is handled
+ * differently for Bundle.gerResource() and Bundle.getEntry()
+ * because getResource uses the bundle classloader and getEntry
+ * only used the base bundle file.
+ * @param url The URL to find the BundleEntry for.
+ * @return
+ */
+ abstract protected BundleEntry findBundleEntry(URL url, AbstractBundle bundle) throws IOException;
- String bundleId = url.getHost();
- if ((bundleId != null) && (bundleId.length() > 0))
- {
- result.append(bundleId);
- }
+ /**
+ * Converts a bundle URL to a String.
+ *
+ * @param url the URL.
+ * @return a string representation of the URL.
+ */
+ protected String toExternalForm(URL url) {
+ StringBuffer result = new StringBuffer(url.getProtocol());
+ result.append("://");
- String path = url.getPath();
- if (path != null)
- {
- if ((path.length() > 0) && (path.charAt(0) != '/')) /* if name doesn't have a leading slash */
- {
- result.append("/");
- }
+ String bundleId = url.getHost();
+ if ((bundleId != null) && (bundleId.length() > 0)) {
+ result.append(bundleId);
+ }
- result.append(path);
- }
+ String path = url.getPath();
+ if (path != null) {
+ if ((path.length() > 0) && (path.charAt(0) != '/')) /* if name doesn't have a leading slash */
+ {
+ result.append("/");
+ }
- return (result.toString());
- }
+ result.append(path);
+ }
+
+ return (result.toString());
+ }
public static void setContext(BundleContext context) {
BundleResourceHandler.context = context;
}
protected int hashCode(URL url) {
- int hash=0;
+ int hash = 0;
String protocol = url.getProtocol();
if (protocol != null)
hash += protocol.hashCode();
@@ -224,7 +214,6 @@
return hash;
}
-
protected boolean equals(URL url1, URL url2) {
return sameFile(url1, url2);
}
@@ -248,7 +237,7 @@
if (!((p1 == p2) || (p1 != null && p1.equalsIgnoreCase(p2))))
return false;
- if (!hostsEqual(url1,url2))
+ if (!hostsEqual(url1, url2))
return false;
String a1 = url1.getAuthority();
@@ -275,4 +264,4 @@
sm.checkPermission(adminPermission);
}
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/adaptor/core/BundleURLConnection.java b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/adaptor/core/BundleURLConnection.java
index e16877c..27fd41f 100644
--- a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/adaptor/core/BundleURLConnection.java
+++ b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/adaptor/core/BundleURLConnection.java
@@ -188,4 +188,4 @@
public URL getFileURL() {
return bundleEntry.getFileURL();
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/adaptor/core/ReferenceInputStream.java b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/adaptor/core/ReferenceInputStream.java
index 7b0e2af..0bc6869 100644
--- a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/adaptor/core/ReferenceInputStream.java
+++ b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/adaptor/core/ReferenceInputStream.java
@@ -35,4 +35,4 @@
public URL getReference() {
return reference;
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/adaptor/core/ServiceRegistryImpl.java b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/adaptor/core/ServiceRegistryImpl.java
index ef5f489..924d6f2 100644
--- a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/adaptor/core/ServiceRegistryImpl.java
+++ b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/adaptor/core/ServiceRegistryImpl.java
@@ -36,7 +36,7 @@
* Initializes the internal data structures of this ServiceRegistry.
*
*/
- public void initialize(){
+ public void initialize() {
publishedServicesByClass = new Hashtable(53);
publishedServicesByContext = new Hashtable(53);
allPublishedServices = new Vector(50, 20);
@@ -137,7 +137,7 @@
int size;
Vector references = new Vector();
- if (clazz == null) /* all services */ {
+ if (clazz == null) /* all services */{
Vector serviceRegs = allPublishedServices;
if (serviceRegs == null) {
@@ -158,7 +158,7 @@
references.addElement(reference);
}
}
- } else /* services registered under the class name */ {
+ } else /* services registered under the class name */{
Vector serviceRegs = (Vector) publishedServicesByClass.get(clazz);
if (serviceRegs == null) {
@@ -192,7 +192,7 @@
/**
* @see org.eclipse.osgi.framework.adaptor.ServiceRegistry#lookupServiceReferences(BundleContext)
*/
- public Vector lookupServiceReferences(BundleContext context){
+ public Vector lookupServiceReferences(BundleContext context) {
int size;
Vector references = new Vector();
Vector serviceRegs = (Vector) publishedServicesByContext.get(context);
@@ -221,4 +221,4 @@
return (references);
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/adaptor/core/SystemBundleData.java b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/adaptor/core/SystemBundleData.java
index 1374017..e17cc48 100644
--- a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/adaptor/core/SystemBundleData.java
+++ b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/adaptor/core/SystemBundleData.java
@@ -49,7 +49,7 @@
}
if (osgiBase != null)
try {
- bundleFile = BundleFile.createBundleFile(osgiBase,this);
+ bundleFile = BundleFile.createBundleFile(osgiBase, this);
} catch (IOException e) {
// should not happen
}
@@ -62,13 +62,13 @@
public URL getEntry(String path) {
if (bundleFile == null)
return null;
-
+
BundleEntry entry = bundleFile.getEntry(path);
if (entry == null) {
return null;
}
try {
- return new URL(null, AbstractBundleData.getBundleEntryURL(getBundleID(),path), new Handler(entry));
+ return new URL(null, AbstractBundleData.getBundleEntryURL(getBundleID(), path), new Handler(entry));
} catch (MalformedURLException e) {
return null;
}
@@ -140,6 +140,7 @@
//TODO may want to cache
return parseSymbolicName(manifest);
}
+
/*
* Convenience method that retrieves the simbolic name string from the header.
* Note: clients may want to cache the returned value.
@@ -147,35 +148,39 @@
public static String parseSymbolicName(Dictionary manifest) {
String symbolicNameEntry = (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME);
if (symbolicNameEntry == null)
- return null;
+ return null;
try {
return ManifestElement.parseHeader(Constants.BUNDLE_SYMBOLICNAME, symbolicNameEntry)[0].getValue();
} catch (BundleException e) {
// here is not the place to validate a manifest
}
- return null;
+ return null;
}
public Version getVersion() {
return version;
}
+
public String getClassPath() {
return (String) manifest.get(Constants.BUNDLE_CLASSPATH);
}
+
public String getActivator() {
return (String) manifest.get(Constants.BUNDLE_ACTIVATOR);
}
+
public String getDynamicImports() {
return (String) manifest.get(Constants.DYNAMICIMPORT_PACKAGE);
}
+
public String getExecutionEnvironment() {
return (String) manifest.get(Constants.BUNDLE_REQUIREDEXECUTIONENVIRONMENT);
}
- protected File getOsgiBase(){
+ protected File getOsgiBase() {
String fwLocation = System.getProperty(OSGI_FRAMEWORK);
File result = null;
- if (fwLocation != null){
+ if (fwLocation != null) {
try {
URL baseURL = new URL(fwLocation);
result = new File(baseURL.getPath());
@@ -192,12 +197,12 @@
return result;
}
- protected Headers createManifest(FrameworkAdaptor adaptor) throws BundleException{
+ protected Headers createManifest(FrameworkAdaptor adaptor) throws BundleException {
InputStream in = null;
if (osgiBase != null && osgiBase.exists()) {
try {
- in = new FileInputStream(new File(osgiBase,Constants.OSGI_BUNDLE_MANIFEST));
+ in = new FileInputStream(new File(osgiBase, Constants.OSGI_BUNDLE_MANIFEST));
} catch (FileNotFoundException e) {
// do nothing here. in == null
}
@@ -230,7 +235,7 @@
// to export and merge this into the system bundle's manifest
String exportPackages = adaptor.getExportPackages();
String exportServices = adaptor.getExportServices();
- String providePackages =adaptor.getProvidePackages();
+ String providePackages = adaptor.getProvidePackages();
if (exportPackages != null) {
String value = (String) manifest.get(Constants.EXPORT_PACKAGE);
if (value == null) {
@@ -263,4 +268,4 @@
}
return manifest;
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/defaultadaptor/DefaultAdaptor.java b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/defaultadaptor/DefaultAdaptor.java
index 6fb586a..536c98e 100644
--- a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/defaultadaptor/DefaultAdaptor.java
+++ b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/defaultadaptor/DefaultAdaptor.java
@@ -30,10 +30,10 @@
*/
public class DefaultAdaptor extends AbstractFrameworkAdaptor {
- public static final String METADATA_ADAPTOR_NEXTID = "METADATA_ADAPTOR_NEXTID"; //$NON-NLS-1$
- public static final String METADATA_ADAPTOR_IBSL = "METADATA_ADAPTOR_IBSL"; //$NON-NLS-1$
- public static final String DATA_DIR_NAME = "data"; //$NON-NLS-1$
- public static final String BUNDLE_STORE = "osgi.bundlestore"; //$NON-NLS-1$
+ public static final String METADATA_ADAPTOR_NEXTID = "METADATA_ADAPTOR_NEXTID"; //$NON-NLS-1$
+ public static final String METADATA_ADAPTOR_IBSL = "METADATA_ADAPTOR_IBSL"; //$NON-NLS-1$
+ public static final String DATA_DIR_NAME = "data"; //$NON-NLS-1$
+ public static final String BUNDLE_STORE = "osgi.bundlestore"; //$NON-NLS-1$
protected AdaptorElementFactory elementFactory;
@@ -59,7 +59,7 @@
/** The State Manager */
protected StateManager stateManager;
-
+
/** The FrameworkLog for the adaptor */
protected FrameworkLog frameworkLog;
@@ -103,7 +103,7 @@
public void initialize(EventPublisher eventPublisher) {
super.initialize(eventPublisher);
initBundleStoreRootDir();
-
+
// need to create the FrameworkLog very early
frameworkLog = createFrameworkLog();
stateManager = createStateManager();
@@ -114,7 +114,7 @@
* @return the StateManager.
*/
protected StateManager createStateManager() {
- File stateLocation = new File(getBundleStoreRootDir(),".state");
+ File stateLocation = new File(getBundleStoreRootDir(), ".state");
stateManager = new StateManager(stateLocation);
State systemState = stateManager.getSystemState();
if (systemState != null)
@@ -146,6 +146,7 @@
protected FrameworkLog createFrameworkLog() {
return new DefaultLog();
}
+
/**
* Init the directory to store the bundles in. Bundledir can be set in 3 different ways.
* Priority is:
@@ -174,7 +175,7 @@
}
- protected void initDataRootDir(){
+ protected void initDataRootDir() {
dataRootDir = getBundleStoreRootDir();
}
@@ -188,7 +189,6 @@
return dataRootDir;
}
-
/**
* Initialize the persistent storage.
*
@@ -275,7 +275,7 @@
File target = new File(directory, list[i]);
/* if the file is a directory */
- if (target.isDirectory()) { //TODO Simplify the nesting.
+ if (target.isDirectory()) { //TODO Simplify the nesting.
File delete = new File(target, ".delete");
/* and the directory is marked for delete */
@@ -323,7 +323,7 @@
}
int len = list.length;
- Vector bundleDatas = new Vector(len << 1, 10); //TODO ArrayList? array?
+ Vector bundleDatas = new Vector(len << 1, 10); //TODO ArrayList? array?
/* create bundle objects for all installed bundles. */
for (int i = 0; i < len; i++) {
@@ -336,7 +336,7 @@
} catch (NumberFormatException nfe) {
continue;
}
- data = (DefaultBundleData) getElementFactory().createBundleData(this,id);
+ data = (DefaultBundleData) getElementFactory().createBundleData(this, id);
loadMetaDataFor(data);
data.initializeExistingBundle();
@@ -401,7 +401,7 @@
} catch (IOException e) {
throw new BundleException(AdaptorMsg.formatter.getString("ADAPTOR_STORAGE_EXCEPTION"), e); //$NON-NLS-1$
}
- data = (DefaultBundleData) getElementFactory().createBundleData(DefaultAdaptor.this,id);
+ data = (DefaultBundleData) getElementFactory().createBundleData(DefaultAdaptor.this, id);
data.setLocation(location);
data.setStartLevel(getInitialBundleStartLevel());
@@ -420,18 +420,18 @@
if (!genDir.exists()) {
throw new IOException(AdaptorMsg.formatter.getString("ADAPTOR_DIRECTORY_CREATE_EXCEPTION", genDir.getPath())); //$NON-NLS-1$
}
-
+
String fileName = mapLocationToName(location);
- File outFile = new File(genDir,fileName);
+ File outFile = new File(genDir, fileName);
if ("file".equals(protocol)) {
File inFile = new File(source.getURL().getPath());
if (inFile.isDirectory()) {
- copyDir(inFile,outFile);
+ copyDir(inFile, outFile);
} else {
- readFile(in,outFile);
+ readFile(in, outFile);
}
} else {
- readFile(in,outFile);
+ readFile(in, outFile);
}
data.setReference(false);
data.setFileName(fileName);
@@ -589,6 +589,7 @@
return (newData);
}
+
/**
* Commit the change to persistent storage.
*
@@ -641,14 +642,14 @@
*/
public void undo() throws BundleException {
/*if (bundleFile != null)
- {
- bundleFile.close();
- } */
+ {
+ bundleFile.close();
+ } */
if (newData != null) {
File nextGenerationDir = newData.createGenerationDir();
- if (!rm(nextGenerationDir)) /* delete downloaded bundle */ {
+ if (!rm(nextGenerationDir)) /* delete downloaded bundle */{
/* mark this bundle to be deleted to ensure it is fully cleaned up
* on next restart.
*/
@@ -699,6 +700,7 @@
this.data = (DefaultBundleData) bundledata;
return (bundledata);
}
+
/**
* Commit the change to persistent storage.
*
@@ -731,6 +733,7 @@
stateManager.getSystemState().removeBundle(data.getBundleID());
}
+
/**
* Undo the change to persistent storage.
*
@@ -788,6 +791,7 @@
frameworkLog.close();
frameworkLog = null;
}
+
/**
* Register a service object.
*
@@ -921,6 +925,7 @@
public State getState() {
return stateManager.getSystemState();
}
+
public PlatformAdmin getPlatformAdmin() {
return stateManager;
}
@@ -968,4 +973,4 @@
bundleMetadata.save();
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/defaultadaptor/DefaultBundleData.java b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/defaultadaptor/DefaultBundleData.java
index a942359..ec5adec 100644
--- a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/defaultadaptor/DefaultBundleData.java
+++ b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/defaultadaptor/DefaultBundleData.java
@@ -41,7 +41,6 @@
/** The base BundleFile object for this BundleData */
protected BundleFile baseBundleFile;
-
/**
* Read data from an existing directory.
* This constructor is used by getInstalledBundles.
@@ -70,7 +69,7 @@
File delete = new File(getBundleStoreDir(), ".delete");
/* and the directory is not marked for delete */
- if (delete.exists())
+ if (delete.exists())
throw new IOException();
createBaseBundleFile();
@@ -84,8 +83,8 @@
loadFromManifest();
}
- protected void initBundleStoreDirs(String bundleID){
- setBundleStoreDir(new File(((DefaultAdaptor)adaptor).getBundleStoreRootDir(), bundleID));
+ protected void initBundleStoreDirs(String bundleID) {
+ setBundleStoreDir(new File(((DefaultAdaptor) adaptor).getBundleStoreRootDir(), bundleID));
}
/**
@@ -158,16 +157,18 @@
sb.append(",");
}
}
- if (sb.length()>0)
+ if (sb.length() > 0)
setNativePaths(sb.toString());
}
protected void setDataDir(File dirData) {
this.dirData = dirData;
}
+
protected File getDataDir() {
return dirData;
}
+
/**
* Return the bundle data directory.
* Attempt to create the directory if it does not exist.
@@ -177,7 +178,7 @@
public File getDataFile(String path) {
// lazily initialize dirData to prevent early access to instance location
if (getDataDir() == null) {
- File dataRoot = ((DefaultAdaptor)adaptor).getDataRootDir();
+ File dataRoot = ((DefaultAdaptor) adaptor).getDataRootDir();
if (dataRoot == null)
throw new IllegalStateException(AdaptorMsg.formatter.getString("ADAPTOR_DATA_AREA_NOT_SET")); //$NON-NLS-1$
setDataDir(new File(dataRoot, id + "/" + DefaultAdaptor.DATA_DIR_NAME));
@@ -237,7 +238,7 @@
protected File getGenerationDir() {
return new File(getBundleStoreDir(), String.valueOf(getGeneration()));
}
-
+
/**
* Return the bundle generation directory.
* Attempt to create the directory if it does not exist.
@@ -272,6 +273,7 @@
protected void setBundleStoreDir(File bundleStoreDir) {
this.bundleStoreDir = bundleStoreDir;
}
+
/**
* Return the top level bundle directory.
*
@@ -292,7 +294,7 @@
* @throws IOException if a write error occurs.
*/
public synchronized void save() throws IOException {
- ((DefaultAdaptor)adaptor).saveMetaDataFor(this);
+ ((DefaultAdaptor) adaptor).saveMetaDataFor(this);
}
/**
@@ -327,11 +329,10 @@
if (referenceFile != null) {
next.setReference(true);
next.setFileName(referenceFile);
- }
- else {
+ } else {
if (next.isReference()) {
next.setReference(false);
- next.setFileName(((DefaultAdaptor)adaptor).mapLocationToName(getLocation()));
+ next.setFileName(((DefaultAdaptor) adaptor).mapLocationToName(getLocation()));
}
}
@@ -343,12 +344,12 @@
throw new IOException(AdaptorMsg.formatter.getString("ADAPTOR_STORAGE_EXCEPTION")); //$NON-NLS-1$
}
- protected BundleFile createBaseBundleFile() throws IOException{
- baseBundleFile = BundleFile.createBundleFile(getBaseFile(),this);
+ protected BundleFile createBaseBundleFile() throws IOException {
+ baseBundleFile = BundleFile.createBundleFile(getBaseFile(), this);
return baseBundleFile;
}
-
- public BundleFile getBaseBundleFile(){
+
+ public BundleFile getBaseBundleFile() {
return baseBundleFile;
}
diff --git a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/defaultadaptor/DefaultClassLoader.java b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/defaultadaptor/DefaultClassLoader.java
index b554af4..089316a 100644
--- a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/defaultadaptor/DefaultClassLoader.java
+++ b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/defaultadaptor/DefaultClassLoader.java
@@ -36,7 +36,7 @@
*/
protected ClasspathEntry[] classpathEntries;
- protected Vector fragClasspaths; //TODO This should be an array or an arraylist if the synchronization is not required
+ protected Vector fragClasspaths; //TODO This should be an array or an arraylist if the synchronization is not required
/**
* The buffer size to use when loading classes. This value is used
@@ -148,12 +148,12 @@
}
// if in dev mode, try using the cp as an absolute path
- if (bundlefile == null && DevClassPathHelper.inDevelopmentMode()){
+ if (bundlefile == null && DevClassPathHelper.inDevelopmentMode()) {
file = new File(cp);
if (file.exists() && file.isAbsolute())
// if the file exists and is absolute then create BundleFile for it.
try {
- bundlefile = BundleFile.createBundleFile(file,bundledata);
+ bundlefile = BundleFile.createBundleFile(file, bundledata);
} catch (IOException e) {
bundledata.getAdaptor().getEventPublisher().publishFrameworkEvent(FrameworkEvent.ERROR, bundledata.getBundle(), e);
}
@@ -236,22 +236,22 @@
if (length > 0) {
classbytes = new byte[length];
- readloop : for (; bytesread < length; bytesread += readcount) {
+ readloop: for (; bytesread < length; bytesread += readcount) {
readcount = in.read(classbytes, bytesread, length - bytesread);
- if (readcount <= 0) /* if we didn't read anything */ {
+ if (readcount <= 0) /* if we didn't read anything */{
break readloop; /* leave the loop */
}
}
- } else /* BundleEntry does not know its own length! */ {
+ } else /* BundleEntry does not know its own length! */{
length = buffersize;
classbytes = new byte[length];
- readloop : while (true) {
+ readloop: while (true) {
for (; bytesread < length; bytesread += readcount) {
readcount = in.read(classbytes, bytesread, length - bytesread);
- if (readcount <= 0) /* if we didn't read anything */ {
+ if (readcount <= 0) /* if we didn't read anything */{
break readloop; /* leave the loop */
}
}
@@ -293,7 +293,7 @@
}
protected Class defineClass(String name, byte[] classbytes, int off, int len, ClasspathEntry classpathEntry) throws ClassFormatError {
- return defineClass(name,classbytes,off,len,classpathEntry.getProtectionDomain());
+ return defineClass(name, classbytes, off, len, classpathEntry.getProtectionDomain());
}
/**
@@ -332,7 +332,7 @@
* @return A URL to the resource or null if the resource does not exist.
*/
protected URL findResourceImpl(String name, BundleFile bundlefile) {
- return bundlefile.getResourceURL(name,hostdata.getBundleID());
+ return bundlefile.getResourceURL(name, hostdata.getBundleID());
}
/**
@@ -393,7 +393,7 @@
return null;
}
- protected BundleEntry findObjectImpl(String object,BundleFile bundleFile){
+ protected BundleEntry findObjectImpl(String object, BundleFile bundleFile) {
return bundleFile.getEntry(object);
}
@@ -462,10 +462,10 @@
protected void findClassPathEntry(ArrayList result, String entry, AbstractBundleData bundledata, ProtectionDomain domain) {
if (!addClassPathEntry(result, entry, bundledata, domain)) {
-// if (devCP == null) {
-// BundleException be = new BundleException(Msg.formatter.getString("BUNDLE_CLASSPATH_ENTRY_NOT_FOUND_EXCEPTION", entry, hostdata.getLocation()));
-// bundledata.getAdaptor().getEventPublisher().publishFrameworkEvent(FrameworkEvent.ERROR, bundledata.getBundle(), be);
-// }
+ // if (devCP == null) {
+ // BundleException be = new BundleException(Msg.formatter.getString("BUNDLE_CLASSPATH_ENTRY_NOT_FOUND_EXCEPTION", entry, hostdata.getLocation()));
+ // bundledata.getAdaptor().getEventPublisher().publishFrameworkEvent(FrameworkEvent.ERROR, bundledata.getBundle(), be);
+ // }
}
}
@@ -473,12 +473,12 @@
if (entry.equals(".")) {
result.add(createClassPathEntry(bundledata.getBaseBundleFile(), domain));
return true;
- }
+ }
Object element = getClasspath(entry, bundledata, domain);
if (element != null) {
result.add(element);
return true;
- }
+ }
// need to check in fragments for the classpath entry.
// only check for fragments if the bundledata is the hostdata.
if (fragClasspaths != null && hostdata == bundledata) {
@@ -560,15 +560,18 @@
protected class ClasspathEntry {
protected BundleFile bundlefile;
protected ProtectionDomain domain;
+
protected ClasspathEntry(BundleFile bundlefile, ProtectionDomain domain) {
this.bundlefile = bundlefile;
this.domain = domain;
}
+
public BundleFile getBundleFile() {
return bundlefile;
}
+
public ProtectionDomain getProtectionDomain() {
return domain;
}
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/defaultadaptor/DefaultElementFactory.java b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/defaultadaptor/DefaultElementFactory.java
index be88e32..926b2e8 100644
--- a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/defaultadaptor/DefaultElementFactory.java
+++ b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/defaultadaptor/DefaultElementFactory.java
@@ -17,14 +17,14 @@
import org.eclipse.osgi.framework.adaptor.core.AbstractFrameworkAdaptor;
import org.eclipse.osgi.framework.adaptor.core.AdaptorElementFactory;
-public class DefaultElementFactory implements AdaptorElementFactory{
+public class DefaultElementFactory implements AdaptorElementFactory {
public AbstractBundleData createBundleData(AbstractFrameworkAdaptor adaptor, long id) throws IOException {
- return new DefaultBundleData((DefaultAdaptor)adaptor, id);
+ return new DefaultBundleData((DefaultAdaptor) adaptor, id);
}
public org.eclipse.osgi.framework.adaptor.BundleClassLoader createClassLoader(ClassLoaderDelegate delegate, ProtectionDomain domain, String[] bundleclasspath, AbstractBundleData data) {
return new DefaultClassLoader(delegate, domain, bundleclasspath, data.getAdaptor().getBundleClassLoaderParent(), data);
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/defaultadaptor/DefaultLog.java b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/defaultadaptor/DefaultLog.java
index d574fb8..963f264 100644
--- a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/defaultadaptor/DefaultLog.java
+++ b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/defaultadaptor/DefaultLog.java
@@ -54,7 +54,7 @@
* that uses System.err to log messages to.
*/
public DefaultLog() {
- this((Writer)null);
+ this((Writer) null);
}
/**
@@ -88,12 +88,11 @@
public void close() {
try {
if (writer != null) {
- Writer tmpWriter = writer;
- writer = null;
+ Writer tmpWriter = writer;
+ writer = null;
tmpWriter.close();
}
- }
- catch (IOException e) {
+ } catch (IOException e) {
e.printStackTrace();
}
}
@@ -102,14 +101,11 @@
if (writer == null) {
if (outFile != null) {
try {
- writer = logForStream(
- SecureAction.getFileOutputStream(outFile,
- true));
+ writer = logForStream(SecureAction.getFileOutputStream(outFile, true));
} catch (IOException e) {
writer = logForStream(System.err);
}
- }
- else {
+ } else {
writer = logForStream(System.err);
}
}
@@ -129,17 +125,16 @@
}
}
- public void log(FrameworkEvent frameworkEvent){
+ public void log(FrameworkEvent frameworkEvent) {
Bundle b = frameworkEvent.getBundle();
Throwable t = frameworkEvent.getThrowable();
-
- FrameworkLogEntry logEntry =
- new FrameworkLogEntry(b.getLocation() + " 0 0", "FrameworkEvent.ERROR", 0, t, null);
+
+ FrameworkLogEntry logEntry = new FrameworkLogEntry(b.getLocation() + " 0 0", "FrameworkEvent.ERROR", 0, t, null);
log(logEntry);
}
- public synchronized void log(FrameworkLogEntry logEntry){
+ public synchronized void log(FrameworkLogEntry logEntry) {
if (logEntry == null)
return;
try {
@@ -150,8 +145,7 @@
}
writeLog(0, logEntry);
writer.flush();
- }
- catch (Exception e) {
+ } catch (Exception e) {
// any exceptions during logging should be caught
System.err.println("An exception occurred while writing to the platform log:");//$NON-NLS-1$
e.printStackTrace(System.err);
@@ -164,9 +158,8 @@
} catch (Exception e2) {
System.err.println("An exception occurred while logging to the console:");//$NON-NLS-1$
e2.printStackTrace(System.err);
- }
- }
- finally {
+ }
+ } finally {
closeFile();
}
}
@@ -179,7 +172,7 @@
setOutput(newFile, null, append);
}
- public synchronized File getFile(){
+ public synchronized File getFile() {
return outFile;
}
@@ -208,8 +201,7 @@
Reader fileIn = null;
try {
openFile();
- fileIn = new InputStreamReader(SecureAction.getFileInputStream(
- oldOutFile), "UTF-8");
+ fileIn = new InputStreamReader(SecureAction.getFileInputStream(oldOutFile), "UTF-8");
copyReader(fileIn, this.writer);
} catch (IOException e) {
copyFailed = true;
@@ -223,7 +215,7 @@
}
// delete the old file if copying didn't fail
if (!copyFailed)
- oldOutFile.delete();
+ oldOutFile.delete();
}
closeFile();
}
@@ -243,16 +235,16 @@
return new Date().toString();
}
- protected String getStackTrace(Throwable t){
- if (t == null)
+ protected String getStackTrace(Throwable t) {
+ if (t == null)
return null;
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
t.printStackTrace(pw);
- if (t instanceof BundleException){
- Throwable n = ((BundleException)t).getNestedException();
+ if (t instanceof BundleException) {
+ Throwable n = ((BundleException) t).getNestedException();
if (n != null) {
pw.println("Nested exception:");
n.printStackTrace(pw);
@@ -261,6 +253,7 @@
return sw.toString();
}
+
protected Writer logForStream(OutputStream output) {
try {
return new BufferedWriter(new OutputStreamWriter(output, "UTF-8")); //$NON-NLS-1$
@@ -276,8 +269,8 @@
FrameworkLogEntry[] children = entry.getChildren();
if (children != null) {
- for (int i=0; i<children.length; i++) {
- writeLog(depth+1, children[i]);
+ for (int i = 0; i < children.length; i++) {
+ writeLog(depth + 1, children[i]);
}
}
}
@@ -312,7 +305,6 @@
// then just skip over them.
}
-
}
protected void writeEntry(int depth, FrameworkLogEntry entry) throws IOException {
@@ -349,20 +341,23 @@
}
protected void write(String message) throws IOException {
- if (message != null){
+ if (message != null) {
writer.write(message);
- if (consoleLog)
+ if (consoleLog)
System.out.print(message);
}
}
+
protected void writeln(String s) throws IOException {
write(s);
writeln();
}
+
protected void writeln() throws IOException {
write(LINE_SEPARATOR);
}
+
protected void writeSpace() throws IOException {
write(" "); //$NON-NLS-1$
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/defaultadaptor/DefaultPermissionStorage.java b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/defaultadaptor/DefaultPermissionStorage.java
index dc79a6e..30bcabd 100644
--- a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/defaultadaptor/DefaultPermissionStorage.java
+++ b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/defaultadaptor/DefaultPermissionStorage.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.osgi.framework.internal.defaultadaptor;
+
import java.io.*;
import java.util.Enumeration;
import java.util.Hashtable;
@@ -286,7 +287,7 @@
* @param key Key to save the permission data for.
*/
protected File save(File file, String location, String[] data) throws IOException {
- if (file == null) /* we need to create a filename */ {
+ if (file == null) /* we need to create a filename */{
file = File.createTempFile("perm", "", permissionDir);
file.delete(); /* delete the empty file */
}
diff --git a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/defaultadaptor/DevClassPathHelper.java b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/defaultadaptor/DevClassPathHelper.java
index 3bdbd7e..a224f4e 100644
--- a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/defaultadaptor/DevClassPathHelper.java
+++ b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/defaultadaptor/DevClassPathHelper.java
@@ -20,7 +20,7 @@
static protected boolean inDevelopmentMode = false;
static protected String[] devDefaultClasspath;
static protected Properties devProperties = null;
-
+
static {
// Check the osgi.dev property to see if dev classpath entries have been defined.
String osgiDev = System.getProperty("osgi.dev");
@@ -29,13 +29,13 @@
inDevelopmentMode = true;
URL location = new URL(osgiDev);
devProperties = load(location);
- devDefaultClasspath = getArrayFromList(devProperties.getProperty("*"));
+ devDefaultClasspath = getArrayFromList(devProperties.getProperty("*"));
} catch (MalformedURLException e) {
devDefaultClasspath = getArrayFromList(osgiDev);
}
}
}
-
+
public static String[] getDevClassPath(String id) {
String[] result = null;
if (id != null && devProperties != null) {
@@ -43,11 +43,11 @@
if (entry != null)
result = getArrayFromList(entry);
}
- if (result == null)
+ if (result == null)
result = devDefaultClasspath;
return result;
}
-
+
/**
* Returns the result of converting a list of comma-separated tokens into an array
*
@@ -66,7 +66,7 @@
}
return list.isEmpty() ? new String[0] : (String[]) list.toArray(new String[list.size()]);
}
-
+
public static boolean inDevelopmentMode() {
return inDevelopmentMode;
}
@@ -89,4 +89,4 @@
}
return props;
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/defaultadaptor/MetaData.java b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/defaultadaptor/MetaData.java
index 493694b..4b91690 100644
--- a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/defaultadaptor/MetaData.java
+++ b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/defaultadaptor/MetaData.java
@@ -185,4 +185,4 @@
return properties.toString();
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/protocol/bundleentry/Handler.java b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/protocol/bundleentry/Handler.java
index 18f83b0..1d6db3a 100644
--- a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/protocol/bundleentry/Handler.java
+++ b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/protocol/bundleentry/Handler.java
@@ -24,23 +24,20 @@
* URLStreamHandler the bundleentry protocol.
*/
-public class Handler extends BundleResourceHandler
-{
+public class Handler extends BundleResourceHandler {
- /**
- * Constructor for a bundle protocol resource URLStreamHandler.
- */
- public Handler()
- {
- super();
- }
+ /**
+ * Constructor for a bundle protocol resource URLStreamHandler.
+ */
+ public Handler() {
+ super();
+ }
- public Handler(BundleEntry bundleEntry) {
- super(bundleEntry);
- }
+ public Handler(BundleEntry bundleEntry) {
+ super(bundleEntry);
+ }
- protected BundleEntry findBundleEntry(URL url, AbstractBundle bundle) throws IOException
- {
+ protected BundleEntry findBundleEntry(URL url, AbstractBundle bundle) throws IOException {
AbstractBundleData bundleData = (AbstractBundleData) bundle.getBundleData();
BundleEntry entry = bundleData.getBaseBundleFile().getEntry(url.getPath());
if (entry == null)
@@ -49,4 +46,4 @@
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/protocol/bundleresource/Handler.java b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/protocol/bundleresource/Handler.java
index c6d825c..b09ef65 100644
--- a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/protocol/bundleresource/Handler.java
+++ b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/protocol/bundleresource/Handler.java
@@ -24,14 +24,12 @@
* URLStreamHandler the bundleresource protocol.
*/
-public class Handler extends BundleResourceHandler
-{
+public class Handler extends BundleResourceHandler {
/**
* Constructor for a bundle protocol resource URLStreamHandler.
*/
- public Handler()
- {
+ public Handler() {
super();
}
@@ -39,8 +37,7 @@
super(bundleEntry);
}
- protected BundleEntry findBundleEntry(URL url, AbstractBundle bundle) throws IOException
- {
+ protected BundleEntry findBundleEntry(URL url, AbstractBundle bundle) throws IOException {
BundleLoader bundleLoader = bundle.getBundleLoader();
if (bundleLoader == null)
throw new FileNotFoundException(url.getPath());
diff --git a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/protocol/reference/Handler.java b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/protocol/reference/Handler.java
index 3e4a180..64d1240 100644
--- a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/protocol/reference/Handler.java
+++ b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/protocol/reference/Handler.java
@@ -53,4 +53,4 @@
setURL(url, url.getProtocol(), null, -1, null, null, reference, null, null);
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/protocol/reference/ReferenceURLConnection.java b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/protocol/reference/ReferenceURLConnection.java
index d2d9589..bab0166 100644
--- a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/protocol/reference/ReferenceURLConnection.java
+++ b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/protocol/reference/ReferenceURLConnection.java
@@ -98,4 +98,4 @@
return new ReferenceInputStream(reference);
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/reliablefile/ReliableFile.java b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/reliablefile/ReliableFile.java
index 355bf23..a415051 100644
--- a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/reliablefile/ReliableFile.java
+++ b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/reliablefile/ReliableFile.java
@@ -327,6 +327,7 @@
* @throws IOException If the copy failed.
*/
private static final int CP_BUF_SIZE = 4096;
+
private static void cp(File from, File to) throws IOException {
FileInputStream in = null;
FileOutputStream out = null;
@@ -394,7 +395,7 @@
* <code>false</code> otherwise.
*/
public static boolean exists(File file) {
- if (file.exists()) /* quick test */ {
+ if (file.exists()) /* quick test */{
return true;
}
@@ -446,4 +447,4 @@
return false;
}
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/reliablefile/ReliableFileInputStream.java b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/reliablefile/ReliableFileInputStream.java
index b20237e..04107fd 100644
--- a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/reliablefile/ReliableFileInputStream.java
+++ b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/reliablefile/ReliableFileInputStream.java
@@ -87,4 +87,4 @@
protected void finalize() throws IOException {
close();
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/reliablefile/ReliableFileOutputStream.java b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/reliablefile/ReliableFileOutputStream.java
index 3b25183..80e2a3a 100644
--- a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/reliablefile/ReliableFileOutputStream.java
+++ b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/reliablefile/ReliableFileOutputStream.java
@@ -123,4 +123,4 @@
public void write(byte b[], int off, int len) throws IOException {
out.write(b, off, len);
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/reliablefile/ReliableMsg.java b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/reliablefile/ReliableMsg.java
index b02ac2c..344b80a 100644
--- a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/reliablefile/ReliableMsg.java
+++ b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/internal/reliablefile/ReliableMsg.java
@@ -27,4 +27,4 @@
static {
formatter = new MessageFormat("org.eclipse.osgi.framework.internal.reliablefile.ExternalMessages");
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/BasicLocation.java b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/BasicLocation.java
index f20fa8a..15cc074 100644
--- a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/BasicLocation.java
+++ b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/BasicLocation.java
@@ -48,12 +48,14 @@
public Location getParentLocation() {
return parent;
}
+
//TODO use synchronized
public URL getURL() {
if (location == null && defaultValue != null)
setURL(defaultValue, false);
return location;
}
+
//TODO use synchronized
public boolean isSet() {
return location != null;
@@ -84,6 +86,7 @@
System.getProperties().put(property, location.toExternalForm());
return lock;
}
+
//TODO use synchronized or remove if passed in constructor
public void setParent(Location value) {
parent = value;
@@ -139,11 +142,13 @@
locker = new Locker_JavaNio(lock);
}
}
+
//TODO use synchronized
public void release() {
if (locker != null)
locker.release();
}
+
//TODO: isRunningWithNIO or hasNIO or...
private boolean runningWithNio() {
try {
diff --git a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/BundleLocalizationImpl.java b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/BundleLocalizationImpl.java
index eb6619a..bda396b 100644
--- a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/BundleLocalizationImpl.java
+++ b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/BundleLocalizationImpl.java
@@ -9,6 +9,7 @@
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.core.runtime.adaptor;
+
import java.util.ResourceBundle;
import org.eclipse.osgi.service.localization.BundleLocalization;
import org.osgi.framework.Bundle;
diff --git a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/BundleStopper.java b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/BundleStopper.java
index b9eb1c2..9ca8a3d 100644
--- a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/BundleStopper.java
+++ b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/BundleStopper.java
@@ -24,17 +24,21 @@
private class ReferenceKey {
private long referrerId;
private long referredId;
+
public ReferenceKey(long referrerId, long referredId) {
this.referrerId = referrerId;
this.referredId = referredId;
}
+
public boolean equals(Object obj) {
return referredId == ((ReferenceKey) obj).referredId && referrerId == ((ReferenceKey) obj).referrerId;
}
+
public int hashCode() {
return ((int) (referredId & 0xFFFF)) << 16 + (int) (referrerId & 0xFFFF);
}
}
+
public void stopBundles() {
Map references = new HashMap();
Bundle[] allBundles = EclipseAdaptor.getDefault().getContext().getBundles();
@@ -46,6 +50,7 @@
Bundle[] orderedBundles = orderBundles(references, allToStop, toStopWithNames);
stopBundles(orderedBundles);
}
+
private void stopBundles(Bundle[] orderedBundles) {
// stop all active legacy bundles in the reverse order of Require-Bundle
for (int i = orderedBundles.length - 1; i >= 0; i--) {
@@ -59,6 +64,7 @@
}
}
}
+
private Bundle[] orderBundles(Map references, Map allToStop, Map toStopWithNames) {
// find dependencies betweeen them
for (Iterator i = allToStop.entrySet().iterator(); i.hasNext();) {
@@ -76,16 +82,16 @@
// ignore dependencies on bundles that we are not stopping
Bundle requiredBundle = (Bundle) toStopWithNames.get(requiredBundleName);
if (requiredBundle != null)
- references.put(new ReferenceKey(toStop.getBundleId(), requiredBundle.getBundleId()), new Object[]{toStop, requiredBundle});
+ references.put(new ReferenceKey(toStop.getBundleId(), requiredBundle.getBundleId()), new Object[] {toStop, requiredBundle});
}
} catch (BundleException e) {
// should never happen, since the framework accepted this bundle, but...
String message = EclipseAdaptorMsg.formatter.getString("ECLIPSE_BUNDLESTOPPER_ERROR_STOPPING_BUNDLE", toStop); //$NON-NLS-1$
FrameworkLogEntry entry = new FrameworkLogEntry(EclipseAdaptorConstants.PI_ECLIPSE_OSGI, message, 0, e, null);
- EclipseAdaptor.getDefault().getFrameworkLog().log(entry);
+ EclipseAdaptor.getDefault().getFrameworkLog().log(entry);
}
}
-
+
//TODO The ordering should be done with taking all the required bundles into account, and then the filtering should be done. Otherwise this can result in a bad ordering in the shutting down.
//TODO Maybe should we also consider the import?
Bundle[] orderedBundles = (Bundle[]) allToStop.keySet().toArray(new Bundle[allToStop.size()]);
@@ -95,19 +101,20 @@
StringBuffer cycleText = new StringBuffer("["); //$NON-NLS-1$
for (int i = 0; i < cycles.length; i++) {
cycleText.append('[');
- for (int j = 0; j < cycles[i].length; j++) {
+ for (int j = 0; j < cycles[i].length; j++) {
cycleText.append(((Bundle) cycles[i][j]).getSymbolicName());
cycleText.append(',');
}
cycleText.insert(cycleText.length() - 1, ']');
}
- cycleText.setCharAt(cycleText.length() - 1, ']');
+ cycleText.setCharAt(cycleText.length() - 1, ']');
String message = EclipseAdaptorMsg.formatter.getString("ECLIPSE_BUNDLESTOPPER_ERROR_STOPPING_BUNDLE", cycleText); //$NON-NLS-1$
FrameworkLogEntry entry = new FrameworkLogEntry(EclipseAdaptorConstants.PI_ECLIPSE_OSGI, message, 0, null, null);
EclipseAdaptor.getDefault().getFrameworkLog().log(entry);
- }
+ }
return orderedBundles;
}
+
private void selectBundlesToStop(Bundle[] allBundles, Map allToStop, Map toStopWithNames) {
// gather all active "auto-stoppable" bundles
for (int i = 0; i < allBundles.length; i++) {
diff --git a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/CachedManifest.java b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/CachedManifest.java
index afe7f18..2bf0eb8 100644
--- a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/CachedManifest.java
+++ b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/CachedManifest.java
@@ -20,11 +20,11 @@
Dictionary manifest = null;
EclipseBundleData bundledata;
-
+
public CachedManifest(EclipseBundleData bundledata) {
this.bundledata = bundledata;
}
-
+
private Dictionary getManifest() {
if (manifest == null)
try {
@@ -58,7 +58,7 @@
}
public Object get(Object key) {
- String keyString = (String) key;
+ String keyString = (String) key;
if (org.osgi.framework.Constants.BUNDLE_VERSION.equalsIgnoreCase(keyString)) {
Version result = bundledata.getVersion();
return result == null ? null : result.toString();
@@ -66,7 +66,7 @@
if (EclipseAdaptorConstants.ECLIPSE_AUTOSTART.equalsIgnoreCase(keyString))
return bundledata.getAutoStart();
if (EclipseAdaptorConstants.ECLIPSE_AUTOSTOP.equalsIgnoreCase(keyString))
- return bundledata.getAutoStop();
+ return bundledata.getAutoStop();
if (EclipseAdaptorConstants.PLUGIN_CLASS.equalsIgnoreCase(keyString))
return bundledata.getPluginClass();
if (EclipseAdaptorConstants.LEGACY.equalsIgnoreCase(keyString))
@@ -89,4 +89,4 @@
return getManifest().put(key, value);
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/ComputeNodeOrder.java b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/ComputeNodeOrder.java
index 86c4a23..1357b5b 100644
--- a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/ComputeNodeOrder.java
+++ b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/ComputeNodeOrder.java
@@ -379,7 +379,7 @@
Vertex vertex = null;
Iterator allV = vertexList.iterator();
state = NEXT_VERTEX;
- nextStateLoop : while (true) {
+ nextStateLoop: while (true) {
switch (state) {
case NEXT_VERTEX :
// on entry, "allV" contains vertexes yet to be visited
@@ -516,4 +516,4 @@
objects[i] = orderedNodes[i];
return knots;
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseAdaptor.java b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseAdaptor.java
index e5d4f05..9080029 100644
--- a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseAdaptor.java
+++ b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseAdaptor.java
@@ -41,10 +41,10 @@
public static boolean TRACE_CLASSES = false;
public static boolean TRACE_BUNDLES = false;
- public static final String FRAMEWORK_SYMBOLICNAME = "org.eclipse.osgi"; //$NON-NLS-1$
+ public static final String FRAMEWORK_SYMBOLICNAME = "org.eclipse.osgi"; //$NON-NLS-1$
//Option names for spies
- private static final String RUNTIME_ADAPTOR = FRAMEWORK_SYMBOLICNAME + "/eclipseadaptor"; //$NON-NLS-1$
+ private static final String RUNTIME_ADAPTOR = FRAMEWORK_SYMBOLICNAME + "/eclipseadaptor"; //$NON-NLS-1$
private static final String OPTION_MONITOR_CLASSES = RUNTIME_ADAPTOR + "/monitor/classes"; //$NON-NLS-1$
private static final String OPTION_MONITOR_RESOURCEBUNDLES = RUNTIME_ADAPTOR + "/monitor/resourcebundles"; //$NON-NLS-1$
private static final String OPTION_TRACE_BUNDLES = RUNTIME_ADAPTOR + "/trace/bundleActivation"; //$NON-NLS-1$
@@ -54,21 +54,20 @@
private static final String OPTION_STATE_READER = RUNTIME_ADAPTOR + "/state/reader";//$NON-NLS-1$
private static final String OPTION_RESOLVER = RUNTIME_ADAPTOR + "/resolver/timing"; //$NON-NLS-1$
private static final String OPTION_PLATFORM_ADMIN = RUNTIME_ADAPTOR + "/debug/platformadmin"; //$NON-NLS-1$
- private static final String OPTION_PLATFORM_ADMIN_RESOLVER= RUNTIME_ADAPTOR + "/debug/platformadmin/resolver"; //$NON-NLS-1$
- private static final String OPTION_MONITOR_PLATFORM_ADMIN = RUNTIME_ADAPTOR + "/resolver/timing"; //$NON-NLS-1$
+ private static final String OPTION_PLATFORM_ADMIN_RESOLVER = RUNTIME_ADAPTOR + "/debug/platformadmin/resolver"; //$NON-NLS-1$
+ private static final String OPTION_MONITOR_PLATFORM_ADMIN = RUNTIME_ADAPTOR + "/resolver/timing"; //$NON-NLS-1$
private static final String OPTION_RESOLVER_READER = RUNTIME_ADAPTOR + "/resolver/reader/timing"; //$NON-NLS-1$
public static final byte BUNDLEDATA_VERSION = 7;
public static final byte NULL = 0;
public static final byte OBJECT = 1;
//Indicate if the framework is stopping
public static boolean stopping = false;
-
+
private static EclipseAdaptor instance;
- private int startLevel = 1; //TODO Can't we use AbstractFrameworkAdaptor.initialStartLevel?
+ private int startLevel = 1; //TODO Can't we use AbstractFrameworkAdaptor.initialStartLevel?
private long timeStamp = 0;
private String installURL = null;
-
/*
* Should be instantiated only by the framework (through reflection).
@@ -78,7 +77,7 @@
instance = this;
setDebugOptions();
}
-
+
public static EclipseAdaptor getDefault() {
return instance;
}
@@ -113,16 +112,16 @@
StateImpl systemState = stateManager.getSystemState();
if (systemState != null)
return stateManager;
- systemState = stateManager.createSystemState();
+ systemState = stateManager.createSystemState();
Vector installedBundles = getInstalledBundles();
if (installedBundles == null)
return stateManager;
StateObjectFactory factory = stateManager.getFactory();
- for (Iterator iter = installedBundles.iterator(); iter.hasNext(); ) {
+ for (Iterator iter = installedBundles.iterator(); iter.hasNext();) {
BundleData toAdd = (BundleData) iter.next();
try {
Dictionary manifest = toAdd.getManifest();
- BundleDescription newDescription = factory.createBundleDescription(manifest, toAdd.getLocation(),toAdd.getBundleID());
+ BundleDescription newDescription = factory.createBundleDescription(manifest, toAdd.getLocation(), toAdd.getBundleID());
systemState.addBundle(newDescription);
} catch (BundleException be) {
// just ignore bundle datas with invalid manifests
@@ -132,11 +131,11 @@
systemState.setTimeStamp(timeStamp);
systemState.resolve();
return stateManager;
- }
+ }
private void checkLocationAndReinitialize() {
if (installURL == null) {
- installURL = EclipseStarter.getSysPath(); //TODO This reference to the starter should be avoided
+ installURL = EclipseStarter.getSysPath(); //TODO This reference to the starter should be avoided
return;
}
if (!EclipseStarter.getSysPath().equals(installURL)) {
@@ -156,7 +155,7 @@
File metadata = LocationManager.getConfigurationFile(LocationManager.BUNDLE_DATA_FILE);
if (!metadata.isFile())
return;
-
+
try {
DataInputStream in = new DataInputStream(new BufferedInputStream(new FileInputStream(metadata)));
try {
@@ -171,7 +170,7 @@
}
} catch (IOException e) {
if (Debug.DEBUG && Debug.DEBUG_GENERAL) {
- Debug.println("Error reading framework metadata: " + e.getMessage()); //$NON-NLS-1$
+ Debug.println("Error reading framework metadata: " + e.getMessage()); //$NON-NLS-1$
Debug.printStackTrace(e);
}
}
@@ -216,10 +215,10 @@
register(org.eclipse.osgi.service.environment.EnvironmentInfo.class.getName(), EnvironmentInfo.getDefault(), bundle);
register(PlatformAdmin.class.getName(), stateManager, bundle);
register(PluginConverter.class.getName(), new PluginConverterImpl(context), bundle);
- register(URLConverter.class.getName(), new URLConverterImpl(),bundle);
- register(CommandProvider.class.getName(), new EclipseCommandProvider(context),bundle);
+ register(URLConverter.class.getName(), new URLConverterImpl(), bundle);
+ register(CommandProvider.class.getName(), new EclipseCommandProvider(context), bundle);
register(FrameworkLog.class.getName(), getFrameworkLog(), bundle);
- register(org.eclipse.osgi.service.localization.BundleLocalization.class.getName(),new BundleLocalizationImpl(),bundle);
+ register(org.eclipse.osgi.service.localization.BundleLocalization.class.getName(), new BundleLocalizationImpl(), bundle);
registerEndorsedXMLParser();
}
@@ -236,7 +235,7 @@
TRACE_FILTERS = options.getOption(OPTION_TRACE_FILTERS);
StateManager.DEBUG = options != null;
StateManager.DEBUG_READER = options.getBooleanOption(OPTION_RESOLVER_READER, false);
- StateManager.MONITOR_PLATFORM_ADMIN = options.getBooleanOption(OPTION_MONITOR_PLATFORM_ADMIN, false);
+ StateManager.MONITOR_PLATFORM_ADMIN = options.getBooleanOption(OPTION_MONITOR_PLATFORM_ADMIN, false);
StateManager.DEBUG_PLATFORM_ADMIN = options.getBooleanOption(OPTION_PLATFORM_ADMIN, false);
StateManager.DEBUG_PLATFORM_ADMIN_RESOLVER = options.getBooleanOption(OPTION_PLATFORM_ADMIN_RESOLVER, false);
}
@@ -246,6 +245,7 @@
return;
new ParsingService();
}
+
private static boolean is14VMorGreater() {
final String DELIM = ".";
String vmVersionString = System.getProperty("java.version"); //$NON-NLS-1$
@@ -266,8 +266,9 @@
}
return false;
}
+
private class ParsingService implements ServiceFactory {
- public static final String SAXFACTORYNAME = "javax.xml.parsers.SAXParserFactory"; //$NON-NLS-1$
+ public static final String SAXFACTORYNAME = "javax.xml.parsers.SAXParserFactory"; //$NON-NLS-1$
public Object getService(Bundle bundle, ServiceRegistration registration) {
return SAXParserFactory.newInstance();
@@ -281,13 +282,14 @@
context.registerService(SAXFACTORYNAME, this, new Hashtable());
}
}
+
public void frameworkStop(BundleContext context) throws BundleException {
saveMetaData();
super.frameworkStop(context);
if (DebugOptions.getDefault() != null) {
- System.out.println("Time spent in registry parsing: " + DebugOptions.getDefault().getOption("org.eclipse.core.runtime/registry/parsing/timing/value")); //$NON-NLS-1$ $NON-NLS-2$
- System.out.println("Time spent in package admin resolve: " + DebugOptions.getDefault().getOption("debug.packageadmin/timing/value")); //$NON-NLS-1$ $NON-NLS-2$
- System.out.println("Time spent resolving the dependency system: " + DebugOptions.getDefault().getOption("org.eclipse.core.runtime.adaptor/resolver/timing/value")); //$NON-NLS-1$ $NON-NLS-2$
+ System.out.println("Time spent in registry parsing: " + DebugOptions.getDefault().getOption("org.eclipse.core.runtime/registry/parsing/timing/value")); //$NON-NLS-1$ $NON-NLS-2$
+ System.out.println("Time spent in package admin resolve: " + DebugOptions.getDefault().getOption("debug.packageadmin/timing/value")); //$NON-NLS-1$ $NON-NLS-2$
+ System.out.println("Time spent resolving the dependency system: " + DebugOptions.getDefault().getOption("org.eclipse.core.runtime.adaptor/resolver/timing/value")); //$NON-NLS-1$ $NON-NLS-2$
}
}
@@ -308,7 +310,7 @@
in.readUTF();
in.readInt();
in.readLong();
-
+
int bundleCount = in.readInt();
Vector result = new Vector(bundleCount);
long id = -1;
@@ -319,11 +321,11 @@
try {
id = in.readLong();
if (id != 0) {
- EclipseBundleData data = (EclipseBundleData) getElementFactory().createBundleData(this,id);
+ EclipseBundleData data = (EclipseBundleData) getElementFactory().createBundleData(this, id);
loadMetaDataFor(data, in);
data.initializeExistingBundle();
if (Debug.DEBUG && Debug.DEBUG_GENERAL)
- Debug.println("BundleData created: " + data); //$NON-NLS-1$
+ Debug.println("BundleData created: " + data); //$NON-NLS-1$
result.addElement(data);
}
} catch (NumberFormatException e) {
@@ -332,20 +334,20 @@
} catch (IOException e) {
state.removeBundle(id);
if (Debug.DEBUG && Debug.DEBUG_GENERAL) {
- Debug.println("Error reading framework metadata: " + e.getMessage()); //$NON-NLS-1$
+ Debug.println("Error reading framework metadata: " + e.getMessage()); //$NON-NLS-1$
Debug.printStackTrace(e);
}
}
}
if (stateTimeStamp != state.getTimeStamp())
- state.resolve(false); //time stamp changed force a full resolve
+ state.resolve(false); //time stamp changed force a full resolve
return result;
} finally {
in.close();
}
} catch (IOException e) {
if (Debug.DEBUG && Debug.DEBUG_GENERAL) {
- Debug.println("Error reading framework metadata: " + e.getMessage()); //$NON-NLS-1$
+ Debug.println("Error reading framework metadata: " + e.getMessage()); //$NON-NLS-1$
Debug.printStackTrace(e);
}
}
@@ -362,7 +364,7 @@
data.setVersion(new Version(readString(in, false)));
data.setActivator(readString(in, false));
data.setAutoStart(readString(in, false));
- data.setAutoStop(readString(in, false));
+ data.setAutoStop(readString(in, false));
data.setPluginClass(readString(in, false));
data.setLegacy(readString(in, false));
data.setClassPath(readString(in, false));
@@ -378,12 +380,12 @@
data.setManifestType(in.readByte());
}
- public void saveMetaDataFor(DefaultBundleData data) throws IOException {
+ public void saveMetaDataFor(DefaultBundleData data) throws IOException {
// TODO may want to force a write of .bundledata in some cases here.
// This is related to bug 55819. Could set a dirty flag here
// and always save the bundledatas when it is set in saveMetaData().
}
-
+
protected void saveMetaDataFor(BundleData data, DataOutputStream out) throws IOException {
if (data.getBundleID() == 0 || !(data instanceof DefaultBundleData)) {
out.writeByte(NULL);
@@ -397,7 +399,7 @@
writeStringOrNull(out, bundleData.getVersion().toString());
writeStringOrNull(out, bundleData.getActivator());
writeStringOrNull(out, bundleData.getAutoStart());
- writeStringOrNull(out, bundleData.getAutoStop());
+ writeStringOrNull(out, bundleData.getAutoStop());
writeStringOrNull(out, bundleData.getPluginClass());
writeStringOrNull(out, bundleData.isLegacy());
writeStringOrNull(out, bundleData.getClassPath());
@@ -422,6 +424,7 @@
else
return in.readUTF();
}
+
private void writeStringOrNull(DataOutputStream out, String string) throws IOException {
if (string == null)
out.writeByte(NULL);
@@ -442,7 +445,7 @@
out.write(BUNDLEDATA_VERSION);
out.writeLong(stateManager.getSystemState().getTimeStamp());
out.writeUTF(installURL);
- out.writeInt(startLevel);
+ out.writeInt(startLevel);
out.writeLong(nextId);
Bundle[] bundles = context.getBundles();
out.writeInt(bundles.length);
@@ -459,7 +462,7 @@
}
} catch (IOException e) {
if (Debug.DEBUG && Debug.DEBUG_GENERAL) {
- Debug.println("Error writing framework metadata: " + e.getMessage()); //$NON-NLS-1$
+ Debug.println("Error writing framework metadata: " + e.getMessage()); //$NON-NLS-1$
Debug.printStackTrace(e);
}
}
@@ -469,16 +472,17 @@
return StatsManager.getDefault();
}
- protected BundleContext getContext(){
+ protected BundleContext getContext() {
return context;
}
-
+
public void frameworkStopping() {
super.frameworkStopping();
stopping = true;
new BundleStopper().stopBundles();
- }
+ }
+
protected void setLog(FrameworkLog log) {
frameworkLog = log;
- }
+ }
}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseAdaptorConstants.java b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseAdaptorConstants.java
index 089993a..e4a9c81 100644
--- a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseAdaptorConstants.java
+++ b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseAdaptorConstants.java
@@ -14,14 +14,14 @@
* Declares constants for manifest headers introduced by the Eclipse adaptor.
*/
interface EclipseAdaptorConstants {
- public static final String PI_ECLIPSE_OSGI = "org.eclipse.osgi"; //$NON-NLS-1$
+ public static final String PI_ECLIPSE_OSGI = "org.eclipse.osgi"; //$NON-NLS-1$
/**
* The "Eclipse-AutoStart" header.
*/
String ECLIPSE_AUTOSTART = "Eclipse-AutoStart"; //$NON-NLS-1$
/**
* The "Eclipse-AutoStop" header.
- */
+ */
String ECLIPSE_AUTOSTOP = "Eclipse-AutoStop"; //$NON-NLS-1$
//TODO decide what to do with this header
String LEGACY = "Legacy"; //$NON-NLS-1$
@@ -29,6 +29,6 @@
String PLUGIN_CLASS = "Plugin-Class"; //$NON-NLS-1$
/**
* The "exceptions" attribute for ECLIPSE_AUTOSTART header.
- */
- String EXCEPTIONS_ATTRIBUTE = "exceptions"; //$NON-NLS-1$
-}
+ */
+ String EXCEPTIONS_ATTRIBUTE = "exceptions"; //$NON-NLS-1$
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseAdaptorMsg.java b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseAdaptorMsg.java
index 27fd893..57ddc5b 100644
--- a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseAdaptorMsg.java
+++ b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseAdaptorMsg.java
@@ -31,25 +31,27 @@
public static MessageFormat formatter;
// Attempt to load the message bundle.
static {
- formatter = new MessageFormat("org.eclipse.core.runtime.adaptor.EclipseAdaptorMessages"); //TODO This could be an adaptor constant.
+ formatter = new MessageFormat("org.eclipse.core.runtime.adaptor.EclipseAdaptorMessages"); //TODO This could be an adaptor constant.
}
+
public static String getResolutionFailureMessage(VersionConstraint unsatisfied) {
if (unsatisfied.isResolved())
throw new IllegalArgumentException();
if (unsatisfied instanceof PackageSpecification)
- return EclipseAdaptorMsg.formatter.getString("ECLIPSE_MISSING_IMPORTED_PACKAGE", toString(unsatisfied)); //$NON-NLS-1$
+ return EclipseAdaptorMsg.formatter.getString("ECLIPSE_MISSING_IMPORTED_PACKAGE", toString(unsatisfied)); //$NON-NLS-1$
else if (unsatisfied instanceof BundleSpecification)
if (((BundleSpecification) unsatisfied).isOptional())
- return EclipseAdaptorMsg.formatter.getString("ECLIPSE_MISSING_OPTIONAL_REQUIRED_BUNDLE", toString(unsatisfied)); //$NON-NLS-1$
+ return EclipseAdaptorMsg.formatter.getString("ECLIPSE_MISSING_OPTIONAL_REQUIRED_BUNDLE", toString(unsatisfied)); //$NON-NLS-1$
else
return EclipseAdaptorMsg.formatter.getString("ECLIPSE_MISSING_REQUIRED_BUNDLE", toString(unsatisfied));//$NON-NLS-1$
else
return EclipseAdaptorMsg.formatter.getString("ECLIPSE_MISSING_HOST", toString(unsatisfied)); //$NON-NLS-1$
}
+
private static String toString(VersionConstraint constraint) {
org.eclipse.osgi.service.resolver.Version versionSpec = constraint.getVersionSpecification();
if (versionSpec == null)
return constraint.getName();
return constraint.getName() + '_' + versionSpec;
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseBundleData.java b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseBundleData.java
index e07c1b9..355a907 100644
--- a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseBundleData.java
+++ b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseBundleData.java
@@ -22,22 +22,21 @@
import org.eclipse.osgi.util.ManifestElement;
import org.osgi.framework.BundleException;
-
//TODO This class does not override save().
//Maybe for consistency should it be overriden to do nothing. See also EclipseAdaptor.saveMetadataFor(BundleData)
public class EclipseBundleData extends DefaultBundleData {
- static final byte MANIFEST_TYPE_UNKNOWN = 0x00;
- static final byte MANIFEST_TYPE_BUNDLE = 0x01;
- static final byte MANIFEST_TYPE_PLUGIN = 0x02;
+ static final byte MANIFEST_TYPE_UNKNOWN = 0x00;
+ static final byte MANIFEST_TYPE_BUNDLE = 0x01;
+ static final byte MANIFEST_TYPE_PLUGIN = 0x02;
static final byte MANIFEST_TYPE_FRAGMENT = 0x04;
- static final byte MANIFEST_TYPE_JAR = 0x08;
-
+ static final byte MANIFEST_TYPE_JAR = 0x08;
+
private static String[] libraryVariants = null;
/** data to detect modification made in the manifest */
private long manifestTimeStamp = 0;
private byte manifestType = MANIFEST_TYPE_UNKNOWN;
-
+
// URL protocol designations
public static final String PROTOCOL = "platform"; //$NON-NLS-1$
public static final String FILE = "file"; //$NON-NLS-1$
@@ -73,11 +72,11 @@
File delete = new File(getBundleStoreDir(), ".delete");
/* and the directory is not marked for delete */
- if (delete.exists())
+ if (delete.exists())
throw new IOException();
createBaseBundleFile();
- if (! checkManifestTimeStamp())
+ if (!checkManifestTimeStamp())
throw new IOException();
}
@@ -85,7 +84,7 @@
if (!"true".equalsIgnoreCase(System.getProperty(PROP_CHECK_CONFIG))) //$NON-NLS-1$
return true;
- return PluginConverterImpl.getTimeStamp(getBaseFile(),getManifestType()) == getManifestTimeStamp();
+ return PluginConverterImpl.getTimeStamp(getBaseFile(), getManifestType()) == getManifestTimeStamp();
}
/**
@@ -140,7 +139,7 @@
//TODO Unused method
private URL[] getSearchURLs(URL target) {
- return new URL[] { target };
+ return new URL[] {target};
}
public synchronized Dictionary getManifest() {
@@ -151,6 +150,7 @@
return null;
}
}
+
public synchronized Dictionary getManifest(boolean first) throws BundleException {
if (manifest == null)
manifest = first ? loadManifest() : new CachedManifest(this);
@@ -158,25 +158,25 @@
Dictionary generatedManifest = generateManifest(manifest);
if (generatedManifest != null)
manifest = generatedManifest;
- }
- return manifest;
+ }
+ return manifest;
}
- public synchronized Dictionary loadManifest() throws BundleException {
+ public synchronized Dictionary loadManifest() throws BundleException {
URL url = getEntry(Constants.OSGI_BUNDLE_MANIFEST);
if (url != null) {
manifestTimeStamp = getBaseBundleFile().getEntry(Constants.OSGI_BUNDLE_MANIFEST).getTime();
manifestType = MANIFEST_TYPE_BUNDLE;
return loadManifestFrom(url);
}
- Dictionary result = generateManifest(null);
- if (result == null) //TODO: need to NLS this
+ Dictionary result = generateManifest(null);
+ if (result == null) //TODO: need to NLS this
throw new BundleException("Manifest not found: " + getLocation());
return result;
}
private Dictionary generateManifest(Dictionary originalManifest) throws BundleException {
- String cacheLocation = (String) System.getProperties().get("osgi.manifest.cache"); //TODO This should be a constant
+ String cacheLocation = (String) System.getProperties().get("osgi.manifest.cache"); //TODO This should be a constant
if (getSymbolicName() != null) {
Version version = getVersion();
File currentFile = new File(cacheLocation, getSymbolicName() + '_' + version.toString() + ".MF");
@@ -191,24 +191,24 @@
PluginConverterImpl converter = PluginConverterImpl.getDefault();
Dictionary generatedManifest = converter.convertManifest(getBaseFile(), true, null);
- if (generatedManifest == null) //TODO Why don't we return the original manifest?
+ if (generatedManifest == null) //TODO Why don't we return the original manifest?
return null;
- ManifestElement generatedFrom = ManifestElement.parseHeader(PluginConverterImpl.GENERATED_FROM,(String)generatedManifest.get(PluginConverterImpl.GENERATED_FROM))[0];
+ ManifestElement generatedFrom = ManifestElement.parseHeader(PluginConverterImpl.GENERATED_FROM, (String) generatedManifest.get(PluginConverterImpl.GENERATED_FROM))[0];
setManifestTimeStamp(Long.parseLong(generatedFrom.getValue()));
setManifestType(Byte.parseByte(generatedFrom.getAttribute(PluginConverterImpl.MANIFEST_TYPE_ATTRIBUTE)));
//merge the original manifest with the generated one
if (originalManifest != null) {
- Enumeration enum = originalManifest.keys();
+ Enumeration enum = originalManifest.keys();
while (enum.hasMoreElements()) {
- Object key = enum.nextElement();
- generatedManifest.put(key, originalManifest.get(key));
+ Object key = enum.nextElement();
+ generatedManifest.put(key, originalManifest.get(key));
}
}
-
+
//write the generated manifest
- Version version = new Version((String)generatedManifest.get(Constants.BUNDLE_VERSION));
+ Version version = new Version((String) generatedManifest.get(Constants.BUNDLE_VERSION));
File bundleManifestLocation = new File(cacheLocation, ManifestElement.parseHeader(org.osgi.framework.Constants.BUNDLE_SYMBOLICNAME, (String) generatedManifest.get(org.osgi.framework.Constants.BUNDLE_SYMBOLICNAME))[0].getValue() + '_' + version.toString() + ".MF");
try {
converter.writeManifest(bundleManifestLocation, generatedManifest, true);
@@ -218,15 +218,16 @@
return generatedManifest;
}
+
private Dictionary loadManifestFrom(URL manifestURL) throws BundleException {
try {
return Headers.parseManifest(manifestURL.openStream());
} catch (IOException e) {
throw new BundleException("Error reading manifest: " + getLocation(), e);
- }
+ }
}
- protected void loadFromManifest() throws IOException{
+ protected void loadFromManifest() throws IOException {
try {
getManifest(true);
} catch (BundleException e) {
@@ -235,13 +236,15 @@
}
super.loadFromManifest();
autoStart = (String) manifest.get(EclipseAdaptorConstants.ECLIPSE_AUTOSTART);
- autoStop = (String) manifest.get(EclipseAdaptorConstants.ECLIPSE_AUTOSTOP);
- pluginClass = (String)manifest.get(EclipseAdaptorConstants.PLUGIN_CLASS);
- isLegacy = (String)manifest.get(EclipseAdaptorConstants.LEGACY);
+ autoStop = (String) manifest.get(EclipseAdaptorConstants.ECLIPSE_AUTOSTOP);
+ pluginClass = (String) manifest.get(EclipseAdaptorConstants.PLUGIN_CLASS);
+ isLegacy = (String) manifest.get(EclipseAdaptorConstants.LEGACY);
}
+
public String isLegacy() {
return isLegacy;
}
+
public void setLegacy(String value) {
isLegacy = value;
}
@@ -249,31 +252,40 @@
public String getPluginClass() {
return pluginClass;
}
+
public void setPluginClass(String value) {
pluginClass = value;
}
+
public long getManifestTimeStamp() {
return manifestTimeStamp;
}
+
public void setManifestTimeStamp(long stamp) {
manifestTimeStamp = stamp;
}
+
public byte getManifestType() {
return manifestType;
}
+
public void setManifestType(byte manifestType) {
this.manifestType = manifestType;
}
+
public void setAutoStart(String value) {
autoStart = value;
}
+
public void setAutoStop(String value) {
autoStop = value;
- }
+ }
+
public String getAutoStart() {
return autoStart;
}
+
public String getAutoStop() {
return autoStop;
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseBundleInstaller.java b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseBundleInstaller.java
index 52328c4..d0a0919 100644
--- a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseBundleInstaller.java
+++ b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseBundleInstaller.java
@@ -20,11 +20,13 @@
public void installBundle(BundleDescription toInstall) throws BundleException {
EclipseAdaptor.getDefault().getContext().installBundle(toInstall.getLocation());
}
+
public void uninstallBundle(BundleDescription toUninstallId) throws BundleException {
Bundle toUninstall = EclipseAdaptor.getDefault().getContext().getBundle(toUninstallId.getBundleId());
if (toUninstall != null)
toUninstall.uninstall();
}
+
public void updateBundle(BundleDescription toUpdateId) throws BundleException {
Bundle toUpdate = EclipseAdaptor.getDefault().getContext().getBundle(toUpdateId.getBundleId());
if (toUpdate != null)
diff --git a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseClassLoader.java b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseClassLoader.java
index 3fb56b1..1902bda 100644
--- a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseClassLoader.java
+++ b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseClassLoader.java
@@ -36,11 +36,12 @@
private boolean autoStart;
// from Eclipse-AutoStart's "exceptions" attribute
private String[] exceptions;
-
+
public EclipseClassLoader(ClassLoaderDelegate delegate, ProtectionDomain domain, String[] classpath, ClassLoader parent, BundleData bundleData) {
super(delegate, domain, classpath, parent, (org.eclipse.osgi.framework.internal.defaultadaptor.DefaultBundleData) bundleData);
parseAutoStart(bundleData);
}
+
private void parseAutoStart(BundleData bundleData) {
try {
String automationHeader = (String) bundleData.getManifest().get(EclipseAdaptorConstants.ECLIPSE_AUTOSTART);
@@ -68,38 +69,38 @@
EclipseAdaptor.getDefault().getFrameworkLog().log(new FrameworkLogEntry(EclipseAdaptorConstants.PI_ECLIPSE_OSGI, message, 0, e, null));
}
}
-
+
public Class findLocalClass(String name) throws ClassNotFoundException {
- if (EclipseAdaptor.MONITOR_CLASSES) //Suport for performance analysis
+ if (EclipseAdaptor.MONITOR_CLASSES) //Suport for performance analysis
ClassloaderStats.startLoadingClass(getClassloaderId(), name);
boolean found = true;
-
+
try {
AbstractBundle bundle = (AbstractBundle) hostdata.getBundle();
// If the bundle is active, just return the class
if (bundle.getState() == AbstractBundle.ACTIVE)
return super.findLocalClass(name);
-
+
//If the bundle is uninstalled, classes can still be loaded from it
if (bundle.getState() == AbstractBundle.UNINSTALLED)
- return super.findLocalClass(name);
-
+ return super.findLocalClass(name);
+
//If the bundle is stopping, we don't want to reactive it but we still want to be able to load classes from it.
if (bundle.getState() == AbstractBundle.STOPPING)
return super.findLocalClass(name);
-
+
// The bundle is not active and does not require activation, just return the class
- if (! shouldActivateFor(name))
+ if (!shouldActivateFor(name))
return super.findLocalClass(name);
-
+
// The bundle is starting
if (bundle.getState() == AbstractBundle.STARTING) {
//If the thread trying to load the class is the one trying to activate the bundle, then return the class
if (bundle.testStateChanging(Thread.currentThread()) || bundle.testStateChanging(null))
return super.findLocalClass(name);
-
+
//If it's another thread, we wait and try again. In any case the class is returned. The difference is that an exception can be logged.
- if (! bundle.testStateChanging(Thread.currentThread())) {
+ if (!bundle.testStateChanging(Thread.currentThread())) {
Object lock = bundle.getStateChangeLock();
long start = System.currentTimeMillis();
long delay = 5000;
@@ -107,31 +108,31 @@
while (true) {
if (bundle.testStateChanging(null))
break;
-
+
if (timeLeft <= 0)
break;
try {
- synchronized(lock) {
+ synchronized (lock) {
lock.wait(timeLeft);
}
- } catch(InterruptedException e) {
+ } catch (InterruptedException e) {
//Ignore and keep waiting
}
timeLeft = start + delay - System.currentTimeMillis();
}
if (timeLeft <= 0 || bundle.getState() != AbstractBundle.ACTIVE) {
- String message = EclipseAdaptorMsg.formatter.getString("ECLIPSE_CLASSLOADER_CONCURRENT_STARTUP", new Object[] {Thread.currentThread(), name, bundle.getStateChanging().getName(), bundle.getSymbolicName()==null ? Long.toString(bundle.getBundleId()) : bundle.getSymbolicName()}); //$NON-NLS-1$
+ String message = EclipseAdaptorMsg.formatter.getString("ECLIPSE_CLASSLOADER_CONCURRENT_STARTUP", new Object[] {Thread.currentThread(), name, bundle.getStateChanging().getName(), bundle.getSymbolicName() == null ? Long.toString(bundle.getBundleId()) : bundle.getSymbolicName()}); //$NON-NLS-1$
EclipseAdaptor.getDefault().getFrameworkLog().log(new FrameworkLogEntry(EclipseAdaptorConstants.PI_ECLIPSE_OSGI, message, 0, null, null));
}
- return super.findLocalClass(name);
+ return super.findLocalClass(name);
}
}
-
+
//The bundle must be started.
try {
hostdata.getBundle().start();
} catch (BundleException e) {
- String message = EclipseAdaptorMsg.formatter.getString("ECLIPSE_CLASSLOADER_ACTIVATION", bundle.getSymbolicName(), Long.toString(bundle.getBundleId())); //$NON-NLS-1$
+ String message = EclipseAdaptorMsg.formatter.getString("ECLIPSE_CLASSLOADER_ACTIVATION", bundle.getSymbolicName(), Long.toString(bundle.getBundleId())); //$NON-NLS-1$
EclipseAdaptor.getDefault().getFrameworkLog().log(new FrameworkLogEntry(EclipseAdaptorConstants.PI_ECLIPSE_OSGI, message, 0, e, null));
} finally {
return super.findLocalClass(name);
@@ -144,12 +145,13 @@
ClassloaderStats.endLoadingClass(getClassloaderId(), name, found);
}
}
+
/**
* Determines if for loading the given class we should activate the bundle.
*/
private boolean shouldActivateFor(String className) {
//Don't reactivate on shut down
- if (EclipseAdaptor.stopping)
+ if (EclipseAdaptor.stopping)
return false;
// no exceptions, it is easy to figure it out
if (exceptions == null)
@@ -163,13 +165,15 @@
// should activate if autoStart and package not in exceptions, or if !autoStart and package in exceptions
return autoStart ^ exceptionsContained(packageName);
}
+
private boolean exceptionsContained(String packageName) {
for (int i = 0; i < exceptions.length; i++) {
- if(exceptions[i].equals(packageName))
+ if (exceptions[i].equals(packageName))
return true;
}
return false;
}
+
/**
* Override defineClass to allow for package defining.
*/
@@ -218,9 +222,11 @@
}
return super.defineClass(name, classbytes, off, len, classpathEntry);
}
+
private String getClassloaderId() {
return hostdata.getBundle().getSymbolicName();
}
+
public URL getResouce(String name) {
URL result = super.getResource(name);
if (EclipseAdaptor.MONITOR_RESOURCE_BUNDLES) {
@@ -230,6 +236,7 @@
}
return result;
}
+
protected void findClassPathEntry(ArrayList result, String entry, AbstractBundleData bundledata, ProtectionDomain domain) {
String var = hasPrefix(entry);
if (var == null) {
@@ -257,6 +264,7 @@
}
}
}
+
private static String[] buildNLJarVariants(String nl) {
ArrayList result = new ArrayList();
nl = nl.replace('_', '/');
@@ -268,6 +276,7 @@
result.add(""); //$NON-NLS-1$
return (String[]) result.toArray(new String[result.size()]);
}
+
//return a String representing the string found between the $s
private String hasPrefix(String libPath) {
if (libPath.startsWith("$ws$")) //$NON-NLS-1$
@@ -278,6 +287,7 @@
return "nl"; //$NON-NLS-1$
return null;
}
+
/**
* Override to create EclipseClasspathEntry objects. EclipseClasspathEntry
* allows access to the manifest file for the classpath entry.
@@ -285,15 +295,18 @@
protected ClasspathEntry createClassPathEntry(BundleFile bundlefile, ProtectionDomain domain) {
return new EclipseClasspathEntry(bundlefile, domain);
}
+
/**
* A ClasspathEntry that has a manifest associated with it.
*/
protected class EclipseClasspathEntry extends ClasspathEntry {
Manifest mf;
boolean initMF = false;
+
protected EclipseClasspathEntry(BundleFile bundlefile, ProtectionDomain domain) {
super(bundlefile, domain);
}
+
public Manifest getManifest() {
if (initMF)
return mf;
diff --git a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseCommandProvider.java b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseCommandProvider.java
index f503b6c..3aff78f 100644
--- a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseCommandProvider.java
+++ b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseCommandProvider.java
@@ -18,9 +18,11 @@
public class EclipseCommandProvider implements CommandProvider {
private BundleContext context;
+
public EclipseCommandProvider(BundleContext context) {
this.context = context;
}
+
public String getHelp() {
StringBuffer help = new StringBuffer(512);
help.append(EclipseAdaptorMsg.NEW_LINE);
@@ -31,6 +33,7 @@
help.append("\tdiag - " + EclipseAdaptorMsg.formatter.getString("ECLIPSE_CONSOLE_HELP_DIAG_COMMAND_DESCRIPTION"));//$NON-NLS-1$
return help.toString();
}
+
private BundleDescription getBundleDescriptionFromToken(State state, String token) {
try {
long id = Long.parseLong(token);
@@ -42,6 +45,7 @@
}
return null;
}
+
public void _diag(CommandInterpreter ci) throws Exception {
String nextArg = ci.nextArgument();
if (nextArg == null) {
@@ -82,4 +86,4 @@
context.ungetService(platformAdminRef);
}
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseElementFactory.java b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseElementFactory.java
index 4e977b6..71b7a07 100644
--- a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseElementFactory.java
+++ b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseElementFactory.java
@@ -22,12 +22,12 @@
public class EclipseElementFactory implements AdaptorElementFactory {
public AbstractBundleData createBundleData(AbstractFrameworkAdaptor adaptor, long id) throws IOException {
- return new EclipseBundleData((DefaultAdaptor)adaptor, id);
+ return new EclipseBundleData((DefaultAdaptor) adaptor, id);
}
//TODO Crazy optimization we could create a DefaultClassLoader when the bundle is a real bundle.
public org.eclipse.osgi.framework.adaptor.BundleClassLoader createClassLoader(ClassLoaderDelegate delegate, ProtectionDomain domain, String[] bundleclasspath, AbstractBundleData data) {
- return new EclipseClassLoader(delegate, domain, bundleclasspath,data.getAdaptor().getBundleClassLoaderParent(), data);
+ return new EclipseClassLoader(delegate, domain, bundleclasspath, data.getAdaptor().getBundleClassLoaderParent(), data);
}
-
-}
+
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseLog.java b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseLog.java
index 3d95cb3..eb8cadb 100644
--- a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseLog.java
+++ b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseLog.java
@@ -18,15 +18,19 @@
public class EclipseLog extends DefaultLog {
private static final String PASSWORD = "-password"; //$NON-NLS-1$
+
public EclipseLog(File logFile) {
super(logFile);
}
+
public EclipseLog(Writer logWriter) {
super(logWriter);
}
+
public EclipseLog() {
// default constructor
}
+
protected String getDate() {
try {
DateFormat formatter = new SimpleDateFormat("MMM dd, yyyy HH:mm:ss.SS"); //$NON-NLS-1$
@@ -38,6 +42,7 @@
}
return Long.toString(System.currentTimeMillis());
}
+
protected void writeSession() throws IOException {
write(SESSION);
writeSpace();
@@ -88,8 +93,7 @@
}
}
- public synchronized void setFile(File newFile, boolean append)
- throws IOException {
+ public synchronized void setFile(File newFile, boolean append) throws IOException {
super.setFile(newFile, append);
System.setProperty(EclipseStarter.PROP_LOGFILE, newFile.getAbsolutePath());
}
diff --git a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseStarter.java b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseStarter.java
index b620191..b56376b 100644
--- a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseStarter.java
+++ b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseStarter.java
@@ -63,21 +63,21 @@
// this is more of an Eclipse argument but this OSGi implementation stores its
// metadata alongside Eclipse's.
private static final String DATA = "-data"; //$NON-NLS-1$
-
+
// System properties
public static final String PROP_DEBUG = "osgi.debug"; //$NON-NLS-1$
public static final String PROP_DEV = "osgi.dev"; //$NON-NLS-1$
public static final String PROP_CONSOLE = "osgi.console"; //$NON-NLS-1$
- public static final String PROP_CONSOLE_CLASS= "osgi.consoleClass"; //$NON-NLS-1$
+ public static final String PROP_CONSOLE_CLASS = "osgi.consoleClass"; //$NON-NLS-1$
public static final String PROP_CHECK_CONFIG = "osgi.checkConfiguration"; //$NON-NLS-1$
public static final String PROP_OS = "osgi.os"; //$NON-NLS-1$
public static final String PROP_WS = "osgi.ws"; //$NON-NLS-1$
public static final String PROP_NL = "osgi.nl"; //$NON-NLS-1$
public static final String PROP_ARCH = "osgi.arch"; //$NON-NLS-1$
public static final String PROP_ADAPTOR = "osgi.adaptor"; //$NON-NLS-1$
- public static final String PROP_SYSPATH= "osgi.syspath"; //$NON-NLS-1$
+ public static final String PROP_SYSPATH = "osgi.syspath"; //$NON-NLS-1$
public static final String PROP_LOGFILE = "osgi.logfile"; //$NON-NLS-1$
-
+
public static final String PROP_EXITCODE = "eclipse.exitcode"; //$NON-NLS-1$
public static final String PROP_EXITDATA = "eclipse.exitdata"; //$NON-NLS-1$
public static final String PROP_CONSOLE_LOG = "eclipse.consoleLog"; //$NON-NLS-1$
@@ -87,13 +87,13 @@
/** string containing the classname of the adaptor to be used in this framework instance */
protected static final String DEFAULT_ADAPTOR_CLASS = "org.eclipse.core.runtime.adaptor.EclipseAdaptor";
-
+
// Console information
protected static final String DEFAULT_CONSOLE_CLASS = "org.eclipse.osgi.framework.internal.core.FrameworkConsole";
private static final String CONSOLE_NAME = "OSGi Console";
private static FrameworkLog log;
-
+
/**
* Launches the platform and runs a single application. The application is either identified
* in the given arguments (e.g., -application <app id>) or in the <code>eclipse.application</code>
@@ -110,12 +110,12 @@
public static Object run(String[] args, Runnable endSplashHandler) throws Exception {
if (running)
throw new IllegalStateException("Platform already running");
- boolean startupFailed = true;
+ boolean startupFailed = true;
try {
startup(args, endSplashHandler);
startupFailed = false;
return run(null);
- } catch(Throwable e) {
+ } catch (Throwable e) {
// ensure the splash screen is down
if (endSplashHandler != null)
endSplashHandler.run();
@@ -127,23 +127,23 @@
// TODO desperate measure - ideally, we should write this to disk (a la Main.log)
e.printStackTrace();
} finally {
- try {
+ try {
shutdown();
- } catch(Throwable e) {
+ } catch (Throwable e) {
FrameworkLogEntry logEntry = new FrameworkLogEntry("org.eclipse.osgi", "Shutdown error", 1, e, null); //TODO Put the right value here
if (log != null)
log.log(logEntry);
else
// TODO desperate measure - ideally, we should write this to disk (a la Main.log)
- e.printStackTrace();
- }
+ e.printStackTrace();
+ }
}
// we only get here if an error happened
System.getProperties().setProperty(PROP_EXITCODE, "13");
System.getProperties().setProperty(PROP_EXITDATA, log.getFile().getPath());
- return null;
+ return null;
}
-
+
/**
* Returns true if the platform is already running, false otherwise.
* @return whether or not the platform is already running
@@ -151,33 +151,32 @@
public static boolean isRunning() {
return running;
}
-
+
protected static FrameworkLog createFrameworkLog() {
FrameworkLog frameworkLog;
String logFileProp = System.getProperty(EclipseStarter.PROP_LOGFILE);
if (logFileProp != null) {
frameworkLog = new EclipseLog(new File(logFileProp));
- }
- else {
+ } else {
Location location = LocationManager.getConfigurationLocation();
File configAreaDirectory = null;
if (location != null)
// TODO assumes the URL is a file: url
configAreaDirectory = new File(location.getURL().getFile());
-
+
if (configAreaDirectory != null) {
String logFileName = Long.toString(System.currentTimeMillis()) + EclipseAdaptor.F_LOG;
File logFile = new File(configAreaDirectory, logFileName);
- System.setProperty(EclipseStarter.PROP_LOGFILE,logFile.getAbsolutePath());
+ System.setProperty(EclipseStarter.PROP_LOGFILE, logFile.getAbsolutePath());
frameworkLog = new EclipseLog(logFile);
- } else
+ } else
frameworkLog = new EclipseLog();
}
- if ("true".equals(System.getProperty(EclipseStarter.PROP_CONSOLE_LOG)))
+ if ("true".equals(System.getProperty(EclipseStarter.PROP_CONSOLE_LOG)))
frameworkLog.setConsoleLog(true);
return frameworkLog;
}
-
+
/**
* Starts the platform and sets it up to run a single application. The application is either identified
* in the given arguments (e.g., -application <app id>) or in the <code>eclipse.application</code>
@@ -188,7 +187,7 @@
* @param argument the argument passed to the application
* @return the result of running the application
* @throws Exception if anything goes wrong
- */
+ */
public static void startup(String[] args, Runnable endSplashHandler) throws Exception {
if (running)
throw new IllegalStateException("Platform is already running");
@@ -234,7 +233,7 @@
if (initialize)
return new Integer(0);
initializeApplicationTracker();
- ParameterizedRunnable application = (ParameterizedRunnable)applicationTracker.getService();
+ ParameterizedRunnable application = (ParameterizedRunnable) applicationTracker.getService();
applicationTracker.close();
if (application == null)
throw new IllegalStateException(EclipseAdaptorMsg.formatter.getString("ECLIPSE_STARTUP_ERROR_NO_APPLICATION"));
@@ -269,9 +268,10 @@
if (bundles[i].getState() != Bundle.ACTIVE) {
String message = EclipseAdaptorMsg.formatter.getString("ECLIPSE_STARTUP_ERROR_BUNDLE_NOT_ACTIVE", bundles[i]);
throw new IllegalStateException(message);
- }
+ }
}
}
+
private static void logUnresolvedBundles(Bundle[] bundles) {
State state = adaptor.getState();
FrameworkLog logService = adaptor.getFrameworkLog();
@@ -288,15 +288,16 @@
FrameworkLogEntry[] logChildren = unsatisfied.length == 0 ? null : new FrameworkLogEntry[unsatisfied.length];
for (int j = 0; j < unsatisfied.length; j++)
logChildren[j] = new FrameworkLogEntry("org.eclipse.osgi", EclipseAdaptorMsg.getResolutionFailureMessage(unsatisfied[j]), 0, null, null);
-
+
logService.log(new FrameworkLogEntry("org.eclipse.osgi", generalMessage, 0, null, logChildren));
}
- }
+ }
+
private static void publishSplashScreen(Runnable endSplashHandler) {
// InternalPlatform now how to retrieve this later
Dictionary properties = new Hashtable();
- properties.put("name","splashscreen");
- context.registerService(Runnable.class.getName(),endSplashHandler,properties);
+ properties.put("name", "splashscreen");
+ context.registerService(Runnable.class.getName(), endSplashHandler, properties);
}
private static String searchForBundle(String name, String parent) throws MalformedURLException {
@@ -311,7 +312,7 @@
// Assume it should be a reference and htat it is relative. This support need not
// be robust as it is temporary..
fileLocation = new File(parent, name);
- url = new URL("reference:file:"+ parent + "/" + name);
+ url = new URL("reference:file:" + parent + "/" + name);
reference = true;
}
// if the name was a URL then see if it is relative. If so, insert syspath.
@@ -322,7 +323,7 @@
reference = true;
baseURL = new URL(url.getFile());
}
-
+
fileLocation = new File(baseURL.getFile());
// if the location is relative, prefix it with the syspath
if (!fileLocation.isAbsolute())
@@ -344,60 +345,61 @@
result.connect();
return url.toExternalForm();
} catch (IOException e) {
-// int i = location.lastIndexOf('_');
-// return i == -1? location : location.substring(0, i);
+ // int i = location.lastIndexOf('_');
+ // return i == -1? location : location.substring(0, i);
return null;
}
}
+
/*
* Ensure all basic bundles are installed, resolved and scheduled to start. Returns an array containing
* all basic bundles.
*/
private static Bundle[] loadBasicBundles() throws BundleException, MalformedURLException, IllegalArgumentException, IllegalStateException {
- long startTime = System.currentTimeMillis();
- ServiceReference reference = context.getServiceReference(StartLevel.class.getName());
- StartLevel start = null;
- if (reference != null)
- start = (StartLevel) context.getService(reference);
- String[] installEntries = getArrayFromList(System.getProperty("osgi.bundles"));
- String syspath = getSysPath();
- Bundle[] bundles = new Bundle[installEntries.length];
- boolean installedSomething = false;
- for (int i = 0; i < installEntries.length; i++) {
- String name = installEntries[i];
- int level = -1;
- int index = name.indexOf('@');
- if (index >= 0) {
- String levelString = name.substring(index + 1, name.length());
- level = Integer.parseInt(levelString);
- name = name.substring(0, index);
- }
- String location = searchForBundle(name, syspath);
- if (location == null)
- throw new IllegalArgumentException(EclipseAdaptorMsg.formatter.getString("ECLIPSE_STARTUP_BUNDLE_NOT_FOUND", name));
- // don't need to install if it is already installed
- bundles[i] = getBundleByLocation(location);
- if (bundles[i] == null) {
- bundles[i] = context.installBundle(location);
- installedSomething = true;
- if (level >= 0 && start != null)
- start.setBundleStartLevel(bundles[i], level);
- }
+ long startTime = System.currentTimeMillis();
+ ServiceReference reference = context.getServiceReference(StartLevel.class.getName());
+ StartLevel start = null;
+ if (reference != null)
+ start = (StartLevel) context.getService(reference);
+ String[] installEntries = getArrayFromList(System.getProperty("osgi.bundles"));
+ String syspath = getSysPath();
+ Bundle[] bundles = new Bundle[installEntries.length];
+ boolean installedSomething = false;
+ for (int i = 0; i < installEntries.length; i++) {
+ String name = installEntries[i];
+ int level = -1;
+ int index = name.indexOf('@');
+ if (index >= 0) {
+ String levelString = name.substring(index + 1, name.length());
+ level = Integer.parseInt(levelString);
+ name = name.substring(0, index);
}
- // If we installed something, force all basic bundles we installed to be resolved
- if (installedSomething)
- refreshPackages(bundles);
- // schedule all basic bundles to be started
- for (int i = 0; i < bundles.length; i++) {
- if (bundles[i].getState() == Bundle.INSTALLED)
- throw new IllegalStateException(EclipseAdaptorMsg.formatter.getString("ECLIPSE_STARTUP_ERROR_BUNDLE_NOT_RESOLVED", bundles[i].getLocation()));
- bundles[i].start();
+ String location = searchForBundle(name, syspath);
+ if (location == null)
+ throw new IllegalArgumentException(EclipseAdaptorMsg.formatter.getString("ECLIPSE_STARTUP_BUNDLE_NOT_FOUND", name));
+ // don't need to install if it is already installed
+ bundles[i] = getBundleByLocation(location);
+ if (bundles[i] == null) {
+ bundles[i] = context.installBundle(location);
+ installedSomething = true;
+ if (level >= 0 && start != null)
+ start.setBundleStartLevel(bundles[i], level);
}
- context.ungetService(reference);
- if (debug)
- System.out.println("Time loadBundles in the framework: " + (System.currentTimeMillis() - startTime));
- return bundles;
}
+ // If we installed something, force all basic bundles we installed to be resolved
+ if (installedSomething)
+ refreshPackages(bundles);
+ // schedule all basic bundles to be started
+ for (int i = 0; i < bundles.length; i++) {
+ if (bundles[i].getState() == Bundle.INSTALLED)
+ throw new IllegalStateException(EclipseAdaptorMsg.formatter.getString("ECLIPSE_STARTUP_ERROR_BUNDLE_NOT_RESOLVED", bundles[i].getLocation()));
+ bundles[i].start();
+ }
+ context.ungetService(reference);
+ if (debug)
+ System.out.println("Time loadBundles in the framework: " + (System.currentTimeMillis() - startTime));
+ return bundles;
+ }
private static void refreshPackages(Bundle[] bundles) {
if (bundles.length == 0)
@@ -405,7 +407,7 @@
ServiceReference packageAdminRef = context.getServiceReference(PackageAdmin.class.getName());
PackageAdmin packageAdmin = null;
if (packageAdminRef != null) {
- packageAdmin = (PackageAdmin)context.getService(packageAdminRef);
+ packageAdmin = (PackageAdmin) context.getService(packageAdminRef);
if (packageAdmin == null)
return;
}
@@ -424,7 +426,7 @@
context.removeFrameworkListener(listener);
context.ungetService(packageAdminRef);
}
-
+
/**
* Invokes the OSGi Console on another thread
*
@@ -440,11 +442,11 @@
Class[] parameterTypes;
Object[] parameters;
if (consolePort.length() == 0) {
- parameterTypes = new Class[] { OSGi.class, String[].class };
- parameters = new Object[] { osgi, consoleArgs };
+ parameterTypes = new Class[] {OSGi.class, String[].class};
+ parameters = new Object[] {osgi, consoleArgs};
} else {
- parameterTypes = new Class[] { OSGi.class, int.class, String[].class };
- parameters = new Object[] { osgi, new Integer(consolePort), consoleArgs };
+ parameterTypes = new Class[] {OSGi.class, int.class, String[].class};
+ parameters = new Object[] {osgi, new Integer(consolePort), consoleArgs};
}
Constructor constructor = consoleClass.getConstructor(parameterTypes);
Object console = constructor.newInstance(parameters);
@@ -466,9 +468,9 @@
private static FrameworkAdaptor createAdaptor() throws Exception {
String adaptorClassName = System.getProperty(PROP_ADAPTOR, DEFAULT_ADAPTOR_CLASS);
Class adaptorClass = Class.forName(adaptorClassName);
- Class[] constructorArgs = new Class[] { String[].class };
+ Class[] constructorArgs = new Class[] {String[].class};
Constructor constructor = adaptorClass.getConstructor(constructorArgs);
- return (FrameworkAdaptor) constructor.newInstance(new Object[] { new String[0] });
+ return (FrameworkAdaptor) constructor.newInstance(new Object[] {new String[0]});
}
private static String[] processCommandLine(String[] args) throws Exception {
@@ -479,23 +481,23 @@
for (int i = 0; i < args.length; i++) {
boolean found = false;
// check for args without parameters (i.e., a flag arg)
-
+
// check if debug should be enabled for the entire platform
// If this is the last arg or there is a following arg (i.e., arg+1 has a leading -),
// simply enable debug. Otherwise, assume that that the following arg is
// actually the filename of an options file. This will be processed below.
if (args[i].equalsIgnoreCase(DEBUG) && ((i + 1 == args.length) || ((i + 1 < args.length) && (args[i + 1].startsWith("-"))))) { //$NON-NLS-1$
- System.getProperties().put(PROP_DEBUG, ""); //$NON-NLS-1$
+ System.getProperties().put(PROP_DEBUG, ""); //$NON-NLS-1$
debug = true;
found = true;
}
-
+
// check if development mode should be enabled for the entire platform
// If this is the last arg or there is a following arg (i.e., arg+1 has a leading -),
// simply enable development mode. Otherwise, assume that that the following arg is
// actually some additional development time class path entries. This will be processed below.
if (args[i].equalsIgnoreCase(DEV) && ((i + 1 == args.length) || ((i + 1 < args.length) && (args[i + 1].startsWith("-"))))) { //$NON-NLS-1$
- System.getProperties().put(PROP_DEV, ""); //$NON-NLS-1$
+ System.getProperties().put(PROP_DEV, ""); //$NON-NLS-1$
found = true;
}
@@ -513,7 +515,7 @@
// look for the console with no port.
if (args[i].equalsIgnoreCase(CONSOLE) && ((i + 1 == args.length) || ((i + 1 < args.length) && (args[i + 1].startsWith("-"))))) { //$NON-NLS-1$
- System.getProperties().put(PROP_CONSOLE, ""); //$NON-NLS-1$
+ System.getProperties().put(PROP_CONSOLE, ""); //$NON-NLS-1$
found = true;
}
@@ -527,37 +529,37 @@
continue;
}
String arg = args[++i];
-
+
// look for the console and port.
if (args[i - 1].equalsIgnoreCase(CONSOLE)) {
System.getProperties().put(PROP_CONSOLE, arg);
found = true;
}
-
+
// look for the configuration location .
if (args[i - 1].equalsIgnoreCase(CONFIGURATION)) {
System.getProperties().put(LocationManager.PROP_CONFIG_AREA, arg);
found = true;
}
-
+
// look for the data location for this instance.
if (args[i - 1].equalsIgnoreCase(DATA)) {
System.getProperties().put(LocationManager.PROP_INSTANCE_AREA, arg);
found = true;
}
-
+
// look for the user location for this instance.
if (args[i - 1].equalsIgnoreCase(USER)) {
System.getProperties().put(LocationManager.PROP_USER_AREA, arg);
found = true;
}
-
+
// look for the development mode and class path entries.
if (args[i - 1].equalsIgnoreCase(DEV)) {
System.getProperties().put(PROP_DEV, arg);
found = true;
}
-
+
// look for the debug mode and option file location.
if (args[i - 1].equalsIgnoreCase(DEBUG)) {
System.getProperties().put(PROP_DEBUG, arg);
@@ -570,19 +572,19 @@
System.getProperties().put(PROP_WS, arg);
found = true;
}
-
+
// look for the operating system
if (args[i - 1].equalsIgnoreCase(OS)) {
System.getProperties().put(PROP_OS, arg);
found = true;
}
-
+
// look for the system architecture
if (args[i - 1].equalsIgnoreCase(ARCH)) {
System.getProperties().put(PROP_ARCH, arg);
found = true;
}
-
+
// look for the nationality/language
if (args[i - 1].equalsIgnoreCase(NL)) {
System.getProperties().put(PROP_NL, arg);
@@ -594,7 +596,7 @@
configArgs[configArgIndex++] = i;
}
}
-
+
// remove all the arguments consumed by this argument parsing
if (configArgIndex == 0) {
EnvironmentInfo.frameworkArgs = new String[0];
@@ -615,7 +617,7 @@
}
return EnvironmentInfo.appArgs;
}
-
+
/**
* Returns the result of converting a list of comma-separated tokens into an array
*
@@ -637,7 +639,7 @@
protected static String getSysPath() {
String result = System.getProperty(PROP_SYSPATH);
- if (result != null)
+ if (result != null)
return result;
URL url = EclipseStarter.class.getProtectionDomain().getCodeSource().getLocation();
@@ -675,12 +677,12 @@
applicationTracker = new ServiceTracker(context, filter, null);
applicationTracker.open();
}
-
+
private static void loadConfigurationInfo() {
Location configArea = LocationManager.getConfigurationLocation();
if (configArea == null)
return;
-
+
URL location = null;
try {
location = new URL(configArea.getURL().toExternalForm() + "config.ini");
@@ -689,7 +691,7 @@
}
mergeProperties(System.getProperties(), loadProperties(location));
}
-
+
private static void loadDefaultProperties() {
URL codeLocation = EclipseStarter.class.getProtectionDomain().getCodeSource().getLocation();
if (codeLocation == null)
@@ -707,10 +709,10 @@
}
mergeProperties(System.getProperties(), loadProperties(result));
}
-
+
private static Properties loadProperties(URL location) {
Properties result = new Properties();
- if (location == null)
+ if (location == null)
return result;
try {
InputStream in = location.openStream();
@@ -722,19 +724,19 @@
} catch (IOException e) {
// its ok if there is no file. We'll just use the defaults for everything
// TODO but it might be nice to log something with gentle wording (i.e., it is not an error)
- }
+ }
return result;
}
-
+
private static void mergeProperties(Properties destination, Properties source) {
- for (Enumeration e = source.keys(); e.hasMoreElements(); ) {
- String key = (String)e.nextElement();
+ for (Enumeration e = source.keys(); e.hasMoreElements();) {
+ String key = (String) e.nextElement();
String value = source.getProperty(key);
if (destination.getProperty(key) == null)
destination.put(key, value);
}
}
-
+
private static void stopSystemBundle() throws BundleException {
if (context == null || !running)
return;
@@ -746,7 +748,7 @@
if (event.getType() == FrameworkEvent.STARTLEVEL_CHANGED)
semaphore.release();
}
-
+
};
context.addFrameworkListener(listener);
systemBundle.stop();
@@ -757,10 +759,11 @@
applicationTracker = null;
running = false;
}
+
private static void setStartLevel(final int value) {
ServiceTracker tracker = new ServiceTracker(context, StartLevel.class.getName(), null);
tracker.open();
- final StartLevel startLevel = (StartLevel)tracker.getService();
+ final StartLevel startLevel = (StartLevel) tracker.getService();
final Semaphore semaphore = new Semaphore(0);
FrameworkListener listener = new FrameworkListener() {
public void frameworkEvent(FrameworkEvent event) {
@@ -774,6 +777,7 @@
context.removeFrameworkListener(listener);
tracker.close();
}
+
/**
* Searches for the given target directory starting in the "plugins" subdirectory
* of the given location. If one is found then this location is returned;
@@ -814,6 +818,7 @@
return null;
return result.replace(File.separatorChar, '/') + "/"; //$NON-NLS-1$
}
+
/**
* Do a quick parse of version identifier so its elements can be correctly compared.
* If we are unable to parse the full version, remaining elements are initialized
@@ -823,7 +828,7 @@
* qualifier). Note, that returning anything else will cause exceptions in the caller.
*/
private static Object[] getVersionElements(String version) {
- Object[] result = { new Integer(0), new Integer(0), new Integer(0), "" }; //$NON-NLS-1$
+ Object[] result = {new Integer(0), new Integer(0), new Integer(0), ""}; //$NON-NLS-1$
StringTokenizer t = new StringTokenizer(version, "."); //$NON-NLS-1$
String token;
int i = 0;
@@ -844,6 +849,7 @@
}
return result;
}
+
/**
* Compares version strings.
* @return result of comparison, as integer;
@@ -872,11 +878,11 @@
String entry = System.getProperty(PROP_VM);
if (entry == null)
return null;
- result.append(entry );
+ result.append(entry);
result.append('\n');
// append the vmargs and commands. Assume that these already end in \n
entry = System.getProperty(PROP_VMARGS);
- if (entry != null)
+ if (entry != null)
result.append(entry);
entry = System.getProperty(PROP_COMMANDS);
if (entry != null)
diff --git a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EnvironmentInfo.java b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EnvironmentInfo.java
index a2c2547..bf31d77 100644
--- a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EnvironmentInfo.java
+++ b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EnvironmentInfo.java
@@ -22,7 +22,7 @@
static String[] allArgs;
static String[] frameworkArgs;
static String[] appArgs;
-
+
// While we recognize the SunOS operating system, we change
// this internally to be Solaris.
private static final String INTERNAL_OS_SUNOS = "SunOS"; //$NON-NLS-1$
@@ -40,7 +40,7 @@
singleton = new EnvironmentInfo();
return singleton;
}
-
+
public boolean inDevelopmentMode() {
return System.getProperty("osgi.dev") != null;
}
@@ -94,11 +94,11 @@
int segments = tokenizer.countTokens();
try {
switch (segments) {
- case 2:
+ case 2 :
Locale userLocale = new Locale(tokenizer.nextToken(), tokenizer.nextToken());
Locale.setDefault(userLocale);
break;
- case 3:
+ case 3 :
userLocale = new Locale(tokenizer.nextToken(), tokenizer.nextToken(), tokenizer.nextToken());
Locale.setDefault(userLocale);
break;
@@ -155,7 +155,7 @@
// Map i386 architecture to x86
arch = name.equalsIgnoreCase(INTERNAL_ARCH_I386) ? Constants.ARCH_X86 : name;
}
- System.getProperties().put("osgi.arch", arch);
+ System.getProperties().put("osgi.arch", arch);
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/IModel.java b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/IModel.java
index a736f56..13996be 100644
--- a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/IModel.java
+++ b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/IModel.java
@@ -86,4 +86,4 @@
public static final String PROPERTY = "property"; //$NON-NLS-1$
public static final String PROPERTY_NAME = "name"; //$NON-NLS-1$
public static final String PROPERTY_VALUE = "value"; //$NON-NLS-1$
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/IPluginInfo.java b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/IPluginInfo.java
index e227efa..52c07f6 100644
--- a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/IPluginInfo.java
+++ b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/IPluginInfo.java
@@ -19,16 +19,28 @@
*/
public interface IPluginInfo {
public Map getLibraries();
+
public String[] getLibrariesName();
+
public ArrayList getRequires();
+
public String getMasterId();
+
public String getMasterVersion();
+
public String getPluginClass();
+
public String getUniqueId();
+
public String getVersion();
+
public boolean isFragment();
+
public Set getPackageFilters();
+
public String getPluginName();
+
public String getProviderName();
+
public boolean isSingleton();
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/LocationManager.java b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/LocationManager.java
index ab84db2..e17ad01 100644
--- a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/LocationManager.java
+++ b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/LocationManager.java
@@ -30,13 +30,13 @@
public static final String PROP_MANIFEST_CACHE = "osgi.manifest.cache"; //$NON-NLS-1$
public static final String PROP_USER_HOME = "user.home"; //$NON-NLS-1$
public static final String PROP_USER_DIR = "user.dir"; //$NON-NLS-1$
-
+
// configuration area file/dir names
- public static final String BUNDLES_DIR = "bundles"; //$NON-NLS-1$
- public static final String FRAMEWORK_FILE = ".framework"; //$NON-NLS-1$
- public static final String STATE_FILE = ".state"; //$NON-NLS-1$
- public static final String BUNDLE_DATA_FILE = ".bundledata"; //$NON-NLS-1$
- public static final String MANIFESTS_DIR = "manifests"; //$NON-NLS-1$
+ public static final String BUNDLES_DIR = "bundles"; //$NON-NLS-1$
+ public static final String FRAMEWORK_FILE = ".framework"; //$NON-NLS-1$
+ public static final String STATE_FILE = ".state"; //$NON-NLS-1$
+ public static final String BUNDLE_DATA_FILE = ".bundledata"; //$NON-NLS-1$
+ public static final String MANIFESTS_DIR = "manifests"; //$NON-NLS-1$
// Constants for configuration location discovery
private static final String ECLIPSE = "eclipse"; //$NON-NLS-1$
@@ -74,7 +74,7 @@
return buildURL("file:" + spec, trailingSlash);
}
}
-
+
private static void mungeConfigurationLocation() {
// if the config property was set, munge it for backwards compatibility.
String location = System.getProperty(PROP_CONFIG_AREA);
@@ -88,16 +88,16 @@
if (!location.endsWith("/"))
location += "/";
System.getProperties().put(PROP_CONFIG_AREA, location);
- }
+ }
}
public static void initializeLocations() {
- URL defaultLocation = buildURL(System.getProperty("user.home"), true);
+ URL defaultLocation = buildURL(System.getProperty("user.home"), true);
userLocation = buildLocation(PROP_USER_AREA, defaultLocation, "user", false);
- defaultLocation = buildURL(new File(System.getProperty("user.dir"), "workspace").getAbsolutePath(), true); //$NON-NLS-1$ //$NON-NLS-2$
+ defaultLocation = buildURL(new File(System.getProperty("user.dir"), "workspace").getAbsolutePath(), true); //$NON-NLS-1$ //$NON-NLS-2$
instanceLocation = buildLocation(PROP_INSTANCE_AREA, defaultLocation, "workspace", false);
-
+
mungeConfigurationLocation();
// compute a default but it is very unlikely to be used since main will have computed everything
defaultLocation = buildURL(computeDefaultConfigurationLocation(), true);
@@ -108,7 +108,7 @@
URL parentLocation = computeSharedConfigurationLocation();
if (parentLocation != null && !parentLocation.equals(configurationLocation.getURL())) {
Location parent = new BasicLocation(null, parentLocation, true);
- ((BasicLocation)configurationLocation).setParent(parent);
+ ((BasicLocation) configurationLocation).setParent(parent);
}
initializeDerivedConfigurationLocations();
@@ -122,16 +122,16 @@
System.getProperties().remove(property);
// if the instance location is not set, predict where the workspace will be and
// put the instance area inside the workspace meta area.
- if (location == null)
+ if (location == null)
result = new BasicLocation(property, defaultLocation, readOnly);
else if (location.equalsIgnoreCase(NONE))
return null;
else if (location.equalsIgnoreCase(NO_DEFAULT))
result = new BasicLocation(property, null, readOnly);
else {
- if (location.equalsIgnoreCase(USER_HOME))
+ if (location.equalsIgnoreCase(USER_HOME))
location = computeDefaultUserAreaLocation(userDefaultAppendage);
- if (location.equalsIgnoreCase(USER_DIR))
+ if (location.equalsIgnoreCase(USER_DIR))
location = new File(System.getProperty(PROP_USER_DIR), userDefaultAppendage).getAbsolutePath();
URL url = buildURL(location, true);
if (url != null) {
@@ -146,7 +146,7 @@
if (System.getProperty(PROP_MANIFEST_CACHE) == null)
System.getProperties().put(PROP_MANIFEST_CACHE, getConfigurationFile(MANIFESTS_DIR).getAbsolutePath());
}
-
+
private static URL computeInstallConfigurationLocation() {
String property = System.getProperty(PROP_INSTALL_AREA);
try {
@@ -168,7 +168,7 @@
}
return null;
}
-
+
private static String computeDefaultConfigurationLocation() {
// 1) We store the config state relative to the 'eclipse' directory if possible
// 2) If this directory is read-only
@@ -176,7 +176,7 @@
// is unique for each local user, and <application-id> is the one
// defined in .eclipseproduct marker file. If .eclipseproduct does not
// exist, use "eclipse" as the application-id.
-
+
URL installURL = computeInstallConfigurationLocation();
File installDir = new File(installURL.getFile());
if ("file".equals(installURL.getProtocol()) && installDir.canWrite()) //$NON-NLS-1$
@@ -197,7 +197,7 @@
return null;
File installDir = new File(installURL.getFile());
String appName = "." + ECLIPSE; //$NON-NLS-1$
- File eclipseProduct = new File(installDir, PRODUCT_SITE_MARKER );
+ File eclipseProduct = new File(installDir, PRODUCT_SITE_MARKER);
if (eclipseProduct.exists()) {
Properties props = new Properties();
try {
@@ -215,22 +215,25 @@
}
}
String userHome = System.getProperty(PROP_USER_HOME);
- return new File(userHome, appName + "/" + pathAppendage).getAbsolutePath(); //$NON-NLS-1$
+ return new File(userHome, appName + "/" + pathAppendage).getAbsolutePath(); //$NON-NLS-1$
}
-
+
public static Location getUserLocation() {
return userLocation;
}
+
public static Location getConfigurationLocation() {
return configurationLocation;
}
+
public static Location getInstallLocation() {
return installLocation;
}
+
public static Location getInstanceLocation() {
return instanceLocation;
}
-
+
public static File getOSGiConfigurationDir() {
// TODO assumes the URL is a file: url
return new File(configurationLocation.getURL().getFile(), EclipseAdaptor.FRAMEWORK_SYMBOLICNAME);
@@ -242,4 +245,4 @@
dir.mkdirs();
return new File(dir, filename);
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/Locker.java b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/Locker.java
index 03ced3c..7de2532 100644
--- a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/Locker.java
+++ b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/Locker.java
@@ -14,5 +14,6 @@
public interface Locker {
public boolean lock() throws IOException;
+
public void release();
}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/PluginConverterImpl.java b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/PluginConverterImpl.java
index 1fad97e..6ef4815 100644
--- a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/PluginConverterImpl.java
+++ b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/PluginConverterImpl.java
@@ -39,7 +39,7 @@
private static final String[] ARCH_LIST = {org.eclipse.osgi.service.environment.Constants.ARCH_PA_RISC, org.eclipse.osgi.service.environment.Constants.ARCH_PPC, org.eclipse.osgi.service.environment.Constants.ARCH_SPARC, org.eclipse.osgi.service.environment.Constants.ARCH_X86, org.eclipse.osgi.service.environment.Constants.ARCH_AMD64};
protected static final String FRAGMENT_MANIFEST = "fragment.xml"; //$NON-NLS-1$
protected static final String GENERATED_FROM = "Generated-from"; //$NON-NLS-1$
- protected static final String MANIFEST_TYPE_ATTRIBUTE ="type"; //$NON-NLS-1$
+ protected static final String MANIFEST_TYPE_ATTRIBUTE = "type"; //$NON-NLS-1$
private static final String[] OS_LIST = {org.eclipse.osgi.service.environment.Constants.OS_AIX, org.eclipse.osgi.service.environment.Constants.OS_HPUX, org.eclipse.osgi.service.environment.Constants.OS_LINUX, org.eclipse.osgi.service.environment.Constants.OS_MACOSX, org.eclipse.osgi.service.environment.Constants.OS_QNX, org.eclipse.osgi.service.environment.Constants.OS_SOLARIS, org.eclipse.osgi.service.environment.Constants.OS_WIN32};
protected static final String PI_RUNTIME = "org.eclipse.core.runtime"; //$NON-NLS-1$
protected static final String PI_BOOT = "org.eclipse.core.boot"; //$NON-NLS-1$
@@ -47,25 +47,30 @@
protected static final String PLUGIN_MANIFEST = "plugin.xml"; //$NON-NLS-1$
private static final String COMPATIBILITY_ACTIVATOR = "org.eclipse.core.internal.compatibility.PluginActivator"; //$NON-NLS-1$
private static final String[] WS_LIST = {org.eclipse.osgi.service.environment.Constants.WS_CARBON, org.eclipse.osgi.service.environment.Constants.WS_GTK, org.eclipse.osgi.service.environment.Constants.WS_MOTIF, org.eclipse.osgi.service.environment.Constants.WS_PHOTON, org.eclipse.osgi.service.environment.Constants.WS_WIN32};
+
public static PluginConverterImpl getDefault() {
return instance;
}
+
public PluginConverterImpl() {
this(null);
}
+
PluginConverterImpl(BundleContext context) {
this.context = context;
instance = this;
}
+
private void init() {
// need to make sure these fields are cleared out for each conversion.
out = null;
pluginInfo = null;
pluginManifestLocation = null;
generatedManifest = new Hashtable(10);
- manifestType=EclipseBundleData.MANIFEST_TYPE_UNKNOWN;
+ manifestType = EclipseBundleData.MANIFEST_TYPE_UNKNOWN;
target = null;
}
+
private void fillPluginInfo(File pluginBaseLocation) {
pluginManifestLocation = pluginBaseLocation;
if (pluginManifestLocation == null)
@@ -80,6 +85,7 @@
EclipseAdaptor.getDefault().getFrameworkLog().log(entry);
}
}
+
public synchronized File convertManifest(File pluginBaseLocation, File bundleManifestLocation, boolean compatibilityManifest, String target) {
init();
this.target = target;
@@ -102,6 +108,7 @@
};
return bundleManifestLocation;
}
+
private Set filterExport(Collection exportToFilter, Collection filter) {
if (filter == null || filter.contains("*")) //$NON-NLS-1$
return (Set) exportToFilter;
@@ -117,6 +124,7 @@
}
return filteredExport;
}
+
private ArrayList findOSJars(File pluginRoot, String path, boolean filter) {
path = path.substring(4);
ArrayList found = new ArrayList(0);
@@ -135,6 +143,7 @@
}
return found;
}
+
private URL findPluginManifest(File baseLocation) {
//Here, we can not use the bundlefile because it may explode the jar and returns a location from which we will not be able to derive the jars location
URL xmlFileLocation;
@@ -190,6 +199,7 @@
}
return null;
}
+
private ArrayList findWSJars(File pluginRoot, String path, boolean filter) {
path = path.substring(4);
ArrayList found = new ArrayList(0);
@@ -201,6 +211,7 @@
}
return found;
}
+
protected void fillManifest(boolean compatibilityManifest) {
generateManifestVersion();
generateHeaders();
@@ -213,9 +224,10 @@
if (compatibilityManifest) {
generateTimestamp();
generateLegacy();
- generateEclipseHeaders();
+ generateEclipseHeaders();
}
}
+
public void writeManifest(File generationLocation, Dictionary manifestToWrite, boolean compatibilityManifest) throws PluginConversionException {
try {
generationLocation.getParentFile().mkdirs();
@@ -246,12 +258,15 @@
}
}
}
+
private void generateLocalizationEntry() {
generatedManifest.put(Constants.BUNDLE_MANIFEST_LOCALIZATION, PLUGIN_PROPERTIES_FILENAME);
}
+
private void generateManifestVersion() {
generatedManifest.put(MANIFEST_VERSION, "1.0"); //$NON-NLS-1$ //$NON-NLS-2$
}
+
private boolean requireRuntimeCompatibility() {
ArrayList requireList = pluginInfo.getRequires();
for (Iterator iter = requireList.iterator(); iter.hasNext();) {
@@ -260,21 +275,24 @@
}
return false;
}
+
private void generateActivator() {
if (!pluginInfo.isFragment())
if (!requireRuntimeCompatibility()) {
String pluginClass = pluginInfo.getPluginClass();
- if (pluginClass != null && ! pluginClass.trim().equals("")) //$NON-NLS-1$
+ if (pluginClass != null && !pluginClass.trim().equals("")) //$NON-NLS-1$
generatedManifest.put(Constants.BUNDLE_ACTIVATOR, pluginClass);
} else {
generatedManifest.put(Constants.BUNDLE_ACTIVATOR, COMPATIBILITY_ACTIVATOR);
}
}
+
private void generateClasspath() {
String[] classpath = pluginInfo.getLibrariesName();
if (classpath.length != 0)
generatedManifest.put(Constants.BUNDLE_CLASSPATH, getStringFromArray(classpath, ",\n ")); //$NON-NLS-1$
}
+
private void generateHeaders() {
generatedManifest.put(Constants.BUNDLE_NAME, pluginInfo.getPluginName());
generatedManifest.put(Constants.BUNDLE_VERSION, pluginInfo.getVersion());
@@ -290,6 +308,7 @@
generatedManifest.put(Constants.FRAGMENT_HOST, hostBundle.toString());
}
}
+
/*
* Generates an entry in the form:
* <symbolic-name>[; singleton=true]
@@ -304,9 +323,11 @@
result.append("=true"); //$NON-NLS-1$
return result.toString();
}
+
private void generateLegacy() {
generatedManifest.put(EclipseAdaptorConstants.LEGACY, "true"); //$NON-NLS-1$
}
+
private void generatePluginClass() {
if (requireRuntimeCompatibility()) {
String pluginClass = pluginInfo.getPluginClass();
@@ -314,12 +335,14 @@
generatedManifest.put(EclipseAdaptorConstants.PLUGIN_CLASS, pluginClass);
}
}
+
private void generateProvidePackage() {
Set exports = getExports();
if (exports != null && exports.size() != 0) {
generatedManifest.put(Constants.PROVIDE_PACKAGE, getStringFromCollection(exports, ",\n "));
}
}
+
private void generateRequireBundle() {
ArrayList requiredBundles = pluginInfo.getRequires();
if (requiredBundles.size() == 0)
@@ -355,16 +378,17 @@
}
generatedManifest.put(Constants.REQUIRE_BUNDLE, bundleRequire.toString());
}
+
private void generateTimestamp() {
// so it is easy to tell which ones are generated
- generatedManifest.put(GENERATED_FROM,
- Long.toString(getTimeStamp(pluginManifestLocation,manifestType)) +
- ";" + MANIFEST_TYPE_ATTRIBUTE + "=" + manifestType);
+ generatedManifest.put(GENERATED_FROM, Long.toString(getTimeStamp(pluginManifestLocation, manifestType)) + ";" + MANIFEST_TYPE_ATTRIBUTE + "=" + manifestType);
}
+
private void generateEclipseHeaders() {
generatedManifest.put(EclipseAdaptorConstants.ECLIPSE_AUTOSTART, "true");
generatedManifest.put(EclipseAdaptorConstants.ECLIPSE_AUTOSTOP, "true");
}
+
private Set getExports() {
Map libs = pluginInfo.getLibraries();
if (libs == null)
@@ -409,9 +433,11 @@
}
return result;
}
+
private Set getExportsFromDir(File location) {
return getExportsFromDir(location, ""); //$NON-NLS-1$
}
+
private Set getExportsFromDir(File location, String packageName) {
String prefix = (packageName.length() > 0) ? (packageName + '.') : ""; //$NON-NLS-1$
File[] files = location.listFiles();
@@ -434,6 +460,7 @@
exportedPaths.add(".");
return exportedPaths;
}
+
private Set getExportsFromJAR(File jarFile) {
Set names = new HashSet();
JarFile file = null;
@@ -463,6 +490,7 @@
}
return names;
}
+
private ArrayList getLibrariesExpandingVariables(String libraryPath, boolean filter) {
String var = hasPrefix(libraryPath);
if (var == null) {
@@ -478,6 +506,7 @@
}
return new ArrayList(0);
}
+
//return a String representing the string found between the $s
private String hasPrefix(String libPath) {
if (libPath.startsWith("$ws$")) //$NON-NLS-1$
@@ -488,11 +517,13 @@
return "nl"; //$NON-NLS-1$
return null;
}
+
private boolean isValidPackageName(String name) {
if (name.indexOf(' ') > 0 || name.equalsIgnoreCase("META-INF") || name.startsWith("META-INF/")) //$NON-NLS-1$ //$NON-NLS-2$
return false;
return true;
}
+
/**
* Parses the plugin manifest to find out: - the plug-in unique identifier -
* the plug-in version - runtime/libraries entries - the plug-in class -
@@ -515,6 +546,7 @@
}
}
}
+
public static boolean upToDate(File generationLocation, File pluginLocation, byte manifestType) {
if (!generationLocation.isFile())
return false;
@@ -542,13 +574,13 @@
secondLine = secondLine.substring(tag.length());
ManifestElement generatedFrom;
try {
- generatedFrom = ManifestElement.parseHeader(PluginConverterImpl.GENERATED_FROM,secondLine)[0];
+ generatedFrom = ManifestElement.parseHeader(PluginConverterImpl.GENERATED_FROM, secondLine)[0];
} catch (BundleException be) {
return false;
}
String timestampStr = generatedFrom.getValue();
try {
- return Long.parseLong(timestampStr.trim()) == getTimeStamp(pluginLocation,manifestType);
+ return Long.parseLong(timestampStr.trim()) == getTimeStamp(pluginLocation, manifestType);
} catch (NumberFormatException nfe) {
// not a big deal - just a bogus existing manifest that will be ignored
}
@@ -559,11 +591,11 @@
if ((manifestType & EclipseBundleData.MANIFEST_TYPE_JAR) != 0)
return pluginLocation.lastModified();
else if ((manifestType & EclipseBundleData.MANIFEST_TYPE_PLUGIN) != 0)
- return new File(pluginLocation,PLUGIN_MANIFEST).lastModified();
+ return new File(pluginLocation, PLUGIN_MANIFEST).lastModified();
else if ((manifestType & EclipseBundleData.MANIFEST_TYPE_FRAGMENT) != 0)
- return new File(pluginLocation,FRAGMENT_MANIFEST).lastModified();
+ return new File(pluginLocation, FRAGMENT_MANIFEST).lastModified();
else if ((manifestType & EclipseBundleData.MANIFEST_TYPE_BUNDLE) != 0)
- return new File(pluginLocation,Constants.OSGI_BUNDLE_MANIFEST).lastModified();
+ return new File(pluginLocation, Constants.OSGI_BUNDLE_MANIFEST).lastModified();
return -1;
}
@@ -573,6 +605,7 @@
out.newLine();
}
}
+
private void writeEntry(String key, String[] value) throws IOException {
if (value == null || value.length == 0)
return;
@@ -598,6 +631,7 @@
}
out.newLine();
}
+
private String getStringFromArray(String[] values, String separator) {
if (values == null)
return "";
@@ -609,6 +643,7 @@
}
return result.toString();
}
+
private String getStringFromCollection(Collection collection, String separator) {
StringBuffer result = new StringBuffer();
boolean first = true;
@@ -621,23 +656,28 @@
}
return result.toString();
}
+
public class PluginConversionException extends Exception {
public PluginConversionException() {
super();
}
+
public PluginConversionException(String message) {
super(message);
}
+
public PluginConversionException(String message, Throwable cause) {
super(message, cause);
}
+
public PluginConversionException(Throwable cause) {
super(cause);
}
}
+
public Dictionary convertManifest(File pluginBaseLocation, boolean compatibility, String target) {
init();
- this.target = target;
+ this.target = target;
fillPluginInfo(pluginBaseLocation);
if (pluginInfo == null)
return null;
diff --git a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/PluginParser.java b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/PluginParser.java
index de40ba4..bd63b79 100644
--- a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/PluginParser.java
+++ b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/PluginParser.java
@@ -9,6 +9,7 @@
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.core.runtime.adaptor;
+
import java.io.InputStream;
import java.util.*;
import javax.xml.parsers.SAXParserFactory;
@@ -19,21 +20,21 @@
public class PluginParser extends DefaultHandler implements IModel {
private PluginInfo manifestInfo = new PluginInfo();
private BundleContext context;
- private String target; // The targeted platform for the given manifest
-
+ private String target; // The targeted platform for the given manifest
+
public class PluginInfo implements IPluginInfo {
private String schemaVersion;
private String pluginId;
private String version;
- private String vendor;
-
+ private String vendor;
+
// an ordered list of library path names.
private ArrayList libraryPaths;
// TODO Should get rid of the libraries map and just have a
// list of library export statements instead. Library paths must
// preserve order.
private Map libraries; //represent the libraries and their export statement
- private ArrayList requires;
+ private ArrayList requires;
private boolean requiresExpanded = false; //indicates if the requires have been processed.
private boolean compatibilityFound = false; //set to true is the requirement list contain compatilibity
private String pluginClass;
@@ -47,16 +48,19 @@
public boolean isFragment() {
return masterPluginId != null;
}
+
public String toString() {
return "plugin-id: " + pluginId + " version: " + version + " libraries: " + libraries + " class:" + pluginClass + " master: " + masterPluginId + " master-version: " + masterVersion + " requires: " + requires + " singleton: " + singleton; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
}
+
public Map getLibraries() {
if (libraries == null)
return new HashMap(0);
return libraries;
}
+
public ArrayList getRequires() {
- if (!TARGET21.equals(target) && schemaVersion == null && ! requiresExpanded) {
+ if (!TARGET21.equals(target) && schemaVersion == null && !requiresExpanded) {
requiresExpanded = true;
if (requires == null) {
requires = new ArrayList(1);
@@ -64,7 +68,7 @@
} else {
//Add elements on the requirement list of ui and help.
for (int i = 0; i < requires.size(); i++) {
- Prerequisite analyzed = (Prerequisite) requires.get(i);
+ Prerequisite analyzed = (Prerequisite) requires.get(i);
if ("org.eclipse.ui".equals(analyzed.getName())) { //$NON-NLS-1$
requires.add(i + 1, new Prerequisite("org.eclipse.ui.workbench.texteditor", null, true, analyzed.isExported(), null)); //$NON-NLS-1$
requires.add(i + 1, new Prerequisite("org.eclipse.jface.text", null, true, analyzed.isExported(), null)); //$NON-NLS-1$
@@ -73,53 +77,64 @@
requires.add(i + 1, new Prerequisite("org.eclipse.ui.ide", null, true, analyzed.isExported(), null)); //$NON-NLS-1$
} else if ("org.eclipse.help".equals(analyzed.getName())) { //$NON-NLS-1$
requires.add(i + 1, new Prerequisite("org.eclipse.help.base", null, true, analyzed.isExported(), null)); //$NON-NLS-1$
- } else if (PluginConverterImpl.PI_RUNTIME.equals(analyzed.getName()) && ! compatibilityFound) {
+ } else if (PluginConverterImpl.PI_RUNTIME.equals(analyzed.getName()) && !compatibilityFound) {
requires.add(i + 1, new Prerequisite(PluginConverterImpl.PI_RUNTIME_COMPATIBILITY, null, false, analyzed.isExported(), null));
}
}
- if (! requires.contains(new Prerequisite(PluginConverterImpl.PI_RUNTIME_COMPATIBILITY, null, false, false, null))) {
+ if (!requires.contains(new Prerequisite(PluginConverterImpl.PI_RUNTIME_COMPATIBILITY, null, false, false, null))) {
requires.add(new Prerequisite(PluginConverterImpl.PI_RUNTIME_COMPATIBILITY, null, false, false, null));
}
}
}
if (requires == null)
return requires = new ArrayList(0);
-
+
return requires;
}
+
public String getMasterId() {
return masterPluginId;
}
+
public String getMasterVersion() {
return masterVersion;
}
+
public String getPluginClass() {
return pluginClass;
}
+
public String getUniqueId() {
return pluginId;
}
+
public String getVersion() {
return version;
}
+
public Set getPackageFilters() {
return filters;
}
+
public String[] getLibrariesName() {
if (libraryPaths == null)
return new String[0];
return (String[]) libraryPaths.toArray(new String[libraryPaths.size()]);
}
+
public String getPluginName() {
return pluginName;
}
+
public String getProviderName() {
return vendor;
}
+
public boolean isSingleton() {
return singleton;
}
}
+
// File name for this plugin or fragment
// This to help with error reporting
String locationName = null;
@@ -151,6 +166,7 @@
this.context = context;
this.target = target;
}
+
/**
* Receive a Locator object for document events.
*
@@ -167,8 +183,10 @@
public void setDocumentLocator(Locator locator) {
this.locator = locator;
}
+
public void endDocument() {
}
+
public void endElement(String uri, String elementName, String qName) {
switch (((Integer) stateStack.peek()).intValue()) {
case IGNORED_ELEMENT_STATE :
@@ -199,14 +217,14 @@
case RUNTIME_LIBRARY_STATE :
if (elementName.equals(LIBRARY)) {
String curLibrary = (String) objectStack.pop();
- if(! curLibrary.trim().equals("")) { //$NON-NLS-1$
+ if (!curLibrary.trim().equals("")) { //$NON-NLS-1$
Vector exportsVector = (Vector) objectStack.pop();
- if (manifestInfo.libraries == null){
+ if (manifestInfo.libraries == null) {
manifestInfo.libraries = new HashMap(3);
manifestInfo.libraryPaths = new ArrayList(3);
}
manifestInfo.libraries.put(curLibrary, exportsVector);
- manifestInfo.libraryPaths.add(curLibrary.replace('\\','/'));
+ manifestInfo.libraryPaths.add(curLibrary.replace('\\', '/'));
}
stateStack.pop();
}
@@ -225,23 +243,28 @@
break;
}
}
+
public void error(SAXParseException ex) {
logStatus(ex);
}
+
public void fatalError(SAXParseException ex) throws SAXException {
logStatus(ex);
throw ex;
}
+
public void handleExtensionPointState(String elementName, Attributes attributes) {
// mark the plugin as singleton and ignore all elements under extension points (if there are any)
manifestInfo.singleton = true;
stateStack.push(new Integer(IGNORED_ELEMENT_STATE));
}
+
public void handleExtensionState(String elementName, Attributes attributes) {
// mark the plugin as singleton and ignore all elements under extension (if there are any)
- manifestInfo.singleton = true;
+ manifestInfo.singleton = true;
stateStack.push(new Integer(CONFIGURATION_ELEMENT_STATE));
}
+
public void handleInitialState(String elementName, Attributes attributes) {
if (elementName.equals(PLUGIN)) {
stateStack.push(new Integer(PLUGIN_STATE));
@@ -254,11 +277,13 @@
// internalError(Policy.bind("parse.unknownTopElement", elementName)); //$NON-NLS-1$
}
}
+
public void handleLibraryExportState(String elementName, Attributes attributes) {
// All elements ignored.
stateStack.push(new Integer(IGNORED_ELEMENT_STATE));
// internalError(Policy.bind("parse.unknownElement", LIBRARY_EXPORT, elementName)); //$NON-NLS-1$
}
+
public void handleLibraryState(String elementName, Attributes attributes) {
if (elementName.equals(LIBRARY_EXPORT)) {
// Change State
@@ -287,6 +312,7 @@
stateStack.push(new Integer(IGNORED_ELEMENT_STATE));
return;
}
+
public void handlePluginState(String elementName, Attributes attributes) {
if (elementName.equals(RUNTIME)) {
// We should only have one Runtime element in a plugin or fragment
@@ -319,10 +345,12 @@
// Set the state to indicate that this element will be ignored
stateStack.push(new Integer(IGNORED_ELEMENT_STATE));
}
+
public void handleRequiresImportState(String elementName, Attributes attributes) {
// All elements ignored.
stateStack.push(new Integer(IGNORED_ELEMENT_STATE));
}
+
public void handleRequiresState(String elementName, Attributes attributes) {
if (elementName.equals(PLUGIN_REQUIRES_IMPORT)) {
parsePluginRequiresImport(attributes);
@@ -332,6 +360,7 @@
// Set the state to indicate that this element will be ignored
stateStack.push(new Integer(IGNORED_ELEMENT_STATE));
}
+
public void handleRuntimeState(String elementName, Attributes attributes) {
if (elementName.equals(LIBRARY)) {
// Change State
@@ -344,6 +373,7 @@
// Set the state to indicate that this element will be ignored
stateStack.push(new Integer(IGNORED_ELEMENT_STATE));
}
+
private void logStatus(SAXParseException ex) {
String name = ex.getSystemId();
if (name == null)
@@ -355,7 +385,7 @@
String msg;
if (name.equals("")) //$NON-NLS-1$
msg = "parse.error";//Policy.bind("parse.error",
- // ex.getMessage()); //$NON-NLS-1$
+ // ex.getMessage()); //$NON-NLS-1$
else
msg = "parse.errorNameLineColumn";
//Policy.bind("parse.errorNameLineColumn", //$NON-NLS-1$
@@ -364,6 +394,7 @@
// factory.error(new Status(IStatus.WARNING, Platform.PI_RUNTIME,
// Platform.PARSE_PROBLEM, msg, ex));
}
+
synchronized public PluginInfo parsePlugin(InputStream in) throws Exception {
SAXParserFactory factory = acquireXMLParsing();
if (factory == null)
@@ -378,6 +409,7 @@
releaseXMLParsing();
}
}
+
private SAXParserFactory acquireXMLParsing() {
if (context == null) {
return SAXParserFactory.newInstance();
@@ -387,10 +419,12 @@
return null;
return (SAXParserFactory) context.getService(parserReference);
}
+
private void releaseXMLParsing() {
if (parserReference != null)
context.ungetService(parserReference);
}
+
public void parseFragmentAttributes(Attributes attributes) {
// process attributes
objectStack.push(manifestInfo);
@@ -412,12 +446,14 @@
manifestInfo.masterVersion = attrValue;
}
}
+
public void parseLibraryAttributes(Attributes attributes) {
// Push a vector to hold the export mask
objectStack.push(new Vector());
String current = attributes.getValue("", LIBRARY_NAME); //$NON-NLS-1$
objectStack.push(current);
}
+
public void parsePluginAttributes(Attributes attributes) {
// process attributes
objectStack.push(manifestInfo);
@@ -437,27 +473,34 @@
manifestInfo.pluginClass = attrValue;
}
}
+
public class Prerequisite {
String name;
String version;
boolean optional;
- boolean export;
+ boolean export;
String match;
+
public boolean isExported() {
return export;
}
+
public String getMatch() {
return match;
}
+
public String getName() {
return name;
}
+
public boolean isOptional() {
return optional;
}
+
public String getVersion() {
return version;
}
+
public Prerequisite(String preqName, String prereqVersion, boolean isOtional, boolean isExported, String prereqMatch) {
name = preqName;
version = prereqVersion;
@@ -465,28 +508,30 @@
export = isExported;
match = prereqMatch;
}
+
public String toString() {
return name;
}
+
public boolean equals(Object prereq) {
- if (! (prereq instanceof Prerequisite) )
+ if (!(prereq instanceof Prerequisite))
return false;
return name.equals(((Prerequisite) prereq).name);
}
}
-
+
public void parsePluginRequiresImport(Attributes attributes) {
if (manifestInfo.requires == null) {
manifestInfo.requires = new ArrayList();
// to avoid cycles
-// if (!manifestInfo.pluginId.equals(PluginConverterImpl.PI_RUNTIME)) //$NON-NLS-1$
-// manifestInfo.requires.add(new Prerequisite(PluginConverterImpl.PI_RUNTIME, null, false, false, null)); //$NON-NLS-1$
+ // if (!manifestInfo.pluginId.equals(PluginConverterImpl.PI_RUNTIME)) //$NON-NLS-1$
+ // manifestInfo.requires.add(new Prerequisite(PluginConverterImpl.PI_RUNTIME, null, false, false, null)); //$NON-NLS-1$
}
// process attributes
String plugin = attributes.getValue("", PLUGIN_REQUIRES_PLUGIN); //$NON-NLS-1$
if (plugin == null)
return;
- if (plugin.equals(PluginConverterImpl.PI_BOOT)) //$NON-NLS-1$//$NON-NLS-2$
+ if (plugin.equals(PluginConverterImpl.PI_BOOT)) //$NON-NLS-1$//$NON-NLS-2$
return;
if (plugin.equals(PluginConverterImpl.PI_RUNTIME_COMPATIBILITY))
manifestInfo.compatibilityFound = true;
@@ -496,8 +541,10 @@
String match = attributes.getValue("", PLUGIN_REQUIRES_MATCH); //$NON-NLS-1$
manifestInfo.requires.add(new Prerequisite(plugin, version, "true".equalsIgnoreCase(optional) ? true : false, "true".equalsIgnoreCase(export) ? true : false, match)); //$NON-NLS-1$ //$NON-NLS-2$
}
+
public void parseRequiresAttributes(Attributes attributes) {
}
+
static String replace(String s, String from, String to) {
String str = s;
int fromLen = from.length();
@@ -509,9 +556,11 @@
}
return str;
}
+
public void startDocument() {
stateStack.push(new Integer(INITIAL_STATE));
}
+
public void startElement(String uri, String elementName, String qName, Attributes attributes) {
switch (((Integer) stateStack.peek()).intValue()) {
case INITIAL_STATE :
@@ -549,9 +598,11 @@
// //$NON-NLS-1$
}
}
+
public void warning(SAXParseException ex) {
logStatus(ex);
}
+
private void internalError(String message) {
// if (locationName != null)
// factory.error(new Status(IStatus.WARNING, Platform.PI_RUNTIME,
@@ -561,6 +612,7 @@
// factory.error(new Status(IStatus.WARNING, Platform.PI_RUNTIME,
// Platform.PARSE_PROBLEM, message, null));
}
+
public void processingInstruction(String target, String data) throws SAXException {
// Since 3.0, a processing instruction of the form <?eclipse version="3.0"?> at
// the start of the manifest file is used to indicate the plug-in manifest
diff --git a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/Semaphore.java b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/Semaphore.java
index 51baa4a..476247a 100644
--- a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/Semaphore.java
+++ b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/Semaphore.java
@@ -12,9 +12,11 @@
public class Semaphore {
protected long notifications;
+
public Semaphore(int count) {
notifications = count;
}
+
/**
* Attempts to acquire this semaphore. Returns only when the semaphore has been acquired.
*/
@@ -31,6 +33,7 @@
}
}
}
+
/**
* Attempts to acquire this semaphore. Returns true if it was successfully acquired,
* and false otherwise.
@@ -53,10 +56,12 @@
timeLeft = start + delay - System.currentTimeMillis();
}
}
+
public synchronized void release() {
notifications++;
notifyAll();
}
+
// for debug only
public String toString() {
return "Semaphore(" + notifications + ")"; //$NON-NLS-1$ //$NON-NLS-2$
diff --git a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/URLConverterImpl.java b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/URLConverterImpl.java
index 1d77c53..eb6113d 100644
--- a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/URLConverterImpl.java
+++ b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/URLConverterImpl.java
@@ -21,15 +21,14 @@
* The service implementation that allows bundleresource or bundleentry
* URLs to be converted to native file URLs on the local file system.
*/
-public class URLConverterImpl implements URLConverter{
+public class URLConverterImpl implements URLConverter {
- public URL convertToFileURL(URL url) throws IOException{
+ public URL convertToFileURL(URL url) throws IOException {
//TODO should close connection at all times
URLConnection connection = url.openConnection();
if (connection instanceof BundleURLConnection) {
- return ((BundleURLConnection)connection).getFileURL();
- }
- else {
+ return ((BundleURLConnection) connection).getFileURL();
+ } else {
return url;
}
}
@@ -38,10 +37,9 @@
//TODO should close connection at all times
URLConnection connection = url.openConnection();
if (connection instanceof BundleURLConnection) {
- return ((BundleURLConnection)connection).getLocalURL();
- }
- else {
+ return ((BundleURLConnection) connection).getLocalURL();
+ } else {
return url;
}
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/testsupport/SimpleBundleInstaller.java b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/testsupport/SimpleBundleInstaller.java
index 95d1ff1..a99fa42 100644
--- a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/testsupport/SimpleBundleInstaller.java
+++ b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/testsupport/SimpleBundleInstaller.java
@@ -17,15 +17,19 @@
public class SimpleBundleInstaller implements BundleInstaller {
private State state;
+
public SimpleBundleInstaller(State state) {
this.state = state;
}
+
public void installBundle(BundleDescription toInstall) throws BundleException {
state.addBundle(toInstall);
}
+
public void uninstallBundle(BundleDescription toUninstall) throws BundleException {
state.removeBundle(toUninstall);
}
+
public void updateBundle(BundleDescription toUpdate) throws BundleException {
//TODO
}
diff --git a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/testsupport/SimplePlatformAdmin.java b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/testsupport/SimplePlatformAdmin.java
index 28ab310..94bf4dc 100644
--- a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/testsupport/SimplePlatformAdmin.java
+++ b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/testsupport/SimplePlatformAdmin.java
@@ -19,4 +19,4 @@
createSystemState();
setInstaller(new SimpleBundleInstaller(getSystemState()));
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/osgi/framework/stats/BundleStats.java b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/osgi/framework/stats/BundleStats.java
index 4a02d21..8e7402a 100644
--- a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/osgi/framework/stats/BundleStats.java
+++ b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/osgi/framework/stats/BundleStats.java
@@ -21,39 +21,35 @@
public class BundleStats {
public String pluginId;
public int activationOrder;
- private long timestamp; //timeStamp at which this plugin has been activated
- private boolean duringStartup; // indicate if the plugin has been activated during startup
- private long startupTime; // the time took by the plugin to startup
- private long startupMethodTime; // the time took to run the startup method
-
+ private long timestamp; //timeStamp at which this plugin has been activated
+ private boolean duringStartup; // indicate if the plugin has been activated during startup
+ private long startupTime; // the time took by the plugin to startup
+ private long startupMethodTime; // the time took to run the startup method
+
// Indicate the position of the activation trace in the file
- private long traceStart=-1;
- private long traceEnd =-1;
+ private long traceStart = -1;
+ private long traceEnd = -1;
//To keep plugins parentage
- private ArrayList pluginsActivated = new ArrayList(3); // TODO create lazily
- private BundleStats activatedBy=null;
+ private ArrayList pluginsActivated = new ArrayList(3); // TODO create lazily
+ private BundleStats activatedBy = null;
-// static {
-// // activate the boot plugin manually since we do not control the classloader
-//// activateBootPlugin();
-// }
+ // static {
+ // // activate the boot plugin manually since we do not control the classloader
+ //// activateBootPlugin();
+ // }
// hard code the starting of the boot plugin as it does not go through the normal sequence
-// private static void activateBootPlugin() {
-// BundleStats plugin = findPlugin(BootLoader.PI_BOOT);
-// plugin.setTimestamp(System.currentTimeMillis());
-// plugin.setActivationOrder(plugins.size());
-// }
-
-
-
-
+ // private static void activateBootPlugin() {
+ // BundleStats plugin = findPlugin(BootLoader.PI_BOOT);
+ // plugin.setTimestamp(System.currentTimeMillis());
+ // plugin.setActivationOrder(plugins.size());
+ // }
// Get the pluginInfo if available, or create it.
public BundleStats(String pluginId) {
this.pluginId = pluginId;
-// duringStartup = booting;
+ // duringStartup = booting;
}
public long getTimestamp() {
@@ -114,7 +110,7 @@
return traceEnd;
}
- protected void setTimestamp(long value) {
+ protected void setTimestamp(long value) {
timestamp = value;
}
@@ -127,7 +123,7 @@
}
protected static void setBooting(boolean boot) {
-// booting = boot;
+ // booting = boot;
}
protected void endActivation() {
@@ -138,8 +134,7 @@
traceEnd = position;
}
-
protected void setActivatedBy(BundleStats value) {
activatedBy = value;
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/osgi/framework/stats/ClassStats.java b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/osgi/framework/stats/ClassStats.java
index 166aa67..bdd9284 100644
--- a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/osgi/framework/stats/ClassStats.java
+++ b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/osgi/framework/stats/ClassStats.java
@@ -123,4 +123,4 @@
duringStartup = true;
loadOrder = -2;
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/osgi/framework/stats/ClassloaderStats.java b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/osgi/framework/stats/ClassloaderStats.java
index df6fcc0..a9e5e41 100644
--- a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/osgi/framework/stats/ClassloaderStats.java
+++ b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/osgi/framework/stats/ClassloaderStats.java
@@ -39,9 +39,9 @@
*/
private static Map loaders = Collections.synchronizedMap(new HashMap(20));
public static File traceFile;
-
- private static boolean TRACE_PLUGINS = true; //TODO make a debug option
- private static boolean TRACE_CLASSES = true; //TODO make a debug option
+
+ private static boolean TRACE_PLUGINS = true; //TODO make a debug option
+ private static boolean TRACE_CLASSES = true; //TODO make a debug option
private static String TRACE_FILENAME = "c:/trace"; //TODO make a debug option
private static String TRACE_FILTERS = "c:/traceFilters"; //TODO make a debug option
@@ -49,6 +49,7 @@
if (TRACE_CLASSES || TRACE_PLUGINS)
initializeTraceOptions();
}
+
private static void initializeTraceOptions() {
// create the trace file
String filename = TRACE_FILENAME = "c:/trace";
@@ -58,41 +59,43 @@
//load the filters
if (!TRACE_CLASSES)
return;
-// filename = TRACE_FILTERS;
-// if (filename.length() == 0)
-// return;
-// try {
-// File filterFile = new File(filename);
-//// if (!filterFile.isAbsolute())
-//// filterFile = new File(InternalBootLoader.getBootDir() + filename);
-// System.out.print("Runtime tracing elements defined in: " + filterFile.getAbsolutePath() + "..."); //$NON-NLS-1$ //$NON-NLS-2$
-// InputStream input = new FileInputStream(filterFile);
-// System.out.println(" Loaded."); //$NON-NLS-1$
-// Properties filters = new Properties() {
-// public Object put(Object key, Object value) {
-// addFilters((String) key, (String) value);
-// return null;
-// }
-// };
-// try {
-// filters.load(input);
-// } finally {
-// input.close();
-// }
-// } catch (IOException e) {
-// System.out.println(" No trace filters loaded."); //$NON-NLS-1$
-// }
+ // filename = TRACE_FILTERS;
+ // if (filename.length() == 0)
+ // return;
+ // try {
+ // File filterFile = new File(filename);
+ //// if (!filterFile.isAbsolute())
+ //// filterFile = new File(InternalBootLoader.getBootDir() + filename);
+ // System.out.print("Runtime tracing elements defined in: " + filterFile.getAbsolutePath() + "..."); //$NON-NLS-1$ //$NON-NLS-2$
+ // InputStream input = new FileInputStream(filterFile);
+ // System.out.println(" Loaded."); //$NON-NLS-1$
+ // Properties filters = new Properties() {
+ // public Object put(Object key, Object value) {
+ // addFilters((String) key, (String) value);
+ // return null;
+ // }
+ // };
+ // try {
+ // filters.load(input);
+ // } finally {
+ // input.close();
+ // }
+ // } catch (IOException e) {
+ // System.out.println(" No trace filters loaded."); //$NON-NLS-1$
+ // }
}
-// protected static void addFilters(String key, String value) {
-// String[] filters = DelegatingURLClassLoader.getArrayFromList(value);
-// if ("plugins".equals(key)) //$NON-NLS-1$
-// pluginFilters.addAll(Arrays.asList(filters));
-// if ("packages".equals(key)) //$NON-NLS-1$
-// packageFilters.addAll(Arrays.asList(filters));
-// }
+
+ // protected static void addFilters(String key, String value) {
+ // String[] filters = DelegatingURLClassLoader.getArrayFromList(value);
+ // if ("plugins".equals(key)) //$NON-NLS-1$
+ // pluginFilters.addAll(Arrays.asList(filters));
+ // if ("packages".equals(key)) //$NON-NLS-1$
+ // packageFilters.addAll(Arrays.asList(filters));
+ // }
public static void startLoadingClass(String id, String className) {
findLoader(id).startLoadClass(className);
}
+
// get and create if does not exist
private static ClassloaderStats findLoader(String id) {
ClassloaderStats result = (ClassloaderStats) loaders.get(id);
@@ -102,32 +105,39 @@
}
return result;
}
+
public static Stack getClassStack() {
return classStack;
}
+
public static ClassloaderStats[] getLoaders() {
//the parameter to toArray is of size zero for thread safety, otherwise this
//could return an array with null entries if the map shrinks concurrently
return (ClassloaderStats[]) loaders.values().toArray(new ClassloaderStats[0]);
}
+
public static void endLoadingClass(String id, String className, boolean success) {
// must be called from a synchronized location to protect against
// concurrent updates
findLoader(id).endLoadClass(className, success);
}
+
public static void loadedBundle(String id, ResourceBundleStats info) {
findLoader(id).loadedBundle(info);
}
+
public static ClassloaderStats getLoader(String id) {
return (ClassloaderStats) loaders.get(id);
}
+
public ClassloaderStats(String id) {
this.id = id;
keepTraces = pluginFilters.contains(id);
}
+
public void addBaseClasses(String[] baseClasses) {
-// if (!id.equals(BootLoader.PI_BOOT))
-// return;
+ // if (!id.equals(BootLoader.PI_BOOT))
+ // return;
for (int i = 0; i < baseClasses.length; i++) {
String name = baseClasses[i];
if (classes.get(name) == null) {
@@ -137,20 +147,25 @@
}
}
}
+
private void loadedBundle(ResourceBundleStats bundle) {
bundles.add(bundle);
}
+
public ArrayList getBundles() {
return bundles;
}
+
private synchronized void startLoadClass(String name) {
classStack.push(findClass(name));
}
+
// internal method that return the existing classStats or creates one
private ClassStats findClass(String name) {
ClassStats result = (ClassStats) classes.get(name);
return result == null ? new ClassStats(name, this) : result;
}
+
private synchronized void endLoadClass(String name, boolean success) {
ClassStats current = (ClassStats) classStack.pop();
if (!success) {
@@ -176,6 +191,7 @@
loadingTime = loadingTime + current.getTimeLoading();
}
}
+
private void traceLoad(String name, ClassStats target) {
// Stack trace code
if (!keepTraces) {
@@ -207,17 +223,21 @@
e.printStackTrace();
}
}
+
public int getClassLoadCount() {
return classes.size();
}
+
public long getClassLoadTime() {
return loadingTime;
}
+
public ClassStats[] getClasses() {
//the parameter to toArray is of size zero for thread safety, otherwise this
//could return an array with null entries if the map shrinks concurrently
return (ClassStats[]) classes.values().toArray(new ClassStats[0]);
}
+
public String getId() {
return id;
}
diff --git a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/osgi/framework/stats/ResourceBundleStats.java b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/osgi/framework/stats/ResourceBundleStats.java
index 17d24de..a66df54 100644
--- a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/osgi/framework/stats/ResourceBundleStats.java
+++ b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/osgi/framework/stats/ResourceBundleStats.java
@@ -21,12 +21,12 @@
*/
public class ResourceBundleStats {
- private String pluginId; // the plugin loading this bundle
- private String fileName; // the filename of the bundle
- private int keyCount = 0; // number of keys in the bundle
- private int keySize = 0; // size of the keys in the bundle
- private int valueSize = 0; // size of the values in the bundle
- private long hashSize = 0; // size of the hashtable
+ private String pluginId; // the plugin loading this bundle
+ private String fileName; // the filename of the bundle
+ private int keyCount = 0; // number of keys in the bundle
+ private int keySize = 0; // size of the keys in the bundle
+ private int valueSize = 0; // size of the values in the bundle
+ private long hashSize = 0; // size of the hashtable
private long fileSize = 0;
private static int sizeOf(String value) {
@@ -34,7 +34,7 @@
}
private static int sizeOf(Properties value) {
- return (int)Math.round(44 + (16 + (value.size() * 1.25 * 4)) + (24 * value.size()));
+ return (int) Math.round(44 + (16 + (value.size() * 1.25 * 4)) + (24 * value.size()));
}
public ResourceBundleStats(String pluginId, String fileName, URL input) {
@@ -52,7 +52,7 @@
/**
* Compute the size of bundle
*/
- private void initialize(ResourceBundle bundle) {
+ private void initialize(ResourceBundle bundle) {
for (Enumeration enum = bundle.getKeys(); enum.hasMoreElements();) {
String key = (String) enum.nextElement();
keySize += sizeOf(key);
@@ -80,7 +80,7 @@
}
hashSize = sizeOf(props);
} finally {
- if (stream!=null)
+ if (stream != null)
stream.close();
}
} catch (IOException e) {
@@ -120,4 +120,4 @@
public long getFileSize() {
return fileSize;
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/osgi/framework/stats/StatsManager.java b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/osgi/framework/stats/StatsManager.java
index 59623be..4053cc9 100644
--- a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/osgi/framework/stats/StatsManager.java
+++ b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/osgi/framework/stats/StatsManager.java
@@ -21,21 +21,21 @@
// This connect plugins and their info, and so allows to access the info without running through
// the plugin registry. This map only contains activated plugins. The key is the plugin Id
private static Map plugins = new HashMap(20);
- private static Stack activationStack = new Stack(); // a stack of the plugins being activated
- private static boolean booting = true; // the state of the platform. This value is changed by the InternalPlatform itself.
-
+ private static Stack activationStack = new Stack(); // a stack of the plugins being activated
+ private static boolean booting = true; // the state of the platform. This value is changed by the InternalPlatform itself.
+
private static StatsManager defaultInstance;
-
+
public static boolean MONITOR_BUNDLES = false;
public static boolean MONITOR_CLASSES = false;
public static String TRACE_FILENAME = null;
-
+
public static StatsManager getDefault() {
if (defaultInstance == null)
defaultInstance = new StatsManager();
return defaultInstance;
}
-
+
public void startActivation(Bundle bundle) {
// should be called from a synchronized location to protect against concurrent updates
BundleStats plugin = findPlugin(bundle.getSymbolicName());
@@ -68,11 +68,11 @@
long startPosition = ClassloaderStats.traceFile.length();
output.println("Activating plugin: " + id); //$NON-NLS-1$
output.println("Plugin activation stack:"); //$NON-NLS-1$
- for (int i = activationStack.size() - 1; i >= 0 ; i--)
- output.println("\t" + ((BundleStats)activationStack.get(i)).getPluginId()); //$NON-NLS-1$
+ for (int i = activationStack.size() - 1; i >= 0; i--)
+ output.println("\t" + ((BundleStats) activationStack.get(i)).getPluginId()); //$NON-NLS-1$
output.println("Class loading stack:"); //$NON-NLS-1$
Stack classStack = ClassloaderStats.getClassStack();
- for (int i = classStack.size() - 1; i >= 0 ; i--)
+ for (int i = classStack.size() - 1; i >= 0; i--)
output.println("\t" + ((ClassStats) classStack.get(i)).getClassName()); //$NON-NLS-1$
output.println("Stack trace:"); //$NON-NLS-1$
new Throwable().printStackTrace(output);
@@ -85,28 +85,29 @@
e.printStackTrace();
}
}
-
+
private static BundleStats findPlugin(String id) {
- BundleStats result = (BundleStats)plugins.get(id);
+ BundleStats result = (BundleStats) plugins.get(id);
ClassLoader cl = BundleStats.class.getClassLoader();
System.out.println(cl);
System.out.println(StatsManager.class.getClassLoader());
try {
- if (result == null) {
- result = new BundleStats(id);
- plugins.put(id, result);
- }} catch(IllegalAccessError e) {
+ if (result == null) {
+ result = new BundleStats(id);
+ plugins.put(id, result);
+ }
+ } catch (IllegalAccessError e) {
e.printStackTrace();
}
return result;
}
-
+
public BundleStats[] getPlugins() {
- return (BundleStats[])plugins.values().toArray(new BundleStats[plugins.size()]);
+ return (BundleStats[]) plugins.values().toArray(new BundleStats[plugins.size()]);
}
public BundleStats getPlugin(String id) {
return (BundleStats) plugins.get(id);
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/osgi/service/datalocation/FileManager.java b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/osgi/service/datalocation/FileManager.java
index c39a187..be74ef2 100644
--- a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/osgi/service/datalocation/FileManager.java
+++ b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/osgi/service/datalocation/FileManager.java
@@ -34,24 +34,28 @@
* </p>
*/
public class FileManager {
-
+
private class Entry {
int id;
long timeStamp;
-
+
Entry(long timeStamp, int id) {
this.timeStamp = timeStamp;
this.id = id;
}
+
int getId() {
return id;
}
+
long getTimeStamp() {
return timeStamp;
}
+
void setId(int value) {
id = value;
}
+
void setTimeStamp(long value) {
timeStamp = value;
}
@@ -63,13 +67,12 @@
private File base;
private File tableFile = null;
private long tableStamp = 0L;
-
+
private Properties table = new Properties();
private ArrayList changed = new ArrayList(5);
private static final String TABLE_FILE = ".fileTable";
-
/**
* Returns a new file manager for the area identified by the given base directory.
*
@@ -122,6 +125,7 @@
update(target, sources[i]);
}
}
+
/**
* Returns the result of converting a list of comma-separated tokens into an array
*
@@ -172,7 +176,7 @@
* @return the id of the file
*/
public int getId(String target) {
- Entry entry = (Entry)table.get(target);
+ Entry entry = (Entry) table.get(target);
if (entry == null)
return -1;
return entry.getId();
@@ -186,7 +190,7 @@
* @return whether or not the given file matches the disk content
*/
public boolean isCurrent(String target) {
- Entry entry = (Entry)table.get(target);
+ Entry entry = (Entry) table.get(target);
long tableStamp = entry == null ? -1 : entry.getTimeStamp();
long fileStamp = new File(getAbsolutePath(target)).lastModified();
return tableStamp == fileStamp;
@@ -219,7 +223,7 @@
* the given target is not managed
*/
public File lookup(String target) {
- Entry entry = (Entry)table.get(target);
+ Entry entry = (Entry) table.get(target);
if (entry == null)
return null;
File result = new File(getAbsolutePath(target));
@@ -268,7 +272,7 @@
String destination = target + "." + id;
move(target, destination);
}
-
+
/**
* Removes the given file from management by this file manager.
*
@@ -293,14 +297,14 @@
throw new IOException("could not restore file table");
}
for (Enumeration e = table.keys(); e.hasMoreElements();) {
- String file = (String)e.nextElement();
+ String file = (String) e.nextElement();
// if the entry has changed internally, update the value.
- String[] elements = getArrayFromList((String)table.get(file));
+ String[] elements = getArrayFromList((String) table.get(file));
if (changed.indexOf(file) == -1) {
Entry entry = new Entry(Long.parseLong(elements[0]), Integer.parseInt(elements[1]));
table.put(file, entry);
} else {
- Entry entry = (Entry)table.get(file);
+ Entry entry = (Entry) table.get(file);
entry.setId(entry.getId() + 1);
table.put(file, entry);
}
@@ -316,12 +320,12 @@
restore();
Properties props = new Properties();
for (Enumeration e = table.keys(); e.hasMoreElements();) {
- String file = (String)e.nextElement();
- Entry entry = (Entry)table.get(file);
+ String file = (String) e.nextElement();
+ Entry entry = (Entry) table.get(file);
String value = Long.toString(entry.getTimeStamp()) + "," + Integer.toString(entry.getId());
props.put(file, value);
}
-
+
try {
props.store(fileStream, "safe table"); //$NON-NLS-1$
} catch (IOException e) {
@@ -332,7 +336,7 @@
private void update(String target, String source) {
String targetFile = getAbsolutePath(target);
move(getAbsolutePath(source), targetFile);
- Entry entry = (Entry)table.get(target);
+ Entry entry = (Entry) table.get(target);
entry.setTimeStamp(new File(targetFile).lastModified());
entry.setId(entry.getId() + 1);
changed.add(target);
@@ -346,10 +350,10 @@
* @return the managed timestamp of the given file
*/
public long getTimeStamp(String target) {
- Entry entry = (Entry)table.get(target);
+ Entry entry = (Entry) table.get(target);
if (entry == null)
return 0L;
return entry.getTimeStamp();
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/osgi/service/datalocation/Location.java b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/osgi/service/datalocation/Location.java
index fc0478f..0cf3241 100644
--- a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/osgi/service/datalocation/Location.java
+++ b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/osgi/service/datalocation/Location.java
@@ -24,8 +24,8 @@
* Returns true if this location allows a default value to be assigned
* @return whether or not this location can assign a default value
*/
- public boolean allowsDefault();
-
+ public boolean allowsDefault();
+
/**
* Returns the default value of this location if any. <code>null</code> is returned
* if no default is avaliable. Note that even locations which allow defaults may still
@@ -33,13 +33,13 @@
* @return the default value for this location
*/
public URL getDefault();
-
+
/**
* Returns the parent of this location or <code>null</code> if none is available.
* @return the parent of this location or <code>null</code>
*/
public Location getParentLocation();
-
+
/**
* Returns the actual URL of this location. If the location's value has been set,
* that value is returned. If the value is not set and the location allows defaults,
@@ -48,12 +48,13 @@
* @return the URL for this location or <code>null</code> if none
*/
public URL getURL();
-
+
/**
* Returns true if this location has a value.
* @return whether or not the value is set
*/
public boolean isSet();
+
/**
* Return true if this locaiton represents a read only location. The read only character
* of a location is not in enforced in any way but rather expresses the intention of the
@@ -61,7 +62,7 @@
* @return whether the location is read only
*/
public boolean isReadOnly();
-
+
/**
* Sets and optionally locks the location's value to the given URL. If the location already has a value an
* exception is thrown. If locking is requested and fails, false is returned and the URL
@@ -86,10 +87,10 @@
* @exception IOException if there was an unexpected problem while acquiring the lock.
*/
public boolean lock() throws IOException;
-
+
/**
* Releases the lock on this location. If the location is not already locked, no action
* is taken.
*/
public void release();
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/osgi/service/environment/Constants.java b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/osgi/service/environment/Constants.java
index 5826209..beac16a 100644
--- a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/osgi/service/environment/Constants.java
+++ b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/osgi/service/environment/Constants.java
@@ -12,7 +12,7 @@
public interface Constants {
//TODO These constants need to be aligned with the OSGi ones. See page 64-588 of the spec
-
+
/**
* Constant string (value "win32") indicating the platform is running on a
* Window 32-bit operating system (e.g., Windows 98, NT, 2000).
@@ -98,7 +98,7 @@
* @since 3.0
*/
public static final String ARCH_AMD64 = "amd64";//$NON-NLS-1$
-
+
/**
* Constant string (value "win32") indicating the platform is running on a
* machine using the Windows windowing system.
@@ -137,4 +137,4 @@
*/
public static final String WS_UNKNOWN = "unknown";//$NON-NLS-1$
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/osgi/service/environment/EnvironmentInfo.java b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/osgi/service/environment/EnvironmentInfo.java
index 1096587..afb68c9 100644
--- a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/osgi/service/environment/EnvironmentInfo.java
+++ b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/osgi/service/environment/EnvironmentInfo.java
@@ -19,24 +19,27 @@
* @since 3.0
*/
public interface EnvironmentInfo {
-
+
/**
* Returns all command line arguments specified when the running framework was started.
* @return the array of command line arguments.
*/
public String[] getCommandLineArgs();
+
/**
* Returns the arguments consumed by the framework implementation itself. Which
* arguments are consumed is implementation specific.
* @return the array of command line arguments consumed by the framework.
*/
- public String[] getFrameworkArgs();
+ public String[] getFrameworkArgs();
+
/**
* Returns the arguments not consumed by the framework implementation itself. Which
* arguments are consumed is implementation specific.
* @return the array of command line arguments not consumed by the framework.
*/
public String[] getNonFrameworkArgs();
+
/**
* Returns the string name of the current system architecture.
* The value is a user-defined string if the architecture is
@@ -46,7 +49,7 @@
* @return the string name of the current system architecture
*/
public String getOSArch();
-
+
/**
* Returns the string name of the current locale for use in finding files
* whose path starts with <code>$nl$</code>.
@@ -54,7 +57,7 @@
* @return the string name of the current locale
*/
public String getNL();
-
+
/**
* Returns the string name of the current operating system for use in finding
* files whose path starts with <code>$os$</code>. <code>OS_UNKNOWN</code> is
@@ -68,7 +71,7 @@
*
*/
public String getOS();
-
+
/**
* Returns the string name of the current window system for use in finding files
* whose path starts with <code>$ws$</code>. <code>null</code> is returned
@@ -77,16 +80,16 @@
* @return the string name of the current window system or <code>null</code>
*/
public String getWS();
-
+
/**
* Returns true if the framework is in debug mode.
* @return whether or not the framework is in debug mode
*/
- public boolean inDebugMode();
-
+ public boolean inDebugMode();
+
/**
* Returns true if the framework is in development mode.
* @return whether or not the framework is in development mode
*/
- public boolean inDevelopmentMode();
-}
+ public boolean inDevelopmentMode();
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/osgi/service/localization/BundleLocalization.java b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/osgi/service/localization/BundleLocalization.java
index ec372bd..43a9af3 100644
--- a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/osgi/service/localization/BundleLocalization.java
+++ b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/osgi/service/localization/BundleLocalization.java
@@ -26,6 +26,6 @@
* @return A <code>ResourceBundle</code> object for the given bundle and locale.
* If null is passed for the locale parameter, the default locale is used.
*/
-
+
public ResourceBundle getLocalization(Bundle bundle, String locale);
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/osgi/service/pluginconversion/PluginConverter.java b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/osgi/service/pluginconversion/PluginConverter.java
index 64c119f..dcb176a 100644
--- a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/osgi/service/pluginconversion/PluginConverter.java
+++ b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/osgi/service/pluginconversion/PluginConverter.java
@@ -30,9 +30,9 @@
* @param target a string indicating the version of the runtime for which the manifest generated is targeted
* @return the generated manifest file location, if a bundle manifest was successfully
* generated (or already existed), <code>null</code> otherwise.
- */
+ */
public File convertManifest(File pluginBaseLocation, File bundleManifestLocation, boolean compatibilityManifest, String target);
-
+
/**
* Converts a plug-in/fragment manifest at the given source base location (a directory) and
* generates a corresponding bundle manifest returned as a dictionary.
@@ -44,7 +44,7 @@
* @param target a string indicating the version of the runtime for which the manifest generated is targeted
* @return the generated manifest as a dictionary, if a bundle manifest was successfully
* generated, <code>null</code> otherwise
- */
+ */
public Dictionary convertManifest(File pluginBaseLocation, boolean compatibility, String target);
/**
diff --git a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/osgi/service/urlconversion/URLConverter.java b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/osgi/service/urlconversion/URLConverter.java
index 510d777..054109b 100644
--- a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/osgi/service/urlconversion/URLConverter.java
+++ b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/osgi/service/urlconversion/URLConverter.java
@@ -38,4 +38,4 @@
* @throws IOException if an error occurs during the conversion.
*/
public URL convertToLocalURL(URL url) throws IOException;
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/BundleDelta.java b/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/BundleDelta.java
index 34656fc..d9dedac 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/BundleDelta.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/BundleDelta.java
@@ -61,13 +61,13 @@
* @see BundleDelta#getType
*/
public static final int OPTIONAL_LINKAGE_CHANGED = 0x40;
-
+
/**
*
* @return
*/
public BundleDescription getBundle();
-
+
/**
* Returns the type of change which occured. The return value is composed
* of by bit-wise masking the relevant flags from the set ADDED, REMOVED,
@@ -78,5 +78,5 @@
* @return the type of change which occured
*/
public int getType();
-
-}
+
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/BundleDescription.java b/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/BundleDescription.java
index 35cefca..2cb1d08 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/BundleDescription.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/BundleDescription.java
@@ -32,6 +32,7 @@
* @return an array of package specifications
*/
public PackageSpecification[] getPackages();
+
/**
* Returns an array of package specifications defined by the
* Provide-Package clause.
@@ -39,6 +40,7 @@
* @return an array of package names
*/
public String[] getProvidedPackages();
+
/**
* Returns the package specification whose package name matches the given
* name. The packages detailed in getPackages() are searched for the given
@@ -106,6 +108,7 @@
* @return the version specification for this bundle.
*/
public Version getVersion();
+
/**
* Returns an array containing all constraints specified by the given
* bundle that could not be satisfied. If all constraints could be
@@ -144,13 +147,15 @@
* @deprecated Use getHosts instead
*/
public HostSpecification getHost();
+
/**
* Returns the hosts for this bundle. An empty array is returned if this bundle is not
* a fragment.
*
* @return
- */
+ */
public HostSpecification[] getHosts();
+
/**
* Returns the numeric id of this bundle. Typically a bundle description
* will only have a numeric id if it represents a bundle that is installed in a
@@ -166,6 +171,7 @@
* @return an array of BundleDescriptions containing all known fragments
*/
public BundleDescription[] getFragments();
+
/**
* Returns the user object associated to this bundle description, or
* <code>null</code> if none exists.
@@ -174,6 +180,7 @@
* or <code>null</code>
*/
public Object getUserObject();
+
/**
* Returns whether this bundle is a singleton. Singleton bundles require
* that at most one single version of the bundle can be resolved at a time.
@@ -186,6 +193,7 @@
* <code>false</code> otherwise
*/
public boolean isSingleton();
+
/**
* Associates a user-provided object to this bundle description, or
* removes an existing association, if <code>null</code> is provided. The
@@ -196,4 +204,4 @@
* <code>null</code>
*/
public void setUserObject(Object userObject);
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/BundleSpecification.java b/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/BundleSpecification.java
index 01b9b33..9fb8cc3 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/BundleSpecification.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/BundleSpecification.java
@@ -10,16 +10,15 @@
*******************************************************************************/
package org.eclipse.osgi.service.resolver;
-
/**
* A representation of one bundle import constraint as seen in a
* bundle manifest and managed by a state and resolver.
*/
public interface BundleSpecification extends VersionConstraint {
// TODO add javadoc.
-
+
public boolean isExported(); // TODO should be isReprovided?
public boolean isOptional();
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/HostSpecification.java b/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/HostSpecification.java
index a50bac2..240ffe5 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/HostSpecification.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/HostSpecification.java
@@ -20,6 +20,6 @@
// a fragment should force a reload of the host when attaching.
// this should be removed.
public boolean reloadHost();
-
+
public BundleDescription[] getSuppliers();
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/PackageSpecification.java b/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/PackageSpecification.java
index d1656e4..1985d5b 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/PackageSpecification.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/PackageSpecification.java
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.osgi.service.resolver;
-
/**
* A representation of one package import constraint as seen in a
* bundle manifest and managed by a state and resolver.
@@ -18,4 +17,4 @@
public interface PackageSpecification extends VersionConstraint {
// TODO add javadoc
public boolean isExported();
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/PlatformAdmin.java b/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/PlatformAdmin.java
index 868c987..75eab9a 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/PlatformAdmin.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/PlatformAdmin.java
@@ -11,6 +11,7 @@
package org.eclipse.osgi.service.resolver;
import org.osgi.framework.BundleException;
+
/**
* Framework service which allows bundle programmers to inspect the bundles and
* packages known to the Framework. The PlatformAdmin service also allows bundles
@@ -33,7 +34,7 @@
*/
// TODO Why is the state not associated with any resolver?
public State getState();
-
+
/**
* Returns a state representing the current system. If there is need to make
* changes to the returned state, a mutable state must be requested.
@@ -46,6 +47,7 @@
*/
// TODO Why is the state not associated with any resolver?
public State getState(boolean mutable);
+
/**
* Returns a state helper object. State helpers provide convenience methods
* for manipulating states.
@@ -58,6 +60,7 @@
* @see StateHelper
*/
public StateHelper getStateHelper();
+
/**
* Commit the differences between the current state and the given state.
* The given state must return true from State.isResolved() or an exception
@@ -68,18 +71,18 @@
* current state or if the given state is not resolved.
*/
public void commit(State state) throws BundleException;
-
+
/**
* Returns a resolver supplied by the system. The returned resolver
* will not be associated with any state.
* @return a system resolver
*/
public Resolver getResolver();
-
+
/**
* Returns a factory that knows how to create state objects, such as bundle
* descriptions and the different types of version constraints.
* @return a state object factory
*/
public StateObjectFactory getFactory();
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/Resolver.java b/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/Resolver.java
index 75c6881..50287eb 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/Resolver.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/Resolver.java
@@ -30,10 +30,11 @@
* </p>
*/
public void resolve();
+
/**
*
*/
- public void resolve(BundleDescription[] discard);
+ public void resolve(BundleDescription[] discard);
/**
* Flushes this resolver of any stored/cached data it may be keeping to
@@ -67,21 +68,24 @@
* </pre>
*/
public void setState(State value);
+
/**
* Notifies the resolver a bundle has been added to the state.
* @param bundle
*/
public void bundleAdded(BundleDescription bundle);
+
/**
* Notifies the resolver a bundle has been removed from the state.
* @param bundle
- */
+ */
public void bundleRemoved(BundleDescription bundle);
+
/**
* Notifies the resolver a bundle has been updated in the state.
* @param newDescription the new description
* @param existingDescription the existing description
- */
+ */
public void bundleUpdated(BundleDescription newDescription, BundleDescription existingDescription);
-
-}
+
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/State.java b/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/State.java
index 876c8c7..52eef68 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/State.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/State.java
@@ -9,6 +9,7 @@
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.osgi.service.resolver;
+
/**
* The state of a system as reported by a resolver. This includes all bundles
* presented to the resolver relative to this state (i.e., both resolved and
@@ -22,6 +23,7 @@
* @return a boolean indicating whether the bundle was successfully added
*/
public boolean addBundle(BundleDescription description);
+
/**
* Returns a delta describing the differences between this state and the
* given state. This state is taken as the base so the absence of a bundle
@@ -32,6 +34,7 @@
*/
// TODO should this return a StateDelta?
public StateChangeEvent compare(State state);
+
/**
* Removes a bundle description with the given bundle id.
*
@@ -40,6 +43,7 @@
* with the given id does not exist in this state
*/
public BundleDescription removeBundle(long bundleId);
+
/**
* Removes the given bundle description.
*
@@ -48,6 +52,7 @@
* <code>false</code> otherwise
*/
public boolean removeBundle(BundleDescription bundle);
+
/**
* Returns the delta representing the changes from the time this state was
* first captured until now.
@@ -55,12 +60,14 @@
* @return
*/
public StateDelta getChanges();
+
/**
* Returns descriptions for all bundles known to this state.
*
* @return the descriptions for all bundles known to this state.
*/
public BundleDescription[] getBundles();
+
/**
* Returns descriptor for all bundles known to this state.
*
@@ -68,6 +75,7 @@
* @see BundleDescription#getBundleId()
*/
public BundleDescription getBundle(long id);
+
/**
* Returns the bundle descriptor for the bundle with the given name and
* version. null is returned if no such bundle is found in this state. If
@@ -79,6 +87,7 @@
* @return the descriptor for the identified bundle
*/
public BundleDescription getBundle(String symbolicName, Version version);
+
/**
* Returns the id of the state on which this state is based. This
* correlates this state to the system state. For example, if
@@ -89,6 +98,7 @@
* @return the id of the state on which this state is based
*/
public long getTimeStamp();
+
/**
* Returns true if there have been no modifications to this state since the
* last time resolve() was called.
@@ -96,6 +106,7 @@
* @return whether or not this state has changed since last resolved.
*/
public boolean isResolved();
+
/**
* Resolves the given version constraint with the given values. The given
* constraint object is destructively modified to reflect its new resolved
@@ -116,6 +127,7 @@
* <code>resolve</code>
*/
public void resolveConstraint(VersionConstraint constraint, Version actualVersion, BundleDescription supplier);
+
/**
* Sets whether or not the given bundle is selected in this state..
* <p>
@@ -129,6 +141,7 @@
// TODO unclear what the valid status flags are.
// what happens if this is called by someone other than the resolver?
public void resolveBundle(BundleDescription bundle, int status);
+
/**
* Returns the resolver associated with this state. A state can work with
* at most one resolver at any given time. Similarly, a resolver can work
@@ -138,6 +151,7 @@
* not have a resolver
*/
public Resolver getResolver();
+
/**
* Sets the resolver associated with this state. A state can work with at
* most one resolver at any given time. Similarly, a resolver can work with
@@ -157,6 +171,7 @@
// been added to the state but it is not resolved? Should setting
// the resolver force a state to be unresolved?
public void setResolver(Resolver value);
+
/**
* Resolves the constraints contained in this state using the resolver
* currently associated with the state and returns a delta describing the
@@ -182,10 +197,12 @@
* interconnections
*/
public StateDelta resolve(boolean incremental);
+
/**
* Same as State.resolve(true);
*/
public StateDelta resolve();
+
/**
* Resolves the constraints contained in this state using the resolver
* currently associated with the state in a incremental, "least-perturbing"
@@ -198,6 +215,7 @@
* interconnections
*/
public StateDelta resolve(BundleDescription[] discard);
+
/**
* Sets the version overrides which are to be applied during the resolutoin
* of this state. Version overrides allow external forces to
@@ -208,6 +226,7 @@
*/
// TODO the exact form of this is not defined as yet.
public void setOverrides(Object value);
+
/**
* Returns descriptions for all bundles currently resolved in this state.
*
@@ -215,6 +234,7 @@
* state.
*/
public BundleDescription[] getResolvedBundles();
+
/**
* Adds the given listener for change events to this state.
* Has no effect if an identical listener is already registered.
@@ -229,6 +249,7 @@
* @see BundleDelta for all available event types
*/
public void addStateChangeListener(StateChangeListener listener, int flags);
+
/**
* Removes the given listener from the list of listeners.
* Has no effect if an identical listener is not registered.
@@ -236,17 +257,20 @@
* @param listener the listener
*/
public void removeStateChangeListener(StateChangeListener listener);
+
/**
* Returns whether this state is empty.
* @return <code>true</code> if this state is empty, <code>false</code>
* otherwise
*/
public boolean isEmpty();
+
/**
* Returns all exported packages in this state, according to the OSGi rules for resolution.
* @see org.osgi.service.packageadmin.PackageAdmin#getExportedPackages(Bundle)
*/
public PackageSpecification[] getExportedPackages();
+
/**
* Returns all bundle descriptions with the given bundle symbolic name.
* @param symbolicName symbolic name of the bundles to query
@@ -254,6 +278,7 @@
* specified symbolic name.
*/
public BundleDescription[] getBundles(String symbolicName);
+
/**
* Returns the factory that created this state.
* @return the state object factory that created this state
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/StateChangeEvent.java b/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/StateChangeEvent.java
index 31f28ca..f3f9d98 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/StateChangeEvent.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/StateChangeEvent.java
@@ -14,10 +14,12 @@
public class StateChangeEvent extends EventObject {
private StateDelta delta;
+
public StateChangeEvent(StateDelta delta) {
super(delta.getState());
this.delta = delta;
}
+
/**
* Returns a delta detailing changes to a state object.
*
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/StateChangeListener.java b/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/StateChangeListener.java
index 46ea645..a9e1c3b 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/StateChangeListener.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/StateChangeListener.java
@@ -14,4 +14,4 @@
public interface StateChangeListener extends EventListener {
public void stateChanged(StateChangeEvent event);
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/StateDelta.java b/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/StateDelta.java
index f1b349b..33a3b42 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/StateDelta.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/StateDelta.java
@@ -16,7 +16,7 @@
* @return an array of bundle deltas
*/
public BundleDelta[] getChanges();
-
+
/**
* Returns an array of all the members
* of this delta which match the given flags. If an exact match is requested
@@ -29,10 +29,10 @@
* @return an array of bundle deltas matching the given match criteria.
*/
public BundleDelta[] getChanges(int mask, boolean exact);
-
+
/**
* Returns the state whose changes are represented by this delta.
* @return
*/
public State getState();
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/StateHelper.java b/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/StateHelper.java
index 8d2ef28..243e7d9 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/StateHelper.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/StateHelper.java
@@ -30,6 +30,7 @@
* bundles in the state that depend on them
*/
public BundleDescription[] getDependentBundles(BundleDescription[] roots);
+
/**
* Returns all unsatisfied constraints in the given bundle. Returns an
* empty array if no unsatisfied constraints can be found.
@@ -42,6 +43,7 @@
* @return an array containing all unsatisfied constraints for the given bundle
*/
public VersionConstraint[] getUnsatisfiedConstraints(BundleDescription bundle);
+
/**
* Returns whether the given package specification constraint is resolvable.
* A package specification constraint may be
@@ -54,6 +56,7 @@
* <code>false</code> otherwise
*/
public boolean isResolvable(PackageSpecification specification);
+
/**
* Returns whether the given bundle specification constraint is resolvable.
* A bundle specification constraint may be
@@ -66,6 +69,7 @@
* <code>false</code> otherwise
*/
public boolean isResolvable(BundleSpecification specification);
+
/**
* Returns whether the given host specification constraint is resolvable.
* A host specification constraint may be
@@ -78,6 +82,7 @@
* <code>false</code> otherwise
*/
public boolean isResolvable(HostSpecification specification);
+
/**
* Returns all packages exported by the given bundle. Returns an empty array
* if no packages are exported.
@@ -86,6 +91,7 @@
* @return all packages exported by the given bundle
*/
public PackageSpecification[] getExportedPackages(BundleDescription bundle);
+
/**
* Returns the package specification corresponding to the given
* package name/version that has been elected to be exported in the given
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/StateObjectFactory.java b/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/StateObjectFactory.java
index cc4f9df..d836cdb 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/StateObjectFactory.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/StateObjectFactory.java
@@ -24,6 +24,7 @@
* @return the created state
*/
public State createState();
+
/**
* Creates a new state that is a copy of the given state. The returned state
* will contain copies of all bundle descriptions in the given state. No data
@@ -33,6 +34,7 @@
* @return the created state
*/
public State createState(State state);
+
/**
* Creates a bundle description from the given parameters.
*
@@ -54,6 +56,7 @@
* @deprecated use another version of createBundleDescription
*/
public BundleDescription createBundleDescription(long id, String symbolicName, Version version, String location, BundleSpecification[] required, HostSpecification host, PackageSpecification[] packages, String[] providedPackages, boolean singleton);
+
/**
* Creates a bundle description from the given parameters.
*
@@ -72,8 +75,9 @@
* <code>null</code>)
* @param singleton whether the bundle created should be a singleton
* @return the created bundle description
- */
- public BundleDescription createBundleDescription(long id, String symbolicName, Version version, String location, BundleSpecification[] required, HostSpecification[] hosts, PackageSpecification[] packages, String[] providedPackages, boolean singleton);
+ */
+ public BundleDescription createBundleDescription(long id, String symbolicName, Version version, String location, BundleSpecification[] required, HostSpecification[] hosts, PackageSpecification[] packages, String[] providedPackages, boolean singleton);
+
/**
* Returns a bundle description based on the information in the supplied manifest dictionary.
* The manifest should contain String keys and String values which correspond to
@@ -86,6 +90,7 @@
* @throws BundleException if an error occurs while reading the manifest
*/
public BundleDescription createBundleDescription(Dictionary manifest, String location, long id) throws BundleException;
+
/**
* Creates a bundle description that is a copy of the given description.
*
@@ -93,6 +98,7 @@
* @return the created bundle description
*/
public BundleDescription createBundleDescription(BundleDescription original);
+
/**
* Creates a bundle specification from the given parameters.
*
@@ -105,6 +111,7 @@
* @see VersionConstraint for information on the available match rules
*/
public BundleSpecification createBundleSpecification(String requiredSymbolicName, Version requiredVersion, byte matchRule, boolean export, boolean optional);
+
/**
* Creates a bundle specification that is a copy of the given constraint.
*
@@ -112,6 +119,7 @@
* @return the created bundle specification
*/
public BundleSpecification createBundleSpecification(BundleSpecification original);
+
/**
* Creates a host specification from the given parameters.
*
@@ -124,6 +132,7 @@
* @see VersionConstraint for information on the available match rules
*/
public HostSpecification createHostSpecification(String hostSymbolicName, Version hostVersion, byte matchRule, boolean reloadHost);
+
/**
* Creates a host specification that is a copy of the given constraint.
*
@@ -131,6 +140,7 @@
* @return the created host specification
*/
public HostSpecification createHostSpecification(HostSpecification original);
+
/**
* Creates a package specification from the given parameters.
*
@@ -141,12 +151,14 @@
* @return the created package specification
*/
public PackageSpecification createPackageSpecification(String packageName, Version packageVersion, boolean exported);
+
/**
* Creates a package specification that is a copy of the given constraint
* @param original the constraint to be copied
* @return the created package specification
*/
public PackageSpecification createPackageSpecification(PackageSpecification original);
+
/**
* Persists the given state in the given output stream. Closes the stream.
*
@@ -158,6 +170,7 @@
* this factory
*/
public void writeState(State state, DataOutputStream stream) throws IOException;
+
/**
* Reads a persisted state from the given stream. Closes the stream.
*
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/Version.java b/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/Version.java
index 37da278..4714810 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/Version.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/Version.java
@@ -80,6 +80,7 @@
public Version(int major, int minor, int micro) {
this(major, minor, micro, null);
}
+
/**
* Creates a plug-in version identifier from its components.
*
@@ -109,6 +110,7 @@
this.micro = micro;
this.qualifier = verifyQualifier(qualifier);
}
+
/**
* Creates a plug-in version identifier from the given string.
* The string represenation consists of up to 4 tokens
@@ -136,6 +138,7 @@
this.micro = ((Integer) parts[2]).intValue();
this.qualifier = (String) parts[3];
}
+
/**
* Validates the given string as a plug-in version identifier.
*
@@ -157,6 +160,7 @@
// OG...
// return new Status(IStatus.OK, Platform.PI_RUNTIME, IStatus.OK, Policy.bind("ok"), null); //$NON-NLS-1$
}
+
private static Object[] parseVersion(String versionId) {
// Do the test outside of the assert so that they 'Policy.bind'
@@ -230,6 +234,7 @@
result[3] = ""; //$NON-NLS-1$
return result;
}
+
/**
* Compare version identifiers for equality. Identifiers are
* equal if all of their components are equal.
@@ -243,6 +248,7 @@
Version v = (Version) object;
return v.getMajorComponent() == major && v.getMinorComponent() == minor && v.getMicroComponent() == micro && v.getQualifierComponent().equals(qualifier);
}
+
/**
* Returns a hash code value for the object.
*
@@ -255,6 +261,7 @@
else
return code + qualifier.hashCode();
}
+
/**
* Returns the major (incompatible) component of this
* version identifier.
@@ -264,6 +271,7 @@
public int getMajorComponent() {
return major;
}
+
/**
* Returns the minor (compatible) component of this
* version identifier.
@@ -273,6 +281,7 @@
public int getMinorComponent() {
return minor;
}
+
/**
* Returns the micro level component of this
* version identifier.
@@ -282,6 +291,7 @@
public int getMicroComponent() {
return micro;
}
+
/**
* Returns the qualifier component of this
* version identifier.
@@ -291,6 +301,7 @@
public String getQualifierComponent() {
return qualifier;
}
+
/**
* Compares two version identifiers to see if this one is
* greater than or equal to the argument.
@@ -326,6 +337,7 @@
else
return false;
}
+
/**
* Compares two version identifiers for major match.
* <p>
@@ -363,6 +375,7 @@
else
return false;
}
+
/**
* Compares two version identifiers for equivalency.
* <p>
@@ -396,6 +409,7 @@
else
return false;
}
+
/**
* Compares two version identifiers for micro match.
* <p>
@@ -421,6 +435,7 @@
else
return false;
}
+
/**
* Compares two version identifiers for perfect equality.
* <p>
@@ -442,6 +457,7 @@
else
return true;
}
+
/**
* Compares two version identifiers for order using multi-decimal
* comparison.
@@ -478,6 +494,7 @@
return false;
}
+
/**
* Returns the string representation of this version identifier.
* The result satisfies
@@ -532,4 +549,4 @@
return -1;
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/VersionConstraint.java b/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/VersionConstraint.java
index f91bbb0..f9a433c 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/VersionConstraint.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/eclipse/osgi/service/resolver/VersionConstraint.java
@@ -29,6 +29,7 @@
* @return this constraint's name
*/
public String getName();
+
/**
* Returns the version required by this constraint to be satisfied, or
* <code>null</code> if none is defined.
@@ -36,6 +37,7 @@
* @return the version this constraint requires, or <code>null</code>
*/
public Version getVersionSpecification();
+
/**
* Returns the actual version this constraint was resolved against, or
* <code>null</code> if it is not resolved.
@@ -44,6 +46,7 @@
* @see #isResolved
*/
public Version getActualVersion();
+
/**
* Returns the matching rule for this constraint.
*
@@ -55,12 +58,14 @@
* @see #GREATER_EQUAL_MATCH
*/
public byte getMatchingRule();
+
/**
* Returns the bundle that declares this constraint.
*
* @return a bundle description
*/
public BundleDescription getBundle();
+
/**
* Returns the bundle that satisfies this constraint, if it is resolved.
*
@@ -68,6 +73,7 @@
* @see #isResolved
*/
public BundleDescription getSupplier();
+
/**
* Returns whether this constraint is resolved. A resolved constraint
* is guaranteed to have its supplier defined.
@@ -76,6 +82,7 @@
* otherwise
*/
public boolean isResolved();
+
/**
* Returns whether this constraint could be satisfied by the given version.
* This will depend on the required version, the given version, and the
@@ -87,5 +94,5 @@
* @return <code>true</code> if this constraint could be resolved,
* <code>false</code> otherwise
*/
- boolean isSatisfiedBy(Version version);
-}
+ boolean isSatisfiedBy(Version version);
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/dependencies/IDependency.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/dependencies/IDependency.java
index a52de24..a8eab92 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/dependencies/IDependency.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/dependencies/IDependency.java
@@ -15,11 +15,18 @@
*/
public interface IDependency {
public Object getRequiredObjectId();
+
public Object getRequiredVersionId();
+
public IMatchRule getMatchRule();
+
public boolean isOptional();
+
public Object getResolvedVersionId();
+
public int getChangedMark();
+
public void resolve(Object resolvedVersionId, int changedMark);
- public Object getUserObject();
+
+ public Object getUserObject();
}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/dependencies/IDependencySystem.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/dependencies/IDependencySystem.java
index a7ca5cc..cf1938e 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/dependencies/IDependencySystem.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/dependencies/IDependencySystem.java
@@ -22,28 +22,44 @@
super(message);
}
}
+
public IResolutionDelta resolve() throws CyclicSystemException;
+
public IResolutionDelta resolve(boolean produceDelta) throws CyclicSystemException;
+
/**
* Returns the delta for the last resolution operation (<code>null</code> if never
* resolved or if last resolved with delta production disabled).
*/
public IResolutionDelta getLastDelta();
+
public void addElements(IElement[] elementsToAdd);
+
public void addElement(IElement element);
+
public void removeElements(IElement[] elementsToRemove);
+
public void removeElement(IElement element);
+
public long getElementCount();
+
// returns all resolved elements ordered by pre-requisites
public List getResolved();
+
public IElement getElement(Object id, Object identifier);
+
public IElementSet getElementSet(Object id);
+
// factory methods - for the case the client does not have its own implementations for dependencies and elements
public IElement createElement(Object id, Object versionId, IDependency[] dependencies, boolean singleton, Object userObject);
+
public IDependency createDependency(Object requiredObjectId, IMatchRule satisfactionRule, Object requiredVersionId, boolean optional, Object userObject);
+
// global access to system version comparator
public int compare(Object obj1, Object obj2);
+
public void removeElement(Object id, Object versionId);
+
/**
* Forces a set of elements to be unresolved. All dependencies the elements may
* have as resolved are also unresolved. Also, any elements currently depending on
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/dependencies/IElement.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/dependencies/IElement.java
index 497bf87..aa59ed7 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/dependencies/IElement.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/dependencies/IElement.java
@@ -15,11 +15,16 @@
*/
public interface IElement {
public Object getId();
+
public Object getVersionId();
+
/** @return a non-null reference */
public IDependency[] getDependencies();
+
/** may return null */
public IDependency getDependency(Object id);
+
public boolean isSingleton();
+
public Object getUserObject();
}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/dependencies/IElementChange.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/dependencies/IElementChange.java
index ebd2d34..8b1757d 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/dependencies/IElementChange.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/dependencies/IElementChange.java
@@ -16,20 +16,21 @@
* Not to be implemented by clients.
*/
public interface IElementChange {
- /** State transitions. */
+ /** State transitions. */
public final static int ADDED = 0x01;
public final static int REMOVED = 0x02;
public final static int UPDATED = ADDED | REMOVED;
public final static int RESOLVED = 0x04;
public final static int UNRESOLVED = 0x08;
public final static int LINKAGE_CHANGED = 0x10;
-
+
/**
* Returns the affected element.
*/
- public IElement getElement();
+ public IElement getElement();
+
/**
* Returns the kind of the transition.
*/
public int getKind();
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/dependencies/IElementSet.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/dependencies/IElementSet.java
index 784adf4..a73c8d1 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/dependencies/IElementSet.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/dependencies/IElementSet.java
@@ -18,43 +18,53 @@
*/
public interface IElementSet {
public IDependencySystem getSystem();
+
/** @return false if there is at least one version that is a singleton. */
public boolean allowsConcurrency();
+
/**
* Returns the unique id for this element set.
*/
public Object getId();
+
/**
* Is this a root element set?
- */
+ */
public boolean isRoot();
+
/**
* Returns all elements available in this element set.
*/
public Set getAvailable();
+
/**
* Returns all elements sets required this element set.
*/
public Collection getRequired();
+
/**
* Returns all elements sets requiring this element set.
*/
public Collection getRequiring();
+
/**
* Returns all elements currently resolved in this element set.
- */
+ */
public Set getResolved();
+
/**
* Returns all elements currently satisfied in this element set.
- */
+ */
public Set getSatisfied();
+
/**
* Returns all elements currently selected in this element set.
- */
+ */
public Set getSelected();
+
/**
* Assumes resolved system - returns all elements whose dependencies
* were resolved to point to the specified element.
*/
- public Collection getRequiringElements(Object versionId);
+ public Collection getRequiringElements(Object versionId);
}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/dependencies/IMatchRule.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/dependencies/IMatchRule.java
index 719960b..df37b49 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/dependencies/IMatchRule.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/dependencies/IMatchRule.java
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.core.dependencies;
-
/**
* Must be implemented by clients.
*/
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/dependencies/IResolutionDelta.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/dependencies/IResolutionDelta.java
index 3d26e8e..8e8887a 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/dependencies/IResolutionDelta.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/dependencies/IResolutionDelta.java
@@ -17,7 +17,8 @@
* @see IElementChange
*/
public interface IResolutionDelta {
- IElementChange[] getAllChanges();
+ IElementChange[] getAllChanges();
+
IElementChange getChange(Object id, Object versionId, Object userObject);
}
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/dependencies/ISelectionPolicy.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/dependencies/ISelectionPolicy.java
index 14b68cb..7aaece5 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/dependencies/ISelectionPolicy.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/dependencies/ISelectionPolicy.java
@@ -24,8 +24,9 @@
* Returns a set containing the selected elements for the given element set.
*/
public Set selectMultiple(IElementSet elementSet);
+
/**
* Returns the selected element for the given element set.
- */
+ */
public IElement selectSingle(IElementSet elementSet);
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/internal/dependencies/Assert.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/internal/dependencies/Assert.java
index 23bfeca7..0c07de5 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/internal/dependencies/Assert.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/internal/dependencies/Assert.java
@@ -25,28 +25,30 @@
* </p>
*/
public final class Assert {
-/* This class is not intended to be instantiated. */
-private Assert() {
-}
-/** Asserts that the given object is not <code>null</code>. If this
- * is not the case, some kind of unchecked exception is thrown.
- *
- * @param object the value to test
- * @exception IllegalArgumentException if the object is <code>null</code>
- */
-public static void isNotNull(Object object) {
- isNotNull(object, ""); //$NON-NLS-1$
-}
-/** Asserts that the given object is not <code>null</code>. If this
- * is not the case, some kind of unchecked exception is thrown.
- * The given message is included in that exception, to aid debugging.
- *
- * @param object the value to test
- * @param message the message to include in the exception
- * @exception IllegalArgumentException if the object is <code>null</code>
- */
-public static void isNotNull(Object object, String message) {
- if (object == null)
- throw new NullPointerException("null argument:" + message); //$NON-NLS-1$
-}
-}
+ /* This class is not intended to be instantiated. */
+ private Assert() {
+ }
+
+ /** Asserts that the given object is not <code>null</code>. If this
+ * is not the case, some kind of unchecked exception is thrown.
+ *
+ * @param object the value to test
+ * @exception IllegalArgumentException if the object is <code>null</code>
+ */
+ public static void isNotNull(Object object) {
+ isNotNull(object, ""); //$NON-NLS-1$
+ }
+
+ /** Asserts that the given object is not <code>null</code>. If this
+ * is not the case, some kind of unchecked exception is thrown.
+ * The given message is included in that exception, to aid debugging.
+ *
+ * @param object the value to test
+ * @param message the message to include in the exception
+ * @exception IllegalArgumentException if the object is <code>null</code>
+ */
+ public static void isNotNull(Object object, String message) {
+ if (object == null)
+ throw new NullPointerException("null argument:" + message); //$NON-NLS-1$
+ }
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/internal/dependencies/AssertionFailedException.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/internal/dependencies/AssertionFailedException.java
index 3171d0a..026521f 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/internal/dependencies/AssertionFailedException.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/internal/dependencies/AssertionFailedException.java
@@ -22,13 +22,14 @@
*/
/* package */
class AssertionFailedException extends RuntimeException {
-/** Constructs a new exception.
- */
-public AssertionFailedException() {
-}
-/** Constructs a new exception with the given message.
- */
-public AssertionFailedException(String detail) {
- super(detail);
-}
-}
+ /** Constructs a new exception.
+ */
+ public AssertionFailedException() {
+ }
+
+ /** Constructs a new exception with the given message.
+ */
+ public AssertionFailedException(String detail) {
+ super(detail);
+ }
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/internal/dependencies/ComputeNodeOrder.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/internal/dependencies/ComputeNodeOrder.java
index 8874f10..29d35a6 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/internal/dependencies/ComputeNodeOrder.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/internal/dependencies/ComputeNodeOrder.java
@@ -21,7 +21,7 @@
* @since 3.0
*/
public class ComputeNodeOrder {
-
+
/*
* Prevent class from being instantiated.
*/
@@ -194,8 +194,7 @@
* @exception IllegalArgumentException if either vertex is undefined or
* if the graph is frozen
*/
- public void addEdge(Object fromId, Object toId)
- throws IllegalArgumentException {
+ public void addEdge(Object fromId, Object toId) throws IllegalArgumentException {
if (initialized) {
throw new IllegalArgumentException();
}
@@ -284,14 +283,14 @@
while (root.predecessor != null) {
root = root.predecessor;
}
- List component = (List)components.get(root);
- if (component == null) {
- component = new ArrayList(2);
- component.add(root.id);
- components.put(root, component);
+ List component = (List) components.get(root);
+ if (component == null) {
+ component = new ArrayList(2);
+ component.add(root.id);
+ components.put(root, component);
+ }
+ component.add(vertex.id);
}
- component.add(vertex.id);
- }
}
List result = new ArrayList(components.size());
for (Iterator it = components.values().iterator(); it.hasNext();) {
@@ -303,53 +302,53 @@
return result;
}
-// /**
-// * Performs a depth-first search of this graph and records interesting
-// * info with each vertex, including DFS finish time. Employs a recursive
-// * helper method <code>DFSVisit</code>.
-// * <p>
-// * Although this method is not used, it is the basis of the
-// * non-recursive <code>DFS</code> method.
-// * </p>
-// */
-// private void recursiveDFS() {
-// // initialize
-// // all vertex.color initially Vertex.WHITE;
-// // all vertex.predecessor initially null;
-// time = 0;
-// for (Iterator allV = vertexList.iterator(); allV.hasNext();) {
-// Vertex nextVertex = (Vertex) allV.next();
-// if (nextVertex.color == Vertex.WHITE) {
-// DFSVisit(nextVertex);
-// }
-// }
-// }
-//
-// /**
-// * Helper method. Performs a depth first search of this graph.
-// *
-// * @param vertex the vertex to visit
-// */
-// private void DFSVisit(Vertex vertex) {
-// // mark vertex as discovered
-// vertex.color = Vertex.GREY;
-// List adj = vertex.adjacent;
-// for (Iterator allAdjacent=adj.iterator(); allAdjacent.hasNext();) {
-// Vertex adjVertex = (Vertex) allAdjacent.next();
-// if (adjVertex.color == Vertex.WHITE) {
-// // explore edge from vertex to adjVertex
-// adjVertex.predecessor = vertex;
-// DFSVisit(adjVertex);
-// } else if (adjVertex.color == Vertex.GREY) {
-// // back edge (grey vertex means visit in progress)
-// cycles = true;
-// }
-// }
-// // done exploring vertex
-// vertex.color = Vertex.BLACK;
-// time++;
-// vertex.finishTime = time;
-// }
+ // /**
+ // * Performs a depth-first search of this graph and records interesting
+ // * info with each vertex, including DFS finish time. Employs a recursive
+ // * helper method <code>DFSVisit</code>.
+ // * <p>
+ // * Although this method is not used, it is the basis of the
+ // * non-recursive <code>DFS</code> method.
+ // * </p>
+ // */
+ // private void recursiveDFS() {
+ // // initialize
+ // // all vertex.color initially Vertex.WHITE;
+ // // all vertex.predecessor initially null;
+ // time = 0;
+ // for (Iterator allV = vertexList.iterator(); allV.hasNext();) {
+ // Vertex nextVertex = (Vertex) allV.next();
+ // if (nextVertex.color == Vertex.WHITE) {
+ // DFSVisit(nextVertex);
+ // }
+ // }
+ // }
+ //
+ // /**
+ // * Helper method. Performs a depth first search of this graph.
+ // *
+ // * @param vertex the vertex to visit
+ // */
+ // private void DFSVisit(Vertex vertex) {
+ // // mark vertex as discovered
+ // vertex.color = Vertex.GREY;
+ // List adj = vertex.adjacent;
+ // for (Iterator allAdjacent=adj.iterator(); allAdjacent.hasNext();) {
+ // Vertex adjVertex = (Vertex) allAdjacent.next();
+ // if (adjVertex.color == Vertex.WHITE) {
+ // // explore edge from vertex to adjVertex
+ // adjVertex.predecessor = vertex;
+ // DFSVisit(adjVertex);
+ // } else if (adjVertex.color == Vertex.GREY) {
+ // // back edge (grey vertex means visit in progress)
+ // cycles = true;
+ // }
+ // }
+ // // done exploring vertex
+ // vertex.color = Vertex.BLACK;
+ // time++;
+ // vertex.finishTime = time;
+ // }
/**
* Performs a depth-first search of this graph and records interesting
@@ -365,8 +364,7 @@
final int AFTER_NEXTED_DFS_VISIT = 4;
// use precomputed objects to avoid garbage
final Integer NEXT_VERTEX_OBJECT = new Integer(NEXT_VERTEX);
- final Integer AFTER_NEXTED_DFS_VISIT_OBJECT =
- new Integer(AFTER_NEXTED_DFS_VISIT);
+ final Integer AFTER_NEXTED_DFS_VISIT_OBJECT = new Integer(AFTER_NEXTED_DFS_VISIT);
// initialize
// all vertex.color initially Vertex.WHITE;
// all vertex.predecessor initially null;
@@ -377,9 +375,9 @@
Vertex vertex = null;
Iterator allV = vertexList.iterator();
state = NEXT_VERTEX;
- nextStateLoop : while (true) {
+ nextStateLoop: while (true) {
switch (state) {
- case NEXT_VERTEX:
+ case NEXT_VERTEX :
// on entry, "allV" contains vertexes yet to be visited
if (!allV.hasNext()) {
// all done
@@ -395,7 +393,7 @@
state = NEXT_VERTEX;
continue nextStateLoop;
}
- case START_DFS_VISIT:
+ case START_DFS_VISIT :
// on entry, "vertex" contains the vertex to be visited
// top of stack is return code
// mark the vertex as discovered
@@ -403,7 +401,7 @@
allAdjacent = vertex.adjacent.iterator();
state = NEXT_ADJACENT;
continue nextStateLoop;
- case NEXT_ADJACENT:
+ case NEXT_ADJACENT :
// on entry, "allAdjacent" contains adjacent vertexes to
// be visited; "vertex" contains vertex being visited
if (allAdjacent.hasNext()) {
@@ -429,12 +427,10 @@
vertex.color = Vertex.BLACK;
time++;
vertex.finishTime = time;
- state =
- ((Integer) stack.remove(stack.size() - 1))
- .intValue();
+ state = ((Integer) stack.remove(stack.size() - 1)).intValue();
continue nextStateLoop;
}
- case AFTER_NEXTED_DFS_VISIT:
+ case AFTER_NEXTED_DFS_VISIT :
// on entry, stack contains "vertex" and "allAjacent"
vertex = (Vertex) stack.remove(stack.size() - 1);
allAdjacent = (Iterator) stack.remove(stack.size() - 1);
@@ -445,7 +441,7 @@
}
}
-
+
/**
* Sorts the given list of probject in a manner that honors the given
* project reference relationships. That is, if project A references project
@@ -472,14 +468,12 @@
* references B (element type: <code>IProject[]</code>)
* @return an object describing the resulting project order
*/
- public static Object[][] computeNodeOrder(
- Object[] objects,
- Object[][] references) {
-
+ public static Object[][] computeNodeOrder(Object[] objects, Object[][] references) {
+
// Step 1: Create the graph object.
final Digraph g1 = new Digraph();
// add vertexes
- for (int i = 0; i < objects.length; i++)
+ for (int i = 0; i < objects.length; i++)
g1.addVertex(objects[i]);
// add edges
for (int i = 0; i < references.length; i++)
@@ -494,10 +488,10 @@
final Digraph g2 = new Digraph();
// add vertexes
List resortedVertexes = g1.idsByDFSFinishTime(false);
- for (Iterator it = resortedVertexes.iterator(); it.hasNext(); )
+ for (Iterator it = resortedVertexes.iterator(); it.hasNext();)
g2.addVertex(it.next());
// add edges
- for (int i = 0; i < references.length; i++)
+ for (int i = 0; i < references.length; i++)
g2.addEdge(references[i][0], references[i][1]);
g2.freeze();
@@ -511,11 +505,11 @@
if (hasCycles) {
List knotList = g2.nonTrivialComponents();
knots = (Object[][]) knotList.toArray(new Object[knotList.size()][]);
- } else {
+ } else {
knots = new Object[0][];
}
for (int i = 0; i < orderedNodes.length; i++)
objects[i] = orderedNodes[i];
return knots;
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/internal/dependencies/Dependency.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/internal/dependencies/Dependency.java
index f7e2ede..cc7701b 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/internal/dependencies/Dependency.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/internal/dependencies/Dependency.java
@@ -21,6 +21,7 @@
private boolean optional;
private Object resolvedVersionId;
private Object userObject;
+
public Dependency(Object requiredObjectId, IMatchRule matchRule, Object requiredVersionId, boolean optional, Object userObject) {
Assert.isNotNull(requiredObjectId);
Assert.isNotNull(matchRule);
@@ -30,54 +31,64 @@
this.optional = optional;
this.userObject = userObject;
}
+
/**
* @see IDependency#getMatchRule()
*/
public IMatchRule getMatchRule() {
return this.matchRule;
}
+
/**
* @see IDependency#getRequiredObjectId()
- */
+ */
public Object getRequiredObjectId() {
return this.requiredObjectId;
}
+
/**
* @see IDependency#getRequiredVersionId()
- */
+ */
public Object getRequiredVersionId() {
return this.requiredVersionId;
}
+
/**
* @see IDependency#isOptional()
- */
+ */
public boolean isOptional() {
return this.optional;
}
+
/**
* @see IDependency#getResolvedVersionId()
- */
+ */
public Object getResolvedVersionId() {
return resolvedVersionId;
}
+
public void resolve(Object resolvedVersionId, int changedMark) {
if ((resolvedVersionId == null && this.resolvedVersionId == null) || (resolvedVersionId != null && resolvedVersionId.equals(this.resolvedVersionId)))
return;
this.resolvedVersionId = resolvedVersionId;
- this.changedMark = changedMark;
+ this.changedMark = changedMark;
}
+
public int getChangedMark() {
return changedMark;
- }
+ }
+
public String toString() {
return " -> " + getRequiredObjectId() + "_" + getRequiredVersionId() + " (" + getMatchRule() + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
+
public Object getUserObject() {
return userObject;
- }
+ }
+
class UnspecifiedVersionMatchRule implements IMatchRule {
public boolean isSatisfied(Object required, Object available) {
return true;
}
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/internal/dependencies/DependencySystem.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/internal/dependencies/DependencySystem.java
index 3402ad9..c3eeba5 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/internal/dependencies/DependencySystem.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/internal/dependencies/DependencySystem.java
@@ -14,11 +14,11 @@
import org.eclipse.core.dependencies.*;
-public class DependencySystem implements IDependencySystem {
+public class DependencySystem implements IDependencySystem {
public final static int SATISFACTION = 0;
public final static int SELECTION = 1;
public final static int RESOLUTION = 2;
- public final static int UP_TO_DATE = Integer.MAX_VALUE;
+ public final static int UP_TO_DATE = Integer.MAX_VALUE;
private long elementCount;
private int mark;
@@ -42,9 +42,11 @@
this.selectionPolicy = selectionPolicy;
this.debug = debug;
}
+
public DependencySystem(Comparator comparator, ISelectionPolicy selectionPolicy) {
this(comparator, selectionPolicy, false);
- }
+ }
+
public IElementSet getElementSet(Object id) {
ElementSet elementSet = (ElementSet) this.elementSets.get(id);
// create an element set for the given id if one does not exist yet
@@ -52,6 +54,7 @@
this.elementSets.put(id, elementSet = new ElementSet(id, this));
return elementSet;
}
+
public Collection discoverRoots() {
Collection roots = new LinkedList();
for (Iterator elementSetsIter = elementSets.values().iterator(); elementSetsIter.hasNext();) {
@@ -61,12 +64,14 @@
}
return roots;
}
+
/**
* Determines which versions of each element set are resolved.
*/
public IResolutionDelta resolve() throws CyclicSystemException {
return this.resolve(true);
}
+
public IResolutionDelta resolve(boolean produceDelta) throws CyclicSystemException {
Collection roots = discoverRoots();
// traverse from roots to leaves - returns leaves
@@ -77,17 +82,19 @@
visit(selected, new ResolutionVisitor(RESOLUTION));
this.lastDelta = this.delta;
this.delta = new ResolutionDelta();
- pruneEmptySets();
+ pruneEmptySets();
return this.lastDelta;
}
+
// clean up any dangling element sets that were removed and are not required by anybody
private void pruneEmptySets() {
for (Iterator elementSetsIter = elementSets.values().iterator(); elementSetsIter.hasNext();) {
ElementSet elementSet = (ElementSet) elementSetsIter.next();
if (elementSet.getElementCount() == 0 && elementSet.getRequiringCount() == 0)
- elementSetsIter.remove();
+ elementSetsIter.remove();
}
}
+
/**
* Traverses a graph starting from the given element sets.
* Returns a set containing all leaf element sets that satisfied the visitor.
@@ -147,34 +154,36 @@
throw new CyclicSystemException(getCycleString());
return leaves;
}
+
// temporary hack (using ComputeNodeOrder) to find out what the cycles are
public String getCycleString() {
// find cycles
IElementSet[] nodes = (IElementSet[]) elementSets.values().toArray(new IElementSet[elementSets.size()]);
ArrayList dependencies = new ArrayList();
for (int i = 0; i < nodes.length; i++) {
- for (Iterator required = nodes[i].getRequiring().iterator();required.hasNext();)
- dependencies.add(new Object[] {nodes[i],required.next()});
- }
- Object[][] cycles = ComputeNodeOrder.computeNodeOrder(nodes,(Object[][])dependencies.toArray(new Object[dependencies.size()][]));
+ for (Iterator required = nodes[i].getRequiring().iterator(); required.hasNext();)
+ dependencies.add(new Object[] {nodes[i], required.next()});
+ }
+ Object[][] cycles = ComputeNodeOrder.computeNodeOrder(nodes, (Object[][]) dependencies.toArray(new Object[dependencies.size()][]));
StringBuffer result = new StringBuffer();
for (int i = 0; i < cycles.length; i++) {
result.append("{");
for (int j = 0; j < cycles[i].length; j++) {
- result.append(((IElementSet)cycles[i][j]).getId());
+ result.append(((IElementSet) cycles[i][j]).getId());
result.append(",");
}
result.deleteCharAt(result.length() - 1);
result.append("},");
}
- if (result.length() > 0)
+ if (result.length() > 0)
result.deleteCharAt(result.length() - 1);
return result.toString();
- }
-
+ }
+
private int getVisitorOrder(int mark) {
return mark & 0xFF;
}
+
private int getNewMark(int order) {
mark = mark % 0xFF + 1;
return (mark << 8) + (order & 0xFF);
@@ -184,37 +193,44 @@
for (int i = 0; i < elementsToAdd.length; i++)
addElement(elementsToAdd[i]);
}
+
public void addElement(IElement element) {
((ElementSet) this.getElementSet(element.getId())).addElement(element);
this.elementCount++;
}
+
public void removeElements(IElement[] elementsToRemove) {
for (int i = 0; i < elementsToRemove.length; i++)
removeElement(elementsToRemove[i]);
}
+
public void removeElement(Object id, Object versionId) {
ElementSet elementSet = (ElementSet) elementSets.get(id);
if (elementSet == null)
return;
elementSet.removeElement(versionId);
}
+
public void removeElement(IElement element) {
ElementSet elementSet = (ElementSet) elementSets.get(element.getId());
if (elementSet == null)
return;
elementSet.removeElement(element);
}
+
public long getElementCount() {
return elementCount;
}
+
public Map getNodes() {
return this.elementSets;
}
+
public List getResolved() {
int mark = getNewMark(RESOLUTION);
Collection elementSets = discoverRoots();
if (elementSets.isEmpty())
- return Collections.EMPTY_LIST;
+ return Collections.EMPTY_LIST;
final List resolved = new LinkedList();
while (!elementSets.isEmpty()) {
Collection nextLevel = new LinkedList();
@@ -222,7 +238,7 @@
ElementSet elementSet = (ElementSet) elementSetsIter.next();
// skip if already visited
if (mark == elementSet.getVisitedMark())
- continue;
+ continue;
Collection resolvedInSet = elementSet.getResolved();
// ignore node (and requiring nodes) if none of its elements are resolved
if (resolvedInSet.isEmpty())
@@ -246,6 +262,7 @@
}
return resolved;
}
+
public String toString() {
StringBuffer result = new StringBuffer();
for (Iterator elementSetsIter = elementSets.values().iterator(); elementSetsIter.hasNext();) {
@@ -260,9 +277,11 @@
}
return result.toString();
}
+
void recordElementStatusChanged(IElement element, int kind) {
this.delta.recordChange(element, kind);
}
+
void recordDependencyChanged(Collection oldResolved, Collection newResolved, Map present) {
for (Iterator oldResolvedIter = oldResolved.iterator(); oldResolvedIter.hasNext();) {
IElement element = (IElement) oldResolvedIter.next();
@@ -275,6 +294,7 @@
this.delta.recordChange(element, IElementChange.RESOLVED);
}
}
+
public IElement getElement(Object id, Object versionId) {
ElementSet elementSet = (ElementSet) elementSets.get(id);
if (elementSet == null)
@@ -285,29 +305,35 @@
public IElement createElement(Object id, Object versionId, IDependency[] dependencies, boolean singleton, Object userObject) {
return new Element(id, versionId, dependencies, singleton, userObject);
}
+
public IDependency createDependency(Object requiredObjectId, IMatchRule satisfactionRule, Object requiredVersionId, boolean optional, Object userObject) {
return new Dependency(requiredObjectId, satisfactionRule, requiredVersionId, optional, userObject);
}
+
public int compare(Object obj1, Object obj2) {
return comparator.compare(obj1, obj2);
}
+
public IResolutionDelta getLastDelta() {
return lastDelta;
}
+
boolean inDebugMode() {
return debug;
}
+
public Collection getRequiringElements(IElement required) {
ElementSet containing = (ElementSet) getElementSet(required.getId());
return containing.getRequiringElements(required.getVersionId());
}
+
public void unresolve(IElement[] elements) {
- int mark = getNewMark(RESOLUTION);
+ int mark = getNewMark(RESOLUTION);
for (int i = 0; i < elements.length; i++) {
ElementSet set = (ElementSet) getElementSet(elements[i].getId());
if (set == null)
return;
- set.unresolve(elements[i],mark);
+ set.unresolve(elements[i], mark);
}
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/internal/dependencies/Element.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/internal/dependencies/Element.java
index 67c6193..a8efb29 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/internal/dependencies/Element.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/internal/dependencies/Element.java
@@ -19,47 +19,57 @@
private IDependency[] dependencies;
private boolean singleton;
private Object userObject;
+
public Element(Object id, Object versionId, IDependency[] dependencies, boolean singleton, Object userObject) {
Assert.isNotNull(id);
Assert.isNotNull(versionId);
Assert.isNotNull(dependencies);
this.id = id;
this.versionId = versionId;
- this.dependencies = dependencies;
+ this.dependencies = dependencies;
this.singleton = singleton;
this.userObject = userObject;
}
+
public Object getId() {
return id;
}
+
public Object getVersionId() {
return versionId;
}
+
public IDependency[] getDependencies() {
return dependencies;
}
+
public IDependency getDependency(Object id) {
for (int i = 0; i < dependencies.length; i++)
if (dependencies[i].getRequiredObjectId().equals(id))
return dependencies[i];
return null;
}
+
public boolean isSingleton() {
return singleton;
}
+
public Object getUserObject() {
return userObject;
}
+
public String toString() {
return this.id + "_" + this.versionId; //$NON-NLS-1$
}
+
public boolean equals(Object obj) {
if (!(obj instanceof Element))
return false;
Element other = (Element) obj;
return (other.userObject != null && other.userObject.equals(this.userObject)) || (this.id.equals(other.id) && this.versionId.equals(other.versionId) && other.userObject == null && this.userObject == null);
}
+
public int hashCode() {
return (id.hashCode() << 16) | (versionId.hashCode() & 0xFFFF);
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/internal/dependencies/ElementChange.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/internal/dependencies/ElementChange.java
index f2866e9..2d12f95 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/internal/dependencies/ElementChange.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/internal/dependencies/ElementChange.java
@@ -17,19 +17,24 @@
class ElementChange implements IElementChange {
private IElement element;
private int kind;
+
ElementChange(IElement element, int kind) {
this.element = element;
this.kind = kind;
}
+
public Object getVersionId() {
return element.getVersionId();
}
+
public int getKind() {
return kind;
}
+
public IElement getElement() {
return element;
}
+
public String toString() {
StringBuffer result = new StringBuffer();
result.append(element.getId());
@@ -40,24 +45,26 @@
result.append(')');
return result.toString();
}
+
private String getStatusName(int status) {
StringBuffer statusStr = new StringBuffer();
if ((status & ADDED) != 0)
statusStr.append("ADDED|");
if ((status & REMOVED) != 0)
- statusStr.append("REMOVED|");
+ statusStr.append("REMOVED|");
if ((status & RESOLVED) != 0)
statusStr.append("RESOLVED|");
if ((status & UNRESOLVED) != 0)
statusStr.append("UNRESOLVED|");
if ((status & LINKAGE_CHANGED) != 0)
- statusStr.append("LINKAGE_CHANGED|");
+ statusStr.append("LINKAGE_CHANGED|");
if (statusStr.length() == 0)
statusStr.append("UNKNOWN");
else
statusStr.deleteCharAt(statusStr.length() - 1);
return statusStr.toString();
}
+
void setKind(int kind) {
this.kind = kind;
}
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/internal/dependencies/ElementSet.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/internal/dependencies/ElementSet.java
index 4e73112..abf2c25 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/internal/dependencies/ElementSet.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/internal/dependencies/ElementSet.java
@@ -31,6 +31,7 @@
private Set selected;
private Set resolved;
private Map dependencyCounters;
+
public ElementSet(Object id, DependencySystem system) {
this.id = id;
this.system = system;
@@ -43,13 +44,16 @@
this.requiring = new LinkedList();
this.dependencyCounters = new HashMap();
}
+
public IDependencySystem getSystem() {
return system;
}
+
/** @return false if there is at least one version that does not allow concurrency. */
public boolean allowsConcurrency() {
return singletonsCount == 0;
}
+
void addElement(IElement element) {
if (this.available.containsKey(element.getVersionId()))
return;
@@ -62,34 +66,40 @@
this.singletonsCount++;
system.recordElementStatusChanged(element, IElementChange.ADDED);
}
+
void removeElement(IElement element) {
removeElement(element.getVersionId());
}
+
void removeElement(Object versionId) {
- IElement toRemove = (IElement) this.available.remove(versionId);
+ IElement toRemove = (IElement) this.available.remove(versionId);
if (toRemove == null)
return;
this.markNeedingUpdate(DependencySystem.SATISFACTION);
- IDependency[] dependencies = toRemove.getDependencies();
+ IDependency[] dependencies = toRemove.getDependencies();
for (int i = 0; i < dependencies.length; i++)
removeRequired(dependencies[i].getRequiredObjectId());
// if does not allow concurrency, decrement preventingConcurrencyCount
if (toRemove.isSingleton())
this.singletonsCount--;
int change = IElementChange.REMOVED;
-// if (resolved.contains(toRemove))
-// change |= IElementChange.UNRESOLVED;
+ // if (resolved.contains(toRemove))
+ // change |= IElementChange.UNRESOLVED;
system.recordElementStatusChanged(toRemove, change);
}
+
public Object getId() {
return id;
}
+
public boolean isRoot() {
return required.isEmpty();
}
+
public Set getAvailable() {
return new HashSet(available.values());
}
+
public Collection getRequired() {
return required;
}
@@ -101,9 +111,11 @@
public Set getResolved() {
return resolved;
}
+
public void resolveDependency(IElement dependent, IDependency dependency, Object resolvedVersionId) {
dependency.resolve(resolvedVersionId, this.visitedMark);
}
+
public void setResolved(Set newResolved) {
this.setNeedingUpdate(DependencySystem.UP_TO_DATE);
@@ -125,9 +137,11 @@
this.resolved = Collections.unmodifiableSet(newResolved);
system.recordDependencyChanged(oldResolved, newResolved, available);
}
+
public Set getSelected() {
return selected;
}
+
public void setSelected(Set selected) {
this.setNeedingUpdate(DependencySystem.RESOLUTION);
if (selected.equals(this.selected))
@@ -135,9 +149,11 @@
this.setChangedMark(visitedMark);
this.selected = Collections.unmodifiableSet(selected);
}
+
public Set getSatisfied() {
return satisfied;
}
+
public void setSatisfied(Set satisfied) {
this.setNeedingUpdate(DependencySystem.SELECTION);
if (satisfied.equals(this.satisfied))
@@ -145,18 +161,23 @@
this.setChangedMark(visitedMark);
this.satisfied = Collections.unmodifiableSet(satisfied);
}
+
public String toString() {
return this.id + ": " + available; //$NON-NLS-1$
}
+
public boolean equals(Object elementSet) {
return ((IElementSet) elementSet).getId().equals(this.id);
}
+
public int hashCode() {
return this.id.hashCode();
}
+
class DependencyCounter {
int value;
}
+
private void addRequired(Object requiredId) {
this.setNeedingUpdate(DependencySystem.SATISFACTION);
ElementSet requiredNode = (ElementSet) system.getElementSet(requiredId);
@@ -166,10 +187,11 @@
// links requiring and required element sets in both directions
this.required.add(requiredNode);
requiredNode.requiring.add(this);
- requiredNode.setNeedingUpdate(Math.min(requiredNode.getNeedingUpdate(),DependencySystem.SELECTION));
+ requiredNode.setNeedingUpdate(Math.min(requiredNode.getNeedingUpdate(), DependencySystem.SELECTION));
}
counter.value++;
}
+
private void removeRequired(Object requiredId) {
ElementSet requiredNode = (ElementSet) system.getElementSet(requiredId);
DependencyCounter counter = (DependencyCounter) this.dependencyCounters.get(requiredId);
@@ -187,33 +209,43 @@
requiredNode.setNeedingUpdate(DependencySystem.SELECTION);
}
}
+
int getRequiringCount() {
return requiring.size();
}
+
int getElementCount() {
return available.size();
}
+
int getVisitedMark() {
return visitedMark;
}
+
void setVisitedMark(int mark) {
this.visitedMark = mark;
}
+
int getChangedMark() {
return changedMark;
}
+
private void setChangedMark(int mark) {
this.changedMark = mark;
}
+
void markNeedingUpdate(int order) {
setNeedingUpdate(order);
}
+
boolean isNeedingUpdate(int order) {
return getNeedingUpdate() <= order;
}
+
IElement getElement(Object versionId) {
return (IElement) this.available.get(versionId);
}
+
public Collection getRequiringElements(Object versionId) {
Collection result = new LinkedList();
for (Iterator requiringSetsIter = requiring.iterator(); requiringSetsIter.hasNext();) {
@@ -221,12 +253,13 @@
for (Iterator iter = requiringSet.getResolved().iterator(); iter.hasNext();) {
Element element = (Element) iter.next();
IDependency requisite = element.getDependency(this.id);
- if (requisite != null && versionId.equals(requisite.getResolvedVersionId()))
+ if (requisite != null && versionId.equals(requisite.getResolvedVersionId()))
result.add(element);
}
}
return result;
}
+
public void unresolve(IElement element, int mark) {
setVisitedMark(mark);
if (!resolved.contains(element))
@@ -234,18 +267,20 @@
Set newResolved = new HashSet(resolved);
newResolved.remove(element);
resolved = Collections.unmodifiableSet(newResolved);
-
+
IDependency[] dependencies = element.getDependencies();
// unresolved dependencies
for (int i = 0; i < dependencies.length; i++)
- resolveDependency(element,dependencies[i],null);
- setChangedMark(mark);
+ resolveDependency(element, dependencies[i], null);
+ setChangedMark(mark);
setNeedingUpdate(DependencySystem.SATISFACTION);
}
+
private void setNeedingUpdate(int needingUpdate) {
this.needingUpdate = needingUpdate;
}
+
private int getNeedingUpdate() {
return needingUpdate;
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/internal/dependencies/IElementSetVisitor.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/internal/dependencies/IElementSetVisitor.java
index 5175f7a..60e1473 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/internal/dependencies/IElementSetVisitor.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/internal/dependencies/IElementSetVisitor.java
@@ -18,7 +18,10 @@
*/
public interface IElementSetVisitor {
public int getOrder();
+
public abstract void update(ElementSet node);
+
public abstract Collection getAncestors(ElementSet node);
- public abstract Collection getDescendants(ElementSet node);
-}
+
+ public abstract Collection getDescendants(ElementSet node);
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/internal/dependencies/ResolutionDelta.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/internal/dependencies/ResolutionDelta.java
index 6764b7f..d06b170 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/internal/dependencies/ResolutionDelta.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/internal/dependencies/ResolutionDelta.java
@@ -18,34 +18,42 @@
public class ResolutionDelta implements IResolutionDelta {
private Map changes;
+
ResolutionDelta() {
this.changes = new HashMap();
}
+
public IElementChange[] getAllChanges() {
return (IElementChange[]) changes.values().toArray(new IElementChange[changes.size()]);
}
+
public IElementChange getChange(Object id, Object versionId, Object userObject) {
return (IElementChange) changes.get(new ElementIdentifier(id, versionId, userObject));
}
+
class ElementIdentifier {
private Object id;
private Object versionId;
private Object userObject;
+
ElementIdentifier(Object id, Object versionId, Object userObject) {
this.id = id;
this.versionId = versionId;
this.userObject = userObject;
}
+
public int hashCode() {
return (id.hashCode() << 16) | (versionId.hashCode() & 0xFFFF);
}
+
public boolean equals(Object anObject) {
if (!(anObject instanceof ElementIdentifier))
return false;
ElementIdentifier change = (ElementIdentifier) anObject;
- return (change.userObject != null && change.userObject.equals(this.userObject)) || (this.id.equals(change.id) && this.versionId.equals(change.versionId) && change.userObject == null && this.userObject == null);
+ return (change.userObject != null && change.userObject.equals(this.userObject)) || (this.id.equals(change.id) && this.versionId.equals(change.versionId) && change.userObject == null && this.userObject == null);
}
}
+
/**
* Record a new status change.
*/
@@ -58,7 +66,7 @@
return;
}
// a removal cancels any existing addition
- if (kind == IElementChange.REMOVED)
+ if (kind == IElementChange.REMOVED)
if (existingChange.getKind() == IElementChange.ADDED) {
// if it was just an addition, just forget the change
this.changes.remove(new ElementIdentifier(element.getId(), element.getVersionId(), element.getUserObject()));
@@ -71,7 +79,8 @@
// otherwise, just update the new status for the existing change object
existingChange.setKind(existingChange.getKind() | kind);
}
+
public String toString() {
return changes.values().toString();
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/internal/dependencies/ResolutionVisitor.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/internal/dependencies/ResolutionVisitor.java
index 7ce30c2..bba3e13 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/internal/dependencies/ResolutionVisitor.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/internal/dependencies/ResolutionVisitor.java
@@ -17,18 +17,23 @@
public class ResolutionVisitor implements IElementSetVisitor {
private int order;
+
public ResolutionVisitor(int order) {
this.order = order;
}
+
public int getOrder() {
return order;
}
+
public Collection getAncestors(ElementSet elementSet) {
return elementSet.getRequired();
}
+
public Collection getDescendants(ElementSet elementSet) {
return elementSet.getRequiring();
}
+
public void update(ElementSet elementSet) {
// if there are no pre-requisites, all selected versions are resolved
if (elementSet.getRequired().isEmpty()) {
@@ -63,4 +68,4 @@
}
elementSet.setResolved(resolved);
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/internal/dependencies/SatisfactionVisitor.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/internal/dependencies/SatisfactionVisitor.java
index 7348a59..35af139 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/internal/dependencies/SatisfactionVisitor.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/internal/dependencies/SatisfactionVisitor.java
@@ -17,18 +17,23 @@
public class SatisfactionVisitor implements IElementSetVisitor {
private int order;
+
public SatisfactionVisitor(int order) {
this.order = order;
}
+
public int getOrder() {
return order;
}
+
public Collection getAncestors(ElementSet elementSet) {
return elementSet.getRequired();
}
+
public Collection getDescendants(ElementSet elementSet) {
return elementSet.getRequiring();
}
+
public void update(ElementSet elementSet) {
// if there are no pre-requisites, all available versions are satisfied
if (elementSet.getRequired().isEmpty()) {
@@ -68,4 +73,4 @@
elementSet.setSatisfied(satisfied);
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/internal/dependencies/SelectionVisitor.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/internal/dependencies/SelectionVisitor.java
index 0371168..6c67cee 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/internal/dependencies/SelectionVisitor.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/internal/dependencies/SelectionVisitor.java
@@ -23,19 +23,24 @@
public class SelectionVisitor implements IElementSetVisitor {
private int order;
private ISelectionPolicy selectionPolicy;
+
public SelectionVisitor(int order, ISelectionPolicy selectionPolicy) {
this.order = order;
this.selectionPolicy = selectionPolicy;
}
+
public int getOrder() {
return order;
}
+
public final Collection getAncestors(ElementSet elementSet) {
return elementSet.getRequiring();
}
+
public final Collection getDescendants(ElementSet elementSet) {
return elementSet.getRequired();
}
+
public void update(ElementSet elementSet) {
// no versions satisfied, so no versions selected
@@ -53,4 +58,4 @@
elementSet.setSelected(selected == null ? Collections.EMPTY_SET : Collections.singleton(selected));
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/internal/dependencies/SimpleSelectionPolicy.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/internal/dependencies/SimpleSelectionPolicy.java
index f319ae6..bea4e5a 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/internal/dependencies/SimpleSelectionPolicy.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/core/internal/dependencies/SimpleSelectionPolicy.java
@@ -23,7 +23,8 @@
// all satisfied are selected
return new HashSet(elementSet.getSatisfied());
}
- public IElement selectSingle(IElementSet elementSet) {
+
+ public IElement selectSingle(IElementSet elementSet) {
// just pick the satisfied element with the highest version
IElement highest = null;
for (Iterator satisfiedIter = elementSet.getSatisfied().iterator(); satisfiedIter.hasNext();) {
@@ -33,4 +34,4 @@
}
return highest;
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/BundleDeltaImpl.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/BundleDeltaImpl.java
index 0ba0425..83a9a1a 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/BundleDeltaImpl.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/BundleDeltaImpl.java
@@ -19,40 +19,46 @@
private int type;
public BundleDeltaImpl(BundleDescription bundleDescription) {
- this(bundleDescription,0);
+ this(bundleDescription, 0);
}
+
public BundleDeltaImpl(BundleDescription bundleDescription, int type) {
this.bundleDescription = bundleDescription;
this.type = type;
}
+
public BundleDescription getBundle() {
return bundleDescription;
}
+
public int getType() {
return type;
- }
+ }
+
public void setType(int type) {
this.type = type;
}
+
public String toString() {
return bundleDescription.getUniqueId() + '_' + bundleDescription.getVersion() + " (" + toTypeString(type) + ")";
}
+
private static String toTypeString(int type) {
StringBuffer typeStr = new StringBuffer();
- if ((type & BundleDelta.ADDED) != 0)
+ if ((type & BundleDelta.ADDED) != 0)
typeStr.append("ADDED,");
- if ((type & BundleDelta.REMOVED) != 0)
+ if ((type & BundleDelta.REMOVED) != 0)
typeStr.append("REMOVED,");
- if ((type & BundleDelta.RESOLVED) != 0)
+ if ((type & BundleDelta.RESOLVED) != 0)
typeStr.append("RESOLVED,");
- if ((type & BundleDelta.UNRESOLVED) != 0)
+ if ((type & BundleDelta.UNRESOLVED) != 0)
typeStr.append("UNRESOLVED,");
- if ((type & BundleDelta.LINKAGE_CHANGED) != 0)
+ if ((type & BundleDelta.LINKAGE_CHANGED) != 0)
typeStr.append("LINKAGE_CHANGED,");
- if ((type & BundleDelta.UPDATED) != 0)
+ if ((type & BundleDelta.UPDATED) != 0)
typeStr.append("UPDATED,");
if (typeStr.length() > 0)
typeStr.deleteCharAt(typeStr.length() - 1);
return typeStr.toString();
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/BundleDescriptionImpl.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/BundleDescriptionImpl.java
index ec5022b..614596f 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/BundleDescriptionImpl.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/BundleDescriptionImpl.java
@@ -16,7 +16,7 @@
import org.osgi.framework.Bundle;
public class BundleDescriptionImpl implements BundleDescription, KeyedElement {
- private long bundleId = -1;
+ private long bundleId = -1;
private String uniqueId; // TODO change to symbolicName
private String location;
private int state;
@@ -26,92 +26,114 @@
private String[] providedPackages;
private BundleSpecification[] requiredBundles;
private boolean singleton;
- private State containingState;
- private Object userObject;
-
+ private State containingState;
+ private Object userObject;
+
public BundleDescriptionImpl() {
//
}
+
public String getLocation() {
return location;
}
+
public boolean isResolved() {
return (state & Bundle.RESOLVED) != 0;
}
+
public State getContainingState() {
return containingState;
}
+
public int getState() {
return state;
}
+
public Version getVersion() {
return version;
}
+
public BundleDescription[] getFragments() {
if (host != null)
return new BundleDescription[0];
return ((StateImpl) containingState).getFragments(this);
}
- public Dictionary getManifest() { //TODO Do we want to keep this method has part of the API?
+
+ public Dictionary getManifest() { //TODO Do we want to keep this method has part of the API?
// TODO Auto-generated method stub
return null;
}
+
public HostSpecification getHost() {
return host;
}
- public HostSpecification[] getHosts() {
+
+ public HostSpecification[] getHosts() {
return host == null ? new HostSpecification[0] : new HostSpecification[] {host};
- }
+ }
+
public void setContainingState(State value) {
containingState = value;
}
+
public void setHost(HostSpecification host) {
this.host = host;
- if (host != null)
+ if (host != null)
((VersionConstraintImpl) host).setBundle(this);
}
+
public void setLocation(String location) {
this.location = location;
}
+
public void setPackages(PackageSpecification[] packages) {
this.packages = packages;
if (packages != null)
for (int i = 0; i < packages.length; i++)
((VersionConstraintImpl) packages[i]).setBundle(this);
}
+
public void setProvidedPackages(String[] providedPackages) {
this.providedPackages = providedPackages;
}
+
public void setRequiredBundles(BundleSpecification[] requiredBundles) {
this.requiredBundles = requiredBundles;
if (requiredBundles != null)
for (int i = 0; i < requiredBundles.length; i++)
- ((VersionConstraintImpl) requiredBundles[i]).setBundle(this);
+ ((VersionConstraintImpl) requiredBundles[i]).setBundle(this);
}
+
public void setState(int state) {
this.state = state;
}
+
public void setUniqueId(String uniqueId) {
this.uniqueId = uniqueId;
}
+
public void setVersion(Version version) {
this.version = version;
}
+
public PackageSpecification[] getPackages() {
if (packages == null)
return new PackageSpecification[0];
return packages;
}
+
public String[] getProvidedPackages() {
if (providedPackages == null)
return new String[0];
return providedPackages;
}
+
public BundleSpecification[] getRequiredBundles() {
if (requiredBundles == null)
return new BundleSpecification[0];
return requiredBundles;
}
+
public BundleSpecification getRequiredBundle(String name) {
if (requiredBundles == null)
return null;
@@ -120,9 +142,11 @@
return requiredBundles[i];
return null;
}
+
public String getUniqueId() {
return uniqueId;
}
+
public PackageSpecification getPackage(String name) {
if (packages == null)
return null;
@@ -131,48 +155,61 @@
return packages[i];
return null;
}
+
public String toString() {
return getUniqueId() + "_" + getVersion(); //$NON-NLS-1$
}
+
public long getBundleId() {
return bundleId;
}
+
public void setBundleId(long bundleId) {
this.bundleId = bundleId;
}
+
public Object getKey() {
return new Long(bundleId);
}
+
public boolean compare(KeyedElement other) {
if (!(other instanceof BundleDescriptionImpl))
return false;
BundleDescriptionImpl otherBundleDescription = (BundleDescriptionImpl) other;
return bundleId == otherBundleDescription.bundleId;
}
+
public int getKeyHashCode() {
return (int) (bundleId % Integer.MAX_VALUE);
}
+
// TODO: to remove before we freeze
public VersionConstraint[] getUnsatisfiedConstraints() {
return StateHelperImpl.getInstance().getUnsatisfiedConstraints(this);
}
+
public boolean isSingleton() {
return singleton;
}
+
public void setSingleton(boolean singleton) {
this.singleton = singleton;
}
+
public Object getUserObject() {
return userObject;
}
+
public void setUserObject(Object userObject) {
this.userObject = userObject;
}
- public int hashCode() {
+
+ public int hashCode() {
if (uniqueId == null)
return (int) (bundleId % Integer.MAX_VALUE);
return (int) ((bundleId * (uniqueId.hashCode())) % Integer.MAX_VALUE);
}
+
public boolean equals(Object object) {
if (!(object instanceof BundleDescription))
return false;
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/BundleInstaller.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/BundleInstaller.java
index d6bd3ba..503f903 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/BundleInstaller.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/BundleInstaller.java
@@ -22,6 +22,8 @@
*/
public interface BundleInstaller {
public void installBundle(BundleDescription toInstall) throws BundleException;
+
public void uninstallBundle(BundleDescription toUninstall) throws BundleException;
+
public void updateBundle(BundleDescription toRefresh) throws BundleException;
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/BundleSpecificationImpl.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/BundleSpecificationImpl.java
index ed5fe83..b3950c9 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/BundleSpecificationImpl.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/BundleSpecificationImpl.java
@@ -15,16 +15,20 @@
public class BundleSpecificationImpl extends VersionConstraintImpl implements BundleSpecification {
private boolean exported;
private boolean optional;
+
public void setExported(boolean exported) {
this.exported = exported;
}
+
public void setOptional(boolean optional) {
this.optional = optional;
}
+
public boolean isExported() {
return exported;
}
+
public boolean isOptional() {
return optional;
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/Eclipse21SelectionPolicy.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/Eclipse21SelectionPolicy.java
index 7b845d1..a9e4551 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/Eclipse21SelectionPolicy.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/Eclipse21SelectionPolicy.java
@@ -34,7 +34,7 @@
IElement satisfiedVersion = (IElement) satisfiedIter.next();
boolean satisfiesDependency = requiringSelectedVersionDependency.getMatchRule().isSatisfied(requiringSelectedVersionDependency.getRequiredVersionId(), satisfiedVersion.getVersionId());
if (satisfiesDependency) {
- boolean betterThanBest = bestVersion == null || elementSet.getSystem().compare(satisfiedVersion.getVersionId(),bestVersion.getVersionId()) > 0;
+ boolean betterThanBest = bestVersion == null || elementSet.getSystem().compare(satisfiedVersion.getVersionId(), bestVersion.getVersionId()) > 0;
if (betterThanBest)
bestVersion = satisfiedVersion;
}
@@ -48,14 +48,15 @@
IElement bestVersion = null;
for (Iterator satisfiedIter = elementSet.getSatisfied().iterator(); satisfiedIter.hasNext();) {
IElement satisfiedVersion = (IElement) satisfiedIter.next();
- boolean betterThanBest = bestVersion == null || elementSet.getSystem().compare(satisfiedVersion.getVersionId(),bestVersion.getVersionId()) > 0;
+ boolean betterThanBest = bestVersion == null || elementSet.getSystem().compare(satisfiedVersion.getVersionId(), bestVersion.getVersionId()) > 0;
if (betterThanBest)
bestVersion = satisfiedVersion;
}
selected = Collections.singleton(bestVersion);
- }
+ }
return selected;
}
+
public IElement selectSingle(IElementSet elementSet) {
// none of its versions are required by other element sets - so just pick the highest
if (elementSet.getRequiring().isEmpty()) {
@@ -100,8 +101,7 @@
highestStatus = status;
}
}
- return highest;
- }
-
+ return highest;
+ }
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/Eclipse30SelectionPolicy.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/Eclipse30SelectionPolicy.java
index e3f363f..1968d34 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/Eclipse30SelectionPolicy.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/Eclipse30SelectionPolicy.java
@@ -24,7 +24,7 @@
Set selected = new HashSet();
// pre-select all elements that were previously resolved and are satisfied
Collection previouslyResolvedSet = elementSet.getResolved();
- for (Iterator iter = previouslyResolvedSet.iterator(); iter.hasNext(); ) {
+ for (Iterator iter = previouslyResolvedSet.iterator(); iter.hasNext();) {
IElement previouslyResolved = (IElement) iter.next();
// if the previously resolved element is satisfied, select it
if (elementSet.getSatisfied().contains(previouslyResolved))
@@ -47,7 +47,7 @@
IElement satisfiedVersion = (IElement) satisfiedIter.next();
boolean satisfiesDependency = requiringSelectedVersionDependency.getMatchRule().isSatisfied(requiringSelectedVersionDependency.getRequiredVersionId(), satisfiedVersion.getVersionId());
if (satisfiesDependency) {
- boolean betterThanBest = bestVersion == null || elementSet.getSystem().compare(satisfiedVersion.getVersionId(),bestVersion.getVersionId()) > 0;
+ boolean betterThanBest = bestVersion == null || elementSet.getSystem().compare(satisfiedVersion.getVersionId(), bestVersion.getVersionId()) > 0;
if (betterThanBest)
bestVersion = satisfiedVersion;
}
@@ -61,14 +61,15 @@
IElement bestVersion = null;
for (Iterator satisfiedIter = elementSet.getSatisfied().iterator(); satisfiedIter.hasNext();) {
IElement satisfiedVersion = (IElement) satisfiedIter.next();
- boolean betterThanBest = bestVersion == null || elementSet.getSystem().compare(satisfiedVersion.getVersionId(),bestVersion.getVersionId()) > 0;
+ boolean betterThanBest = bestVersion == null || elementSet.getSystem().compare(satisfiedVersion.getVersionId(), bestVersion.getVersionId()) > 0;
if (betterThanBest)
bestVersion = satisfiedVersion;
}
selected = Collections.singleton(bestVersion);
- }
+ }
return selected;
}
+
public IElement selectSingle(IElementSet elementSet) {
Collection previouslyResolvedSet = elementSet.getResolved();
// we already have one element resolved
@@ -79,7 +80,7 @@
if (elementSet.getSatisfied().contains(previouslyResolved))
return previouslyResolved;
}
-
+
// none of its versions are required by other element sets - so just pick the highest
if (elementSet.getRequiring().isEmpty()) {
// otherwise, pick the highest version
@@ -123,8 +124,7 @@
highestStatus = status;
}
}
- return highest;
- }
-
+ return highest;
+ }
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/HostSpecificationImpl.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/HostSpecificationImpl.java
index 5081d9d..8cf272b 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/HostSpecificationImpl.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/HostSpecificationImpl.java
@@ -16,18 +16,22 @@
public class HostSpecificationImpl extends VersionConstraintImpl implements HostSpecification {
private boolean reloadHost;
+
public boolean reloadHost() {
return reloadHost;
}
+
public void setReloadHost(boolean reloadHost) {
this.reloadHost = reloadHost;
}
+
public boolean isOptional() {
// a fragment cannot exist without its master
return false;
}
+
public BundleDescription[] getSuppliers() {
BundleDescription supplier = getSupplier();
return (supplier == null) ? new BundleDescription[0] : new BundleDescription[] {supplier};
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/PackageSpecificationImpl.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/PackageSpecificationImpl.java
index c0a681d..06bc4e9 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/PackageSpecificationImpl.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/PackageSpecificationImpl.java
@@ -14,13 +14,16 @@
public class PackageSpecificationImpl extends VersionConstraintImpl implements PackageSpecification {
private boolean export;
+
public boolean isExported() {
return export;
}
+
public void setExport(boolean export) {
this.export = export;
}
+
public String toString() {
- return super.toString() + " (" + (export ? "exp" : " imp") + ")"; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ return super.toString() + " (" + (export ? "exp" : " imp") + ")"; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/ReadOnlyState.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/ReadOnlyState.java
index c8a6b9b..5293c31 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/ReadOnlyState.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/ReadOnlyState.java
@@ -14,85 +14,112 @@
public class ReadOnlyState implements State {
private State target;
+
public ReadOnlyState(State target) {
this.target = target;
}
+
public boolean addBundle(BundleDescription description) {
throw new UnsupportedOperationException();
}
+
public boolean updateBundle(BundleDescription newDescription) {
throw new UnsupportedOperationException();
}
+
public BundleDescription removeBundle(long bundleId) {
throw new UnsupportedOperationException();
}
+
public boolean removeBundle(BundleDescription bundle) {
throw new UnsupportedOperationException();
- }
+ }
+
public StateChangeEvent compare(State state) {
return target.compare(state);
}
+
public StateDelta getChanges() {
return target.getChanges();
}
+
public BundleDescription[] getBundles() {
return target.getBundles();
}
+
public BundleDescription getBundle(long id) {
return target.getBundle(id);
}
+
public BundleDescription getBundle(String symbolicName, Version version) {
return target.getBundle(symbolicName, version);
}
+
public long getTimeStamp() {
return target.getTimeStamp();
}
+
public boolean isResolved() {
return target.isResolved();
}
+
public void resolveConstraint(VersionConstraint constraint, Version actualVersion, BundleDescription supplier) {
throw new UnsupportedOperationException();
}
+
public void resolveBundle(BundleDescription bundle, int status) {
throw new UnsupportedOperationException();
}
+
public Resolver getResolver() {
return null;
}
+
public void setResolver(Resolver value) {
throw new UnsupportedOperationException();
}
+
public StateDelta resolve(boolean incremental) {
throw new UnsupportedOperationException();
}
+
public StateDelta resolve() {
throw new UnsupportedOperationException();
}
+
public StateDelta resolve(BundleDescription[] discard) {
throw new UnsupportedOperationException();
}
+
public void setOverrides(Object value) {
throw new UnsupportedOperationException();
}
+
public BundleDescription[] getResolvedBundles() {
return target.getResolvedBundles();
}
+
public void addStateChangeListener(StateChangeListener listener, int flags) {
throw new UnsupportedOperationException();
}
+
public void removeStateChangeListener(StateChangeListener listener) {
throw new UnsupportedOperationException();
}
+
public boolean isEmpty() {
return target.isEmpty();
}
+
public PackageSpecification[] getExportedPackages() {
return target.getExportedPackages();
}
+
public BundleDescription[] getBundles(String symbolicName) {
return target.getBundles(symbolicName);
}
+
public StateObjectFactory getFactory() {
return target.getFactory();
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/ResolverHelper.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/ResolverHelper.java
index 29f899e..f3696e7 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/ResolverHelper.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/ResolverHelper.java
@@ -9,6 +9,7 @@
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.osgi.internal.resolver;
+
import java.util.*;
import org.eclipse.core.dependencies.*;
import org.eclipse.core.internal.dependencies.DependencySystem;
@@ -26,6 +27,7 @@
return v1.isGreaterThan(v2) ? 1 : v1.matchQualifier(v2) ? 0 : -1;
}
}
+
private static final IMatchRule MAJOR = new MatchMajorRule();
private static final IMatchRule MINOR = new MatchMinorRule();
private static final IMatchRule MICRO = new MatchMicroRule();
@@ -49,65 +51,80 @@
}
throw new IllegalArgumentException("match byte: " + b); //$NON-NLS-1$
}
+
private final static class UnsatisfiableRule implements IMatchRule {
public boolean isSatisfied(Object required, Object available) {
return false;
}
+
public String toString() {
return "unsatisfiable"; //$NON-NLS-1$
}
}
+
private final static class MatchQualifierRule implements IMatchRule {
public boolean isSatisfied(Object required, Object available) {
return ((Version) available).matchQualifier((Version) required);
}
+
public String toString() {
return Constants.VERSION_MATCH_QUALIFIER;
}
}
+
private final static class MatchMajorRule implements IMatchRule {
public boolean isSatisfied(Object required, Object available) {
return ((Version) available).matchMajor((Version) required);
}
+
public String toString() {
return Constants.VERSION_MATCH_MAJOR;
}
}
+
private final static class MatchGreaterOrEqualRule implements IMatchRule {
public boolean isSatisfied(Object required, Object available) {
return ((Version) available).matchGreaterOrEqualTo((Version) required);
}
+
public String toString() {
return Constants.VERSION_MATCH_GREATERTHANOREQUAL;
}
}
+
private final static class MatchMinorRule implements IMatchRule {
public boolean isSatisfied(Object required, Object available) {
return ((Version) available).matchMinor((Version) required);
}
+
public String toString() {
return Constants.VERSION_MATCH_MINOR;
}
}
+
private final static class MatchMicroRule implements IMatchRule {
public boolean isSatisfied(Object required, Object available) {
return ((Version) available).matchMicro((Version) required);
}
+
public String toString() {
return Constants.VERSION_MATCH_MICRO;
}
}
+
public static IElement createElement(BundleDescription bundleDescription, IDependencySystem system) {
String uniqueId = getUniqueId(bundleDescription);
Version version = getVersion(bundleDescription);
return system.createElement(uniqueId, version, createPrerequisites(bundleDescription, system), bundleDescription.isSingleton(), bundleDescription);
}
+
private static Version getVersion(BundleDescription bundleDescription) {
Version version = bundleDescription.getVersion();
if (version == null)
version = Version.emptyVersion;
return version;
}
+
private static String getUniqueId(BundleDescription bundleDescription) {
String uniqueId = bundleDescription.getUniqueId();
if (uniqueId == null)
@@ -115,6 +132,7 @@
uniqueId = Long.toString(bundleDescription.getBundleId());
return uniqueId;
}
+
private static IDependency[] createPrerequisites(BundleDescription bundleDesc, IDependencySystem system) {
BundleSpecification[] required = bundleDesc.getRequiredBundles();
HostSpecification host = bundleDesc.getHost();
@@ -132,6 +150,7 @@
prereqs.add(createPrerequisite(system, host));
return (IDependency[]) prereqs.toArray(new IDependency[prereqs.size()]);
}
+
private static IDependency createPrerequisite(IDependencySystem system, VersionConstraint constraint) {
boolean optional = (constraint instanceof BundleSpecification) && ((BundleSpecification) constraint).isOptional();
Version requiredVersion = constraint.getVersionSpecification();
@@ -139,9 +158,11 @@
requiredVersion = null;
return system.createDependency(constraint.getName(), getMatchRule(constraint.getMatchingRule()), requiredVersion, optional, constraint);
}
+
public static IDependencySystem createDependencySystem(ISelectionPolicy policy) {
return new DependencySystem(new ResolverHelper.BundleVersionComparator(), policy);
}
+
public static IDependencySystem buildDependencySystem(State state, ISelectionPolicy selectionPolicy) {
IDependencySystem dependencySystem = createDependencySystem(selectionPolicy);
BundleDescription[] bundles = state.getBundles();
@@ -149,17 +170,21 @@
dependencySystem.addElement(ResolverHelper.createElement(bundles[i], dependencySystem));
return dependencySystem;
}
+
public static void remove(BundleDescription description, IDependencySystem system) {
system.removeElement(getUniqueId(description), getVersion(description));
}
+
public static void add(BundleDescription description, IDependencySystem system) {
system.addElement(createElement(description, system));
}
+
public static void unresolve(BundleDescription bundle, IDependencySystem system) {
IElement element = system.getElement(getUniqueId(bundle), getVersion(bundle));
if (element != null)
- system.unresolve(new IElement[]{element});
+ system.unresolve(new IElement[] {element});
}
+
public static void update(BundleDescription newDescription, BundleDescription existing, IDependencySystem system) {
system.removeElement(getUniqueId(existing), getVersion(existing));
system.addElement(createElement(newDescription, system));
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/ResolverImpl.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/ResolverImpl.java
index 8931498..f02307e 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/ResolverImpl.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/ResolverImpl.java
@@ -19,12 +19,14 @@
public class ResolverImpl implements Resolver {
private State state;
private IDependencySystem dependencies;
+
public void resolve(BundleDescription[] reRefresh) {
// unresolving the given bundles will force them to be re-resolved
for (int i = 0; i < reRefresh.length; i++)
unresolveBundle(reRefresh[i]);
resolve();
}
+
/**
* TODO: need to devise a way to report problems (a la IStatus)
*/
@@ -44,6 +46,7 @@
processInnerDelta(delta);
resolvePackages();
}
+
public void setState(State newState) {
// to avoid infinite (mutual) recursion
if (state == newState)
@@ -60,6 +63,7 @@
// forget any dependency state created before
flush();
}
+
/*
* Applies changes in the constraint system to the state object.
*/
@@ -68,7 +72,7 @@
IElementChange[] changes = delta.getAllChanges();
for (int i = 0; i < changes.length; i++) {
IElement element = changes[i].getElement();
- BundleDescription bundle = (BundleDescription) element.getUserObject();
+ BundleDescription bundle = (BundleDescription) element.getUserObject();
int kind = changes[i].getKind();
if ((kind & IElementChange.RESOLVED) != 0) {
state.resolveBundle(bundle, Bundle.RESOLVED);
@@ -79,6 +83,7 @@
resolveConstraints(element, bundle);
}
}
+
private void resolveConstraints(IElement element, BundleDescription bundle) {
// tells the state that some of the constraints have
// changed
@@ -93,27 +98,33 @@
state.resolveConstraint(constraint, actualVersion, supplier);
}
}
+
public void bundleAdded(BundleDescription bundle) {
if (dependencies == null)
return;
ResolverHelper.add(bundle, dependencies);
}
+
public void bundleRemoved(BundleDescription bundle) {
if (dependencies == null)
return;
ResolverHelper.remove(bundle, dependencies);
}
+
public void bundleUpdated(BundleDescription newDescription, BundleDescription existingDescription) {
if (dependencies == null)
return;
ResolverHelper.update(newDescription, existingDescription, dependencies);
}
+
public State getState() {
return state;
}
+
public void flush() {
dependencies = null;
}
+
/*
* Ensures that all currently resolved bundles have their import-package
* clauses satisfied.
@@ -170,6 +181,7 @@
/* return false if a at least one bundle was unresolved during this */
return tries > 1;
}
+
/*
* Unresolves a bundle and all bundles that require it.
*/
@@ -181,13 +193,14 @@
return;
IElementSet bundleElementSet = dependencies.getElementSet(bundle.getUniqueId());
Collection requiring = bundleElementSet.getRequiringElements(bundle.getVersion());
- for (Iterator requiringIter = requiring.iterator(); requiringIter.hasNext(); ) {
+ for (Iterator requiringIter = requiring.iterator(); requiringIter.hasNext();) {
IElement requiringElement = (IElement) requiringIter.next();
BundleDescription requiringBundle = state.getBundle((String) requiringElement.getId(), (Version) requiringElement.getVersionId());
if (requiringBundle != null)
unresolveRequirementChain(requiringBundle);
}
}
+
private void unresolveBundle(BundleDescription bundle) {
if (!bundle.isResolved())
return;
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateBuilder.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateBuilder.java
index 1039be6..2394a87 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateBuilder.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateBuilder.java
@@ -12,7 +12,6 @@
import java.util.*;
-
import org.eclipse.osgi.service.resolver.*;
import org.eclipse.osgi.util.ManifestElement;
import org.osgi.framework.BundleException;
@@ -37,19 +36,19 @@
String version = (String) manifest.get(Constants.BUNDLE_VERSION);
result.setVersion((version != null) ? new Version(version) : Version.emptyVersion);
result.setLocation(location);
- ManifestElement[] host = ManifestElement.parseHeader(Constants.FRAGMENT_HOST,(String) manifest.get(Constants.FRAGMENT_HOST));
+ ManifestElement[] host = ManifestElement.parseHeader(Constants.FRAGMENT_HOST, (String) manifest.get(Constants.FRAGMENT_HOST));
if (host != null)
result.setHost(createHostSpecification(host[0]));
- ManifestElement[] imports = ManifestElement.parseHeader(Constants.IMPORT_PACKAGE,(String) manifest.get(Constants.IMPORT_PACKAGE));
- ManifestElement[] exports = ManifestElement.parseHeader(Constants.EXPORT_PACKAGE,(String) manifest.get(Constants.EXPORT_PACKAGE));
+ ManifestElement[] imports = ManifestElement.parseHeader(Constants.IMPORT_PACKAGE, (String) manifest.get(Constants.IMPORT_PACKAGE));
+ ManifestElement[] exports = ManifestElement.parseHeader(Constants.EXPORT_PACKAGE, (String) manifest.get(Constants.EXPORT_PACKAGE));
result.setPackages(createPackages(exports, imports));
- ManifestElement[] provides = ManifestElement.parseHeader(Constants.PROVIDE_PACKAGE,(String) manifest.get(Constants.PROVIDE_PACKAGE));
+ ManifestElement[] provides = ManifestElement.parseHeader(Constants.PROVIDE_PACKAGE, (String) manifest.get(Constants.PROVIDE_PACKAGE));
result.setProvidedPackages(createProvidedPackages(provides));
- ManifestElement[] requires = ManifestElement.parseHeader(Constants.REQUIRE_BUNDLE,(String) manifest.get(Constants.REQUIRE_BUNDLE));
+ ManifestElement[] requires = ManifestElement.parseHeader(Constants.REQUIRE_BUNDLE, (String) manifest.get(Constants.REQUIRE_BUNDLE));
result.setRequiredBundles(createRequiredBundles(requires));
return result;
}
-
+
private static BundleSpecification[] createRequiredBundles(ManifestElement[] specs) {
if (specs == null)
return null;
@@ -58,6 +57,7 @@
result[i] = createRequiredBundle(specs[i]);
return result;
}
+
private static BundleSpecification createRequiredBundle(ManifestElement spec) {
BundleSpecificationImpl result = new BundleSpecificationImpl();
result.setName(spec.getValue());
@@ -69,6 +69,7 @@
result.setOptional(spec.getAttribute(Constants.OPTIONAL_ATTRIBUTE) != null);
return result;
}
+
private static byte parseMatchingRule(String match) {
if (match == null)
return VersionConstraint.MAJOR_MATCH;
@@ -87,6 +88,7 @@
// default to MAJOR match rule.
return VersionConstraint.MAJOR_MATCH;
}
+
private static String[] createProvidedPackages(ManifestElement[] specs) {
if (specs == null || specs.length == 0)
return null;
@@ -95,6 +97,7 @@
result[i] = specs[i].getValue();
return result;
}
+
private static PackageSpecification[] createPackages(ManifestElement[] exported, ManifestElement[] imported) {
int capacity = (exported == null ? 0 : exported.length) + (imported == null ? 0 : imported.length);
if (capacity == 0)
@@ -108,6 +111,7 @@
packages.put(exported[i].getValue(), createPackage(exported[i], true));
return (PackageSpecification[]) packages.values().toArray(new PackageSpecification[packages.size()]);
}
+
private static PackageSpecification createPackage(ManifestElement spec, boolean export) {
PackageSpecificationImpl result = new PackageSpecificationImpl();
result.setName(spec.getValue());
@@ -117,6 +121,7 @@
result.setExport(export);
return result;
}
+
private static HostSpecification createHostSpecification(ManifestElement spec) {
if (spec == null)
return null;
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateDeltaImpl.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateDeltaImpl.java
index 60cac2c..e4a370d 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateDeltaImpl.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateDeltaImpl.java
@@ -18,36 +18,42 @@
public class StateDeltaImpl implements StateDelta {
private State state;
private Map changes = new HashMap();
+
public StateDeltaImpl(State state) {
this.state = state;
}
+
public BundleDelta[] getChanges() {
return (BundleDelta[]) changes.values().toArray(new BundleDelta[changes.size()]);
}
+
public BundleDelta[] getChanges(int mask, boolean exact) {
List result = new ArrayList();
for (Iterator changesIter = changes.values().iterator(); changesIter.hasNext();) {
BundleDelta change = (BundleDelta) changesIter.next();
if (change.getType() == mask || (!exact && (change.getType() & mask) == mask))
- result.add(change);
+ result.add(change);
}
return (BundleDelta[]) result.toArray(new BundleDelta[result.size()]);
}
+
public State getState() {
return state;
}
+
void recordBundleAdded(BundleDescriptionImpl added) {
Object key = added.getKey();
BundleDeltaImpl change = (BundleDeltaImpl) changes.get(key);
if (change != null) {
if ((change.getType() & BundleDelta.REMOVED) != 0)
change.setType(BundleDelta.UPDATED | (change.getType() & ~BundleDelta.REMOVED));
- else
+ else
throw new IllegalStateException();
} else
changes.put(key, new BundleDeltaImpl(added, BundleDelta.ADDED));
-
+
}
+
void recordBundleRemoved(BundleDescriptionImpl removed) {
Object key = removed.getKey();
BundleDeltaImpl change = (BundleDeltaImpl) changes.get(key);
@@ -60,6 +66,7 @@
} else
changes.put(key, new BundleDeltaImpl(removed, BundleDelta.REMOVED));
}
+
void recordConstraintResolved(BundleDescriptionImpl changedLinkage, boolean optional) {
Object key = changedLinkage.getKey();
BundleDeltaImpl change = (BundleDeltaImpl) changes.get(key);
@@ -68,6 +75,7 @@
if (change == null || (newType == BundleDelta.LINKAGE_CHANGED && change.getType() == BundleDelta.OPTIONAL_LINKAGE_CHANGED))
changes.put(key, new BundleDeltaImpl(changedLinkage, newType));
}
+
void recordBundleResolved(BundleDescriptionImpl resolved, int status) {
Object key = resolved.getKey();
BundleDeltaImpl change = (BundleDeltaImpl) changes.get(key);
@@ -84,6 +92,6 @@
}
// new type will have only one of RESOLVED|UNRESOLVED bits set
newType = newType | (currentType & ~(BundleDelta.RESOLVED | BundleDelta.UNRESOLVED));
- change.setType(newType);
- }
-}
+ change.setType(newType);
+ }
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateHelperImpl.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateHelperImpl.java
index 248b2a2..ce0fe67 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateHelperImpl.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateHelperImpl.java
@@ -20,6 +20,7 @@
*/
public class StateHelperImpl implements StateHelper {
private static StateHelper instance = new StateHelperImpl();
+
/**
* @see StateHelper
*/
@@ -49,6 +50,7 @@
} while (changed);
return (BundleDescription[]) reachable.toArray(new BundleDescription[reachable.size()]);
}
+
/*
* Returns whether a bundle has any dependency on any of the given bundles.
*/
@@ -69,6 +71,7 @@
return true;
return false;
}
+
/**
* @see StateHelper
*/
@@ -92,6 +95,7 @@
unsatisfied.add(packages[i]);
return (VersionConstraint[]) unsatisfied.toArray(new VersionConstraint[unsatisfied.size()]);
}
+
/**
* @see StateHelper
*/
@@ -103,18 +107,21 @@
return false;
return specification.isSatisfiedBy(exported.getVersionSpecification());
}
+
/**
* @see StateHelper
*/
public boolean isResolvable(BundleSpecification specification) {
return isBundleConstraintResolvable(specification);
}
+
/**
* @see StateHelper
*/
public boolean isResolvable(HostSpecification specification) {
return isBundleConstraintResolvable(specification);
}
+
/*
* Returns whether a bundle specification/host specification can be resolved.
*/
@@ -125,6 +132,7 @@
return true;
return false;
}
+
/**
* @see StateHelper
*/
@@ -144,6 +152,7 @@
}
return exported;
}
+
/**
* @see StateHelper
*/
@@ -159,7 +168,8 @@
}
return null;
}
+
public static StateHelper getInstance() {
return instance;
- }
+ }
}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateImpl.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateImpl.java
index bada3a5..a8b542f 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateImpl.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateImpl.java
@@ -24,17 +24,17 @@
private boolean resolved = true;
protected long timeStamp = System.currentTimeMillis();
private KeyedHashSet bundleDescriptions = new KeyedHashSet(false);
- private StateObjectFactory factory;
+ private StateObjectFactory factory;
private static long cumulativeTime;
-
+
protected StateImpl() {
// to prevent extra-package instantiation
}
public boolean addBundle(BundleDescription description) {
if (description.getBundleId() < 0)
- throw new IllegalArgumentException("no id set");
+ throw new IllegalArgumentException("no id set");
if (!basicAddBundle(description))
return false;
resolved = false;
@@ -43,15 +43,18 @@
resolver.bundleAdded(description);
return true;
}
+
public StateChangeEvent compare(State state) {
throw new UnsupportedOperationException("not implemented"); //$NON-NLS-1$
}
+
public BundleDescription removeBundle(long bundleId) {
BundleDescription toRemove = getBundle(bundleId);
if (toRemove == null || !removeBundle(toRemove))
- return null;
+ return null;
return toRemove;
}
+
public boolean removeBundle(BundleDescription toRemove) {
if (!bundleDescriptions.remove((KeyedElement) toRemove))
return false;
@@ -61,32 +64,39 @@
resolver.bundleRemoved(toRemove);
return true;
}
+
public StateDelta getChanges() {
return getDelta();
}
+
private StateDeltaImpl getDelta() {
if (changes == null)
changes = getNewDelta();
return changes;
}
+
private StateDeltaImpl getNewDelta() {
return new StateDeltaImpl(this);
}
+
public BundleDescription[] getBundles(final String symbolicName) {
final List bundles = new ArrayList();
- for (Iterator iter = bundleDescriptions.iterator(); iter.hasNext(); ) {
+ for (Iterator iter = bundleDescriptions.iterator(); iter.hasNext();) {
BundleDescription bundle = (BundleDescription) iter.next();
if (symbolicName.equals(bundle.getUniqueId()))
bundles.add(bundle);
}
return (BundleDescription[]) bundles.toArray(new BundleDescription[bundles.size()]);
- }
+ }
+
public BundleDescription[] getBundles() {
return (BundleDescription[]) bundleDescriptions.elements(new BundleDescription[bundleDescriptions.size()]);
}
+
public BundleDescription getBundle(long id) {
return (BundleDescription) bundleDescriptions.getByKey(new Long(id));
}
+
// TODO: this does not comply with the spec
public BundleDescription getBundle(String requiredUniqueId, Version requiredVersion) {
BundleDescription[] bundles = getBundles();
@@ -96,23 +106,27 @@
}
return null;
}
+
public long getTimeStamp() {
return timeStamp;
}
+
public boolean isResolved() {
return resolved || isEmpty();
}
+
public void resolveConstraint(VersionConstraint constraint, Version actualVersion, BundleDescription supplier) {
VersionConstraintImpl modifiable = ((VersionConstraintImpl) constraint);
if (modifiable.getActualVersion() != actualVersion || modifiable.getSupplier() != supplier) {
modifiable.setActualVersion(actualVersion);
- modifiable.setSupplier(supplier);
+ modifiable.setSupplier(supplier);
if (constraint instanceof BundleSpecification || constraint instanceof HostSpecification) {
- boolean optional = (constraint instanceof BundleSpecification) && ((BundleSpecification) constraint).isOptional();
+ boolean optional = (constraint instanceof BundleSpecification) && ((BundleSpecification) constraint).isOptional();
getDelta().recordConstraintResolved((BundleDescriptionImpl) constraint.getBundle(), optional);
}
}
}
+
public void resolveBundle(BundleDescription bundle, int status) {
((BundleDescriptionImpl) bundle).setState(status);
getDelta().recordBundleResolved((BundleDescriptionImpl) bundle, status);
@@ -125,6 +139,7 @@
resolvedBundles.remove((KeyedElement) bundle);
}
}
+
private void unresolveConstraints(BundleDescription bundle) {
HostSpecification host = bundle.getHost();
if (host != null)
@@ -140,12 +155,13 @@
public Resolver getResolver() {
return resolver;
}
+
public void setResolver(Resolver newResolver) {
if (resolver == newResolver)
- return;
+ return;
if (resolver != null) {
Resolver oldResolver = resolver;
- resolver = null;
+ resolver = null;
oldResolver.setState(null);
}
resolver = newResolver;
@@ -153,6 +169,7 @@
return;
resolver.setState(this);
}
+
private StateDelta resolve(boolean incremental, BundleDescription[] reResolve) {
if (resolver == null)
throw new IllegalStateException("no resolver set"); //$NON-NLS-1$
@@ -179,56 +196,69 @@
return savedChanges;
}
+
private void flush() {
resolver.flush();
resolved = false;
if (resolvedBundles.isEmpty())
return;
- for (Iterator iter = resolvedBundles.iterator(); iter.hasNext(); ) {
+ for (Iterator iter = resolvedBundles.iterator(); iter.hasNext();) {
BundleDescriptionImpl resolvedBundle = (BundleDescriptionImpl) iter.next();
resolvedBundle.setState(0);
}
resolvedBundles.clear();
}
+
public StateDelta resolve() {
return resolve(true, null);
}
+
public StateDelta resolve(boolean incremental) {
return resolve(incremental, null);
}
+
public StateDelta resolve(BundleDescription[] reResolve) {
return resolve(true, reResolve);
}
+
public void setOverrides(Object value) {
throw new UnsupportedOperationException();
}
+
public BundleDescription[] getResolvedBundles() {
return (BundleDescription[]) resolvedBundles.elements(new BundleDescription[resolvedBundles.size()]);
}
+
public void addStateChangeListener(StateChangeListener listener, int flags) {
if (listeners.containsKey(listener))
return;
listeners.put(listener, new Integer(flags));
}
+
public void removeStateChangeListener(StateChangeListener listener) {
listeners.remove(listener);
}
+
public boolean isEmpty() {
return bundleDescriptions.isEmpty();
}
+
public void setResolved(boolean resolved) {
this.resolved = resolved;
}
+
public boolean basicAddBundle(BundleDescription description) {
((BundleDescriptionImpl) description).setContainingState(this);
return bundleDescriptions.add((BundleDescriptionImpl) description);
}
+
void addResolvedBundle(BundleDescriptionImpl resolved) {
resolvedBundles.add(resolved);
}
+
public PackageSpecification[] getExportedPackages() {
final List allExportedPackages = new ArrayList();
- for (Iterator iter = resolvedBundles.iterator(); iter.hasNext(); ) {
+ for (Iterator iter = resolvedBundles.iterator(); iter.hasNext();) {
BundleDescription bundle = (BundleDescription) iter.next();
PackageSpecification[] bundlePackages = bundle.getPackages();
for (int i = 0; i < bundlePackages.length; i++)
@@ -237,11 +267,12 @@
}
return (PackageSpecification[]) allExportedPackages.toArray(new PackageSpecification[allExportedPackages.size()]);
}
+
public BundleDescription[] getImportingBundles(final PackageSpecification exportedPackage) {
if (!exportedPackage.isResolved())
return null;
final List allImportingBundles = new ArrayList();
- for (Iterator iter = resolvedBundles.iterator(); iter.hasNext(); ) {
+ for (Iterator iter = resolvedBundles.iterator(); iter.hasNext();) {
BundleDescription bundle = (BundleDescription) iter.next();
PackageSpecification[] bundlePackages = bundle.getPackages();
for (int i = 0; i < bundlePackages.length; i++)
@@ -252,9 +283,10 @@
}
return (BundleDescription[]) allImportingBundles.toArray(new BundleDescription[allImportingBundles.size()]);
}
+
public BundleDescription[] getFragments(final BundleDescription host) {
final List fragments = new ArrayList();
- for (Iterator iter = bundleDescriptions.iterator(); iter.hasNext(); ) {
+ for (Iterator iter = bundleDescriptions.iterator(); iter.hasNext();) {
BundleDescription bundle = (BundleDescription) iter.next();
HostSpecification hostSpec = bundle.getHost();
if (hostSpec != null && hostSpec.getSupplier() == host)
@@ -262,12 +294,15 @@
}
return (BundleDescription[]) fragments.toArray(new BundleDescription[fragments.size()]);
}
+
public void setTimeStamp(long newTimeStamp) {
- timeStamp = newTimeStamp;
+ timeStamp = newTimeStamp;
}
+
public StateObjectFactory getFactory() {
return factory;
}
+
void setFactory(StateObjectFactory factory) {
this.factory = factory;
}
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateManager.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateManager.java
index f2e2e27..68747f5 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateManager.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateManager.java
@@ -26,15 +26,18 @@
private StateObjectFactoryImpl factory;
private long lastTimeStamp;
private BundleInstaller installer;
+
public StateManager(File stateLocation) {
// a negative timestamp means no timestamp checking
this(stateLocation, -1);
}
+
public StateManager(File stateLocation, long expectedTimeStamp) {
factory = new StateObjectFactoryImpl();
this.stateLocation = stateLocation;
readState(expectedTimeStamp);
}
+
public void shutdown() throws IOException {
writeState();
//systemState should not be set to null as when the framework
@@ -42,6 +45,7 @@
//not be reset, resulting in a null pointer exception
//systemState = null;
}
+
private void readState(long expectedTimeStamp) {
if (!stateLocation.isFile())
return;
@@ -71,6 +75,7 @@
System.out.println("Time to read state: " + (System.currentTimeMillis() - readStartupTime));
}
}
+
private void writeState() throws IOException {
if (systemState == null)
return;
@@ -79,27 +84,34 @@
DataOutputStream output = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(stateLocation)));
factory.writeState(systemState, output);
}
+
public StateImpl createSystemState() {
systemState = factory.createSystemState();
initializeSystemState();
return systemState;
}
+
private void initializeSystemState() {
systemState.setResolver(new ResolverImpl());
lastTimeStamp = systemState.getTimeStamp();
}
+
public StateImpl getSystemState() {
return systemState;
}
+
public State getState(boolean mutable) {
return mutable ? factory.createState(systemState) : new ReadOnlyState(systemState);
}
+
public State getState() {
return getState(true);
}
+
public StateObjectFactory getFactory() {
return factory;
}
+
public synchronized void commit(State state) throws BundleException {
// client trying to sneak in some alien implementation
if (!(state instanceof UserState))
@@ -129,18 +141,23 @@
}
}
}
+
public Resolver getResolver() {
return new ResolverImpl();
}
+
public StateHelper getStateHelper() {
return StateHelperImpl.getInstance();
}
+
public File getStateLocation() {
return stateLocation;
}
+
public BundleInstaller getInstaller() {
return installer;
}
+
public void setInstaller(BundleInstaller installer) {
this.installer = installer;
}
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateMsg.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateMsg.java
index 59d7f05..66e6f62 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateMsg.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateMsg.java
@@ -38,4 +38,4 @@
static {
formatter = new MessageFormat("org.eclipse.osgi.internal.resolver.StateMessages");
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateObjectFactoryImpl.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateObjectFactoryImpl.java
index 754f4df..3223b57 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateObjectFactoryImpl.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateObjectFactoryImpl.java
@@ -18,11 +18,12 @@
public class StateObjectFactoryImpl implements StateObjectFactory {
public BundleDescription createBundleDescription(Dictionary manifest, String location, long id) throws BundleException {
BundleDescriptionImpl result;
- result = (BundleDescriptionImpl) StateBuilder.createBundleDescription(manifest, location);
+ result = (BundleDescriptionImpl) StateBuilder.createBundleDescription(manifest, location);
result.setBundleId(id);
return result;
}
- public BundleDescription createBundleDescription(long id, String symbolicName, Version version, String location, BundleSpecification[] required, HostSpecification host,PackageSpecification[] packages, String[] providedPackages, boolean singleton) {
+
+ public BundleDescription createBundleDescription(long id, String symbolicName, Version version, String location, BundleSpecification[] required, HostSpecification host, PackageSpecification[] packages, String[] providedPackages, boolean singleton) {
BundleDescriptionImpl bundle = new BundleDescriptionImpl();
bundle.setBundleId(id);
bundle.setUniqueId(symbolicName);
@@ -33,12 +34,14 @@
bundle.setHost(host);
bundle.setProvidedPackages(providedPackages);
bundle.setSingleton(singleton);
- return bundle;
+ return bundle;
}
- public BundleDescription createBundleDescription(long id, String symbolicName, Version version, String location, BundleSpecification[] required, HostSpecification[] hosts,PackageSpecification[] packages, String[] providedPackages, boolean singleton) {
+
+ public BundleDescription createBundleDescription(long id, String symbolicName, Version version, String location, BundleSpecification[] required, HostSpecification[] hosts, PackageSpecification[] packages, String[] providedPackages, boolean singleton) {
HostSpecification host = hosts == null || hosts.length == 0 ? null : hosts[1];
return createBundleDescription(id, symbolicName, version, location, required, host, packages, providedPackages, singleton);
}
+
public BundleDescription createBundleDescription(BundleDescription original) {
BundleDescriptionImpl bundle = new BundleDescriptionImpl();
bundle.setBundleId(original.getBundleId());
@@ -48,80 +51,89 @@
BundleSpecification[] originalRequired = original.getRequiredBundles();
BundleSpecification[] newRequired = new BundleSpecification[originalRequired.length];
for (int i = 0; i < newRequired.length; i++)
- newRequired[i] = createBundleSpecification(originalRequired[i]);
+ newRequired[i] = createBundleSpecification(originalRequired[i]);
bundle.setRequiredBundles(newRequired);
PackageSpecification[] originalPackages = original.getPackages();
PackageSpecification[] newPackages = new PackageSpecification[originalPackages.length];
for (int i = 0; i < newPackages.length; i++)
- newPackages[i] = createPackageSpecification(originalPackages[i]);
+ newPackages[i] = createPackageSpecification(originalPackages[i]);
bundle.setPackages(newPackages);
- if (original.getHost() != null)
+ if (original.getHost() != null)
bundle.setHost(createHostSpecification(original.getHost()));
String[] originalProvidedPackages = original.getProvidedPackages();
String[] newProvidedPackages = new String[originalProvidedPackages.length];
- System.arraycopy(originalProvidedPackages,0,newProvidedPackages,0,originalProvidedPackages.length);
- bundle.setProvidedPackages(newProvidedPackages);
+ System.arraycopy(originalProvidedPackages, 0, newProvidedPackages, 0, originalProvidedPackages.length);
+ bundle.setProvidedPackages(newProvidedPackages);
bundle.setSingleton(original.isSingleton());
- return bundle;
+ return bundle;
}
+
public BundleSpecification createBundleSpecification(String requiredSymbolicName, Version requiredVersion, byte matchingRule, boolean export, boolean optional) {
- BundleSpecificationImpl bundleSpec = new BundleSpecificationImpl();
+ BundleSpecificationImpl bundleSpec = new BundleSpecificationImpl();
bundleSpec.setName(requiredSymbolicName);
bundleSpec.setVersionSpecification(requiredVersion);
bundleSpec.setMatchingRule(matchingRule);
bundleSpec.setExported(export);
bundleSpec.setOptional(optional);
- return bundleSpec;
+ return bundleSpec;
}
+
public BundleSpecification createBundleSpecification(BundleSpecification original) {
- BundleSpecificationImpl bundleSpec = new BundleSpecificationImpl();
+ BundleSpecificationImpl bundleSpec = new BundleSpecificationImpl();
bundleSpec.setName(original.getName());
bundleSpec.setVersionSpecification(original.getVersionSpecification());
bundleSpec.setMatchingRule(original.getMatchingRule());
bundleSpec.setExported(original.isExported());
bundleSpec.setOptional(original.isOptional());
- return bundleSpec;
+ return bundleSpec;
}
+
public HostSpecification createHostSpecification(String hostSymbolicName, Version hostVersion, byte matchingRule, boolean reloadHost) {
- HostSpecificationImpl hostSpec = new HostSpecificationImpl();
+ HostSpecificationImpl hostSpec = new HostSpecificationImpl();
hostSpec.setName(hostSymbolicName);
hostSpec.setVersionSpecification(hostVersion);
hostSpec.setMatchingRule(matchingRule);
hostSpec.setReloadHost(reloadHost);
return hostSpec;
}
+
public HostSpecification createHostSpecification(HostSpecification original) {
- HostSpecificationImpl hostSpec = new HostSpecificationImpl();
+ HostSpecificationImpl hostSpec = new HostSpecificationImpl();
hostSpec.setName(original.getName());
hostSpec.setVersionSpecification(original.getVersionSpecification());
hostSpec.setMatchingRule(original.getMatchingRule());
hostSpec.setReloadHost(original.reloadHost());
return hostSpec;
}
+
public PackageSpecification createPackageSpecification(String packageName, Version packageVersion, boolean exported) {
- PackageSpecificationImpl packageSpec = new PackageSpecificationImpl();
+ PackageSpecificationImpl packageSpec = new PackageSpecificationImpl();
packageSpec.setName(packageName);
packageSpec.setVersionSpecification(packageVersion);
packageSpec.setExport(exported);
return packageSpec;
- }
+ }
+
public PackageSpecification createPackageSpecification(PackageSpecification original) {
- PackageSpecificationImpl packageSpec = new PackageSpecificationImpl();
+ PackageSpecificationImpl packageSpec = new PackageSpecificationImpl();
packageSpec.setName(original.getName());
packageSpec.setVersionSpecification(original.getVersionSpecification());
packageSpec.setExport(original.isExported());
return packageSpec;
}
+
public SystemState createSystemState() {
- SystemState state = new SystemState();
- state.setFactory(this);
- return state;
- }
- public State createState() {
- StateImpl state = new UserState();
+ SystemState state = new SystemState();
state.setFactory(this);
return state;
}
+
+ public State createState() {
+ StateImpl state = new UserState();
+ state.setFactory(this);
+ return state;
+ }
+
public State createState(State original) {
StateImpl newState = new UserState();
newState.setFactory(this);
@@ -132,6 +144,7 @@
newState.setResolved(false);
return newState;
}
+
public SystemState readSystemState(DataInputStream stream, long expectedTimeStamp) throws IOException {
StateReader reader = new StateReader();
SystemState restoredState = new SystemState();
@@ -139,18 +152,20 @@
return null;
restoredState.setFactory(this);
return restoredState;
- }
+ }
+
public State readState(DataInputStream stream) throws IOException {
StateReader reader = new StateReader();
- StateImpl restoredState = (StateImpl) createState();
+ StateImpl restoredState = (StateImpl) createState();
if (!reader.loadState(restoredState, stream))
return null;
- return restoredState;
+ return restoredState;
}
+
public void writeState(State state, DataOutputStream stream) throws IOException {
if (state.getFactory() != this)
throw new IllegalArgumentException();
StateWriter writer = new StateWriter();
- writer.saveState((StateImpl) state, stream);
+ writer.saveState((StateImpl) state, stream);
}
}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateReader.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateReader.java
index 9e71c43..9b08336 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateReader.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateReader.java
@@ -55,10 +55,11 @@
if (!state.isResolved())
return true;
int resolvedLength = in.readInt();
- for(int i = 0;i < resolvedLength;i++)
+ for (int i = 0; i < resolvedLength; i++)
state.addResolvedBundle(readBundleDescription(in));
return true;
}
+
private BundleDescriptionImpl readBundleDescription(DataInputStream in) throws IOException {
byte tag = readTag(in);
if (tag == NULL)
@@ -66,8 +67,8 @@
if (tag == INDEX)
return (BundleDescriptionImpl) objectTable.get(in.readInt());
BundleDescriptionImpl result = new BundleDescriptionImpl();
- addToObjectTable(result);
- result.setBundleId(in.readLong());
+ addToObjectTable(result);
+ result.setBundleId(in.readLong());
result.setUniqueId(readString(in, false));
result.setLocation(readString(in, false));
result.setState(in.readInt());
@@ -78,7 +79,7 @@
PackageSpecification[] packages = new PackageSpecification[packageCount];
for (int i = 0; i < packages.length; i++)
packages[i] = readPackageSpec(in);
-
+
result.setPackages(packages);
}
int providedPackageCount = in.readInt();
@@ -98,6 +99,7 @@
result.setSingleton(in.readBoolean());
return result;
}
+
private BundleSpecificationImpl readBundleSpec(DataInputStream in) throws IOException {
BundleSpecificationImpl result = new BundleSpecificationImpl();
readVersionConstraint(result, in);
@@ -105,12 +107,14 @@
result.setOptional(in.readBoolean());
return result;
}
+
private PackageSpecificationImpl readPackageSpec(DataInputStream in) throws IOException {
PackageSpecificationImpl result = new PackageSpecificationImpl();
readVersionConstraint(result, in);
result.setExport(in.readBoolean());
return result;
}
+
private HostSpecificationImpl readHostSpec(DataInputStream in) throws IOException {
byte tag = readTag(in);
if (tag == NULL)
@@ -120,6 +124,7 @@
result.setReloadHost(in.readBoolean());
return result;
}
+
// called by readers for VersionConstraintImpl subclasses
private void readVersionConstraint(VersionConstraintImpl version, DataInputStream in) throws IOException {
version.setName(readString(in, false));
@@ -128,6 +133,7 @@
version.setActualVersion(readVersion(in));
version.setSupplier(readBundleDescription(in));
}
+
private Version readVersion(DataInputStream in) throws IOException {
byte tag = readTag(in);
if (tag == NULL)
@@ -140,8 +146,9 @@
String qualifierComponent = readString(in, false);
Version result = new Version(majorComponent, minorComponent, serviceComponent, qualifierComponent);
addToObjectTable(result);
- return result;
+ return result;
}
+
public final boolean loadState(StateImpl state, DataInputStream input, long expectedTimestamp) throws IOException {
try {
return readState(state, input, expectedTimestamp);
@@ -149,9 +156,11 @@
input.close();
}
}
+
public final boolean loadState(StateImpl state, DataInputStream input) throws IOException {
return loadState(state, input, -1);
}
+
private String readString(DataInputStream in, boolean intern) throws IOException {
byte type = in.readByte();
if (type == NULL)
@@ -161,6 +170,7 @@
else
return in.readUTF();
}
+
private byte readTag(DataInputStream in) throws IOException {
return in.readByte();
}
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateWriter.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateWriter.java
index d958854..e190006 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateWriter.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateWriter.java
@@ -35,6 +35,7 @@
// return the index of the object just added (i.e. size - 1)
return (objectTable.size() - 1);
}
+
private int getFromObjectTable(Object object) {
if (objectTable != null) {
Object objectResult = objectTable.get(object);
@@ -44,6 +45,7 @@
}
return -1;
}
+
private boolean writePrefix(Object object, DataOutputStream out) throws IOException {
if (writeIndex(object, out))
return true;
@@ -52,12 +54,13 @@
out.writeByte(OBJECT);
return false;
}
+
private void writeState(StateImpl state, DataOutputStream out) throws IOException {
out.write(StateReader.STATE_CACHE_VERSION);
if (writePrefix(state, out))
return;
- out.writeLong(state.getTimeStamp());
- BundleDescription[] bundles = state.getBundles();
+ out.writeLong(state.getTimeStamp());
+ BundleDescription[] bundles = state.getBundles();
out.writeInt(bundles.length);
if (bundles.length == 0)
return;
@@ -67,13 +70,14 @@
if (!state.isResolved())
return;
BundleDescription[] resolvedBundles = state.getResolvedBundles();
- out.writeInt(resolvedBundles.length);
+ out.writeInt(resolvedBundles.length);
for (int i = 0; i < resolvedBundles.length; i++)
- writeBundleDescription((BundleDescriptionImpl) resolvedBundles[i], out);
+ writeBundleDescription((BundleDescriptionImpl) resolvedBundles[i], out);
}
+
private void writeBundleDescription(BundleDescriptionImpl bundle, DataOutputStream out) throws IOException {
if (writePrefix(bundle, out))
- return;
+ return;
out.writeLong(bundle.getBundleId());
writeStringOrNull(bundle.getUniqueId(), out);
writeStringOrNull(bundle.getLocation(), out);
@@ -95,18 +99,21 @@
out.writeInt(requiredBundles.length);
for (int i = 0; i < requiredBundles.length; i++)
writeBundleSpec((BundleSpecificationImpl) requiredBundles[i], out);
-
+
out.writeBoolean(bundle.isSingleton());
}
+
private void writeBundleSpec(BundleSpecificationImpl bundle, DataOutputStream out) throws IOException {
writeVersionConstraint(bundle, out);
out.writeBoolean(bundle.isExported());
out.writeBoolean(bundle.isOptional());
}
+
private void writePackageSpec(PackageSpecificationImpl packageSpec, DataOutputStream out) throws IOException {
writeVersionConstraint(packageSpec, out);
out.writeBoolean(packageSpec.isExported());
}
+
private void writeHostSpec(HostSpecificationImpl host, DataOutputStream out) throws IOException {
if (host == null) {
out.writeByte(NULL);
@@ -116,6 +123,7 @@
writeVersionConstraint(host, out);
out.writeBoolean(host.reloadHost());
}
+
// called by writers for VersionConstraintImpl subclasses
private void writeVersionConstraint(VersionConstraintImpl version, DataOutputStream out) throws IOException {
writeStringOrNull(version.getName(), out);
@@ -124,6 +132,7 @@
writeVersion(version.getActualVersion(), out);
writeBundleDescription((BundleDescriptionImpl) version.getSupplier(), out);
}
+
private void writeVersion(Version version, DataOutputStream out) throws IOException {
// TODO: should assess whether avoiding sharing versions would be good
if (writePrefix(version, out))
@@ -133,6 +142,7 @@
out.writeInt(version.getMicroComponent());
writeStringOrNull(version.getQualifierComponent(), out);
}
+
private boolean writeIndex(Object object, DataOutputStream out) throws IOException {
if (object == null) {
out.writeByte(NULL);
@@ -145,6 +155,7 @@
out.writeInt(index);
return true;
}
+
public void saveState(StateImpl state, DataOutputStream output) throws IOException {
try {
writeState(state, output);
@@ -152,6 +163,7 @@
output.close();
}
}
+
private void writeStringOrNull(String string, DataOutputStream out) throws IOException {
if (string == null)
out.writeByte(NULL);
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/SystemState.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/SystemState.java
index 0c739a4..3833346 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/SystemState.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/SystemState.java
@@ -19,15 +19,17 @@
updateTimeStamp();
return true;
}
+
public boolean removeBundle(BundleDescription toRemove) {
if (!super.removeBundle(toRemove))
return false;
updateTimeStamp();
return true;
}
+
private void updateTimeStamp() {
if (timeStamp == Long.MAX_VALUE)
timeStamp = 0;
- timeStamp++;
+ timeStamp++;
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/UserState.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/UserState.java
index 0f21b3f..766af94 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/UserState.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/UserState.java
@@ -21,18 +21,22 @@
private long referenceTimestamp; // TODO what is this used for?
private List added = new Vector(); // TODO why not ArrayList
private List removed = new Vector(); // TODO why not ArrayList
+
public long getReferenceTimestamp() {
return referenceTimestamp;
}
+
public void setReferenceTimestamp(long referenceTimestamp) {
this.referenceTimestamp = referenceTimestamp;
}
+
public synchronized boolean addBundle(BundleDescription description) {
if (!super.addBundle(description))
return false;
added.add(new Long(description.getBundleId()));
return true;
}
+
public synchronized BundleDescription removeBundle(long bundleId) {
BundleDescription description = super.removeBundle(bundleId);
if (description == null)
@@ -40,9 +44,11 @@
removed.add(new Long(description.getBundleId()));
return description;
}
+
public Long[] getAllAdded() {
return (Long[]) added.toArray(new Long[added.size()]);
}
+
public Long[] getAllRemoved() {
return (Long[]) removed.toArray(new Long[removed.size()]);
}
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/VersionConstraintImpl.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/VersionConstraintImpl.java
index b064676..937a548 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/VersionConstraintImpl.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/VersionConstraintImpl.java
@@ -18,25 +18,32 @@
private byte matchingRule = GREATER_EQUAL_MATCH;
private BundleDescription bundle;
private BundleDescription supplier;
- private Version actualVersion;
+ private Version actualVersion;
+
public String getName() {
return name;
}
+
public Version getVersionSpecification() {
return versionSpecification;
}
+
public Version getActualVersion() {
return actualVersion;
}
+
public byte getMatchingRule() {
return matchingRule;
}
+
public BundleDescription getBundle() {
return bundle;
}
+
public BundleDescription getSupplier() {
return supplier;
}
+
public boolean isResolved() {
return supplier != null;
}
@@ -44,25 +51,32 @@
public void setActualVersion(Version actualVersion) {
this.actualVersion = actualVersion;
}
+
public void setSupplier(BundleDescription supplier) {
this.supplier = supplier;
}
+
public void setMatchingRule(byte matchingRule) {
this.matchingRule = matchingRule;
}
+
public void setName(String name) {
this.name = name;
}
+
public void setVersionSpecification(Version versionSpecification) {
this.versionSpecification = versionSpecification;
}
+
public void setBundle(BundleDescription bundle) {
this.bundle = bundle;
}
+
public void unresolve() {
actualVersion = null;
supplier = null;
}
+
public boolean isSatisfiedBy(Version provided) {
Version required = getVersionSpecification();
if (required == null)
@@ -74,12 +88,13 @@
return provided.matchMicro(required);
case MINOR_MATCH :
return provided.matchMinor(required);
- case GREATER_EQUAL_MATCH:
+ case GREATER_EQUAL_MATCH :
return provided.matchGreaterOrEqualTo(required);
default :
- return provided.matchMajor(required);
+ return provided.matchMajor(required);
}
}
+
public String toString() {
return "name: " + name + " - version: " + versionSpecification;
}
diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/debug/Debug.java b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/debug/Debug.java
index 35e995f..7d638d7 100644
--- a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/debug/Debug.java
+++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/debug/Debug.java
@@ -69,60 +69,79 @@
public static void print(boolean x) {
out.print(x);
}
+
public static void print(char x) {
out.print(x);
}
+
public static void print(int x) {
out.print(x);
}
+
public static void print(long x) {
out.print(x);
}
+
public static void print(float x) {
out.print(x);
}
+
public static void print(double x) {
out.print(x);
}
+
public static void print(char x[]) {
out.print(x);
}
+
public static void print(String x) {
out.print(x);
}
+
public static void print(Object x) {
out.print(x);
}
+
public static void println(boolean x) {
out.println(x);
}
+
public static void println(char x) {
out.println(x);
}
+
public static void println(int x) {
out.println(x);
}
+
public static void println(long x) {
out.println(x);
}
+
public static void println(float x) {
out.println(x);
}
+
public static void println(double x) {
out.println(x);
}
+
public static void println(char x[]) {
out.println(x);
}
+
public static void println(String x) {
out.println(x);
}
+
public static void println(Object x) {
out.println(x);
}
+
public static void printStackTrace(Throwable x) {
printStackTrace(x, out);
}
+
private static void printStackTrace(Throwable t, PrintStream out) {
t.printStackTrace(out);
@@ -148,4 +167,4 @@
}
}
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/eventmgr/ListenerQueue.java b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/eventmgr/ListenerQueue.java
index ca44b20..b42ab5c 100644
--- a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/eventmgr/ListenerQueue.java
+++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/eventmgr/ListenerQueue.java
@@ -103,7 +103,7 @@
lists = queue.getElements();
}
EventThread eventThread = manager.getEventThread();
- synchronized (eventThread) { /* synchronize on the EventThread to ensure no interleaving of posting to the event thread */
+ synchronized (eventThread) { /* synchronize on the EventThread to ensure no interleaving of posting to the event thread */
int size = lists.length;
for (int i = 0; i < size; i++) { /* iterate over the list of listener lists */
ListElement list = lists[i];
@@ -129,7 +129,7 @@
readOnly = true;
lists = queue.getElements();
}
- synchronized (manager) { /* synchronize on the EventManager to ensure no interleaving of event delivery */
+ synchronized (manager) { /* synchronize on the EventManager to ensure no interleaving of event delivery */
int size = lists.length;
for (int i = 0; i < size; i++) { /* iterate over the list of listener lists */
ListElement list = lists[i];
diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/internal/core/Msg.java b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/internal/core/Msg.java
index d12f0fb..91d3c60 100644
--- a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/internal/core/Msg.java
+++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/internal/core/Msg.java
@@ -36,4 +36,4 @@
static {
formatter = new org.eclipse.osgi.framework.msg.MessageFormat("org.eclipse.osgi.framework.internal.core.ExternalMessages");
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/internal/reliablefile/ReliableFile.java b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/internal/reliablefile/ReliableFile.java
index 355bf23..a415051 100644
--- a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/internal/reliablefile/ReliableFile.java
+++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/internal/reliablefile/ReliableFile.java
@@ -327,6 +327,7 @@
* @throws IOException If the copy failed.
*/
private static final int CP_BUF_SIZE = 4096;
+
private static void cp(File from, File to) throws IOException {
FileInputStream in = null;
FileOutputStream out = null;
@@ -394,7 +395,7 @@
* <code>false</code> otherwise.
*/
public static boolean exists(File file) {
- if (file.exists()) /* quick test */ {
+ if (file.exists()) /* quick test */{
return true;
}
@@ -446,4 +447,4 @@
return false;
}
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/internal/reliablefile/ReliableFileInputStream.java b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/internal/reliablefile/ReliableFileInputStream.java
index b20237e..04107fd 100644
--- a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/internal/reliablefile/ReliableFileInputStream.java
+++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/internal/reliablefile/ReliableFileInputStream.java
@@ -87,4 +87,4 @@
protected void finalize() throws IOException {
close();
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/internal/reliablefile/ReliableFileOutputStream.java b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/internal/reliablefile/ReliableFileOutputStream.java
index 3b25183..80e2a3a 100644
--- a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/internal/reliablefile/ReliableFileOutputStream.java
+++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/internal/reliablefile/ReliableFileOutputStream.java
@@ -123,4 +123,4 @@
public void write(byte b[], int off, int len) throws IOException {
out.write(b, off, len);
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/log/FrameworkLog.java b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/log/FrameworkLog.java
index 694d23f..650a852 100644
--- a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/log/FrameworkLog.java
+++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/log/FrameworkLog.java
@@ -84,4 +84,4 @@
* no longer be logged to it.
*/
public void close();
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/log/FrameworkLogEntry.java b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/log/FrameworkLogEntry.java
index 6a768be..7e0bc92 100644
--- a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/log/FrameworkLogEntry.java
+++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/log/FrameworkLogEntry.java
@@ -33,15 +33,17 @@
*
* @return Returns the children.
*/
- public FrameworkLogEntry[] getChildren(){
+ public FrameworkLogEntry[] getChildren() {
return children;
}
+
/**
* @return Returns the entry.
*/
public String getEntry() {
return entry;
}
+
/**
* @return Returns the message.
*/
@@ -55,10 +57,11 @@
public int getStackCode() {
return stackCode;
}
+
/**
* @return Returns the throwable.
*/
public Throwable getThrowable() {
return throwable;
}
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/util/SecureAction.java b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/util/SecureAction.java
index 728a822..56e2b32 100644
--- a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/util/SecureAction.java
+++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/util/SecureAction.java
@@ -25,7 +25,7 @@
* @param property the property key.
* @return the value of the property or null if it does not exist.
*/
- public static String getProperty(final String property){
+ public static String getProperty(final String property) {
if (System.getSecurityManager() == null)
return System.getProperty(property);
else
@@ -44,13 +44,13 @@
* @return the value of the property or the def value if the property
* does not exist.
*/
- public static String getProperty(final String property, final String def){
+ public static String getProperty(final String property, final String def) {
if (System.getSecurityManager() == null)
- return System.getProperty(property,def);
+ return System.getProperty(property, def);
else
return (String) AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
- return System.getProperty(property,def);
+ return System.getProperty(property, def);
}
});
}
@@ -83,8 +83,8 @@
return new FileInputStream(file);
else
try {
- return (FileInputStream) AccessController.doPrivileged( new PrivilegedExceptionAction(){
- public Object run() throws FileNotFoundException{
+ return (FileInputStream) AccessController.doPrivileged(new PrivilegedExceptionAction() {
+ public Object run() throws FileNotFoundException {
return new FileInputStream(file);
}
});
@@ -103,19 +103,19 @@
*/
public static FileOutputStream getFileOutputStream(final File file, final boolean append) throws FileNotFoundException {
if (System.getSecurityManager() == null)
- return new FileOutputStream(file.getAbsolutePath(),append);
+ return new FileOutputStream(file.getAbsolutePath(), append);
else
try {
- return (FileOutputStream) AccessController.doPrivileged( new PrivilegedExceptionAction(){
- public Object run() throws FileNotFoundException{
- return new FileOutputStream(file.getAbsolutePath(),append);
+ return (FileOutputStream) AccessController.doPrivileged(new PrivilegedExceptionAction() {
+ public Object run() throws FileNotFoundException {
+ return new FileOutputStream(file.getAbsolutePath(), append);
}
});
} catch (PrivilegedActionException e) {
throw (FileNotFoundException) e.getException();
}
}
-
+
/**
* Creates a new Thread from a Runnable. Same as calling
* new Thread(target,name).
@@ -124,15 +124,15 @@
* @return The new Thread
*/
public static Thread createThread(final Runnable target, final String name) {
- if(System.getSecurityManager() == null)
+ if (System.getSecurityManager() == null)
return new Thread(target, name);
else {
- return (Thread) AccessController.doPrivileged( new PrivilegedAction(){
+ return (Thread) AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
return new Thread(target, name);
}
});
}
}
-
+
}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/service/datalocation/Location.java b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/service/datalocation/Location.java
index fc0478f..0cf3241 100644
--- a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/service/datalocation/Location.java
+++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/service/datalocation/Location.java
@@ -24,8 +24,8 @@
* Returns true if this location allows a default value to be assigned
* @return whether or not this location can assign a default value
*/
- public boolean allowsDefault();
-
+ public boolean allowsDefault();
+
/**
* Returns the default value of this location if any. <code>null</code> is returned
* if no default is avaliable. Note that even locations which allow defaults may still
@@ -33,13 +33,13 @@
* @return the default value for this location
*/
public URL getDefault();
-
+
/**
* Returns the parent of this location or <code>null</code> if none is available.
* @return the parent of this location or <code>null</code>
*/
public Location getParentLocation();
-
+
/**
* Returns the actual URL of this location. If the location's value has been set,
* that value is returned. If the value is not set and the location allows defaults,
@@ -48,12 +48,13 @@
* @return the URL for this location or <code>null</code> if none
*/
public URL getURL();
-
+
/**
* Returns true if this location has a value.
* @return whether or not the value is set
*/
public boolean isSet();
+
/**
* Return true if this locaiton represents a read only location. The read only character
* of a location is not in enforced in any way but rather expresses the intention of the
@@ -61,7 +62,7 @@
* @return whether the location is read only
*/
public boolean isReadOnly();
-
+
/**
* Sets and optionally locks the location's value to the given URL. If the location already has a value an
* exception is thrown. If locking is requested and fails, false is returned and the URL
@@ -86,10 +87,10 @@
* @exception IOException if there was an unexpected problem while acquiring the lock.
*/
public boolean lock() throws IOException;
-
+
/**
* Releases the lock on this location. If the location is not already locked, no action
* is taken.
*/
public void release();
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/service/debug/DebugOptions.java b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/service/debug/DebugOptions.java
index 6bb9839..46ae8c7 100644
--- a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/service/debug/DebugOptions.java
+++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/service/debug/DebugOptions.java
@@ -12,7 +12,10 @@
public interface DebugOptions {
public abstract boolean getBooleanOption(String option, boolean defaultValue);
+
public abstract String getOption(String option);
+
public abstract int getIntegerOption(String option, int defaultValue);
+
public abstract void setOption(String option, String value);
}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/service/localization/BundleLocalization.java b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/service/localization/BundleLocalization.java
index ec372bd..43a9af3 100644
--- a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/service/localization/BundleLocalization.java
+++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/service/localization/BundleLocalization.java
@@ -26,6 +26,6 @@
* @return A <code>ResourceBundle</code> object for the given bundle and locale.
* If null is passed for the locale parameter, the default locale is used.
*/
-
+
public ResourceBundle getLocalization(Bundle bundle, String locale);
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/service/urlconversion/URLConverter.java b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/service/urlconversion/URLConverter.java
index 510d777..054109b 100644
--- a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/service/urlconversion/URLConverter.java
+++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/service/urlconversion/URLConverter.java
@@ -38,4 +38,4 @@
* @throws IOException if an error occurs during the conversion.
*/
public URL convertToLocalURL(URL url) throws IOException;
-}
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/util/ManifestElement.java b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/util/ManifestElement.java
index 4df870b..ce5f923 100644
--- a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/util/ManifestElement.java
+++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/util/ManifestElement.java
@@ -108,7 +108,7 @@
* Each value component is delemited by a ';'.
* @return the String[] of value components
*/
- public String[] getValueComponents(){
+ public String[] getValueComponents() {
return valueComponents;
}
@@ -168,7 +168,7 @@
}
return attributes.keys();
}
-
+
/**
* Adds an attribute to this manifest element.
* @param key the key of the attribute
@@ -184,15 +184,13 @@
// create a list to contain multiple values
if (curValue instanceof ArrayList) {
newList = (ArrayList) curValue;
- }
- else {
+ } else {
newList = new ArrayList(5);
newList.add(curValue);
}
newList.add(value);
attributes.put(key, newList);
- }
- else {
+ } else {
attributes.put(key, value);
}
}
@@ -217,7 +215,7 @@
Tokenizer tokenizer = new Tokenizer(value);
- parseloop : while (true) {
+ parseloop: while (true) {
String next = tokenizer.getToken(";,");
if (next == null) {
throw new BundleException(Msg.formatter.getString("MANIFEST_INVALID_HEADER_EXCEPTION", header, value));
@@ -242,7 +240,7 @@
c = tokenizer.getChar();
- if (c == ';') /* more */ {
+ if (c == ';') /* more */{
headerValues.add(next);
headerValue.append(";").append(next);
@@ -275,7 +273,7 @@
c = tokenizer.getChar();
- if (c == ';') /* more */ {
+ if (c == ';') /* more */{
next = tokenizer.getToken("=");
if (next == null) {
@@ -292,11 +290,11 @@
Debug.println("");
}
- if (c == ',') /* another manifest element */ {
+ if (c == ',') /* another manifest element */{
continue parseloop;
}
- if (c == '\0') /* end of value */ {
+ if (c == '\0') /* end of value */{
break parseloop;
}
@@ -314,4 +312,4 @@
return (result);
}
-}
+}
\ No newline at end of file