Created
December 16, 2010 19:03
-
-
Save ckundo/743803 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package earthquake_detector; | |
import org.osgi.framework.BundleActivator; | |
import org.osgi.framework.BundleContext; | |
import org.osgi.util.tracker.ServiceTracker; | |
import com.buglabs.bug.accelerometer.pub.IAccelerometerSampleProvider; | |
import com.buglabs.bug.module.gps.pub.IPositionProvider; | |
import com.buglabs.bug.swarm.connector.pub.ISwarmConnector; | |
import com.buglabs.application.ServiceTrackerHelper; | |
/** | |
* This is the activator that serves as the application's main() or start. | |
* | |
* The OSGi services that are used in this application are defined in the variable 'services', and are | |
* used to construct a ServiceTracker and MannagedRunnable that is created and started inside a thread when/if | |
* all the services are available. | |
* | |
* @author kgilmer | |
* | |
*/ | |
public class Activator implements BundleActivator { | |
public static final String KEY_LATITUDE = "latitude"; | |
public static final String KEY_LONGITUDE = "longitude"; | |
public static final String KEY_LOCATION = "location"; | |
public static final String KEY_ACCELERATION = "acceleration"; | |
private String services[] = new String[] { | |
ISwarmConnector.class.getName(), | |
IAccelerometerSampleProvider.class.getName(), | |
IPositionProvider.class.getName() | |
}; | |
private ServiceTracker st; | |
public void start(BundleContext context) throws Exception { | |
st = ServiceTrackerHelper.openServiceTracker(context, services, new Monitor()); | |
} | |
public void stop(BundleContext context) throws Exception { | |
st.close(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment