Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDJ Houghton2006-02-09 11:25:30 -0500
committerDJ Houghton2006-02-09 11:25:30 -0500
commit43b604d5e19d8af20ca9318d86d0017ab12c6574 (patch)
tree82655b25d95574981ad799d83bd9be73f3977023
parent4a1946965c5fc8ea61b8ae79e0ec4fe33e5f70d8 (diff)
downloadrt.equinox.bundles-43b604d5e19d8af20ca9318d86d0017ab12c6574.tar.gz
rt.equinox.bundles-43b604d5e19d8af20ca9318d86d0017ab12c6574.tar.xz
rt.equinox.bundles-43b604d5e19d8af20ca9318d86d0017ab12c6574.zip
Bug 105851 - Allow per instance configuration of the framework
-rw-r--r--bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/DevClassPathHelper.java2
-rw-r--r--bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/FindSupport.java8
-rw-r--r--bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/ExtensionsParser.java3
-rw-r--r--bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/RegistryObjectManager.java2
-rw-r--r--bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/RegistryProperties.java36
-rw-r--r--bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/TableReader.java2
-rw-r--r--bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/TableWriter.java6
-rw-r--r--bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/osgi/Activator.java5
-rw-r--r--bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/osgi/RegistryStrategyOSGI.java10
9 files changed, 56 insertions, 18 deletions
diff --git a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/DevClassPathHelper.java b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/DevClassPathHelper.java
index cfab2ea6..de1e0222 100644
--- a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/DevClassPathHelper.java
+++ b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/DevClassPathHelper.java
@@ -27,7 +27,7 @@ public class DevClassPathHelper {
static {
// Check the osgi.dev property to see if dev classpath entries have been defined.
- String osgiDev = System.getProperty(PROP_DEV);
+ String osgiDev = Activator.getContext() == null ? System.getProperty(PROP_DEV) : Activator.getContext().getProperty(PROP_DEV);
if (osgiDev != null) {
try {
inDevelopmentMode = true;
diff --git a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/FindSupport.java b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/FindSupport.java
index 1a9b8351..caa5aaf2 100644
--- a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/FindSupport.java
+++ b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/FindSupport.java
@@ -29,7 +29,7 @@ public class FindSupport {
public static final String PROP_WS = "osgi.ws"; //$NON-NLS-1$
public static final String PROP_ARCH = "osgi.arch"; //$NON-NLS-1$
- private static String[] NL_JAR_VARIANTS = buildNLVariants(System.getProperty(PROP_NL));
+ private static String[] NL_JAR_VARIANTS = buildNLVariants(Activator.getContext() == null ? System.getProperty(PROP_NL) : Activator.getContext().getProperty(PROP_NL));
private static String[] buildNLVariants(String nl) {
ArrayList result = new ArrayList();
@@ -108,7 +108,7 @@ public class FindSupport {
}
if (os == null)
// use default
- os = System.getProperty(PROP_OS);
+ os = Activator.getContext().getProperty(PROP_OS);
if (os.length() == 0)
return null;
@@ -123,7 +123,7 @@ public class FindSupport {
}
if (osArch == null)
// use default
- osArch = System.getProperty(PROP_ARCH);
+ osArch = Activator.getContext().getProperty(PROP_ARCH);
if (osArch.length() == 0)
return null;
@@ -159,7 +159,7 @@ public class FindSupport {
}
if (ws == null)
// use default
- ws = System.getProperty(PROP_WS);
+ ws = Activator.getContext().getProperty(PROP_WS);
IPath filePath = new Path("ws").append(ws).append(path); //$NON-NLS-1$
// We know that there is only one segment to the ws path
// e.g. ws/win32
diff --git a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/ExtensionsParser.java b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/ExtensionsParser.java
index 5d540d2f..fc7e72e4 100644
--- a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/ExtensionsParser.java
+++ b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/ExtensionsParser.java
@@ -15,6 +15,7 @@ import java.io.IOException;
import java.util.*;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParserFactory;
+import org.eclipse.core.internal.registry.osgi.Activator;
import org.eclipse.core.runtime.*;
import org.eclipse.osgi.util.NLS;
import org.xml.sax.*;
@@ -563,7 +564,7 @@ public class ExtensionsParser extends DefaultHandler {
* for extension points that were renamed between release 2.1 and 3.0.
*/
private Extension[] fixRenamedExtensionPoints(Extension[] extensions) {
- if (extensions == null || (schemaVersion != null && schemaVersion.equals("3.0")) || System.getProperties().get(NO_EXTENSION_MUNGING) != null) //$NON-NLS-1$
+ if (extensions == null || (schemaVersion != null && schemaVersion.equals("3.0")) || RegistryProperties.getProperty(NO_EXTENSION_MUNGING) != null) //$NON-NLS-1$
return extensions;
for (int i = 0; i < extensions.length; i++) {
Extension extension = extensions[i];
diff --git a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/RegistryObjectManager.java b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/RegistryObjectManager.java
index d9294319..c2bb4b57 100644
--- a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/RegistryObjectManager.java
+++ b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/RegistryObjectManager.java
@@ -67,7 +67,7 @@ public class RegistryObjectManager implements IObjectManager {
public RegistryObjectManager(ExtensionRegistry registry) {
extensionPoints = new HashtableOfStringAndInt();
- if ("true".equalsIgnoreCase(System.getProperty(PROP_NO_REGISTRY_FLUSHING))) { //$NON-NLS-1$
+ if ("true".equalsIgnoreCase(RegistryProperties.getProperty(PROP_NO_REGISTRY_FLUSHING))) { //$NON-NLS-1$
cache = new ReferenceMap(ReferenceMap.HARD, CACHE_INITIAL_SIZE, DEFAULT_LOADFACTOR);
} else {
cache = new ReferenceMap(ReferenceMap.SOFT, CACHE_INITIAL_SIZE, DEFAULT_LOADFACTOR);
diff --git a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/RegistryProperties.java b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/RegistryProperties.java
new file mode 100644
index 00000000..b40894aa
--- /dev/null
+++ b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/RegistryProperties.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2006 Eclipse Foundation 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
+ *
+ *******************************************************************************/
+package org.eclipse.core.internal.registry;
+
+import java.util.Properties;
+
+import org.eclipse.core.internal.registry.osgi.Activator;
+import org.osgi.framework.BundleContext;
+
+/**
+ * Simple Property mechanism to chain property lookup from local registry properties,
+ * to BundleContext properties (if available) or System properties otherwise.
+ */
+public class RegistryProperties {
+
+ private static Properties registryProperties = new Properties();
+
+ public static String getProperty(String propertyName) {
+ String propertyValue = registryProperties.getProperty(propertyName);
+ if (propertyValue != null)
+ return propertyValue;
+
+ BundleContext bc = Activator.getContext();
+ return (bc == null) ? System.getProperty(propertyName) : bc.getProperty(propertyName);
+ }
+
+ public static void setProperty(String propertyName, String propertyValue) {
+ registryProperties.setProperty(propertyName, propertyValue);
+ }
+}
diff --git a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/TableReader.java b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/TableReader.java
index 3a83fc4a..3d909493 100644
--- a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/TableReader.java
+++ b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/TableReader.java
@@ -129,7 +129,7 @@ public class TableReader {
String windowsStamp = in.readUTF();
String localeStamp = in.readUTF();
long timeStamp = registry.computeState();
- return ((expectedTimestamp == 0 || expectedTimestamp == registryStamp) && (installStamp == timeStamp) && (osStamp.equals(System.getProperty(IRegistryConstants.PROP_OS))) && (windowsStamp.equals(System.getProperty(IRegistryConstants.PROP_WS))) && (localeStamp.equals(System.getProperty(IRegistryConstants.PROP_NL))) && mainDataFileSize == mainDataFile.length() && extraDataFileSize == extraDataFile.length() && contributionsFileSize == contributionsFile.length() && orphansFileSize == orphansFile.length());
+ return ((expectedTimestamp == 0 || expectedTimestamp == registryStamp) && (installStamp == timeStamp) && (osStamp.equals(RegistryProperties.getProperty(IRegistryConstants.PROP_OS))) && (windowsStamp.equals(RegistryProperties.getProperty(IRegistryConstants.PROP_WS))) && (localeStamp.equals(RegistryProperties.getProperty(IRegistryConstants.PROP_NL))) && mainDataFileSize == mainDataFile.length() && extraDataFileSize == extraDataFile.length() && contributionsFileSize == contributionsFile.length() && orphansFileSize == orphansFile.length());
} catch (IOException e) {
log(new Status(IStatus.ERROR, RegistryMessages.OWNER_NAME, fileError, RegistryMessages.meta_registryCacheInconsistent, e));
return false;
diff --git a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/TableWriter.java b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/TableWriter.java
index 2b929d67..ca530ec1 100644
--- a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/TableWriter.java
+++ b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/TableWriter.java
@@ -194,9 +194,9 @@ public class TableWriter {
output.writeLong(extraDataFile.length());
output.writeLong(contributionsFile.length());
output.writeLong(orphansFile.length());
- output.writeUTF(System.getProperty(IRegistryConstants.PROP_OS));
- output.writeUTF(System.getProperty(IRegistryConstants.PROP_WS));
- output.writeUTF(System.getProperty(IRegistryConstants.PROP_NL));
+ output.writeUTF(RegistryProperties.getProperty(IRegistryConstants.PROP_OS));
+ output.writeUTF(RegistryProperties.getProperty(IRegistryConstants.PROP_WS));
+ output.writeUTF(RegistryProperties.getProperty(IRegistryConstants.PROP_NL));
}
private void saveArray(int[] array, DataOutputStream out) throws IOException {
diff --git a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/osgi/Activator.java b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/osgi/Activator.java
index 200b4504..a47c096d 100644
--- a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/osgi/Activator.java
+++ b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/osgi/Activator.java
@@ -13,6 +13,7 @@ package org.eclipse.core.internal.registry.osgi;
import java.io.File;
import java.util.Hashtable;
import org.eclipse.core.internal.registry.IRegistryConstants;
+import org.eclipse.core.internal.registry.RegistryProperties;
import org.eclipse.core.runtime.*;
import org.eclipse.osgi.service.datalocation.Location;
import org.eclipse.osgi.service.environment.EnvironmentInfo;
@@ -85,9 +86,9 @@ public class Activator implements BundleActivator {
for (int i = 0; i < args.length; i++) {
if (args[i].equalsIgnoreCase(IRegistryConstants.NO_REGISTRY_CACHE))
- System.getProperties().setProperty(IRegistryConstants.PROP_NO_REGISTRY_CACHE, "true"); //$NON-NLS-1$
+ RegistryProperties.setProperty(IRegistryConstants.PROP_NO_REGISTRY_CACHE, "true"); //$NON-NLS-1$
else if (args[i].equalsIgnoreCase(IRegistryConstants.NO_LAZY_REGISTRY_CACHE_LOADING))
- System.getProperties().setProperty(IRegistryConstants.PROP_NO_LAZY_CACHE_LOADING, "true"); //$NON-NLS-1$
+ RegistryProperties.setProperty(IRegistryConstants.PROP_NO_LAZY_CACHE_LOADING, "true"); //$NON-NLS-1$
}
}
diff --git a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/osgi/RegistryStrategyOSGI.java b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/osgi/RegistryStrategyOSGI.java
index eceb7642..0722f8da 100644
--- a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/osgi/RegistryStrategyOSGI.java
+++ b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/osgi/RegistryStrategyOSGI.java
@@ -301,20 +301,20 @@ public class RegistryStrategyOSGI extends RegistryStrategy {
// Cache strategy
public boolean cacheUse() {
- return !"true".equals(System.getProperty(IRegistryConstants.PROP_NO_REGISTRY_CACHE)); //$NON-NLS-1$
+ return !"true".equals(RegistryProperties.getProperty(IRegistryConstants.PROP_NO_REGISTRY_CACHE)); //$NON-NLS-1$
}
public boolean cacheLazyLoading() {
- return !("true".equalsIgnoreCase(System.getProperty(IRegistryConstants.PROP_NO_LAZY_CACHE_LOADING))); //$NON-NLS-1$
+ return !("true".equalsIgnoreCase(RegistryProperties.getProperty(IRegistryConstants.PROP_NO_LAZY_CACHE_LOADING))); //$NON-NLS-1$
}
public long cacheComputeTimeStamp() {
- // If the check config prop is false or not set then exit
- if (!"true".equalsIgnoreCase(System.getProperty(IRegistryConstants.PROP_CHECK_CONFIG))) //$NON-NLS-1$
- return 0;
BundleContext context = Activator.getContext();
if (context == null)
return 0;
+ // If the check config prop is false or not set then exit
+ if (!"true".equalsIgnoreCase(context.getProperty(IRegistryConstants.PROP_CHECK_CONFIG))) //$NON-NLS-1$
+ return 0;
Bundle[] allBundles = context.getBundles();
long result = 0;
for (int i = 0; i < allBundles.length; i++) {

Back to the top