|
@@ -36,6 +36,17 @@ public abstract class TrashPolicy extends Configured {
|
|
protected Path trash; // path to trash directory
|
|
protected Path trash; // path to trash directory
|
|
protected long deletionInterval; // deletion interval for Emptier
|
|
protected long deletionInterval; // deletion interval for Emptier
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Used to setup the trash policy. Must be implemented by all TrashPolicy
|
|
|
|
+ * implementations.
|
|
|
|
+ * @param conf the configuration to be used
|
|
|
|
+ * @param fs the filesystem to be used
|
|
|
|
+ * @param home the home directory
|
|
|
|
+ * @deprecated Use {@link #initialize(Configuration, FileSystem)} instead.
|
|
|
|
+ */
|
|
|
|
+ @Deprecated
|
|
|
|
+ public abstract void initialize(Configuration conf, FileSystem fs, Path home);
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* Used to setup the trash policy. Must be implemented by all TrashPolicy
|
|
* Used to setup the trash policy. Must be implemented by all TrashPolicy
|
|
* implementations. Different from initialize(conf, fs, home), this one does
|
|
* implementations. Different from initialize(conf, fs, home), this one does
|
|
@@ -99,6 +110,25 @@ public abstract class TrashPolicy extends Configured {
|
|
*/
|
|
*/
|
|
public abstract Runnable getEmptier() throws IOException;
|
|
public abstract Runnable getEmptier() throws IOException;
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Get an instance of the configured TrashPolicy based on the value
|
|
|
|
+ * of the configuration parameter fs.trash.classname.
|
|
|
|
+ *
|
|
|
|
+ * @param conf the configuration to be used
|
|
|
|
+ * @param fs the file system to be used
|
|
|
|
+ * @param home the home directory
|
|
|
|
+ * @return an instance of TrashPolicy
|
|
|
|
+ * @deprecated Use {@link #getInstance(Configuration, FileSystem)} instead.
|
|
|
|
+ */
|
|
|
|
+ @Deprecated
|
|
|
|
+ public static TrashPolicy getInstance(Configuration conf, FileSystem fs, Path home) {
|
|
|
|
+ Class<? extends TrashPolicy> trashClass = conf.getClass(
|
|
|
|
+ "fs.trash.classname", TrashPolicyDefault.class, TrashPolicy.class);
|
|
|
|
+ TrashPolicy trash = ReflectionUtils.newInstance(trashClass, conf);
|
|
|
|
+ trash.initialize(conf, fs, home); // initialize TrashPolicy
|
|
|
|
+ return trash;
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* Get an instance of the configured TrashPolicy based on the value
|
|
* Get an instance of the configured TrashPolicy based on the value
|
|
* of the configuration parameter fs.trash.classname.
|
|
* of the configuration parameter fs.trash.classname.
|