@Test public void testSupported() { final SDSNodeIdProvider nodeid = new SDSNodeIdProvider(session).withCache(cache); assertTrue(new SDSTouchFeature(session, nodeid).isSupported(new Path(new Path(new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory)), new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)), StringUtils.EMPTY)); assertTrue(new SDSTouchFeature(session, nodeid).isSupported(new Path(new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory)), StringUtils.EMPTY)); assertFalse(new SDSTouchFeature(session, nodeid).isSupported(new Path("/", EnumSet.of(Path.Type.directory)), StringUtils.EMPTY)); }
@Override public boolean isSupported(final Path workdir, final String filename) { if(workdir.isRoot()) { return false; } if(!this.validate(filename)) { log.warn(String.format("Validation failed for target name %s", filename)); return false; } return new SDSPermissionsFeature(session, nodeid).containsRole(workdir, SDSPermissionsFeature.CREATE_ROLE); }
SDSTouchFeature implements Touch<VersionId> { @Override public boolean isSupported(final Path workdir, final String filename) { if(workdir.isRoot()) { return false; } if(!this.validate(filename)) { log.warn(String.format("Validation failed for target name %s", filename)); return false; } return new SDSPermissionsFeature(session, nodeid).containsRole(workdir, SDSPermissionsFeature.CREATE_ROLE); } }
SDSTouchFeature implements Touch<VersionId> { @Override public boolean isSupported(final Path workdir, final String filename) { if(workdir.isRoot()) { return false; } if(!this.validate(filename)) { log.warn(String.format("Validation failed for target name %s", filename)); return false; } return new SDSPermissionsFeature(session, nodeid).containsRole(workdir, SDSPermissionsFeature.CREATE_ROLE); } SDSTouchFeature(final SDSSession session, final SDSNodeIdProvider nodeid); }
SDSTouchFeature implements Touch<VersionId> { @Override public boolean isSupported(final Path workdir, final String filename) { if(workdir.isRoot()) { return false; } if(!this.validate(filename)) { log.warn(String.format("Validation failed for target name %s", filename)); return false; } return new SDSPermissionsFeature(session, nodeid).containsRole(workdir, SDSPermissionsFeature.CREATE_ROLE); } 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 boolean isSupported(final Path workdir, final String filename) { if(workdir.isRoot()) { return false; } if(!this.validate(filename)) { log.warn(String.format("Validation failed for target name %s", filename)); return false; } return new SDSPermissionsFeature(session, nodeid).containsRole(workdir, SDSPermissionsFeature.CREATE_ROLE); } 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);  }