Package com.openshift.client

Examples of com.openshift.client.OpenShiftException


 
  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


   * @throws OpenShiftException
   *             the open shift exception
   */
  private 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

      out.write(url.getBytes());
      out.write(IHttpClient.QUESTION_MARK);
      new FormUrlEncodedMediaType().writeTo(new ParameterValueMap(urlParameters), out);
      return out.toString();
    } catch (IOException e) {
      throw new OpenShiftException(e, "Could not add paramters {0} to url {1}", urlParameters, url);
    } catch (EncodingException e) {
      throw new OpenShiftException(e, "Could not add paramters {0} to url {1}", urlParameters, url);
    }
  }
View Full Code Here

  public IApplication createApplication(final String name, final IStandaloneCartridge cartridge,
      final ApplicationScale scale, final IGearProfile gearProfile, String initialGitUrl, int timeout,
      IEmbeddableCartridge... cartridges)
      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, timeout,
            null, cartridges);
View Full Code Here

  public IApplication createApplication(final String name, final IStandaloneCartridge cartridge,
      final ApplicationScale scale, final IGearProfile gearProfile, String initialGitUrl, int timeout,
      Map<String, String> environmentVariables, IEmbeddableCartridge... cartridges)
      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, timeout, environmentVariables, cartridges);
View Full Code Here

        final ApplicationScale scale, final IGearProfile gearProfile, final String initialGitUrl,
        final int timeout, Map<String, String> environmentVariables,
        final IEmbeddableCartridge... embeddableCartridges)
        throws OpenShiftException {
      if (cartridge == null) {
        throw new OpenShiftException("Application cartridge is mandatory but was not given.");
      }

      Parameters parameters = new Parameters()
          .add(IOpenShiftJsonConstants.PROPERTY_NAME, name)
          .addCartridges(cartridge, embeddableCartridges)
View Full Code Here

          && !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

  }

  @Override
  public IEnvironmentVariable addEnvironmentVariable(String name, String value) throws OpenShiftException {
    if (name == null) {
      throw new OpenShiftException("Environment variable name is mandatory but none was given.");
    }
    if (value == null) {
      throw new OpenShiftException("Value for environment variable \"{0}\" not given.", name);
    }
    if (hasEnvironmentVariable(name)) {
      throw new OpenShiftException("Environment variable with name \"{0}\" already exists.", name);
    }   
   
    EnvironmentVariableResourceDTO environmentVariableResourceDTO =
        new AddEnvironmentVariableRequest().execute(name, value);   
    IEnvironmentVariable environmentVariable = new EnvironmentVariableResource(environmentVariableResourceDTO, this);
View Full Code Here

   * @see com.openshift.client.IApplication#removeEnvironmentVariable(com.openshift.client.IEnvironmentVariable)
   */
  @Override
  public void removeEnvironmentVariable(IEnvironmentVariable environmentVariable){     
      if(getEnvironmentVariable(environmentVariable.getName()) == null)
        throw new OpenShiftException("IEnvironmentVariable with supplied name does not exist.");
      environmentVariable.destroy();
      environmentVariablesMap.remove(environmentVariable.getName());
    
    }
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.