@Override public <T> Optional<T> findProperty(Class<T> propertyType) { if (propertyType.isInstance(this)) { return Optional.of(propertyType.cast(this)); } return core.findProperty(propertyType); } }
@Override public <T> Optional<T> findProperty(Class<T> propertyType) { if (propertyType.isInstance(this)) { return Optional.of(propertyType.cast(this)); } return entity.findProperty(propertyType); }
private List<DirectIoPath> getSources() { List<DirectIoPath> dpaths = paths.subList(0, paths.size() - 1).stream() .map(dataSourceParameter::resolve) .peek(it -> { if (it.isComponentRoot()) { throw new CommandConfigurationException(MessageFormat.format( "cannot copy data source root \"{0}\"", it)); } if (it.getSource().getEntity().findProperty(HadoopDataSourceCore.class).isPresent() == false) { throw new CommandConfigurationException(MessageFormat.format( "unsupported data source \"{0}\" (type: {1}): {2}", it.getSource().getId(), it.getSource().getEntity().getClass().getName(), it)); } }) .collect(Collectors.toList()); return dpaths; }
private List<DirectIoPath> getSources() { List<DirectIoPath> dpaths = paths.subList(0, paths.size() - 1).stream() .map(dataSourceParameter::resolve) .peek(it -> { if (it.isComponentRoot()) { throw new CommandConfigurationException(MessageFormat.format( "cannot copy data source root \"{0}\"", it)); } if (it.getSource().getEntity().findProperty(HadoopDataSourceCore.class).isPresent() == false) { throw new CommandConfigurationException(MessageFormat.format( "unsupported data source \"{0}\" (type: {1}): {2}", it.getSource().getId(), it.getSource().getEntity().getClass().getName(), it)); } }) .collect(Collectors.toList()); return dpaths; }
/** * Resolves the given path as Hadoop file system path. * @param path the Direct I/O path string * @return the corresponded Hadoop file system path */ public org.apache.hadoop.fs.Path resolveAsHadoopPath(String path) { DirectIoPath result = resolve(path); if (result.getSource().getEntity().findProperty(HadoopDataSourceCore.class).isPresent() == false) { throw new CommandConfigurationException(MessageFormat.format( "unsupported target path \"{0}\" (type: {1}): {2}", result.getSource().getId(), result.getSource().getEntity().getClass().getName(), result)); } if (result.getResourcePattern().isPresent()) { throw new CommandConfigurationException(MessageFormat.format( "target path must not contain any meta-characters: {0}", result)); } return asHadoopPath(result.getBarePath()); }