|
Lines 1-6
Link Here
|
| 1 |
package org.eclipse.pde.runtime.rosgi.rs; |
1 |
package org.eclipse.pde.runtime.rosgi.rs; |
| 2 |
|
2 |
|
|
|
3 |
import org.eclipse.core.runtime.IStatus; |
| 3 |
import org.eclipse.core.runtime.Plugin; |
4 |
import org.eclipse.core.runtime.Plugin; |
|
|
5 |
import org.eclipse.core.runtime.Status; |
| 4 |
import org.eclipse.ecf.core.ContainerCreateException; |
6 |
import org.eclipse.ecf.core.ContainerCreateException; |
| 5 |
import org.eclipse.ecf.core.IContainer; |
7 |
import org.eclipse.ecf.core.IContainer; |
| 6 |
import org.eclipse.ecf.core.IContainerManager; |
8 |
import org.eclipse.ecf.core.IContainerManager; |
|
Lines 9-16
Link Here
|
| 9 |
import org.eclipse.pde.internal.runtime.registry.rosgi.IRosgiRegistryHost; |
11 |
import org.eclipse.pde.internal.runtime.registry.rosgi.IRosgiRegistryHost; |
| 10 |
import org.eclipse.pde.internal.runtime.registry.rosgi.RosgiRegistryHost; |
12 |
import org.eclipse.pde.internal.runtime.registry.rosgi.RosgiRegistryHost; |
| 11 |
import org.osgi.framework.BundleContext; |
13 |
import org.osgi.framework.BundleContext; |
|
|
14 |
import org.osgi.framework.ServiceReference; |
| 12 |
import org.osgi.util.tracker.ServiceTracker; |
15 |
import org.osgi.util.tracker.ServiceTracker; |
| 13 |
|
16 |
|
|
|
17 |
import ch.ethz.iks.r_osgi.RemoteOSGiService; |
| 18 |
|
| 14 |
public class Activator extends Plugin { |
19 |
public class Activator extends Plugin { |
| 15 |
|
20 |
|
| 16 |
private RosgiRegistryHost host; |
21 |
private RosgiRegistryHost host; |
|
Lines 38-52
Link Here
|
| 38 |
try { |
43 |
try { |
| 39 |
container = containerManager.getContainerFactory().createContainer("ecf.r_osgi.peer"); |
44 |
container = containerManager.getContainerFactory().createContainer("ecf.r_osgi.peer"); |
| 40 |
} catch (ContainerCreateException e) { |
45 |
} catch (ContainerCreateException e) { |
| 41 |
// TODO Auto-generated catch block |
46 |
getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, e.getMessage(), e)); |
| 42 |
e.printStackTrace(); |
|
|
| 43 |
} |
47 |
} |
| 44 |
IRemoteServiceContainerAdapter containerAdapter = (IRemoteServiceContainerAdapter) container |
48 |
IRemoteServiceContainerAdapter containerAdapter = (IRemoteServiceContainerAdapter) container |
| 45 |
.getAdapter(IRemoteServiceContainerAdapter.class); |
49 |
.getAdapter(IRemoteServiceContainerAdapter.class); |
| 46 |
serviceRegistration = containerAdapter.registerRemoteService( |
50 |
serviceRegistration = containerAdapter.registerRemoteService( |
| 47 |
new String[] { IRosgiRegistryHost.class.getName() }, host, null); |
51 |
new String[] { IRosgiRegistryHost.class.getName() }, host, null); |
| 48 |
|
52 |
|
| 49 |
System.out.println("IRosgiRegistryHost RemoteService registered"); |
53 |
ServiceReference rosgiReference = Activator.getDefault().getBundleContext().getServiceReference("ch.ethz.iks.r_osgi.RemoteOSGiService"); |
|
|
54 |
RemoteOSGiService rosgi = (RemoteOSGiService) Activator.getDefault().getBundleContext().getService(rosgiReference); |
| 55 |
getLog().log(new Status(IStatus.INFO, PLUGIN_ID, "org.eclipse.pde.runtime.core is listening on r-osgi protocol, port " + rosgi.getListeningPort("r-osgi"))); |
| 50 |
return true; |
56 |
return true; |
| 51 |
} |
57 |
} |
| 52 |
|
58 |
|
|
Lines 88-91
Link Here
|
| 88 |
return container; |
94 |
return container; |
| 89 |
} |
95 |
} |
| 90 |
|
96 |
|
|
|
97 |
public IRosgiRegistryHost getHost(){ |
| 98 |
return host; |
| 99 |
} |
| 91 |
} |
100 |
} |