Package com.openshift.client

Examples of com.openshift.client.OpenShiftException


          && !isTimeouted(timeout, startTime)) {
        Thread.sleep(APPLICATION_WAIT_RETRY_DELAY);
      }
      return canResolv(applicationUrl);
    } catch (MalformedURLException e) {
      throw new OpenShiftException(e,
          "Could not wait for application {0} to become accessible, it has an invalid URL \"{1}\": {2}",
          name, applicationUrl, e.getMessage());
    }
  }
View Full Code Here


  public String request(String href, HttpMethod httpMethod, Map<String, Object> parameters) throws OpenShiftException {
    URL url = getUrl(href);
    try {
      return request(url, httpMethod, parameters);
    } catch (UnsupportedEncodingException e) {
      throw new OpenShiftException(e, e.getMessage());
    } catch (UnauthorizedException e) {
      throw new InvalidCredentialsOpenShiftException(url.toString(), e);
    } catch (NotFoundException e) {
      throw new NotFoundOpenShiftException(url.toString(), e);
    } catch (HttpClientException e) {
View Full Code Here

    case PUT:
      return client.put(parameters, url);
    case DELETE:
      return client.delete(parameters, url);
    default:
      throw new OpenShiftException("Unexpected HTTP method {0}", httpMethod.toString());
    }
   
   
  }
View Full Code Here

  }
 
  private URL getUrl(String href) throws OpenShiftException {
    try {
      if (href == null) {
        throw new OpenShiftException("Invalid empty url");
      }
      if (href.startsWith(HTTP)) {
        return new URL(href);
      }
      if (href.startsWith(SERVICE_PATH)) {
        return new URL(baseUrl + href);
      }
      if (href.charAt(0) == SLASH) {
        href = href.substring(1, href.length());
      }
      return new URL(getServiceUrl() + href);
    } catch (MalformedURLException e) {
      throw new OpenShiftException(e, e.getMessage());
    }
  }
View Full Code Here

  }
 
  public <DTO> DTO execute(final ServiceParameter... parameters) throws OpenShiftException {
    final Link link = getLink();
    if (link == null) {
      throw new OpenShiftException("Could not request resource, no link present");
    }
    // avoid concurrency issues, to prevent reading the links map while it
    // is still being retrieved
    final RestResponse response = resource.getService().request(link, parameters);
    if(response != null) {
View Full Code Here

  public IApplication createApplication(final String name, final IStandaloneCartridge cartridge,
      final ApplicationScale scale, final IGearProfile gearProfile, String initialGitUrl)
      throws OpenShiftException {
    if (name == null) {
      throw new OpenShiftException("Application name is mandatory but none was given.");
    }
    // this would trigger lazy loading list of available applications.
    // this is needed anyhow since we're adding the new app to the list of
    // available apps
    if (hasApplicationByName(name)) {
      throw new OpenShiftException("Application with name \"{0}\" already exists.", name);
    }

    ApplicationResourceDTO applicationDTO =
        new CreateApplicationRequest().execute(name, cartridge, scale, gearProfile, initialGitUrl);
    IApplication application = new ApplicationResource(applicationDTO, cartridge, this);
View Full Code Here

    }

    public ApplicationResourceDTO execute(final String name, final IStandaloneCartridge cartridge,
        final ApplicationScale scale, final IGearProfile gearProfile, final String initialGitUrl) throws OpenShiftException {
      if (cartridge == null) {
        throw new OpenShiftException("Application cartridge is mandatory but was not given.");
      }
     
      List<ServiceParameter> parameters = new ArrayList<ServiceParameter>();
      addStringParameter(IOpenShiftJsonConstants.PROPERTY_NAME, name, parameters);
      addCartridgeParameter(cartridge, parameters);
View Full Code Here

   * @throws OpenShiftException
   *             the open shift exception
   */
  private static ModelNode getModelNode(final String content) throws OpenShiftException {
    if (content == null) {
      throw new OpenShiftException("Could not unmarshall response: no content.");
    }
    final ModelNode node = ModelNode.fromJSONString(content);
    if (!node.isDefined()) {
      throw new OpenShiftException("Could not unmarshall response: erroneous content.");
    }

    return node;
  }
View Full Code Here

    if (rootNode.has(PROPERTY_DATA)) {
      for (ModelNode dataNode : rootNode.get(PROPERTY_DATA).asList()) {
        if (dataNode.getType() == ModelType.OBJECT) {
          domains.add(createDomain(dataNode, null));
        } else {
          throw new OpenShiftException("Unexpected node type: {0}", dataNode.getType());
        }
      }
    } else {
      final ModelNode domainNode = rootNode.get(PROPERTY_DOMAIN);
      if (domainNode.isDefined()
          && domainNode.getType() == ModelType.OBJECT) {
        domains.add(createDomain(domainNode, null));
      } else {
        throw new OpenShiftException("Unexpected node type: {0}", domainNode.getType());
      }
    }

    return domains;
  }
View Full Code Here

 
  public IDomain createDomain(String id) throws OpenShiftException {
    Assert.notNull(id);

    if (hasDomain(id)) {
      throw new OpenShiftException("Domain {0} already exists", id);
    }

    final DomainResourceDTO domainDTO = new AddDomainRequest().execute(id);
    final IDomain domain = new DomainResource(domainDTO, this);
    this.domains.add(domain);
View Full Code Here

TOP

Related Classes of com.openshift.client.OpenShiftException

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.