Package com.cloud.agent.api.storage

Examples of com.cloud.agent.api.storage.UploadAnswer


        if (s_logger.isTraceEnabled()) {
            getUploadListener().log("handleEvent, event type=" + event + ", curr state=" + getName(), Level.TRACE);
        }
        switch (event) {
            case UPLOAD_ANSWER:
                UploadAnswer answer = (UploadAnswer)eventObj;
                return handleAnswer(answer);
            case ABANDON_UPLOAD:
                return handleAbort();
            case TIMEOUT_CHECK:
                Date now = new Date();
View Full Code Here


    @Override
    public boolean processAnswers(long agentId, long seq, Answer[] answers) {
        boolean processed = false;
        if (answers != null & answers.length > 0) {
            if (answers[0] instanceof UploadAnswer) {
                final UploadAnswer answer = (UploadAnswer)answers[0];
                if (getJobId() == null) {
                    setJobId(answer.getJobId());
                } else if (!getJobId().equalsIgnoreCase(answer.getJobId())) {
                    return false;//TODO
                }
                transition(UploadEvent.UPLOAD_ANSWER, answer);
                processed = true;
            }
View Full Code Here

  @Override
  public boolean processAnswers(long agentId, long seq, Answer[] answers) {
    boolean processed = false;
      if(answers != null & answers.length > 0) {
        if(answers[0] instanceof UploadAnswer) {
          final UploadAnswer answer = (UploadAnswer)answers[0];
          if (getJobId() == null) {
            setJobId(answer.getJobId());
          } else if (!getJobId().equalsIgnoreCase(answer.getJobId())){
            return false;//TODO
          }
          transition(UploadEvent.UPLOAD_ANSWER, answer);
          processed = true;
        }
View Full Code Here

        return null;
    }

    private UploadAnswer handleUploadProgressCmd(UploadProgressCommand cmd) {
        String jobId = cmd.getJobId();
        UploadAnswer answer;
        UploadJob uj = null;
        if (jobId != null)
            uj = jobs.get(jobId);
        if (uj == null) {          
            return new UploadAnswer(null, 0, "Cannot find job", com.cloud.storage.UploadVO.Status.UNKNOWN, "", "", 0);           
        }
        TemplateUploader td = uj.getTemplateUploader();
        switch (cmd.getRequest()) {
        case GET_STATUS:
            break;
        case ABORT:
            td.stopUpload();
            sleep();
            break;
            /*case RESTART:
            td.stopUpload();
            sleep();
            threadPool.execute(td);
            break;*/
        case PURGE:
            td.stopUpload();
            answer = new UploadAnswer(jobId, getUploadPct(jobId), getUploadError(jobId), getUploadStatus2(jobId), getUploadLocalPath(jobId), getInstallPath(jobId), getUploadTemplateSize(jobId));
            jobs.remove(jobId);
            return answer;
        default:
            break; // TODO
        }
        return new UploadAnswer(jobId, getUploadPct(jobId), getUploadError(jobId), getUploadStatus2(jobId), getUploadLocalPath(jobId), getInstallPath(jobId),
                getUploadTemplateSize(jobId));
   
View Full Code Here

                cmd.getFormat(), cmd.getAccountId(), cmd.getDescription(),
                cmd.getChecksum(), cmd.getInstallPath(), user, password,
                cmd.getTemplateSizeInBytes());
        sleep();
        if (jobId == null) {
            return new UploadAnswer(null, 0, "Internal Error", com.cloud.storage.UploadVO.Status.UPLOAD_ERROR, "", "", 0);
        }
        return new UploadAnswer(jobId, getUploadPct(jobId), getUploadError(jobId), getUploadStatus2(jobId), getUploadLocalPath(jobId), getInstallPath(jobId),
                getUploadTemplateSize(jobId));
    }
View Full Code Here

TOP

Related Classes of com.cloud.agent.api.storage.UploadAnswer

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.