@Test public void testTouch() throws Exception { final Path file = new Path( testPathPrefix, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)); new MantaTouchFeature(session).touch(file, new TransferStatus().withMime("x-application/cyberduck")); assertNotNull(new MantaAttributesFinderFeature(session).find(file)); new MantaDeleteFeature(session).delete(Collections.singletonList(file), new DisabledLoginCallback(), new Delete.DisabledCallback()); }
@Override public Path touch(final Path file, final TransferStatus status) throws BackgroundException { try { if(!session.getClient().existsAndIsAccessible(file.getParent().getAbsolute())) { session.getClient().putDirectory(file.getParent().getAbsolute()); } session.getClient().put(file.getAbsolute(), new byte[0]); } catch(MantaException e) { throw new MantaExceptionMappingService().map("Cannot create file {0}", e, file); } catch(MantaClientHttpResponseException e) { throw new MantaHttpExceptionMappingService().map("Cannot create file {0}", e, file); } catch(IOException e) { throw new DefaultIOExceptionMappingService().map("Cannot create file {0}", e, file); } return file; }
MantaTouchFeature implements Touch { @Override public Path touch(final Path file, final TransferStatus status) throws BackgroundException { try { if(!session.getClient().existsAndIsAccessible(file.getParent().getAbsolute())) { session.getClient().putDirectory(file.getParent().getAbsolute()); } session.getClient().put(file.getAbsolute(), new byte[0]); } catch(MantaException e) { throw new MantaExceptionMappingService().map("Cannot create file {0}", e, file); } catch(MantaClientHttpResponseException e) { throw new MantaHttpExceptionMappingService().map("Cannot create file {0}", e, file); } catch(IOException e) { throw new DefaultIOExceptionMappingService().map("Cannot create file {0}", e, file); } return file; } }
MantaTouchFeature implements Touch { @Override public Path touch(final Path file, final TransferStatus status) throws BackgroundException { try { if(!session.getClient().existsAndIsAccessible(file.getParent().getAbsolute())) { session.getClient().putDirectory(file.getParent().getAbsolute()); } session.getClient().put(file.getAbsolute(), new byte[0]); } catch(MantaException e) { throw new MantaExceptionMappingService().map("Cannot create file {0}", e, file); } catch(MantaClientHttpResponseException e) { throw new MantaHttpExceptionMappingService().map("Cannot create file {0}", e, file); } catch(IOException e) { throw new DefaultIOExceptionMappingService().map("Cannot create file {0}", e, file); } return file; } MantaTouchFeature(final MantaSession session); }
MantaTouchFeature implements Touch { @Override public Path touch(final Path file, final TransferStatus status) throws BackgroundException { try { if(!session.getClient().existsAndIsAccessible(file.getParent().getAbsolute())) { session.getClient().putDirectory(file.getParent().getAbsolute()); } session.getClient().put(file.getAbsolute(), new byte[0]); } catch(MantaException e) { throw new MantaExceptionMappingService().map("Cannot create file {0}", e, file); } catch(MantaClientHttpResponseException e) { throw new MantaHttpExceptionMappingService().map("Cannot create file {0}", e, file); } catch(IOException e) { throw new DefaultIOExceptionMappingService().map("Cannot create file {0}", e, file); } return file; } MantaTouchFeature(final MantaSession session); @Override Path touch(final Path file, final TransferStatus status); @Override boolean isSupported(final Path workdir, final String filename); @Override Touch withWriter(final Write writer); }
MantaTouchFeature implements Touch { @Override public Path touch(final Path file, final TransferStatus status) throws BackgroundException { try { if(!session.getClient().existsAndIsAccessible(file.getParent().getAbsolute())) { session.getClient().putDirectory(file.getParent().getAbsolute()); } session.getClient().put(file.getAbsolute(), new byte[0]); } catch(MantaException e) { throw new MantaExceptionMappingService().map("Cannot create file {0}", e, file); } catch(MantaClientHttpResponseException e) { throw new MantaHttpExceptionMappingService().map("Cannot create file {0}", e, file); } catch(IOException e) { throw new DefaultIOExceptionMappingService().map("Cannot create file {0}", e, file); } return file; } MantaTouchFeature(final MantaSession session); @Override Path touch(final Path file, final TransferStatus status); @Override boolean isSupported(final Path workdir, final String filename); @Override Touch withWriter(final Write writer);  }