Examples of CFJob


Examples of org.eclipse.orion.server.cf.jobs.CFJob

    final String finalContentLocation = contentLocation;

    final String encodedName = IOUtilities.getQueryParameter(request, CFProtocolConstants.KEY_NAME);
    final JSONObject targetJSON = extractJSONData(IOUtilities.getQueryParameter(request, CFProtocolConstants.KEY_TARGET));

    return new CFJob(request, false) {
      @Override
      protected IStatus performJob() {
        try {
          ComputeTargetCommand computeTarget = new ComputeTargetCommand(this.userId, targetJSON);
          IStatus result = computeTarget.doIt();
View Full Code Here

Examples of org.eclipse.orion.server.cf.jobs.CFJob

    final String appGuid = path.segment(0);
    boolean addRoute = "routes".equals(path.segment(1)); //$NON-NLS-1$
    final String routeGuid = addRoute ? path.segment(2) : null;

    if (addRoute)
      return new CFJob(request, false) {
        @Override
        protected IStatus performJob() {
          try {
            ComputeTargetCommand computeTarget = new ComputeTargetCommand(this.userId, targetJSON2);
            IStatus status = computeTarget.doIt();
            if (!status.isOK())
              return status;
            Target target = computeTarget.getTarget();

            GetAppByGuidCommand getAppByGuid = new GetAppByGuidCommand(target.getCloud(), appGuid);
            IStatus getAppByGuidStatus = getAppByGuid.doIt();
            if (!getAppByGuidStatus.isOK())
              return getAppByGuidStatus;
            App app = getAppByGuid.getApp();

            GetRouteByGuidCommand getRouteByGuid = new GetRouteByGuidCommand(target.getCloud(), routeGuid);
            IStatus getRouteByGuidStatus = getRouteByGuid.doIt();
            if (!getRouteByGuidStatus.isOK())
              return getRouteByGuidStatus;
            Route route = getRouteByGuid.getRoute();

            MapRouteCommand unmapRoute = new MapRouteCommand(target, app, route.getGuid());
            return unmapRoute.doIt();
          } catch (Exception e) {
            String msg = NLS.bind("Failed to handle request for {0}", pathString); //$NON-NLS-1$
            ServerStatus status = new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, msg, e);
            logger.error(msg, e);
            return status;
          }
        }
      };

    final JSONObject jsonData = extractJSONData(request);
    final JSONObject targetJSON = jsonData.optJSONObject(CFProtocolConstants.KEY_TARGET);

    final String state = jsonData.optString(CFProtocolConstants.KEY_STATE, null);
    final String appName = jsonData.optString(CFProtocolConstants.KEY_NAME, null);
    final String contentLocation = ServletResourceHandler.toOrionLocation(request, jsonData.optString(CFProtocolConstants.KEY_CONTENT_LOCATION, null));

    /* custom packager details */
    final String packagerName = jsonData.optString(CFProtocolConstants.KEY_PACKAGER, null);

    /* non-manifest deployments using a .json representation */
    final JSONObject manifestJSON = jsonData.optJSONObject(CFProtocolConstants.KEY_MANIFEST);
    final JSONObject instrumentationJSON = jsonData.optJSONObject(CFProtocolConstants.KEY_INSTRUMENTATION);
    final boolean persistManifest = jsonData.optBoolean(CFProtocolConstants.KEY_PERSIST, false);

    /* default application startup is one minute */
    int userTimeout = jsonData.optInt(CFProtocolConstants.KEY_TIMEOUT, 60);
    final int timeout = (userTimeout > 0) ? userTimeout : 0;

    return new CFJob(request, false) {

      @Override
      protected IStatus performJob() {
        try {

View Full Code Here

Examples of org.eclipse.orion.server.cf.jobs.CFJob

    IPath path = new Path(pathString);
    final String appGuid = path.segment(0);
    boolean deleteRoute = "routes".equals(path.segment(1)); //$NON-NLS-1$
    final String routeGuid = deleteRoute ? path.segment(2) : null;

    return new CFJob(request, false) {
      @Override
      protected IStatus performJob() {
        try {
          ComputeTargetCommand computeTarget = new ComputeTargetCommand(userId, targetJSON);
          IStatus status = computeTarget.doIt();
View Full Code Here

Examples of org.eclipse.orion.server.cf.jobs.CFJob

   * @param response The response associated with the request.
   * @param path Path suffix required to handle the request.
   * @return A {@link JazzJob} which returns the requested resource on completion.
   */
  protected CFJob handleGet(T resource, final HttpServletRequest request, final HttpServletResponse response, final String path) {
    return new CFJob(request, false) {
      @Override
      protected IStatus performJob() {
        String msg = NLS.bind("Failed to handle request for {0}", path); //$NON-NLS-1$
        return new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_NOT_IMPLEMENTED, msg, null);
      }
View Full Code Here

Examples of org.eclipse.orion.server.cf.jobs.CFJob

   * @param response The response associated with the request.
   * @param path Path suffix required to handle the request.
   * @return A {@link JazzJob} which returns the PUT request result on completion.
   */
  protected CFJob handlePut(T resource, final HttpServletRequest request, final HttpServletResponse response, final String path) {
    return new CFJob(request, false) {
      @Override
      protected IStatus performJob() {
        String msg = NLS.bind("Failed to handle request for {0}", path); //$NON-NLS-1$
        return new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_NOT_IMPLEMENTED, msg, null);
      }
View Full Code Here

Examples of org.eclipse.orion.server.cf.jobs.CFJob

   * @param response The response associated with the request.
   * @param path Path suffix required to handle the request.
   * @return A {@link JazzJob} which returns the POST request result on completion.
   */
  protected CFJob handlePost(final T resource, final HttpServletRequest request, final HttpServletResponse response, final String path) {
    return new CFJob(request, false) {
      @Override
      protected IStatus performJob() {
        String msg = NLS.bind("Failed to handle request for {0}", path); //$NON-NLS-1$
        return new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_NOT_IMPLEMENTED, msg, null);
      }
View Full Code Here

Examples of org.eclipse.orion.server.cf.jobs.CFJob

   * @param response The response associated with the request.
   * @param path Path suffix required to handle the request.
   * @return A {@link JazzJob} which returns the DELETE request result on completion.
   */
  protected CFJob handleDelete(T resource, final HttpServletRequest request, final HttpServletResponse response, final String path) {
    return new CFJob(request, false) {
      @Override
      protected IStatus performJob() {
        String msg = NLS.bind("Failed to handle request for {0}", path); //$NON-NLS-1$
        return new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_NOT_IMPLEMENTED, msg, null);
      }
View Full Code Here

Examples of org.eclipse.orion.server.cf.jobs.CFJob

      /* build the request resource */
      T resource = buildResource(request, path);

      switch (getMethod(request)) {
        case GET :
          CFJob getJob = handleGet(resource, request, response, path);
          return TaskJobHandler.handleTaskJob(request, response, getJob, statusHandler, JsonURIUnqualificationStrategy.LOCATION_ONLY);

        case PUT :
          CFJob putJob = handlePut(resource, request, response, path);
          return TaskJobHandler.handleTaskJob(request, response, putJob, statusHandler, JsonURIUnqualificationStrategy.LOCATION_ONLY);

        case POST :
          CFJob postJob = handlePost(resource, request, response, path);
          return TaskJobHandler.handleTaskJob(request, response, postJob, statusHandler, JsonURIUnqualificationStrategy.LOCATION_ONLY);

        case DELETE :
          CFJob deleteJob = handleDelete(resource, request, response, path);
          return TaskJobHandler.handleTaskJob(request, response, deleteJob, statusHandler, JsonURIUnqualificationStrategy.LOCATION_ONLY);

        default :
          /* we don't know how to handle this request */
          return false;
View Full Code Here

Examples of org.eclipse.orion.server.cf.jobs.CFJob

  @Override
  protected CFJob handleGet(Info info, HttpServletRequest request, HttpServletResponse response, final String path) {
    final JSONObject targetJSON = extractJSONData(IOUtilities.getQueryParameter(request, CFProtocolConstants.KEY_TARGET));

    return new CFJob(request, false) {
      @Override
      protected IStatus performJob() {
        try {
          URL targetUrl = null;
          if (targetJSON != null) {
View Full Code Here

Examples of org.eclipse.orion.server.cf.jobs.CFJob

    IPath path = new Path(pathString);
    final String appName = path.segment(0);
    final String logName = path.segment(1);
    final String instanceNo = path.segment(2);

    return new CFJob(request, false) {
      @Override
      protected IStatus performJob() {
        try {
          ComputeTargetCommand computeTargetCommand = new ComputeTargetCommand(this.userId, targetJSON);
          IStatus result = computeTargetCommand.doIt();
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.