Examples of ITimeService


Examples of com.mycorp.examples.timeservice.ITimeService

     
      // No arguments to getCurrentTime() method, so
      // nothing to deserialize from request
     
      // Get local OSGi ITimeService
      ITimeService timeService = HttpServiceComponent.getDefault()
          .getService(ITimeService.class);
     
      // Call local service to get the time
      Long currentTime = timeService.getCurrentTime();
     
      // Serialize response
        try {
        resp.getOutputStream().print(new JSONObject().put("time", currentTime).toString());
      } catch (JSONException e) {
View Full Code Here

Examples of com.mycorp.examples.timeservice.ITimeService

      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;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.