@Test public void testCopy() throws Exception { final ProtocolFactory factory = new ProtocolFactory(new HashSet<>(Collections.singleton(new IRODSProtocol()))); final Profile profile = new ProfilePlistReader(factory).read( new Local("../profiles/iRODS (iPlant Collaborative).cyberduckprofile")); final Host host = new Host(profile, profile.getDefaultHostname(), new Credentials( System.getProperties().getProperty("irods.key"), System.getProperties().getProperty("irods.secret") )); final IRODSSession session = new IRODSSession(host); session.open(Proxy.DIRECT, new DisabledHostKeyCallback(), new DisabledLoginCallback()); session.login(Proxy.DIRECT, new DisabledLoginCallback(), new DisabledCancelCallback()); final Path test = new Path(new IRODSHomeFinderService(session).find(), UUID.randomUUID().toString(), EnumSet.of(Path.Type.file)); new IRODSTouchFeature(session).touch(test, new TransferStatus()); final Path copy = new Path(new IRODSHomeFinderService(session).find(), UUID.randomUUID().toString(), EnumSet.of(Path.Type.file)); new IRODSCopyFeature(session).copy(test, copy, new TransferStatus(), new DisabledConnectionCallback()); assertTrue(new IRODSFindFeature(session).find(test)); assertTrue(new IRODSFindFeature(session).find(copy)); new IRODSDeleteFeature(session).delete(Arrays.asList(test, copy), new DisabledLoginCallback(), new Delete.DisabledCallback()); session.close(); }
@Override public Path copy(final Path source, final Path target, final ch.cyberduck.core.transfer.TransferStatus status, final ConnectionCallback callback) throws BackgroundException { try { final IRODSFileSystemAO fs = session.getClient(); final DataTransferOperations transfer = fs.getIRODSAccessObjectFactory() .getDataTransferOperations(fs.getIRODSAccount()); transfer.copy(fs.getIRODSFileFactory().instanceIRODSFile(source.getAbsolute()), fs.getIRODSFileFactory().instanceIRODSFile(target.getAbsolute()), new TransferStatusCallbackListener() { @Override public FileStatusCallbackResponse statusCallback(final TransferStatus transferStatus) { return FileStatusCallbackResponse.CONTINUE; } @Override public void overallStatusCallback(final TransferStatus transferStatus) { } @Override public CallbackResponse transferAsksWhetherToForceOperation(final String irodsAbsolutePath, final boolean isCollection) { return CallbackResponse.YES_THIS_FILE; } }, DefaultTransferControlBlock.instance(StringUtils.EMPTY, PreferencesFactory.get().getInteger("connection.retry"))); return target; } catch(JargonException e) { throw new IRODSExceptionMappingService().map("Cannot copy {0}", e, source); } }
IRODSCopyFeature implements Copy { @Override public Path copy(final Path source, final Path target, final ch.cyberduck.core.transfer.TransferStatus status, final ConnectionCallback callback) throws BackgroundException { try { final IRODSFileSystemAO fs = session.getClient(); final DataTransferOperations transfer = fs.getIRODSAccessObjectFactory() .getDataTransferOperations(fs.getIRODSAccount()); transfer.copy(fs.getIRODSFileFactory().instanceIRODSFile(source.getAbsolute()), fs.getIRODSFileFactory().instanceIRODSFile(target.getAbsolute()), new TransferStatusCallbackListener() { @Override public FileStatusCallbackResponse statusCallback(final TransferStatus transferStatus) { return FileStatusCallbackResponse.CONTINUE; } @Override public void overallStatusCallback(final TransferStatus transferStatus) { } @Override public CallbackResponse transferAsksWhetherToForceOperation(final String irodsAbsolutePath, final boolean isCollection) { return CallbackResponse.YES_THIS_FILE; } }, DefaultTransferControlBlock.instance(StringUtils.EMPTY, PreferencesFactory.get().getInteger("connection.retry"))); return target; } catch(JargonException e) { throw new IRODSExceptionMappingService().map("Cannot copy {0}", e, source); } } }
IRODSCopyFeature implements Copy { @Override public Path copy(final Path source, final Path target, final ch.cyberduck.core.transfer.TransferStatus status, final ConnectionCallback callback) throws BackgroundException { try { final IRODSFileSystemAO fs = session.getClient(); final DataTransferOperations transfer = fs.getIRODSAccessObjectFactory() .getDataTransferOperations(fs.getIRODSAccount()); transfer.copy(fs.getIRODSFileFactory().instanceIRODSFile(source.getAbsolute()), fs.getIRODSFileFactory().instanceIRODSFile(target.getAbsolute()), new TransferStatusCallbackListener() { @Override public FileStatusCallbackResponse statusCallback(final TransferStatus transferStatus) { return FileStatusCallbackResponse.CONTINUE; } @Override public void overallStatusCallback(final TransferStatus transferStatus) { } @Override public CallbackResponse transferAsksWhetherToForceOperation(final String irodsAbsolutePath, final boolean isCollection) { return CallbackResponse.YES_THIS_FILE; } }, DefaultTransferControlBlock.instance(StringUtils.EMPTY, PreferencesFactory.get().getInteger("connection.retry"))); return target; } catch(JargonException e) { throw new IRODSExceptionMappingService().map("Cannot copy {0}", e, source); } } IRODSCopyFeature(final IRODSSession session); }
IRODSCopyFeature implements Copy { @Override public Path copy(final Path source, final Path target, final ch.cyberduck.core.transfer.TransferStatus status, final ConnectionCallback callback) throws BackgroundException { try { final IRODSFileSystemAO fs = session.getClient(); final DataTransferOperations transfer = fs.getIRODSAccessObjectFactory() .getDataTransferOperations(fs.getIRODSAccount()); transfer.copy(fs.getIRODSFileFactory().instanceIRODSFile(source.getAbsolute()), fs.getIRODSFileFactory().instanceIRODSFile(target.getAbsolute()), new TransferStatusCallbackListener() { @Override public FileStatusCallbackResponse statusCallback(final TransferStatus transferStatus) { return FileStatusCallbackResponse.CONTINUE; } @Override public void overallStatusCallback(final TransferStatus transferStatus) { } @Override public CallbackResponse transferAsksWhetherToForceOperation(final String irodsAbsolutePath, final boolean isCollection) { return CallbackResponse.YES_THIS_FILE; } }, DefaultTransferControlBlock.instance(StringUtils.EMPTY, PreferencesFactory.get().getInteger("connection.retry"))); return target; } catch(JargonException e) { throw new IRODSExceptionMappingService().map("Cannot copy {0}", e, source); } } IRODSCopyFeature(final IRODSSession session); @Override Path copy(final Path source, final Path target, final ch.cyberduck.core.transfer.TransferStatus status, final ConnectionCallback callback); @Override boolean isRecursive(final Path source, final Path target); @Override boolean isSupported(final Path source, final Path target); }
IRODSCopyFeature implements Copy { @Override public Path copy(final Path source, final Path target, final ch.cyberduck.core.transfer.TransferStatus status, final ConnectionCallback callback) throws BackgroundException { try { final IRODSFileSystemAO fs = session.getClient(); final DataTransferOperations transfer = fs.getIRODSAccessObjectFactory() .getDataTransferOperations(fs.getIRODSAccount()); transfer.copy(fs.getIRODSFileFactory().instanceIRODSFile(source.getAbsolute()), fs.getIRODSFileFactory().instanceIRODSFile(target.getAbsolute()), new TransferStatusCallbackListener() { @Override public FileStatusCallbackResponse statusCallback(final TransferStatus transferStatus) { return FileStatusCallbackResponse.CONTINUE; } @Override public void overallStatusCallback(final TransferStatus transferStatus) { } @Override public CallbackResponse transferAsksWhetherToForceOperation(final String irodsAbsolutePath, final boolean isCollection) { return CallbackResponse.YES_THIS_FILE; } }, DefaultTransferControlBlock.instance(StringUtils.EMPTY, PreferencesFactory.get().getInteger("connection.retry"))); return target; } catch(JargonException e) { throw new IRODSExceptionMappingService().map("Cannot copy {0}", e, source); } } IRODSCopyFeature(final IRODSSession session); @Override Path copy(final Path source, final Path target, final ch.cyberduck.core.transfer.TransferStatus status, final ConnectionCallback callback); @Override boolean isRecursive(final Path source, final Path target); @Override boolean isSupported(final Path source, final Path target);  }