Feature #5603

Progress monitoring on directory copy/move

Added by Hajnal Akos almost 7 years ago. Updated almost 7 years ago.

Status:ClosedStart date:12/02/2013
Priority:NormalDue date:
Assigned To:Schwarz Lionel% Done:


Target version:1.0.0


Metric for progress monitoring is not available when copying directories.
(file.copy.progress applies to single file copy/move).
It would be good to have.


#1 Updated by Schwarz Lionel almost 7 years ago

  • Category set to engine

#2 Updated by Schwarz Lionel almost 7 years ago

  • Status changed from New to Feedback

Hi Akos,
After a quick glance at the code, it seems it is already implemented. Can you send me your code that does dir copy and do not get file.copy.progress monitoring?


#3 Updated by Schwarz Lionel almost 7 years ago

  • Status changed from Feedback to Assigned
import org.ogf.saga.context.*;
import org.ogf.saga.monitoring.*;
import org.ogf.saga.namespace.*;
import org.ogf.saga.session.*;
import org.ogf.saga.task.*;
import org.ogf.saga.url.*;
import fr.in2p3.jsaga.impl.file.copy.AbstractCopyTask;

public class CopyProgress {
    public static void main(String[] args) throws Exception {
        try {
            URL url = URLFactory.createURL("sftp://host/tmp/test1/"); // from dir
            URL target = URLFactory.createURL("sftp://host/tmp/test2/"); // to dir
            Session session = SessionFactory.createSession(false);
            Context ctx = ContextFactory.createContext("SSH");
            ctx.setAttribute(Context.USERID, "xxxxx");
            ctx.setAttribute(Context.USERPASS, "***");
            ctx.setVectorAttribute("DataServiceAttributes", new String[]{"sftp.KnownHosts="});
            NSEntry file = NSFactory.createNSEntry(session, url, Flags.NONE.getValue());
            Task task = file.copy(TaskMode.TASK, target, Flags.OVERWRITE.getValue());
            System.out.println("Available metrics:");
            for (String metric: task.listMetrics()) System.out.println("- " + metric); // only task.state
            Metric metric = task.getMetric(AbstractCopyTask.FILE_COPY_PROGRESS); // fails
        } catch (Exception e) { e.printStackTrace(); }

#4 Updated by Schwarz Lionel almost 7 years ago

  • Status changed from Assigned to Closed

Fixed and available in the next snapshot

Also available in: Atom PDF