示例#1
0
 @Override
 public void onExecuting(ConvertTask task) {
   SharedFile sf = this.taskTagFileMap.get(task.getTaskTag());
   if (null != sf) {
     Logger.d(this.getClass(), " ConvertTask: " + task.getTaskTag() + " Executing");
     sf.getHttpSession().setAttribute("convertstate", "executing");
   }
 }
示例#2
0
  protected String startConverting(SharedFile file) {
    Logger.d(this.getClass(), "startConverting:" + file.getAliasFile().getAbsolutePath());
    ConvertTask task = new ConvertTask(file.getAliasFile().getAbsolutePath(), this.workPath);

    taskTagFileMap.put(task.getTaskTag(), file);
    ConvertTool.getInstance().addConvertTask(task);

    return task.getTaskTag();
  }
示例#3
0
  @Override
  public void onCompleted(ConvertTask task) {
    SharedFile sf = this.taskTagFileMap.get(task.getTaskTag());
    if (null == sf) {
      return;
    }
    Logger.d(
        this.getClass(),
        " ConvertTask: taskTag: "
            + task.getTaskTag()
            + " state : "
            + task.getStateCode().getDescription()
            + " "
            + " FileURIList : "
            + task.getConvertedFileURIList().toString());

    List<String> uriList = task.getConvertedFileURIList();

    // 组装图片访问 URL
    for (String uri : uriList) {
      String url = this.fileUrlPrefix + uri;
      sf.appendUrl(url);
    }

    sf.getHttpSession().setAttribute("file", sf.toJSON());

    sf.getHttpSession().setAttribute("convertstate", "completed");

    this.taskTagFileMap.remove(task.getTaskTag());
  }
示例#4
0
  @Override
  public void onTaskFailed(ConvertTask task, StateCode code) {
    // TODO  转换失败
    SharedFile sf = this.taskTagFileMap.get(task.getTaskTag());
    if (null == sf) {
      // TODO Error
      return;
    }
    Logger.d(
        this.getClass(),
        " ConvertTask: "
            + task.getTaskTag()
            + " Failed : "
            + code.getDescription()
            + " FailCode: "
            + task.getFaileCode()
            + " FileURIList : "
            + task.getConvertedFileURIList().toString());
    sf.getHttpSession().setAttribute("convertstate", "failed");

    this.taskTagFileMap.remove(task.getTaskTag());
  }
示例#5
0
 @Override
 public void onQueueing(ConvertTask task) {
   Logger.d(this.getClass(), " ConvertTask: " + task.getTaskTag() + " Queueing ");
 }