@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()); }
@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"); } }
@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()); }