Examples of CloudApplication


Examples of org.cloudfoundry.client.lib.domain.CloudApplication

  }

  protected boolean bindServiceToCaldecottApp(String serviceName, CloudFoundryOperations client, SubMonitor monitor)
      throws CoreException {

    CloudApplication caldecottApp = getCaldecottApp(client);
    List<String> updateCaldecottServices = new ArrayList<String>();
    List<String> existingServices = caldecottApp.getServices();
    if (existingServices != null) {
      // Must iterate to filter out possible null service names
      for (String existing : existingServices) {
        if (existing != null) {
          updateCaldecottServices.add(existing);
        }
      }
    }

    IModule caldecottModule = getCaldecottModule(monitor.newChild(1));

    if (!updateCaldecottServices.contains(serviceName)) {
      monitor.setTaskName("Binding service " + serviceName + " to tunnel application"); //$NON-NLS-1$ //$NON-NLS-2$

      updateCaldecottServices.add(serviceName);
      CloudFoundryServerBehaviour behaviour = cloudServer.getBehaviour();
      behaviour.stopModule(new IModule[] { caldecottModule }, monitor.newChild(1));
      behaviour.updateServices(TunnelHelper.getTunnelAppName(), updateCaldecottServices, monitor.newChild(1));

      setDeploymentServices(serviceName, monitor.newChild(1));

      return caldecottApp.getServices().contains(serviceName);
    }
    else {
      return true;
    }
View Full Code Here

Examples of org.cloudfoundry.client.lib.domain.CloudApplication

  }

  protected void startCaldecottApp(IProgressMonitor progress, final CloudFoundryOperations client)
      throws CoreException {
    progress.setTaskName("Starting tunnel application"); //$NON-NLS-1$
    CloudApplication caldecottApp = getCaldecottApp(client);

    if (caldecottApp == null) {
      throw CloudErrorUtil.toCoreException("No Caldecott application found. Unable to create tunnel."); //$NON-NLS-1$
    }
    CloudFoundryApplicationModule appModule = cloudServer.getExistingCloudModule(caldecottApp.getName());
    if (appModule == null) {
      throw CloudErrorUtil
          .toCoreException("No local Caldecott application module found. Application may not have finished deploying. Unable to create tunnel."); //$NON-NLS-1$
    }
View Full Code Here

Examples of org.cloudfoundry.client.lib.domain.CloudApplication

        int totalWorkTicks = 100;
        int worked = 10;

        progress = SubMonitor.convert(progress, totalWorkTicks);

        CloudApplication caldecottApp = getOrDeployCaldecottApp(getSubMonitor(worked, progress), client);

        if (caldecottApp == null) {
          return null;
        }
View Full Code Here

Examples of org.cloudfoundry.client.lib.domain.CloudApplication

    return getCaldecottTunnel(serviceName) != null;
  }

  protected synchronized CloudApplication getCaldecottApp(CloudFoundryOperations client) throws CoreException {

    CloudApplication caldecottApp = null;
    try {
      caldecottApp = client.getApplication(TunnelHelper.getTunnelAppName());
    }
    catch (Throwable e) {
      throw new CoreException(CloudFoundryPlugin.getErrorStatus(e));
View Full Code Here

Examples of org.cloudfoundry.client.lib.domain.CloudApplication

   * @return
   */
  protected synchronized CloudApplication getOrDeployCaldecottApp(IProgressMonitor monitor,
      CloudFoundryOperations client) throws CoreException {
    monitor.setTaskName("Obtaining tunnel application"); //$NON-NLS-1$
    CloudApplication caldecottApp = null;
    try {
      caldecottApp = getCaldecottApp(client);
    }
    catch (Throwable e) {
      // Ignore all first attempt.
View Full Code Here

Examples of org.cloudfoundry.client.lib.domain.CloudApplication

  }

  protected void updateCloudApplicationMapping(IProgressMonitor monitor) {
    try {
      CloudFoundryApplicationModule appModule = behaviour.getCloudFoundryServer().getExistingCloudModule(appName);
      CloudApplication actualApp = behaviour.getApplication(appName, monitor);
      if (appModule != null && actualApp != null) {
        appModule.setCloudApplication(actualApp);
      }
      else {
        String missing = appModule == null ? "No Cloud appplication module found. The application may not be correctly created in the local Cloud server instance. " //$NON-NLS-1$
View Full Code Here

Examples of org.cloudfoundry.client.lib.domain.CloudApplication

    int index = path.indexOf("/"); //$NON-NLS-1$
    if (index >= 0 && (index + 1) <= path.length()) {
      String appUrl = path.substring(0, index);
      String instance = path.substring(index + 1);
      for (ApplicationResource app : applications) {
        CloudApplication cloudApp = app.getCloudApplication();
        String cloudAppId = ((Integer) app.getInstanceId()).toString();
        if (validApp(appUrl, cloudApp, cloudAppId, instance)) {
          return app;
        }
      }
View Full Code Here

Examples of org.cloudfoundry.client.lib.domain.CloudApplication

      index = leftover.indexOf("/"); //$NON-NLS-1$
      if (index >= 0) {
        String instance = leftover.substring(0, index);
        String filePath = leftover.substring(index);
        for (ApplicationResource app : applications) {
          CloudApplication cloudApp = app.getCloudApplication();
          String cloudAppId = ((Integer) app.getInstanceId()).toString();
          if (validApp(appUrl, cloudApp, cloudAppId, instance)) {
            return new Object[] { app, filePath };
          }
        }
View Full Code Here

Examples of org.cloudfoundry.client.lib.domain.CloudApplication

      }

      client =  clientOrgSpace(client);
    }

    CloudApplication serverApp = null;
    try {
      serverApp = client.getApplication(TunnelHelper.getTunnelAppName());
    }
    catch (CloudFoundryException e) {}
    if (serverApp == null) {
      System.out.println("Deploying Caldecott server app");
      TunnelHelper.deployTunnelApp(client);
    }
    try {
      serverApp = client.getApplication(TunnelHelper.getTunnelAppName());
    }
    catch (CloudFoundryException e) {
      System.err.println("Unable to deploy Caldecott server app: " + e.getMessage());
      throw e;
    }
    if (!serverApp.getState().equals(CloudApplication.AppState.STARTED)) {
      System.out.println("Starting Caldecott server app");
      client.startApplication(serverApp.getName());
    }

    while (vcap_service == null) {
      System.out.println("You have the following services defined:");
      List<CloudService> services = client.getServices();
View Full Code Here

Examples of org.cloudfoundry.client.lib.domain.CloudApplication

  @Override
  protected void doExecute() throws MojoExecutionException {

    try {
      CloudApplication application = getClient().getApplication(getAppname());

      if (application.getRunningInstances() > 0) {
        getLog().info(String.format("Application '%s' is already started", getAppname()));
      } else {
        getLog().info(String.format("Starting application '%s'", getAppname()));

        final StartingInfo startingInfo = getClient().startApplication(getAppname());
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.