Package org.apache.tuscany.sca.sample.comet.model

Examples of org.apache.tuscany.sca.sample.comet.model.Response


@Service({TemperatureService.class, HumidityService.class})
public class TemperatureHumidityServiceImpl implements TemperatureService, HumidityService {

    @Override
    public Response getHumidity(final Location location) {
        final Response response = new Response();
        response.setDate(new Date());
        response.setData(Helper.randomInt(90) + "%");
        return response;
    }
View Full Code Here


        return response;
    }

    @Override
    public Response getTemperature(final Location location, final int scale) {
        final Response response = new Response();
        response.setDate(new Date());
        final String data = "" + Helper.randomInt(scale == TemperatureService.CELSIUS ? 40 : 150);
        response.setData(data);
        return response;
    }
View Full Code Here

@Service(PrecipitationService.class)
public class PrecipitationServiceImpl implements PrecipitationService {

    @Override
    public Response getPrecipitation(final Location location) {
        final Response response = new Response();
        response.setDate(new Date());
        response.setData(Helper.randomInt(100) + "%");
        return response;
    }
View Full Code Here

  public void getHumidity(final Location location) {
    new Timer().scheduleAtFixedRate(new TimerTask() {

      @Override
      public void run() {
        final Response response = new Response();
        response.setDate(new Date());
        response.setData(Helper.randomInt(90) + "%");
        Status status = callback.sendMessage(response);
        if (status == Status.CLIENT_DISCONNECTED) {
          System.out.println("Client disconnected from HumidityService.");
          this.cancel();
        }
View Full Code Here

  public void getTemperature(final Location location, final int scale) {
    new Timer().scheduleAtFixedRate(new TimerTask() {

      @Override
      public void run() {
        final Response response = new Response();
        response.setDate(new Date());
        final String data = "" + Helper.randomInt(scale == TemperatureService.CELSIUS ? 40 : 150);
        response.setData(data);
        Status status = callback.sendMessage(response);
        if (status == Status.CLIENT_DISCONNECTED) {
          System.out.println("Client disconnected from TemperatureService.");
          this.cancel();
        }
View Full Code Here

  public void getPrecipitation(final Location location) {
    new Timer().scheduleAtFixedRate(new TimerTask() {

      @Override
      public void run() {
        Response response = new Response();
        response.setDate(new Date());
        response.setData(Helper.randomInt(100) + "%");
        Status status = client.sendMessage(response);
        if (status == Status.CLIENT_DISCONNECTED) {
          System.out.println("Client disconnected from PrecipitationService.");
          this.cancel();
        }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.sample.comet.model.Response

Copyright © 2018 www.massapicom. 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.