Added support for DebugOptions
diff --git a/bundles/org.eclipse.equinox.ds/.options b/bundles/org.eclipse.equinox.ds/.options
new file mode 100644
index 0000000..e4414ee
--- /dev/null
+++ b/bundles/org.eclipse.equinox.ds/.options
@@ -0,0 +1,14 @@
+# Debugging options for the org.eclipse.equinox.ds plugin
+
+# Turns on/off debugging of SCR
+org.eclipse.equinox.ds/debug=false
+# Specifies that logged entries should be printed to the framework runtime console 
+org.eclipse.equinox.ds/print_on_console=false
+# Enables generating and printing logs about the time performance of the operations executed by the SCR
+org.eclipse.equinox.ds/performance=false
+
+#Advanced options 
+# Enables caching of the parsed XML documents of the component descriptions
+#org.eclipse.equinox.ds/cache_descriptions=false
+# Specifies the maximum time in milliseconds, which is allowed to a user component's activate or bind method to take. If the method invocation has not finished, a new dispatcher thread will be launched to process the pending work of SCR 
+#org.eclipse.equinox.ds/block_timeout=30000
diff --git a/bundles/org.eclipse.equinox.ds/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.ds/META-INF/MANIFEST.MF
index 8ce276d..98d9cfb 100644
--- a/bundles/org.eclipse.equinox.ds/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.ds/META-INF/MANIFEST.MF
@@ -18,6 +18,7 @@
  org.eclipse.equinox.internal.util.ref;version="1.0",
  org.eclipse.equinox.internal.util.threadpool;version="1.0",
  org.eclipse.equinox.internal.util.timer;version="1.0",
+ org.eclipse.osgi.service.debug;version="1.0", 
  org.eclipse.osgi.util,
  org.osgi.framework;version="1.3",
  org.osgi.service.cm;version="1.2",
diff --git a/bundles/org.eclipse.equinox.ds/src/org/eclipse/equinox/internal/ds/Activator.java b/bundles/org.eclipse.equinox.ds/src/org/eclipse/equinox/internal/ds/Activator.java
index cbbc9fb..86f5edb 100644
--- a/bundles/org.eclipse.equinox.ds/src/org/eclipse/equinox/internal/ds/Activator.java
+++ b/bundles/org.eclipse.equinox.ds/src/org/eclipse/equinox/internal/ds/Activator.java
@@ -13,6 +13,7 @@
 
 import java.util.Dictionary;
 import org.eclipse.equinox.internal.util.ref.Log;
+import org.eclipse.osgi.service.debug.DebugOptions;
 import org.osgi.framework.*;
 import org.osgi.service.cm.ConfigurationAdmin;
 import org.osgi.service.cm.ConfigurationListener;
@@ -42,6 +43,8 @@
 	private ServiceTracker cmTracker;
 	private ServiceRegistration cmTrackerReg;
 
+	private ServiceTracker debugTracker = null;
+
 	private SCRManager scrManager = null;
 
 	private boolean inited = false;
@@ -127,12 +130,14 @@
 			time = new long[] {tmp, 0, tmp};
 		}
 		// initialize the logging routines
+		debugTracker = new ServiceTracker(bc, DebugOptions.class.getName(), null);
+		debugTracker.open();
 		log = new Log(bc, false);
-		DEBUG = getBoolean("equinox.ds.debug");
-		PERF = getBoolean("equinox.ds.perf");
-		DBSTORE = getBoolean("equinox.ds.dbstore");
+		DEBUG = getBooleanDebugOption("org.eclipse.equinox.ds/debug", false) || getBoolean("equinox.ds.debug");
+		PERF = getBooleanDebugOption("org.eclipse.equinox.ds/performance", false) || getBoolean("equinox.ds.perf");
+		DBSTORE = getBooleanDebugOption("org.eclipse.equinox.ds/cache_descriptions", false) || getBoolean("equinox.ds.dbstore");
 		log.setDebug(DEBUG);
-		boolean print = getBoolean("equinox.ds.print");
+		boolean print = getBooleanDebugOption("org.eclipse.equinox.ds/print_on_console", false) || getBoolean("equinox.ds.print");
 		log.setPrintOnConsole(print);
 		if (DEBUG) {
 			log.setMaps(TracerMap.getMap(), TracerMap.getStarts());
@@ -195,6 +200,11 @@
 			cmTracker = null;
 		}
 
+		if (debugTracker != null) {
+			debugTracker.close();
+			debugTracker = null;
+		}
+
 		if (scrManager != null) {
 			scrManager.stopIt();
 		}
@@ -234,4 +244,18 @@
 		}
 		return defaultValue;
 	}
+
+	public boolean getBooleanDebugOption(String option, boolean defaultValue) {
+		if (debugTracker == null) {
+			return defaultValue;
+		}
+		DebugOptions options = (DebugOptions) debugTracker.getService();
+		if (options != null) {
+			String value = options.getOption(option);
+			if (value != null)
+				return value.equalsIgnoreCase("true"); //$NON-NLS-1$
+		}
+		return defaultValue;
+	}
+
 }