From 18b429e67a69b04ad79ad9afee46be72ef16a92e Mon Sep 17 00:00:00 2001
From: Eric Slenk <slenkeri@anr.msu.edu>
Date: Wed, 30 Nov 2016 17:34:39 -0500
Subject: [PATCH] Fix import, get and use service.

---
 build.gradle                                      |  4 ++--
 .../structuralintegrity/viewtool/Activator.java   | 15 ++++++++++++---
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/build.gradle b/build.gradle
index 2efb3f8..e33e571 100644
--- a/build.gradle
+++ b/build.gradle
@@ -4,7 +4,7 @@ apply plugin: 'war'
 apply plugin: 'eclipse'
 
 sourceCompatibility = '1.8'
-version = '0.1.0-3'
+version = '0.1.0-7'
 
 
 repositories {
@@ -30,7 +30,7 @@ jar {
         instruction 'Bundle-Activator', "${applicationName}.Activator"
         instruction 'DynamicImport-Package', '*'
         instruction 'Import-Package', '' +
-                'edu.msu.anr.osgi.structuralintegrity.service;version=1.0.2' +
+                'edu.msu.anr.osgi.structuralintegrity.service;version=1.0.2,' +
                 '*;version=0'
     }
 }
diff --git a/src/main/java/edu/msu/anr/osgi/structuralintegrity/viewtool/Activator.java b/src/main/java/edu/msu/anr/osgi/structuralintegrity/viewtool/Activator.java
index c0cb36f..af1dca9 100644
--- a/src/main/java/edu/msu/anr/osgi/structuralintegrity/viewtool/Activator.java
+++ b/src/main/java/edu/msu/anr/osgi/structuralintegrity/viewtool/Activator.java
@@ -7,6 +7,8 @@ import com.dotmarketing.util.Logger;
 
 import edu.msu.anr.osgi.structuralintegrity.service.StructuresSnapshotService;
 
+import java.io.File;
+
 public class Activator extends GenericBundleActivator {
 
     private ServiceTracker<StructuresSnapshotService, StructuresSnapshotService> structuresSnapshotServiceTracker;
@@ -20,15 +22,22 @@ public class Activator extends GenericBundleActivator {
         // Create a ServiceTracker for the StructuresSnapshotService
         try {
             structuresSnapshotServiceTracker = new ServiceTracker<>(
-                bundleContext,
-                StructuresSnapshotService.class.getName(),
-                null
+                    bundleContext,
+                    StructuresSnapshotService.class.getName(),
+                    null
             );
+            structuresSnapshotServiceTracker.open();
         } catch (Exception e) {
             Logger.error(this, e.getMessage());
             throw e;
         }
 
+        // Test service tracker
+        StructuresSnapshotService service = (StructuresSnapshotService) structuresSnapshotServiceTracker.getService();
+        if (service != null) {
+            File[] snapshotFiles = service.getSavedSnapshotFiles();
+        }
+
         //Registering the ViewTool service
         registerViewToolService( bundleContext, new StructuresSnapshotServiceToolInfo() );
     }
-- 
GitLab