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