@Test public void testTouch() 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()); assertTrue(new IRODSFindFeature(session).find(test)); new IRODSDeleteFeature(session).delete(Collections.<Path>singletonList(test), new DisabledLoginCallback(), new Delete.DisabledCallback()); assertFalse(new IRODSFindFeature(session).find(test)); session.close(); }
@Override public Path touch(final Path file, final TransferStatus status) throws BackgroundException { try { final IRODSFileSystemAO fs = session.getClient(); final int descriptor = fs.createFile(file.getAbsolute(), DataObjInp.OpenFlags.WRITE_TRUNCATE, DataObjInp.DEFAULT_CREATE_MODE); fs.fileClose(descriptor, false); return new Path(file.getParent(), file.getName(), file.getType(), new IRODSAttributesFinderFeature(session).find(file)); } catch(JargonException e) { throw new IRODSExceptionMappingService().map("Cannot create file {0}", e, file); } }
IRODSTouchFeature implements Touch { @Override public Path touch(final Path file, final TransferStatus status) throws BackgroundException { try { final IRODSFileSystemAO fs = session.getClient(); final int descriptor = fs.createFile(file.getAbsolute(), DataObjInp.OpenFlags.WRITE_TRUNCATE, DataObjInp.DEFAULT_CREATE_MODE); fs.fileClose(descriptor, false); return new Path(file.getParent(), file.getName(), file.getType(), new IRODSAttributesFinderFeature(session).find(file)); } catch(JargonException e) { throw new IRODSExceptionMappingService().map("Cannot create file {0}", e, file); } } }
IRODSTouchFeature implements Touch { @Override public Path touch(final Path file, final TransferStatus status) throws BackgroundException { try { final IRODSFileSystemAO fs = session.getClient(); final int descriptor = fs.createFile(file.getAbsolute(), DataObjInp.OpenFlags.WRITE_TRUNCATE, DataObjInp.DEFAULT_CREATE_MODE); fs.fileClose(descriptor, false); return new Path(file.getParent(), file.getName(), file.getType(), new IRODSAttributesFinderFeature(session).find(file)); } catch(JargonException e) { throw new IRODSExceptionMappingService().map("Cannot create file {0}", e, file); } } IRODSTouchFeature(final IRODSSession session); }
IRODSTouchFeature implements Touch { @Override public Path touch(final Path file, final TransferStatus status) throws BackgroundException { try { final IRODSFileSystemAO fs = session.getClient(); final int descriptor = fs.createFile(file.getAbsolute(), DataObjInp.OpenFlags.WRITE_TRUNCATE, DataObjInp.DEFAULT_CREATE_MODE); fs.fileClose(descriptor, false); return new Path(file.getParent(), file.getName(), file.getType(), new IRODSAttributesFinderFeature(session).find(file)); } catch(JargonException e) { throw new IRODSExceptionMappingService().map("Cannot create file {0}", e, file); } } IRODSTouchFeature(final IRODSSession session); @Override Path touch(final Path file, final TransferStatus status); @Override Touch withWriter(final Write writer); }
IRODSTouchFeature implements Touch { @Override public Path touch(final Path file, final TransferStatus status) throws BackgroundException { try { final IRODSFileSystemAO fs = session.getClient(); final int descriptor = fs.createFile(file.getAbsolute(), DataObjInp.OpenFlags.WRITE_TRUNCATE, DataObjInp.DEFAULT_CREATE_MODE); fs.fileClose(descriptor, false); return new Path(file.getParent(), file.getName(), file.getType(), new IRODSAttributesFinderFeature(session).find(file)); } catch(JargonException e) { throw new IRODSExceptionMappingService().map("Cannot create file {0}", e, file); } } IRODSTouchFeature(final IRODSSession session); @Override Path touch(final Path file, final TransferStatus status); @Override Touch withWriter(final Write writer);  }