Package org.platformlayer.ops.helpers

Examples of org.platformlayer.ops.helpers.CurlResult


  public void reload() throws OpsException {
    execute("RELOAD");
  }

  public SolrCoreStatus getStatus() throws OpsException {
    CurlResult result = execute("STATUS");
    String xml = result.getBody();
    boolean namespaceAware = false;
    Document dom;
    try {
      dom = XmlHelper.parseXmlDocument(xml, namespaceAware);
    } catch (ParserConfigurationException e) {
View Full Code Here


    String url = "http://127.0.0.1:8080/solr/admin/cores?core=" + coreKey;

    url += "&action=" + action;

    CurlRequest request = new CurlRequest(url);
    CurlResult result = request.executeRequest(target);
    log.info("result: " + result);
    return result;
  }
View Full Code Here

    Command curlCommand = curlRequest.toCommand();
    Command pipedCommand = dataSourceCommand.pipeTo(curlCommand);

    ProcessExecution execution = request.target.executeCommand(pipedCommand);

    CurlResult curlResult = curlRequest.parseResponse(execution);

    int httpResult = curlResult.getHttpResult();
    switch (httpResult) {
    case 200:
      break;
    case 201:
      break;
View Full Code Here

    }

    @Override
    public <T> T doRequest0(Class<T> c) {
      CurlRequest request = toCurlRequest();
      CurlResult result;
      try {
        result = request.executeRequest(target);
      } catch (OpsException e) {
        throw new OpenstackException("Error issuing request", e);
      }

      int httpStatus = result.getHttpResult();

      switch (httpStatus) {
      case 200:
        break;
      case 201:
        // Created
        break;
      case 202:
        // Accepted
        break;

      case 401:
        throw new OpenstackAuthenticationException("Not authorized");

      case 403:
        throw new OpenstackForbiddenException("Forbidden");

      case 404:
        throw new OpenstackNotFoundException("Item not found");

      default:
        throw new OpenstackException("Error processing request. Status code=" + httpStatus);
      }

      if (c == Void.class) {
        return null;
      } else {
        String xml = result.getBody();

        JaxbHelper jaxb = JaxbHelper.get(c);
        try {
          return (T) jaxb.unmarshal(xml);
        } catch (JAXBException e) {
View Full Code Here

        String url = "http://ftp.debian.org/debian/dists/stable/Release.gpg";
        CurlRequest request = new CurlRequest(url);
        request.proxy = proxy;
        request.timeout = TimeSpan.FIVE_SECONDS;
        try {
          CurlResult result = request.executeRequest(target);
          if (result.getHttpResult() != 200) {
            log.info("Unexpected response code while testing proxy: " + proxy + ".  Code="
                + result.getHttpResult());
            continue;
          }
          TimeSpan timeTotal = result.getTimeTotal();
          if (bestTime == null || timeTotal.isLessThan(bestTime)) {
            bestProxy = proxy;
            bestTime = timeTotal;
          }
        } catch (OpsException e) {
View Full Code Here

TOP

Related Classes of org.platformlayer.ops.helpers.CurlResult

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.