package jythongps;

import java.io.InputStream;
import java.util.Dictionary;

import jy.IJythonServiceListener;

import org.osgi.framework.Bundle;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
import org.osgi.framework.ServiceListener;
import org.python.core.PySystemState;
import org.python.util.PythonInterpreter;

import com.buglabs.bug.module.gps.pub.IPositionProvider;
import com.buglabs.device.IButtonEventProvider;
import com.buglabs.status.IStatusBarProvider;
import com.buglabs.util.StringUtil;

public class Activator implements BundleActivator {
	ServiceListener serviceListener;
	
	
	public void start(BundleContext context) throws Exception {
		
		// We'll be using Jython classes, create an interpreter object to use
		PythonInterpreter interp = new PythonInterpreter();
					
		// Need to add the bundle packages to the PySystemState so that the jython
		// script can see them.  This code must be run after initializing the PythonInterpreter
		Bundle thisBundle = context.getBundle();
		Dictionary bundleHeaders = thisBundle.getHeaders();
		String importPackages = (String)bundleHeaders.get("Import-Package");
		if(importPackages!=null)
		{
			String[] result = StringUtil.split(importPackages, ",");
			for(int x=0; x