package pack.server;
import java.util.Dictionary;
import java.util.Hashtable;
import javax.swing.JFrame;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;
import pack.iserver.IServer;
public class Activator implements BundleActivator {
private ServiceRegistration registration;
private JFrame f = null;
public void start(BundleContext context) throws Exception {
Dictionary<String, String> props = new Hashtable<String, String>();
javax.swing.SwingUtilities.invokeLater(new Runnable() {
// This creates of the application window.
public void run()
{
System.out.println("hey");
f = new JFrame();
f.setVisible(true);
}
});
// Console c = new Console();
// c.setSystemInput();
// c.setSystemOutput();
// c.setSystemErr();
registration = context.registerService(IServer.class.getName(),
new Server(), props);
System.out.println("O servidor foi registado");
// String[] keys = registration.getReference().getPropertyKeys();
//
// for(String k: keys){
// System.out.println(k);
// }
}
public void stop(BundleContext context) throws Exception {
registration.unregister();
}
}