use of com.mycorp.examples.timeservice.ITimeService in project ecf by eclipse.
the class Activator method addingService.
/**
* NOTE: The method will be called when the ITimeService is discovered.
*/
public ITimeService addingService(ServiceReference<ITimeService> reference) {
// XXX Here is where the ITimeService is received, when discovered.
System.out.println("ITimeService discovered!");
System.out.println("Service Reference=" + reference);
// Get the time service proxy
ITimeService timeService = this.context.getService(reference);
System.out.println("Calling timeService=" + timeService);
// Call the service!
Long time = timeService.getCurrentTime();
// Print out the result
System.out.println("Call Done. Current time given by ITimeService.getCurrentTime() is: " + time);
return timeService;
}
use of com.mycorp.examples.timeservice.ITimeService in project ecf by eclipse.
the class TimeServiceRestClientContainer method connect.
@Override
public void connect(ID targetID, IConnectContext connectContext1) throws ContainerConnectException {
super.connect(targetID, connectContext1);
// Create the IRemoteCallable to represent
// access to the ITimeService method.
IRemoteCallable callable = RestCallableFactory.createCallable("getCurrentTime", ITimeService.class.getName(), null, new HttpGetRequestType(), 30000);
// Register the callable and associate it with the ITimeService class
// name
reg = registerCallables(new String[] { ITimeService.class.getName() }, new IRemoteCallable[][] { { callable } }, null);
}
Aggregations