Package org.eclipse.orion.server.cf.ds.objects

Examples of org.eclipse.orion.server.cf.ds.objects.Plan


      set(application, ManifestConstants.INSTANCES, ManifestUtils.DEFAULT_INSTANCES);
      set(application, ManifestConstants.PATH, ManifestUtils.DEFAULT_PATH);

      /* node.js application require a start command */
      if (application.has(ManifestConstants.COMMAND))
        return new Plan(getId(), getWizardId(), TYPE, manifest);

      InputStream is = null;
      try {

        is = packageStore.openInputStream(EFS.NONE, null);
        JSONObject packageJSON = new JSONObject(new JSONTokener(new InputStreamReader(is)));
        if (packageJSON.has(NodeJSConstants.SCRIPTS)) {
          JSONObject scripts = packageJSON.getJSONObject(NodeJSConstants.SCRIPTS);
          if (scripts.has(NodeJSConstants.START)) {
            application.put(ManifestConstants.COMMAND, scripts.getString(NodeJSConstants.START));
            return new Plan(getId(), getWizardId(), TYPE, manifest);
          }
        }

      } catch (JSONException ex) {
        /* can't parse the package.json, fail */
        return null;

      } finally {
        IOUtilities.safeClose(is);
      }

      /* look for server.js or app.js files */
      IFileStore serverJS = contentLocation.getChild(NodeJSConstants.SERVER_JS);
      if (serverJS.fetchInfo().exists()) {
        application.put(ManifestConstants.COMMAND, NodeJSConstants.NODE_SERVER_JS);
        return new Plan(getId(), getWizardId(), TYPE, manifest);
      }

      IFileStore appJS = contentLocation.getChild(NodeJSConstants.APP_JS);
      if (appJS.fetchInfo().exists()) {
        application.put(ManifestConstants.COMMAND, NodeJSConstants.NODE_APP_JS);
        return new Plan(getId(), getWizardId(), TYPE, manifest);
      }

      /* could not deduce command, mark as required */
      Plan plan = new Plan(getId(), getWizardId(), TYPE, manifest);
      plan.addRequired(ManifestConstants.COMMAND);
      return plan;

    } catch (Exception ex) {
      String msg = NLS.bind("Failed to handle generic deployment plan for {0}", contentLocation.toString()); //$NON-NLS-1$
      logger.error(msg, ex);
View Full Code Here


  @Override
  public List<Plan> getDeploymentPlans(IFileStore contentLocation, ManifestParseTree manifest) {
    List<Plan> plans = new ArrayList<Plan>();
    for (IDeploymentPlanner planner : planners) {
      Plan plan = planner.getDeploymentPlan(contentLocation, manifest != null ? new ManifestParseTree(manifest) : null);
      if (plan != null)
        plans.add(plan);
    }

    return plans;
View Full Code Here

      ManifestParseTree application = manifest.get(ManifestConstants.APPLICATIONS).get(0);
      set(application, ManifestConstants.HOST, ManifestUtils.slugify(applicationName));
      set(application, ManifestConstants.MEMORY, ManifestUtils.DEFAULT_MEMORY);
      set(application, ManifestConstants.INSTANCES, ManifestUtils.DEFAULT_INSTANCES);
      set(application, ManifestConstants.PATH, ManifestUtils.DEFAULT_PATH);
      return new Plan(getId(), getWizardId(), TYPE, manifest);

    } catch (Exception ex) {
      /* Nobody expected the Spanish inquisition */
      String msg = NLS.bind("Failed to handle generic deployment plan for {0}", contentLocation.toString()); //$NON-NLS-1$
      logger.error(msg, ex);
View Full Code Here

TOP

Related Classes of org.eclipse.orion.server.cf.ds.objects.Plan

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.