package org.ngbw.web.actions; import java.util.List; import org.apache.log4j.Logger; import org.ngbw.cipres.sdk.api.foldershare.policy.AppendCopyDuplicateNumberPolicy; import org.ngbw.sdk.common.util.CipresTaskThread; import org.ngbw.sdk.database.SourceDocument; import org.ngbw.sdk.database.Task; import org.ngbw.sdk.foldershare.task.FileUploadTask; /** * * @author Tony Chen */ public class CipresDataShareManager extends SetTaskOutput { private static final Logger logger = Logger.getLogger(CipresDataShareManager.class); /** * When task output documents are transferred to CIPRES Share site, * it is important that the directory structures should be maintained * (except the username) to avoid confusing. This method reads the * structures of the directory and returns them in a List. * *
* The directory structures of CIPRES Task output documents are in this form:
*
* {@code /username/user-defined-folder-name/Tasks/user-defined-task-label/scheduler.conf}
* {@code /username/user-defined-folder-name/Tasks/user-defined-task-label/_JOBINFO.TXT}
* ...
*
* where {@code user-defined-folder-name} can have multiple sub-directories.
*
* i.e.
* {@code /johndoe/beast/Tasks/beast-task-01/scheduler.conf}
* {@code /johndoe/beast/aminoacid/Tasks/beast-task-37/scheduler.conf}
* ...
*
* On CIPRES Share site, the same directory structures, except the username, should be maintained for
* consistency.
*
* Example 1:
* When the user johndoe transfers the file {@code /johndoe/beast/Tasks/beast-task-01/scheduler.conf}
* to CIPRES Share, it will be placed under {@code /beast/Tasks/beast-task-01} directory. Note that the root
* directory 'johndoe' will be created on CIPRES Share.
*
* Thus, invoking this method {@code getTaskOutputDocsDirectories(Task)} returns
* {@code List["beast", "Tasks", "beast-task-01"]}.
*
* Example 2:
* The file {@code /johndoe/beast/aminoacid/Tasks/beast-task-37/scheduler.conf} transferred to CIPRES Share
* will be placed under {@code /beast/aminoacid/Tasks/beast-task-37} directory. Thus invoking this method
* {@code getTaskOutputDocsDirectories(Task)} returns {@code List ["beast", "aminoacid", "Tasks", "beast-task-37"]}.
*
*
*
* NOTE: The {@code username} will be removed.
*
*
* @param task the CIPRES Task which output files are from
*
* @return directory structures
*
* @throws Throwable
*/
private List
* Directory structures will be maintained the same on CIPRES Share.
*
* @return
*
* @throws Throwable
*/
public String transferTaskOutputFiles () throws Throwable
{
logger.debug("BEGIN: transferTaskOutputFiles()::String");
Task task = (Task) getSessionAttribute(CURRENT_TASK);
List