Package org.platformlayer

Examples of org.platformlayer.PlatformLayerClient


    super("get", "item");
  }

  @Override
  public Object runCommand() throws PlatformLayerClientException {
    PlatformLayerClient client = getPlatformLayerClient();

    PlatformLayerKey key = path.resolve(getContext());
    return client.getItemUntyped(key, getFormat());
  }
View Full Code Here


    super("list", "children");
  }

  @Override
  public Object runCommand() throws PlatformLayerClientException {
    PlatformLayerClient client = getPlatformLayerClient();

    PlatformLayerKey key = path.resolve(getContext());
    boolean includeDeleted = true;
    return client.listChildren(key, includeDeleted);
  }
View Full Code Here

    super("delete", "link");
  }

  @Override
  public Object runCommand() throws PlatformLayerClientException {
    PlatformLayerClient client = getPlatformLayerClient();

    PlatformLayerKey resolved = path.resolve(getContext());

    UntypedItemXml item = (UntypedItemXml) client.getItemUntyped(resolved, Format.XML);

    Links links = item.getLinks();

    Link existing = links.findLink(name);
    List<Link> linkList = links.getLinks();
    if (existing != null) {
      linkList.remove(existing);

      item.setLinks(links);

      String xml = item.serialize();

      UntypedItemXml updated = (UntypedItemXml) client.putItem(resolved, xml, Format.XML);

      return updated.getLinks().getLinks();
    } else {
      return linkList;
    }
View Full Code Here

    super("tail", "log");
  }

  @Override
  public Object runCommand() throws PlatformLayerClientException, InterruptedException {
    PlatformLayerClient client = getPlatformLayerClient();

    // TODO: System.out isn't quite right
    JobLogPrinter jobLogPrinter = new JobLogPrinter(new PrintWriter(System.out));

    if (Strings.isNullOrEmpty(executionId)) {
      JobExecutionList jobExecutions = client.listJobExecutions(jobId);

      JobExecutionData last = null;

      for (JobExecutionData execution : jobExecutions.getRuns()) {
        if (execution.getState() == JobState.PRESTART) {
          continue;
        }

        if (last == null) {
          last = execution;
          continue;
        }

        if (last.getStartedAt().before(execution.getStartedAt())) {
          last = execution;
          continue;
        }
      }

      if (last != null) {
        executionId = last.getExecutionId();
      }
    }

    // TODO: What if executionId == null? Also retries..
    JobLog previousJobLog = null;
    int jobLogOffset = 0;

    while (true) {
      // TODO: Only fetch tail
      JobLog jobLog = client.getJobExecutionLog(jobId, executionId);
      if (previousJobLog == null) {
        jobLogPrinter.startJobLog(jobLog);
      }

      List<JobLogLine> lines = jobLog.getLines();
View Full Code Here

    Runnable runnable = new Runnable() {
      @Override
      public void run() {
        try {
          PlatformLayerClient platformLayer = HttpPlatformLayerClient.build(httpStrategy,
              endpoint.getPlatformlayerBaseUrl(), endpoint.getAuthenticator(), endpoint.getProjectId(),
              endpoint.getTrustKeys());

          platformLayer.doAction(target, task.action);

          // TODO: Wait for task completion??
          // TODO: Link job id??
        } catch (PlatformLayerClientException e) {
          log.warn("Error running action", e);
View Full Code Here

      }
    }

    ProjectId runAsProjectId = new ProjectId(runAsProject.getName());

    PlatformLayerClient platformLayerClient;
    if (federationMap.isEmpty()) {
      platformLayerClient = defaultClient;
    } else {
      federationMap.addDefault(defaultClient);
View Full Code Here

    DirectAuthenticator directAuthenticator = buildDirectAuthenticator(project);
    // TODO: Introduce a direct client for "loopback" (normal) calls?
    String platformLayerUrl = OpsSystem.getPlatformLayerUrlBase();
    List<String> trustKeys = opsSystem.getServerTrustKeys();

    PlatformLayerClient client;

    // client = HttpPlatformLayerClient.build(httpStrategy, platformLayerUrl,
    // directAuthenticator, projectId, trustKeys);

    DirectAuthentication auth = new DirectAuthentication(project);
View Full Code Here

    File configFile = IoUtils.resolve(config);
    return new PlatformLayerTestContext(configFile, typedItemMapper);
  }

  public PlatformLayerClient buildPlatformLayerClient() throws IOException, OpsException {
    PlatformLayerClient client;
    if (configFile == null) {
      throw new IllegalArgumentException("Config file is required");
    }

    InputStream is = null;
View Full Code Here

TOP

Related Classes of org.platformlayer.PlatformLayerClient

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.