@Test(expected = BackgroundException.class) public void testTouchFileRoot() throws Exception { try { final SDSNodeIdProvider nodeid = new SDSNodeIdProvider(session).withCache(cache); new SDSTouchFeature(session, nodeid).touch(new Path(new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)), new TransferStatus()); } catch(InteroperabilityException e) { assertEquals("Error -80001. Parent ID must be positive. Please contact your web hosting service provider for assistance.", e.getDetail()); throw e; } }
@Override public Path touch(final Path file, final TransferStatus status) throws BackgroundException { try { if(nodeid.isEncrypted(file)) { status.setFilekey(nodeid.getFileKey()); } final StatusOutputStream<VersionId> out = writer.write(file, status.complete(), new DisabledConnectionCallback()); out.close(); return new Path(file.getParent(), file.getName(), file.getType(), new PathAttributes(file.attributes()).withVersionId(out.getStatus().id)); } catch(IOException e) { throw new DefaultIOExceptionMappingService().map("Cannot create file {0}", e, file); } }
SDSTouchFeature implements Touch<VersionId> { @Override public Path touch(final Path file, final TransferStatus status) throws BackgroundException { try { if(nodeid.isEncrypted(file)) { status.setFilekey(nodeid.getFileKey()); } final StatusOutputStream<VersionId> out = writer.write(file, status.complete(), new DisabledConnectionCallback()); out.close(); return new Path(file.getParent(), file.getName(), file.getType(), new PathAttributes(file.attributes()).withVersionId(out.getStatus().id)); } catch(IOException e) { throw new DefaultIOExceptionMappingService().map("Cannot create file {0}", e, file); } } }
SDSTouchFeature implements Touch<VersionId> { @Override public Path touch(final Path file, final TransferStatus status) throws BackgroundException { try { if(nodeid.isEncrypted(file)) { status.setFilekey(nodeid.getFileKey()); } final StatusOutputStream<VersionId> out = writer.write(file, status.complete(), new DisabledConnectionCallback()); out.close(); return new Path(file.getParent(), file.getName(), file.getType(), new PathAttributes(file.attributes()).withVersionId(out.getStatus().id)); } catch(IOException e) { throw new DefaultIOExceptionMappingService().map("Cannot create file {0}", e, file); } } SDSTouchFeature(final SDSSession session, final SDSNodeIdProvider nodeid); }
SDSTouchFeature implements Touch<VersionId> { @Override public Path touch(final Path file, final TransferStatus status) throws BackgroundException { try { if(nodeid.isEncrypted(file)) { status.setFilekey(nodeid.getFileKey()); } final StatusOutputStream<VersionId> out = writer.write(file, status.complete(), new DisabledConnectionCallback()); out.close(); return new Path(file.getParent(), file.getName(), file.getType(), new PathAttributes(file.attributes()).withVersionId(out.getStatus().id)); } catch(IOException e) { throw new DefaultIOExceptionMappingService().map("Cannot create file {0}", e, file); } } SDSTouchFeature(final SDSSession session, final SDSNodeIdProvider nodeid); @Override Path touch(final Path file, final TransferStatus status); @Override boolean isSupported(final Path workdir, final String filename); boolean validate(final String filename); @Override Touch<VersionId> withWriter(final Write<VersionId> writer); }
SDSTouchFeature implements Touch<VersionId> { @Override public Path touch(final Path file, final TransferStatus status) throws BackgroundException { try { if(nodeid.isEncrypted(file)) { status.setFilekey(nodeid.getFileKey()); } final StatusOutputStream<VersionId> out = writer.write(file, status.complete(), new DisabledConnectionCallback()); out.close(); return new Path(file.getParent(), file.getName(), file.getType(), new PathAttributes(file.attributes()).withVersionId(out.getStatus().id)); } catch(IOException e) { throw new DefaultIOExceptionMappingService().map("Cannot create file {0}", e, file); } } SDSTouchFeature(final SDSSession session, final SDSNodeIdProvider nodeid); @Override Path touch(final Path file, final TransferStatus status); @Override boolean isSupported(final Path workdir, final String filename); boolean validate(final String filename); @Override Touch<VersionId> withWriter(final Write<VersionId> writer);  }