Skip to content
Snippets Groups Projects
Commit 18b429e6 authored by Eric Slenk's avatar Eric Slenk
Browse files

Fix import, get and use service.

parent 58cb21a5
No related branches found
No related tags found
No related merge requests found
......@@ -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'
}
}
......
......@@ -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() );
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment