Java Rx类代码示例(javarx怎么用?javarx使用的例子)

本文整理汇总了Java中org.glassfish.jersey.client.rx.Rx的典型用法代码示例。如果您正苦于以下问题:Java Rx类的具体用法?Java Rx怎么用?Java Rx使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Java Rx类代码示例(javarx怎么用?javarx使用的例子)

Rx类属于org.glassfish.jersey.client.rx包,在下文中一共展示了Rx类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: queryObservationsByRange

import org.glassfish.jersey.client.rx.Rx; //导入依赖的package包/类
@Override
public Observable<Model> queryObservationsByRange(String systemId, List<String> sensorsId,
    String start, String end) {
  if (Strings.isNullOrEmpty(start)) {
    throw new IllegalArgumentException();
  }

  UriBuilder uriBuilder = UriBuilder.fromPath(config.tsdbEndpoint())
      .path(QUERY_OBSERVATIONS)
      .queryParam(PARAM_SYSTEM_ID, systemId)
      .queryParam(PARAM_SENSOR_ID, sensorsId.toArray())
      .queryParam(PARAM_START, start);

  if (!Strings.isNullOrEmpty(end)) {
    uriBuilder.queryParam(PARAM_END, end);
  }

  Observable<Response> get = Rx.newClient(RxObservableInvoker.class, mes)
      .target(uriBuilder.build()).request().rx().get();

  return responseToModel(get);
} 
开发者ID:semiotproject,项目名称:semiot-platform,代码行数:23,代码来源:TSDBQueryServiceImpl.java

示例2: postUpload

import org.glassfish.jersey.client.rx.Rx; //导入依赖的package包/类
public Observable<Response> postUpload(MultiPart multipart) {
  Observable<Response> post = Rx.newClient(RxObservableInvoker.class, mes)
      .register(MultiPartFeature.class)
      .target(UriBuilder.fromPath(config.deviceProxyEndpoint()).path(URL_BUNDLES).build())
      .request(MediaType.APPLICATION_JSON)
      .header("Authorization", "Basic YWRtaW46YWRtaW4=").rx()
      .post(Entity.entity(multipart, MediaType.MULTIPART_FORM_DATA_TYPE));

  return post;
} 
开发者ID:semiotproject,项目名称:semiot-platform,代码行数:11,代码来源:OSGiApiService.java

示例3: postObservableRespForPath

import org.glassfish.jersey.client.rx.Rx; //导入依赖的package包/类
private Observable<Response> postObservableRespForPath(String path, Entity<?> ent) {
  return Rx.newClient(RxObservableInvoker.class, mes)
      .target(UriBuilder.fromPath(config.deviceProxyEndpoint()).path(path).build())
      .request(MediaType.APPLICATION_JSON)
      .header("Authorization", "Basic YWRtaW46YWRtaW4=").rx()
      .post(ent);
} 
开发者ID:semiotproject,项目名称:semiot-platform,代码行数:8,代码来源:OSGiApiService.java

示例4: queryDateTimeOfLatestObservation

import org.glassfish.jersey.client.rx.Rx; //导入依赖的package包/类
@Override
public Observable<String> queryDateTimeOfLatestObservation(String systemId, List<String> sensorsId) {
  Observable<Response> get = Rx.newClient(RxObservableInvoker.class, mes)
      .target(UriBuilder.fromPath(config.tsdbEndpoint())
          .path(QUERY_TIME_OBSERVATIONS_LATEST)
          .queryParam(PARAM_SYSTEM_ID, systemId)
          .queryParam(PARAM_SENSOR_ID, sensorsId.toArray()).build())
      .request().rx().get();

  return get.map((response) -> response.readEntity(String.class));
} 
开发者ID:semiotproject,项目名称:semiot-platform,代码行数:12,代码来源:TSDBQueryServiceImpl.java

示例5: queryLatestBySystemId

import org.glassfish.jersey.client.rx.Rx; //导入依赖的package包/类
@Override
public Observable<Model> queryLatestBySystemId(String systemId, List<String> sensorsId) {
  Observable<Response> get = Rx.newClient(RxObservableInvoker.class, mes)
      .target(UriBuilder.fromPath(config.tsdbEndpoint())
          .path(QUERY_OBSERVATIONS_LATEST)
          .queryParam(PARAM_SYSTEM_ID, systemId)
          .queryParam(PARAM_SENSOR_ID, sensorsId.toArray())
          .build())
      .request().rx().get();

  return responseToModel(get);
} 
开发者ID:semiotproject,项目名称:semiot-platform,代码行数:13,代码来源:TSDBQueryServiceImpl.java

示例6: queryDateTimeOfLatestCommandResult

import org.glassfish.jersey.client.rx.Rx; //导入依赖的package包/类
@Override
public Observable<ZonedDateTime> queryDateTimeOfLatestCommandResult(String systemId,
    String processId) {
  URI uri = UriBuilder.fromPath(config.tsdbEndpoint())
      .path(config.tsdbCommandResultsLatestPath())
      .queryParam("system_id", systemId)
      .queryParam("process_id", processId).build();

  logger.debug("queryDateTimeOfLatestCommandResult: URL {}", uri);

  Observable<Response> result = Rx.newClient(RxObservableInvoker.class, mes)
      .target(uri).request().rx().get();

  return result.map((response -> {
    if (response.getStatus() == 200) {
      Model model = RDFUtils.toModel(response.readEntity(String.class), RDFLanguages.JSONLD);
      if (model.isEmpty()) {
        return null;
      } else {
        Literal dateTime = (Literal) model.listObjectsOfProperty(DUL.hasEventTime).next();

        return ZonedDateTime.parse(dateTime.getLexicalForm(),
            DateTimeFormatter.ISO_OFFSET_DATE_TIME);
      }
    } else {
      logger.debug("None 200 nor 404");
      return null;
      // throw Exceptions.propagate(new
      // WebApplicationException(Response
      // .status(response.getStatus())
      // .entity(response.readEntity(String.class))
      // .build()));
    }
  }));
} 
开发者ID:semiotproject,项目名称:semiot-platform,代码行数:36,代码来源:TSDBQueryServiceImpl.java

示例7: queryCommandResultsByRange

import org.glassfish.jersey.client.rx.Rx; //导入依赖的package包/类
@Override
public Observable<Model> queryCommandResultsByRange(String systemId, String processId,
    ZonedDateTime start, ZonedDateTime end) {
  UriBuilder uriBuilder = UriBuilder.fromPath(config.tsdbEndpoint())
      .path(config.tsdbCommandResultsPath())
      .queryParam("system_id", systemId)
      .queryParam("process_id", processId)
      .queryParam("start", start.format(DateTimeFormatter.ISO_OFFSET_DATE_TIME));
  if (end != null) {
    uriBuilder.queryParam("end", end.format(DateTimeFormatter.ISO_OFFSET_DATE_TIME));
  }
  URI uri = uriBuilder.build();

  logger.debug("queryCommandResultsByRange: URL {}", uri);

  Observable<Response> result = Rx.newClient(RxObservableInvoker.class, mes)
      .target(uri).request().rx().get();

  return result.map((response -> {
    if (response.getStatus() == 200) {
      return RDFUtils.toModel(response.readEntity(String.class), RDFLanguages.JSONLD);
    } else {
      logger.debug("None 200 nor 404");
      return null;
      // throw Exceptions.propagate(new
      // WebApplicationException(Response
      // .status(response.getStatus())
      // .entity(response.readEntity(String.class))
      // .build()));
    }
  }));
} 
开发者ID:semiotproject,项目名称:semiot-platform,代码行数:33,代码来源:TSDBQueryServiceImpl.java

示例8: executeCommand

import org.glassfish.jersey.client.rx.Rx; //导入依赖的package包/类
public Observable<Model> executeCommand(String systemId, Model command) {
  URI uri = UriBuilder
      .fromPath(config.deviceProxyEndpoint())
      .path(config.deviceProxyCommandAPI())
      .queryParam("system_id", systemId)
      .build();

  logger.debug("{}", uri);

  Observable<Response> post = Rx.newClient(RxObservableInvoker.class, mes)
      .target(uri)
      .request().rx()
      .post(Entity.entity(
          RDFUtils.toString(command, RDFLanguages.TURTLE),
          MediaType.TEXT_TURTLE));

  return post.map(response -> {
    if (response.getStatus() == 200) {
      return RDFUtils.toModel(response.readEntity(String.class), RDFLanguages.JSONLD);
    } else {
      throw Exceptions.propagate(new WebApplicationException(
          Response.status(response.getStatus())
              .entity(response.readEntity(String.class))
              .build()));
    }
  });
} 
开发者ID:semiotproject,项目名称:semiot-platform,代码行数:28,代码来源:DeviceProxyService.java

示例9: getObservableRespForPath

import org.glassfish.jersey.client.rx.Rx; //导入依赖的package包/类
private Observable<Response> getObservableRespForPath(String path) {
  return Rx.newClient(RxObservableInvoker.class, mes)
      .target(UriBuilder.fromPath(config.deviceProxyEndpoint()).path(path).build())
      .request(MediaType.APPLICATION_JSON)
      .header("Authorization", "Basic YWRtaW46YWRtaW4=").rx().get();
} 
开发者ID:semiotproject,项目名称:semiot-platform,代码行数:7,代码来源:OSGiApiService.java

示例10: submitConfiguration

import org.glassfish.jersey.client.rx.Rx; //导入依赖的package包/类
@Override
public Observable<Response> submitConfiguration(JsonObject json) {
  return Rx.newClient(RxObservableInvoker.class, mes)
      .target(UriBuilder.fromPath(config.tsdbEndpoint()).path(QUERY_SETTINGS))
      .request().rx().post(Entity.entity(json.toString(), MediaType.APPLICATION_JSON));
} 
开发者ID:semiotproject,项目名称:semiot-platform,代码行数:7,代码来源:TSDBQueryServiceImpl.java

示例11: getForPath

import org.glassfish.jersey.client.rx.Rx; //导入依赖的package包/类
private Observable<Response> getForPath(String url) {
  return Rx.newClient(RxObservableInvoker.class, mes).target(url).request().rx().get();
} 
开发者ID:semiotproject,项目名称:semiot-platform,代码行数:4,代码来源:ExternalQueryService.java

示例12: deleteForPath

import org.glassfish.jersey.client.rx.Rx; //导入依赖的package包/类
private Observable<Response> deleteForPath(String url) {
  return Rx.newClient(RxObservableInvoker.class, mes).target(url).request().rx().delete();
} 
开发者ID:semiotproject,项目名称:semiot-platform,代码行数:4,代码来源:ExternalQueryService.java

本文标签属性:

示例:示例的拼音

代码:代码大全可复制

java:java模拟器

Rx:rx tx

上一篇:水资源名词解释(水资源包括)
下一篇:科考是什么意思(科考是什么意思)(中国古代的科举制度)

为您推荐