Added support for dynamically registering Rascal metric providers. Currently uses IMetricProvider as the service interface - this will need changing to be something Rascal-specific (i.e. a Rascal base class).

git-svn-id: https://svn.cs.york.ac.uk/svn/ossmeter/Software/source@947 1b171192-1bc4-4300-84b6-1b6fde2e8ce3

jw@CS.YORK.AC.UK jw@CS.YORK.AC.UK 2014-03-02

added metric-providers/org.ossmeter.metricprovider.rascal/src/org/ossmeter/metricprovider/rascal/RascalMetricProviderManager.java
added metric-providers/org.ossmeter.metricprovider.rascal/src/org/ossmeter/metricprovider/rascal/RascalMetricServiceTracker.java
changed metric-providers/org.ossmeter.metricprovider.rascal/META-INF/MANIFEST.MF
changed metric-providers/org.ossmeter.metricprovider.rascal/src/org/ossmeter/metricprovider/rascal/RascalManager.java
changed metric-providers/org.ossmeter.metricprovider.rascal/plugin.xml
copied metric-providers/org.ossmeter.metricprovider.rascal/src/org/ossmeter/metricprovider/rascal/Activator.java -> metric-providers/org.ossmeter.metricprovider.rascal/src/org/ossmeter/metricprovider/rascal/Rasctivator.java
metric-providers/org.ossmeter.metricprovider.rascal/src/org/ossmeter/metricprovider/rascal/RascalMetricProviderManager.java Diff Switch to side-by-side view
Loading...
metric-providers/org.ossmeter.metricprovider.rascal/src/org/ossmeter/metricprovider/rascal/RascalMetricServiceTracker.java Diff Switch to side-by-side view
Loading...
metric-providers/org.ossmeter.metricprovider.rascal/META-INF/MANIFEST.MF Diff Switch to side-by-side view
Loading...
metric-providers/org.ossmeter.metricprovider.rascal/src/org/ossmeter/metricprovider/rascal/RascalManager.java Diff Switch to side-by-side view
Loading...
metric-providers/org.ossmeter.metricprovider.rascal/plugin.xml Diff Switch to side-by-side view
Loading...
metric-providers/org.ossmeter.metricprovider.rascal/src/org/ossmeter/metricprovider/rascal/Activator.java to metric-providers/org.ossmeter.metricprovider.rascal/src/org/ossmeter/metricprovider/rascal/Rasctivator.java
--- a/metric-providers/org.ossmeter.metricprovider.rascal/src/org/ossmeter/metricprovider/rascal/Activator.java
+++ b/metric-providers/org.ossmeter.metricprovider.rascal/src/org/ossmeter/metricprovider/rascal/Rasctivator.java
@@ -2,29 +2,34 @@
 
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
+import org.osgi.util.tracker.ServiceTracker;
+import org.ossmeter.platform.IMetricProvider;
 
-public class Activator implements BundleActivator {
+public class Rasctivator implements BundleActivator {
 
 	private static BundleContext context;
+	
+	protected ServiceTracker<IMetricProvider, IMetricProvider> rascalTracker;
 
 	static BundleContext getContext() {
 		return context;
 	}
 
-	/*
-	 * (non-Javadoc)
-	 * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
-	 */
+	@Override
 	public void start(BundleContext bundleContext) throws Exception {
-		Activator.context = bundleContext;
+		Rasctivator.context = bundleContext;
+		
+		rascalTracker = new ServiceTracker<>(bundleContext, 
+				IMetricProvider.class, RascalMetricServiceTracker.getInstance());
+		
+		rascalTracker.open();
 	}
 
-	/*
-	 * (non-Javadoc)
-	 * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
-	 */
+	@Override
 	public void stop(BundleContext bundleContext) throws Exception {
-		Activator.context = null;
+		Rasctivator.context = null;
+		
+		rascalTracker.close();
 	}
 
 }