@Override public CommitStep build() throws IOException { Preconditions.checkNotNull(this.srcPath); Preconditions.checkNotNull(this.dstPath); return new FsRenameCommitStep(this); } }
@Override public boolean isCompleted() throws IOException { if (this.dstFs == null) { this.dstFs = getFileSystem(this.dstFsUri); } return this.dstFs.exists(this.dstPath); }
@Test public void testExecute() throws IOException { this.step.execute(); Assert.assertTrue(this.fs.exists(new Path(ROOT_DIR, "dir2/file"))); } }
@Override public void execute() throws IOException { if (this.srcFs == null) { this.srcFs = getFileSystem(this.srcFsUri); } if (this.dstFs == null) { this.dstFs = getFileSystem(this.dstFsUri); } log.info(String.format("Moving %s to %s", this.srcPath, this.dstPath)); HadoopUtils.movePath(this.srcFs, this.srcPath, this.dstFs, this.dstPath, this.overwrite, this.dstFs.getConf()); } }
@Override public CommitStep build() throws IOException { Preconditions.checkNotNull(this.srcPath); Preconditions.checkNotNull(this.dstPath); return new FsRenameCommitStep(this); } }
private FsRenameCommitStep(Builder<? extends Builder<?>> builder) throws IOException { super(builder); this.srcPath = builder.srcPath; this.dstPath = builder.dstPath; this.srcFs = builder.srcFs != null ? builder.srcFs : getFileSystem(this.props.getProp(ConfigurationKeys.FS_URI_KEY, ConfigurationKeys.LOCAL_FS_URI)); this.srcFsUri = this.srcFs.getUri().toString(); this.dstFs = builder.dstFs != null ? builder.dstFs : getFileSystem(this.props.getProp(ConfigurationKeys.FS_URI_KEY, ConfigurationKeys.LOCAL_FS_URI)); this.dstFsUri = this.dstFs.getUri().toString(); this.overwrite = builder.overwrite; }
@Override public boolean isCompleted() throws IOException { if (this.dstFs == null) { this.dstFs = getFileSystem(this.dstFsUri); } return this.dstFs.exists(this.dstPath); }
@Override public void execute() throws IOException { if (this.srcFs == null) { this.srcFs = getFileSystem(this.srcFsUri); } if (this.dstFs == null) { this.dstFs = getFileSystem(this.dstFsUri); } log.info(String.format("Moving %s to %s", this.srcPath, this.dstPath)); HadoopUtils.movePath(this.srcFs, this.srcPath, this.dstFs, this.dstPath, this.overwrite, this.dstFs.getConf()); } }
private FsRenameCommitStep(Builder<? extends Builder<?>> builder) throws IOException { super(builder); this.srcPath = builder.srcPath; this.dstPath = builder.dstPath; this.srcFs = builder.srcFs != null ? builder.srcFs : getFileSystem(this.props.getProp(ConfigurationKeys.FS_URI_KEY, ConfigurationKeys.LOCAL_FS_URI)); this.srcFsUri = this.srcFs.getUri().toString(); this.dstFs = builder.dstFs != null ? builder.dstFs : getFileSystem(this.props.getProp(ConfigurationKeys.FS_URI_KEY, ConfigurationKeys.LOCAL_FS_URI)); this.dstFsUri = this.dstFs.getUri().toString(); this.overwrite = builder.overwrite; }