Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2010-02-23 22:01:29 +0000
committerThomas Watson2010-02-23 22:01:29 +0000
commitbd5394e8775b7195e599b3c3a1f4dc5818f73abe (patch)
treee659e33bc61ad5a2d3170e4ad052f1e02c700572
parent4509d4665b8d871107db5da03d9f8ecf50ffd9d4 (diff)
downloadrt.equinox.framework-bd5394e8775b7195e599b3c3a1f4dc5818f73abe.tar.gz
rt.equinox.framework-bd5394e8775b7195e599b3c3a1f4dc5818f73abe.tar.xz
rt.equinox.framework-bd5394e8775b7195e599b3c3a1f4dc5818f73abe.zip
Merge content from HEAD (tag v20100222) to branch.OSGI_RI_v20100222
-rw-r--r--bundles/org.eclipse.osgi/.options1
-rw-r--r--bundles/org.eclipse.osgi/META-INF/MANIFEST.MF3
-rw-r--r--bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/service/resolver/package.html17
-rw-r--r--bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/console/package.html17
-rw-r--r--bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/eventmgr/package.html17
-rw-r--r--bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Framework.java1
-rw-r--r--bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/launch/Equinox.java95
-rw-r--r--bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/launch/package.html17
-rw-r--r--bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/AdaptorMsg.java4
-rw-r--r--bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/BaseStorage.java6
-rw-r--r--bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/ExternalMessages.properties4
-rw-r--r--bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseStarter.java8
-rw-r--r--bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/internal/adaptor/CachedManifest.java5
-rw-r--r--bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/internal/adaptor/EclipseAdaptorHook.java2
-rw-r--r--bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/GroupingChecker.java6
-rw-r--r--bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/debug/FrameworkDebugOptions.java100
-rw-r--r--bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/log/package.html17
-rw-r--r--bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/service/debug/DebugOptions.java32
-rw-r--r--bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/service/debug/DebugTrace.java7
-rw-r--r--bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/service/debug/package.html17
-rw-r--r--bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/service/environment/package.html18
-rw-r--r--bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/service/localization/package.html19
-rw-r--r--bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/service/runnable/ApplicationLauncher.java6
-rw-r--r--bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/service/runnable/ApplicationRunnable.java6
-rw-r--r--bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/service/runnable/ParameterizedRunnable.java6
-rw-r--r--bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/service/runnable/package.html17
-rw-r--r--bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/storagemanager/StorageManager.java32
-rw-r--r--bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/storagemanager/package.html17
28 files changed, 444 insertions, 53 deletions
diff --git a/bundles/org.eclipse.osgi/.options b/bundles/org.eclipse.osgi/.options
index 379288c65..4fb063288 100644
--- a/bundles/org.eclipse.osgi/.options
+++ b/bundles/org.eclipse.osgi/.options
@@ -30,6 +30,7 @@ org.eclipse.osgi/debug/objectPool/dups=false
# Eclipse adaptor options
org.eclipse.osgi/eclipseadaptor/debug = false
org.eclipse.osgi/eclipseadaptor/debug/location = false
+org.eclipse.osgi/eclipseadaptor/debug/cachedmanifest = false
org.eclipse.osgi/eclipseadaptor/debug/platformadmin=false
org.eclipse.osgi/eclipseadaptor/debug/platformadmin/resolver=false
org.eclipse.osgi/eclipseadaptor/converter/debug = false
diff --git a/bundles/org.eclipse.osgi/META-INF/MANIFEST.MF b/bundles/org.eclipse.osgi/META-INF/MANIFEST.MF
index 0ac2694e3..135865292 100644
--- a/bundles/org.eclipse.osgi/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.osgi/META-INF/MANIFEST.MF
@@ -6,7 +6,7 @@ Export-Package: org.eclipse.osgi.event;version="1.0",
org.eclipse.osgi.framework.log;version="1.0",
org.eclipse.osgi.launch; version="1.0",
org.eclipse.osgi.service.datalocation;version="1.3",
- org.eclipse.osgi.service.debug;version="1.1",
+ org.eclipse.osgi.service.debug;version="1.2",
org.eclipse.osgi.service.environment;version="1.3",
org.eclipse.osgi.service.localization;version="1.1",
org.eclipse.osgi.service.pluginconversion;version="1.0",
@@ -74,3 +74,4 @@ Main-Class: org.eclipse.core.runtime.adaptor.EclipseStarter
Bundle-RequiredExecutionEnvironment: J2SE-1.5,
J2SE-1.4,
CDC-1.1/Foundation-1.1
+Eclipse-BundleShape: jar
diff --git a/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/service/resolver/package.html b/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/service/resolver/package.html
new file mode 100644
index 000000000..04babd03f
--- /dev/null
+++ b/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/service/resolver/package.html
@@ -0,0 +1,17 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <title>Package-level Javadoc</title>
+</head>
+<body>
+Provides the Equinox resolver API.
+<h2>
+Package Specification</h2>
+This package specifies the API for Equinox resolver.
+<p>
+Clients that need access to the Equinox runtime resolver will likely be interested
+in the types provided by this package.
+</p>
+</body>
+</html>
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/console/package.html b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/console/package.html
new file mode 100644
index 000000000..d140bf5b7
--- /dev/null
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/console/package.html
@@ -0,0 +1,17 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <title>Package-level Javadoc</title>
+</head>
+<body>
+Provides services related to the Equinox console.
+<h2>
+Package Specification</h2>
+This package specifies the API for services related to the Equinox console.
+<p>
+Clients which provide commands or provide sessions to the Equinox console
+will likely be interested in the types provided by this package.
+</p>
+</body>
+</html>
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/eventmgr/package.html b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/eventmgr/package.html
new file mode 100644
index 000000000..41e344cab
--- /dev/null
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/eventmgr/package.html
@@ -0,0 +1,17 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <title>Package-level Javadoc</title>
+</head>
+<body>
+Provides the event manager API.
+<h2>
+Package Specification</h2>
+This package specifies the API for the event manager.
+<p>
+Clients which implement an event bus to deliver synchronous and/or asynchronous
+events to listeners will likely be interested in the types provided by this package.
+</p>
+</body>
+</html>
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 a0c2892d5..2305d34d8 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
@@ -191,7 +191,6 @@ public class Framework implements EventDispatcher, EventPublisher, Runnable {
try {
adaptor.initializeStorage();
} catch (IOException e) /* fatal error */{
- e.printStackTrace();
throw new RuntimeException(e.getMessage(), e);
}
if (Profile.PROFILE && Profile.STARTUP)
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/launch/Equinox.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/launch/Equinox.java
index d4d687869..f8d24cc9e 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/launch/Equinox.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/launch/Equinox.java
@@ -14,11 +14,13 @@ import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
-import java.net.URL;
-import java.net.URLClassLoader;
+import java.net.*;
import java.security.*;
import java.util.*;
import org.eclipse.osgi.framework.internal.core.FrameworkProperties;
+import org.eclipse.osgi.framework.util.Headers;
+import org.eclipse.osgi.internal.baseadaptor.DevClassPathHelper;
+import org.eclipse.osgi.util.ManifestElement;
import org.osgi.framework.*;
import org.osgi.framework.launch.Framework;
@@ -39,7 +41,7 @@ public class Equinox implements Framework {
if (sm != null)
sm.checkPermission(new AllPermission());
useSeparateCL = FrameworkProperties.inUse();
- this.configuration = configuration;
+ this.configuration = configuration == null ? Collections.EMPTY_MAP : new HashMap(configuration);
}
private Framework createImpl() {
@@ -74,11 +76,96 @@ public class Equinox implements Framework {
ClassLoader thisCL = this.getClass().getClassLoader();
if (!(useSeparateCL && (thisCL instanceof URLClassLoader)))
return Class.forName(implName);
- URL[] cp = ((URLClassLoader) thisCL).getURLs();
+ URL[] cp = getFrameworkURLs((URLClassLoader) thisCL);
EquinoxFWClassLoader fwCL = new EquinoxFWClassLoader(cp, thisCL);
return fwCL.loadClass(implName);
}
+ private URL[] getFrameworkURLs(URLClassLoader frameworkLoader) {
+ // use the classpath of the framework class loader
+ URL[] cp = frameworkLoader.getURLs();
+ ArrayList result = new ArrayList(cp.length);
+ for (int i = 0; i < cp.length; i++) {
+ // need to add only the urls for the framework and any framework fragments
+ InputStream manifest = null;
+ try {
+ if (cp[i].getFile().endsWith("/")) { //$NON-NLS-1$
+ manifest = new URL(cp[i], org.eclipse.osgi.framework.internal.core.Constants.OSGI_BUNDLE_MANIFEST).openStream();
+ } else {
+ manifest = new URL("jar:" + cp[i].toExternalForm() + "!/" + org.eclipse.osgi.framework.internal.core.Constants.OSGI_BUNDLE_MANIFEST).openStream(); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ Map headers = ManifestElement.parseBundleManifest(manifest, new Headers(10));
+ String bsnSpec = getValue(headers, Constants.BUNDLE_SYMBOLICNAME);
+ if (bsnSpec == null)
+ continue;
+ String internalBSN = org.eclipse.osgi.framework.internal.core.Constants.getInternalSymbolicName();
+ if (internalBSN.equals(bsnSpec)) {
+ // this is the framework
+ addDevClassPaths(cp[i], bsnSpec, result);
+ result.add(cp[i]);
+ } else {
+ if (!isFrameworkFragment(headers, internalBSN))
+ continue;
+ // this is for a framework extension
+ addDevClassPaths(cp[i], bsnSpec, result);
+ result.add(cp[i]);
+ }
+ } catch (IOException e) {
+ continue; // no manifest;
+ } catch (BundleException e) {
+ continue; // bad manifest;
+ } finally {
+ if (manifest != null)
+ try {
+ manifest.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ }
+ return (URL[]) result.toArray(new URL[result.size()]);
+ }
+
+ private void addDevClassPaths(URL cp, String bsn, ArrayList result) {
+ if (!cp.getPath().endsWith("/")) //$NON-NLS-1$
+ return;
+ String[] devPaths = DevClassPathHelper.getDevClassPath(bsn);
+ if (devPaths == null)
+ return;
+ for (int i = 0; i < devPaths.length; i++)
+ try {
+ char lastChar = devPaths[i].charAt(devPaths[i].length() - 1);
+ URL url;
+ if ((devPaths[i].endsWith(".jar") || (lastChar == '/' || lastChar == '\\'))) //$NON-NLS-1$
+ url = new URL(cp, devPaths[i]);
+ else
+ url = new URL(cp, devPaths[i] + "/"); //$NON-NLS-1$
+ result.add(url);
+ } catch (MalformedURLException e) {
+ continue;
+ }
+ }
+
+ private boolean isFrameworkFragment(Map headers, String internalBSN) {
+ String hostBSN = getValue(headers, Constants.FRAGMENT_HOST);
+ return internalBSN.equals(hostBSN) || Constants.SYSTEM_BUNDLE_SYMBOLICNAME.equals(hostBSN);
+ }
+
+ private String getValue(Map headers, String key) {
+ String headerSpec = (String) headers.get(key);
+ if (headerSpec == null)
+ return null;
+ ManifestElement[] elements;
+ try {
+ elements = ManifestElement.parseHeader(key, headerSpec);
+ } catch (BundleException e) {
+ return null;
+ }
+ if (elements == null)
+ return null;
+ return elements[0].getValue();
+ }
+
private synchronized Framework getImpl() {
if (impl == null)
impl = createImpl();
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/launch/package.html b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/launch/package.html
new file mode 100644
index 000000000..b2d671be0
--- /dev/null
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/launch/package.html
@@ -0,0 +1,17 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <title>Package-level Javadoc</title>
+</head>
+<body>
+Provides the Equinox framework launch API.
+<h2>
+Package Specification</h2>
+This package specifies the Equinox framework launch API.
+<p>
+Clients that want to launch an embedded instance of Equinox
+will likely be interested in the types provided by this package.
+</p>
+</body>
+</html>
diff --git a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/AdaptorMsg.java b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/AdaptorMsg.java
index 48277287d..3185ff22a 100644
--- a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/AdaptorMsg.java
+++ b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/AdaptorMsg.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2008 IBM Corporation and others.
+ * Copyright (c) 2004, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -31,6 +31,8 @@ public class AdaptorMsg extends NLS {
public static String ADAPTOR_EXTENSION_NATIVECODE_ERROR;
public static String ADAPTOR_EXTENSION_REQUIRE_ERROR;
public static String ADAPTOR_STORAGE_EXCEPTION;
+ public static String ADAPTOR_STORAGE_INIT_FAILED_MSG;
+ public static String ADAPTOR_STORAGE_INIT_FAILED_TITLE;
public static String ADAPTOR_URL_CREATE_EXCEPTION;
public static String BUNDLE_CLASSPATH_ENTRY_NOT_FOUND_EXCEPTION;
diff --git a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/BaseStorage.java b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/BaseStorage.java
index 656a1d8fe..e9f2ce813 100644
--- a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/BaseStorage.java
+++ b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/BaseStorage.java
@@ -206,7 +206,7 @@ public class BaseStorage implements SynchronousBundleListener {
StateManager.DEBUG_PLATFORM_ADMIN_RESOLVER = options.getBooleanOption(OPTION_PLATFORM_ADMIN_RESOLVER, false);
}
- protected StorageManager initFileManager(File baseDir, String lockMode, boolean readOnly) {
+ protected StorageManager initFileManager(File baseDir, String lockMode, boolean readOnly) throws IOException {
StorageManager sManager = new StorageManager(baseDir, lockMode, readOnly);
try {
sManager.open(!readOnly);
@@ -218,6 +218,10 @@ public class BaseStorage implements SynchronousBundleListener {
String message = NLS.bind(EclipseAdaptorMsg.ECLIPSE_STARTUP_FILEMANAGER_OPEN_ERROR, ex.getMessage());
FrameworkLogEntry logEntry = new FrameworkLogEntry(FrameworkAdaptor.FRAMEWORK_SYMBOLICNAME, FrameworkLogEntry.ERROR, 0, message, 0, ex, null);
adaptor.getFrameworkLog().log(logEntry);
+ FrameworkProperties.setProperty(EclipseStarter.PROP_EXITCODE, "15"); //$NON-NLS-1$
+ String errorDialog = "<title>" + AdaptorMsg.ADAPTOR_STORAGE_INIT_FAILED_TITLE + "</title>" + NLS.bind(AdaptorMsg.ADAPTOR_STORAGE_INIT_FAILED_MSG, baseDir) + "\n" + ex.getMessage(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ FrameworkProperties.setProperty(EclipseStarter.PROP_EXITDATA, errorDialog);
+ throw ex;
}
return sManager;
}
diff --git a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/ExternalMessages.properties b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/ExternalMessages.properties
index 36c862014..d83e88923 100644
--- a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/ExternalMessages.properties
+++ b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/ExternalMessages.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2003, 2009 IBM Corporation and others.
+# Copyright (c) 2003, 2010 IBM Corporation and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
@@ -12,6 +12,8 @@
#External Messages for EN locale
ADAPTOR_STORAGE_EXCEPTION=The FrameworkAdaptor object could not perform the operation
+ADAPTOR_STORAGE_INIT_FAILED_MSG=Locking is not possible in the directory \"{0}\". A common reason is that the file system or Runtime Environment does not support file locking for that location. Please choose a different location, or disable file locking passing \"-Dosgi.locking=none\" as a VM argument.
+ADAPTOR_STORAGE_INIT_FAILED_TITLE =Invalid Configuration Location
ADAPTOR_URL_CREATE_EXCEPTION=\"{0}\" is an invalid URL
ADAPTOR_DIRECTORY_CREATE_EXCEPTION=The directory \"{0}\" could not be created
ADAPTOR_DIRECTORY_EXCEPTION=The file \"{0}\" is not a directory
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 603fb615a..520dda50f 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2009 IBM Corporation and others.
+ * Copyright (c) 2003, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -215,8 +215,10 @@ public class EclipseStarter {
}
}
// we only get here if an error happened
- FrameworkProperties.setProperty(PROP_EXITCODE, "13"); //$NON-NLS-1$
- FrameworkProperties.setProperty(PROP_EXITDATA, NLS.bind(EclipseAdaptorMsg.ECLIPSE_STARTUP_ERROR_CHECK_LOG, log == null ? null : log.getFile().getPath()));
+ if (FrameworkProperties.getProperty(PROP_EXITCODE) == null) {
+ FrameworkProperties.setProperty(PROP_EXITCODE, "13"); //$NON-NLS-1$
+ FrameworkProperties.setProperty(PROP_EXITDATA, NLS.bind(EclipseAdaptorMsg.ECLIPSE_STARTUP_ERROR_CHECK_LOG, log == null ? null : log.getFile().getPath()));
+ }
return null;
}
diff --git a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/internal/adaptor/CachedManifest.java b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/internal/adaptor/CachedManifest.java
index bc1a9712f..4705870b1 100644
--- a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/internal/adaptor/CachedManifest.java
+++ b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/internal/adaptor/CachedManifest.java
@@ -25,6 +25,7 @@ import org.osgi.framework.Version;
*/
public class CachedManifest extends Dictionary {
static final String SERVICE_COMPONENT = "Service-Component"; //$NON-NLS-1$
+ static boolean DEBUG = false;
private Dictionary manifest = null;
private EclipseStorageHook storageHook;
@@ -35,6 +36,8 @@ public class CachedManifest extends Dictionary {
public Dictionary getManifest() {
if (manifest == null)
try {
+ if (DEBUG)
+ System.out.println("Reading manifest for: " + storageHook.getBaseData()); //$NON-NLS-1$
manifest = storageHook.createCachedManifest(true);
} catch (BundleException e) {
final String message = NLS.bind(EclipseAdaptorMsg.ECLIPSE_CACHEDMANIFEST_UNEXPECTED_EXCEPTION, storageHook.getBaseData().getLocation());
@@ -133,6 +136,8 @@ public class CachedManifest extends Dictionary {
if (SERVICE_COMPONENT.equals(keyString))
return storageHook.getServiceComponent();
Dictionary result = getManifest();
+ if (DEBUG)
+ System.out.println("Manifest read because of header: " + key); //$NON-NLS-1$
return result == null ? null : result.get(key);
}
diff --git a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/internal/adaptor/EclipseAdaptorHook.java b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/internal/adaptor/EclipseAdaptorHook.java
index 86a57be99..cb29c6f55 100644
--- a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/internal/adaptor/EclipseAdaptorHook.java
+++ b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/internal/adaptor/EclipseAdaptorHook.java
@@ -42,6 +42,7 @@ public class EclipseAdaptorHook implements AdaptorHook, HookConfigurator {
private static final String RUNTIME_ADAPTOR = FrameworkAdaptor.FRAMEWORK_SYMBOLICNAME + "/eclipseadaptor"; //$NON-NLS-1$
private static final String OPTION_CONVERTER = RUNTIME_ADAPTOR + "/converter/debug"; //$NON-NLS-1$
private static final String OPTION_LOCATION = RUNTIME_ADAPTOR + "/debug/location"; //$NON-NLS-1$
+ private static final String OPTION_CACHEDMANIFEST = RUNTIME_ADAPTOR + "/debug/cachedmanifest"; //$NON-NLS-1$
static final boolean SET_TCCL_XMLFACTORY = "true".equals(FrameworkProperties.getProperty("eclipse.parsers.setTCCL", "true"));//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
private BaseAdaptor adaptor;
@@ -213,6 +214,7 @@ public class EclipseAdaptorHook implements AdaptorHook, HookConfigurator {
return;
PluginConverterImpl.DEBUG = options.getBooleanOption(OPTION_CONVERTER, false);
BasicLocation.DEBUG = options.getBooleanOption(OPTION_LOCATION, false);
+ CachedManifest.DEBUG = options.getBooleanOption(OPTION_CACHEDMANIFEST, false);
}
public void addHooks(HookRegistry hookRegistry) {
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/GroupingChecker.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/GroupingChecker.java
index a0522d09f..79f9e59dc 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/GroupingChecker.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/GroupingChecker.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2008 IBM Corporation and others. All rights reserved.
+ * Copyright (c) 2004, 2010 IBM Corporation and others. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
@@ -159,7 +159,7 @@ public class GroupingChecker {
if (supplier.getExport(packageName) != null) {
// the required bundle exports the package; get the package roots from it
PackageRoots requiredRoots = getPackageRoots(supplier, packageName, visited);
- if (requiredRoots != null)
+ if (requiredRoots != nullPackageRoots)
roots.add(requiredRoots);
} else {
// the bundle does not export the package; but it may reexport another bundle that does
@@ -171,7 +171,7 @@ public class GroupingChecker {
if (reexported.getExport(packageName) != null) {
// the reexported bundle exports the package; get the package roots from it
PackageRoots reExportedRoots = getPackageRoots(reexported, packageName, visited);
- if (reexported != null)
+ if (reExportedRoots != nullPackageRoots)
roots.add(reExportedRoots);
}
}
diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/debug/FrameworkDebugOptions.java b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/debug/FrameworkDebugOptions.java
index 5c0a137e5..020022dc8 100644
--- a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/debug/FrameworkDebugOptions.java
+++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/debug/FrameworkDebugOptions.java
@@ -14,6 +14,7 @@ import java.io.*;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.*;
+import java.util.Map.Entry;
import org.eclipse.osgi.framework.internal.core.FrameworkProperties;
import org.eclipse.osgi.service.debug.*;
import org.osgi.framework.*;
@@ -188,6 +189,17 @@ public class FrameworkDebugOptions implements DebugOptions, ServiceTrackerCustom
}
}
+ public Map getOptions() {
+ Properties snapShot = new Properties();
+ synchronized (lock) {
+ if (options != null)
+ snapShot.putAll(options);
+ else if (disabledOptions != null)
+ snapShot.putAll(disabledOptions);
+ }
+ return snapShot;
+ }
+
/*
* (non-Javadoc)
* @see org.eclipse.osgi.service.debug.DebugOptions#getAllOptions()
@@ -220,19 +232,15 @@ public class FrameworkDebugOptions implements DebugOptions, ServiceTrackerCustom
public void removeOption(String option) {
if (option == null)
return;
- boolean fireChangedEvent = false;
+ String fireChangedEvent = null;
synchronized (lock) {
- if (options != null) {
- fireChangedEvent = options.remove(option) != null;
+ if (options != null && options.remove(option) != null) {
+ fireChangedEvent = getSymbolicName(option);
}
}
// Send the options change event outside the sync block
- if (fireChangedEvent) {
- int firstSlashIndex = option.indexOf("/"); //$NON-NLS-1$
- if (firstSlashIndex > 0) {
- String symbolicName = option.substring(0, firstSlashIndex);
- optionsChanged(symbolicName);
- }
+ if (fireChangedEvent != null) {
+ optionsChanged(fireChangedEvent);
}
}
@@ -241,7 +249,12 @@ public class FrameworkDebugOptions implements DebugOptions, ServiceTrackerCustom
* @see org.eclipse.osgi.service.debug.DebugOptions#setOption(java.lang.String, java.lang.String)
*/
public void setOption(String option, String value) {
- boolean fireChangedEvent = false;
+
+ if (option == null || value == null) {
+ throw new IllegalArgumentException("The option and value must not be null."); //$NON-NLS-1$
+ }
+ String fireChangedEvent = null;
+ value = value != null ? value.trim() : null;
synchronized (lock) {
if (options != null) {
// get the current value
@@ -249,26 +262,75 @@ public class FrameworkDebugOptions implements DebugOptions, ServiceTrackerCustom
if (currentValue != null) {
if (!currentValue.equals(value)) {
- fireChangedEvent = true;
+ fireChangedEvent = getSymbolicName(option);
}
} else {
if (value != null) {
- fireChangedEvent = true;
+ fireChangedEvent = getSymbolicName(option);
}
}
- if (fireChangedEvent) {
- options.put(option, value.trim());
+ if (fireChangedEvent != null) {
+ options.put(option, value);
}
}
}
// Send the options change event outside the sync block
- if (fireChangedEvent) {
- int firstSlashIndex = option.indexOf("/"); //$NON-NLS-1$
- if (firstSlashIndex > 0) {
- String symbolicName = option.substring(0, firstSlashIndex);
- optionsChanged(symbolicName);
+ if (fireChangedEvent != null) {
+ optionsChanged(fireChangedEvent);
+ }
+ }
+
+ private String getSymbolicName(String option) {
+ int firstSlashIndex = option.indexOf("/"); //$NON-NLS-1$
+ if (firstSlashIndex > 0)
+ return option.substring(0, firstSlashIndex);
+ return null;
+ }
+
+ public void setOptions(Map ops) {
+ if (ops == null)
+ throw new IllegalArgumentException("The options must not be null."); //$NON-NLS-1$
+ Properties newOptions = new Properties();
+ for (Iterator entries = ops.entrySet().iterator(); entries.hasNext();) {
+ Entry entry = (Entry) entries.next();
+ if (!(entry.getKey() instanceof String) || !(entry.getValue() instanceof String))
+ throw new IllegalArgumentException("Option keys and values must be of type String: " + entry.getKey() + "=" + entry.getValue()); //$NON-NLS-1$ //$NON-NLS-2$
+ newOptions.put(entry.getKey(), ((String) entry.getValue()).trim());
+ }
+ Set fireChangesTo = null;
+
+ synchronized (lock) {
+ if (options == null) {
+ disabledOptions = newOptions;
+ // no events to fire
+ return;
+ }
+ fireChangesTo = new HashSet();
+ // first check for removals
+ for (Iterator keys = options.keySet().iterator(); keys.hasNext();) {
+ String key = (String) keys.next();
+ if (!newOptions.containsKey(key)) {
+ String symbolicName = getSymbolicName(key);
+ if (symbolicName != null)
+ fireChangesTo.add(symbolicName);
+ }
+ }
+ // now check for changes to existing values
+ for (Iterator newEntries = newOptions.entrySet().iterator(); newEntries.hasNext();) {
+ Entry entry = (Entry) newEntries.next();
+ String existingValue = (String) options.get(entry.getKey());
+ if (!entry.getValue().equals(existingValue)) {
+ String symbolicName = getSymbolicName((String) entry.getKey());
+ if (symbolicName != null)
+ fireChangesTo.add(symbolicName);
+ }
}
+ // finally set the actual options
+ options = newOptions;
}
+ if (fireChangesTo != null)
+ for (Iterator iChanges = fireChangesTo.iterator(); iChanges.hasNext();)
+ optionsChanged((String) iChanges.next());
}
/*
diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/log/package.html b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/log/package.html
new file mode 100644
index 000000000..a4db43cbc
--- /dev/null
+++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/log/package.html
@@ -0,0 +1,17 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <title>Package-level Javadoc</title>
+</head>
+<body>
+Provides the <tt>FrameworkLog</tt> service.
+<h2>
+Package Specification</h2>
+This package specifies the API for the <tt>FrameworkLog</tt> service.
+<p>
+Clients needing to log entries to the eclipse log will likely be interested
+in the types provided by this package.
+</p>
+</body>
+</html>
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 8611c310f..9e6b3bd2e 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
@@ -11,6 +11,7 @@
package org.eclipse.osgi.service.debug;
import java.io.File;
+import java.util.Map;
/**
* Used to get debug options settings and creating a new {@link DebugTrace} instance for
@@ -97,6 +98,19 @@ public interface DebugOptions {
public abstract int getIntegerOption(String option, int defaultValue);
/**
+ * Returns a snapshot of the current options. All
+ * keys and values are of type <code>String</code>. If no
+ * options are set then an empty map is returned.
+ * <p>
+ * If debug is not enabled then the snapshot of the current disabled
+ * values is returned. See {@link DebugOptions#setDebugEnabled(boolean)}.
+ * </p>
+ * @return a snapshot of the current options.
+ * @since 3.6
+ */
+ public Map /*<String, String>*/getOptions();
+
+ /**
* Sets the identified option to the identified value. If debug is
* not enabled then the specified option is not changed.
* @param option the name of the option to set
@@ -105,6 +119,24 @@ public interface DebugOptions {
public abstract void setOption(String option, String value);
/**
+ * Sets the current option key/value pairs to the specified options.
+ * The specified map replaces all keys and values of the current debug options.
+ * An <code>IllegalArgumentException</code> is thrown if any key or value
+ * in the specified map is not of type <code>String</code>.
+ * <p>
+ * If debug is not enabled then the specified options are saved as
+ * the disabled values and no notifications will be sent.
+ * See {@link DebugOptions#setDebugEnabled(boolean)}.
+ * If debug is enabled then notifications will be sent to the
+ * listeners which have options that have been changed, added or removed.
+ * </p>
+
+ * @param options the new set of options
+ * @since 3.6
+ */
+ public abstract void setOptions(Map /*<String, String>*/options);
+
+ /**
* Removes the identified option. If debug is not enabled then
* the specified option is not removed.
* @param option the name of the option to remove
diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/service/debug/DebugTrace.java b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/service/debug/DebugTrace.java
index 33c3e9d90..a6768b731 100644
--- a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/service/debug/DebugTrace.java
+++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/service/debug/DebugTrace.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
+ * Copyright (c) 2009, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -28,6 +28,11 @@ package org.eclipse.osgi.service.debug;
* of "/debug/parser", the trace will only be printed if the option "com.acme.bundle/debug/parser"
* has a value of "true".
* </p>
+ * <p>
+ * Note that the pipe character ("&#124;") is reserved for internal use. If this character
+ * happens to occur in any of the thread name, the option, the message or an Exception
+ * message, it will be escaped to the corresponding HTML representation ("&amp&#35;124&#59;").
+ * </p>
*
* @since 3.5
* @noimplement This interface is not intended to be implemented by clients.
diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/service/debug/package.html b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/service/debug/package.html
new file mode 100644
index 000000000..8c32c76e5
--- /dev/null
+++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/service/debug/package.html
@@ -0,0 +1,17 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <title>Package-level Javadoc</title>
+</head>
+<body>
+Provides the <tt>DebugOptions</tt> service.
+<h2>
+Package Specification</h2>
+This package specifies the API for the <tt>DebugOptions</tt> service.
+<p>
+Clients accessing debug and trace options will likely be interested
+in the types provided by this package.
+</p>
+</body>
+</html>
diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/service/environment/package.html b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/service/environment/package.html
new file mode 100644
index 000000000..ef6f90466
--- /dev/null
+++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/service/environment/package.html
@@ -0,0 +1,18 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <title>Package-level Javadoc</title>
+</head>
+<body>
+Provides the <tt>EnvironmentInfo</tt> service.
+<h2>
+Package Specification</h2>
+This package specifies the API for the <tt>EnvironmentInfo</tt> service.
+<p>
+Clients accessing the command line used to start the running framework
+as well as information about the environment will likely be interested
+in the types provided by this package.
+</p>
+</body>
+</html>
diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/service/localization/package.html b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/service/localization/package.html
new file mode 100644
index 000000000..07ddb0021
--- /dev/null
+++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/service/localization/package.html
@@ -0,0 +1,19 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <title>Package-level Javadoc</title>
+</head>
+<body>
+Provides bundle localization and local provider service APIs.
+<h2>
+Package Specification</h2>
+This package specifies the API for the <tt>BundleLocalization</tt> and
+<tt>LocalePrivder</tt> services.
+<p>
+Clients accessing the localization resource bundles use to localize
+OSGi bundle manifests will likely be interested in the types provided
+by this package.
+</p>
+</body>
+</html>
diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/service/runnable/ApplicationLauncher.java b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/service/runnable/ApplicationLauncher.java
index b1be943d3..85128c99e 100644
--- a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/service/runnable/ApplicationLauncher.java
+++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/service/runnable/ApplicationLauncher.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2008 IBM Corporation and others.
+ * Copyright (c) 2005, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -17,6 +17,10 @@ package org.eclipse.osgi.service.runnable;
* <p>
* This interface is not intended to be implemented by clients.
* </p>
+ * <p>
+ * This class is for internal use by the platform-related plug-ins.
+ * Clients outside of the base platform should not reference or subclass this class.
+ * </p>
*
* @since 3.2
* @noimplement This interface is not intended to be implemented by clients.
diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/service/runnable/ApplicationRunnable.java b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/service/runnable/ApplicationRunnable.java
index c01f2ec3e..1d9efee1f 100644
--- a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/service/runnable/ApplicationRunnable.java
+++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/service/runnable/ApplicationRunnable.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2008 IBM Corporation and others.
+ * Copyright (c) 2004, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -12,6 +12,10 @@ package org.eclipse.osgi.service.runnable;
/**
* A parameterized runnable that can be stopped.
+ * <p>
+ * This class is for internal use by the platform-related plug-ins.
+ * Clients outside of the base platform should not reference or subclass this class.
+ * </p>
* @since 3.2
*/
public interface ApplicationRunnable extends ParameterizedRunnable {
diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/service/runnable/ParameterizedRunnable.java b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/service/runnable/ParameterizedRunnable.java
index 2489dbde5..e75c891f3 100644
--- a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/service/runnable/ParameterizedRunnable.java
+++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/service/runnable/ParameterizedRunnable.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2008 IBM Corporation and others.
+ * Copyright (c) 2004, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -18,6 +18,10 @@ package org.eclipse.osgi.service.runnable;
* <p>
* Clients may implement this interface.
* </p>
+ * <p>
+ * This class is for internal use by the platform-related plug-ins.
+ * Clients outside of the base platform should not reference or subclass this class.
+ * </p>
* @since 3.0
*/
public interface ParameterizedRunnable {
diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/service/runnable/package.html b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/service/runnable/package.html
new file mode 100644
index 000000000..03dbe8d4a
--- /dev/null
+++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/service/runnable/package.html
@@ -0,0 +1,17 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <title>Package-level Javadoc</title>
+</head>
+<body>
+Provides API for monitoring and running code on the main thread.
+<h2>
+Package Specification</h2>
+This package specifies the API for monitoring and running code on the main thread.
+<p>
+Clients that monitor the startup sequence will likely be interested
+in the types provided by this package.
+</p>
+</body>
+</html>
diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/storagemanager/StorageManager.java b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/storagemanager/StorageManager.java
index cf23f2783..3ebfe71c1 100644
--- a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/storagemanager/StorageManager.java
+++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/storagemanager/StorageManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2008 IBM Corporation and others.
+ * Copyright (c) 2004, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -87,12 +87,14 @@ public final class StorageManager {
private static final int FILETYPE_STANDARD = 0;
private static final int FILETYPE_RELIABLEFILE = 1;
private static final SecureAction secure = (SecureAction) AccessController.doPrivileged(SecureAction.createSecureAction());
- private static boolean tempCleanup = Boolean.valueOf(secure.getProperty("osgi.embedded.cleanTempFiles")).booleanValue(); //$NON-NLS-1$
- private static boolean openCleanup = Boolean.valueOf(secure.getProperty("osgi.embedded.cleanupOnOpen")).booleanValue(); //$NON-NLS-1$
+ private static final boolean tempCleanup = Boolean.valueOf(secure.getProperty("osgi.embedded.cleanTempFiles")).booleanValue(); //$NON-NLS-1$
+ private static final boolean openCleanup = Boolean.valueOf(secure.getProperty("osgi.embedded.cleanupOnOpen")).booleanValue(); //$NON-NLS-1$
private static final String MANAGER_FOLDER = ".manager"; //$NON-NLS-1$
private static final String TABLE_FILE = ".fileTable"; //$NON-NLS-1$
private static final String LOCK_FILE = ".fileTableLock"; //$NON-NLS-1$
private static final int MAX_LOCK_WAIT = 5000; // 5 seconds
+ // this should be static but the tests expect to be able to create new managers after changing this setting dynamically
+ private final boolean useReliableFiles = Boolean.valueOf(secure.getProperty("osgi.useReliableFiles")).booleanValue(); //$NON-NLS-1$
private class Entry {
int readId;
@@ -130,24 +132,23 @@ public final class StorageManager {
}
}
- private File base; //The folder managed
- private File managerRoot; //The folder that will contain all the file related to the functionning of the manager (typically a subdir of base)
+ private final File base; //The folder managed
+ private final File managerRoot; //The folder that will contain all the file related to the functionning of the manager (typically a subdir of base)
- private String lockMode = null;
- private File tableFile = null;
- private File lockFile; // The lock file for the table (this file is the same for all the instances)
+ private final String lockMode;
+ private final File tableFile;
+ private final File lockFile; // The lock file for the table (this file is the same for all the instances)
private Locker locker; // The locker for the lock
- private File instanceFile = null; //The file reprensenting the running instance. It is created when the table file is read.
+ private File instanceFile; //The file representing the running instance. It is created when the table file is read.
private Locker instanceLocker = null; //The locker for the instance file.
- private boolean readOnly; // Whether this storage manager is in read-only mode
+ private final boolean readOnly; // Whether this storage manager is in read-only mode
private boolean open; // Whether this storage manager is open for use
// locking related fields
private int tableStamp = -1;
- private Properties table = new Properties();
- private boolean useReliableFiles = Boolean.valueOf(secure.getProperty("osgi.useReliableFiles")).booleanValue(); //$NON-NLS-1$
+ private final Properties table = new Properties();
/**
* Returns a new storage manager for the area identified by the given base
@@ -174,8 +175,6 @@ public final class StorageManager {
this.base = base;
this.lockMode = lockMode;
this.managerRoot = new File(base, MANAGER_FOLDER);
- if (!readOnly)
- this.managerRoot.mkdirs();
this.tableFile = new File(managerRoot, TABLE_FILE);
this.lockFile = new File(managerRoot, LOCK_FILE);
this.readOnly = readOnly;
@@ -677,12 +676,15 @@ public final class StorageManager {
* This methods opens the storage manager.
* This method must be called before any operation on the storage manager.
* @param wait indicates if the open operation must wait in case of contention on the lock file.
- * @throws IOException if an error occured opening the storage manager
+ * @throws IOException if an error occurred opening the storage manager
*/
public void open(boolean wait) throws IOException {
if (openCleanup)
cleanup();
if (!readOnly) {
+ managerRoot.mkdirs();
+ if (!managerRoot.exists())
+ throw new IOException(EclipseAdaptorMsg.fileManager_cannotLock);
boolean locked = lock(wait);
if (!locked && wait)
throw new IOException(EclipseAdaptorMsg.fileManager_cannotLock);
diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/storagemanager/package.html b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/storagemanager/package.html
new file mode 100644
index 000000000..660775973
--- /dev/null
+++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/storagemanager/package.html
@@ -0,0 +1,17 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <title>Package-level Javadoc</title>
+</head>
+<body>
+Provides the storage manager API.
+<h2>
+Package Specification</h2>
+This package specifies the API for managing a group of files that are related to each other.
+<p>
+Clients that manage groups of files that are closely related to each other may be interested
+in the types provided by this package.
+</p>
+</body>
+</html>

Back to the top