Search in sources :

Example 1 with ITimeService

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;
}
Also used : ITimeService(com.mycorp.examples.timeservice.ITimeService)

Example 2 with ITimeService

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);
}
Also used : IRemoteCallable(org.eclipse.ecf.remoteservice.client.IRemoteCallable) ITimeService(com.mycorp.examples.timeservice.ITimeService) HttpGetRequestType(org.eclipse.ecf.remoteservice.rest.client.HttpGetRequestType)

Aggregations

ITimeService (com.mycorp.examples.timeservice.ITimeService)2 IRemoteCallable (org.eclipse.ecf.remoteservice.client.IRemoteCallable)1 HttpGetRequestType (org.eclipse.ecf.remoteservice.rest.client.HttpGetRequestType)1