Examples of XDRuntime


Examples of org.springframework.xd.rest.domain.XDRuntime

  private final EntityLinks entityLinks;

  @RequestMapping()
  @ResponseBody
  public XDRuntime info() {
    XDRuntime xdRuntime = new XDRuntime();
    xdRuntime.add(entityLinks.linkFor(StreamDefinitionResource.class).withRel("streams"));
    xdRuntime.add(entityLinks.linkFor(JobDefinitionResource.class).withRel("jobs"));
    xdRuntime.add(entityLinks.linkFor(ModuleDefinitionResource.class).withRel("modules"));

    xdRuntime.add(entityLinks.linkFor(ModuleMetadataResource.class).withRel("runtime/modules"));
    xdRuntime.add(entityLinks.linkFor(DetailedContainerResource.class).withRel("runtime/containers"));

    xdRuntime.add(entityLinks.linkFor(DetailedJobInfoResource.class).withRel("jobs/configurations"));
    xdRuntime.add(entityLinks.linkFor(JobExecutionInfoResource.class).withRel("jobs/executions"));
    xdRuntime.add(entityLinks.linkFor(JobInstanceInfoResource.class).withRel("jobs/instances"));


    // Maybe https://github.com/spring-projects/spring-hateoas/issues/169 will help eventually
    TemplateVariable start = new TemplateVariable("start", VariableType.REQUEST_PARAM);
    TemplateVariable lod = new TemplateVariable("detailLevel", VariableType.REQUEST_PARAM_CONTINUED);
    TemplateVariables vars = new TemplateVariables(start, lod);
    for (CompletionKind k : CompletionKind.values()) {
      Object mi = ControllerLinkBuilder.methodOn(CompletionsController.class).completions(k, "", 42);
      Link link = ControllerLinkBuilder.linkTo(mi).withRel(String.format("completions/%s", k));
      String href = link.getHref().substring(0, link.getHref().lastIndexOf('?'));
      UriTemplate template = new UriTemplate(href, vars);
      Link copy = new Link(template, link.getRel());

      xdRuntime.add(copy);
    }


    xdRuntime.add(entityLinks.linkFor(CounterResource.class).withRel("counters"));
    xdRuntime.add(entityLinks.linkFor(FieldValueCounterResource.class).withRel("field-value-counters"));
    xdRuntime.add(entityLinks.linkFor(AggregateCountsResource.class).withRel("aggregate-counters"));
    xdRuntime.add(entityLinks.linkFor(GaugeResource.class).withRel("gauges"));
    xdRuntime.add(entityLinks.linkFor(RichGaugeResource.class).withRel("rich-gauges"));
    return xdRuntime;
  }
View Full Code Here

Examples of org.springframework.xd.rest.domain.XDRuntime

   */
  private CompletionOperations completionOperations;

  public SpringXDTemplate(ClientHttpRequestFactory factory, URI baseURI) {
    super(factory);
    XDRuntime xdRuntime = restTemplate.getForObject(baseURI, XDRuntime.class);

    resources.put("streams/definitions", new UriTemplate(xdRuntime.getLink("streams").getHref() + "/definitions"));
    resources.put("streams/deployments", new UriTemplate(xdRuntime.getLink("streams").getHref() + "/deployments"));
    resources.put("jobs", new UriTemplate(xdRuntime.getLink("jobs").getHref()));
    resources.put("jobs/definitions", new UriTemplate(xdRuntime.getLink("jobs").getHref() + "/definitions"));
    resources.put("jobs/deployments", new UriTemplate(xdRuntime.getLink("jobs").getHref() + "/deployments"));
    resources.put("modules", new UriTemplate(xdRuntime.getLink("modules").getHref()));

    resources.put("jobs/configurations", new UriTemplate(xdRuntime.getLink("jobs/configurations").getHref()));
    resources.put("jobs/executions", new UriTemplate(xdRuntime.getLink("jobs/executions").getHref()));
    resources.put("jobs/instances", new UriTemplate(xdRuntime.getLink("jobs/instances").getHref()));

    resources.put("runtime/containers", new UriTemplate(xdRuntime.getLink("runtime/containers").getHref()));
    resources.put("runtime/modules", new UriTemplate(xdRuntime.getLink("runtime/modules").getHref()));

    resources.put("completions/stream", new UriTemplate(xdRuntime.getLink("completions/stream").getHref()));
    resources.put("completions/job", new UriTemplate(xdRuntime.getLink("completions/job").getHref()));
    resources.put("completions/module", new UriTemplate(xdRuntime.getLink("completions/module").getHref()));

    resources.put("counters", new UriTemplate(xdRuntime.getLink("counters").getHref()));
    resources.put("field-value-counters", new UriTemplate(xdRuntime.getLink("field-value-counters").getHref()));
    resources.put("aggregate-counters", new UriTemplate(xdRuntime.getLink("aggregate-counters").getHref()));
    resources.put("gauges", new UriTemplate(xdRuntime.getLink("gauges").getHref()));
    resources.put("rich-gauges", new UriTemplate(xdRuntime.getLink("rich-gauges").getHref()));


    streamOperations = new StreamTemplate(this);
    jobOperations = new JobTemplate(this);
    counterOperations = new CounterTemplate(this);
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.