1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.jetspeed.util;
18
19 import java.io.File;
20 import java.io.FileFilter;
21 import java.io.IOException;
22
23 /***
24 * @author <a href="mailto:weaver@apache.org">Scott T. Weaver</a>
25 *
26 * TODO To change the template for this generated type comment go to
27 * Window - Preferences - Java - Code Generation - Code and Comments
28 */
29 public interface FileSystemHelper
30 {
31 /***
32 *
33 * <p>
34 * copyFrom
35 * </p>
36 *
37 * @param directory Directory to copy content from
38 * @throws {@link java.io.IlleaglArgumentException} if the <code>directory.isDirectory</code>
39 * returns <code>false</code>
40 */
41 void copyFrom(File directory) throws IOException;
42
43 /***
44 *
45 * <p>
46 * copyFrom
47 * </p>
48 *
49 * @param directory
50 * @param fileFilter
51 * @throws IOException
52 */
53 void copyFrom(File directory, FileFilter fileFilter) throws IOException;
54
55 /***
56 *
57 * <p>
58 * remove
59 * </p>
60 * Removes the underlying directory structure from the root directory down.
61 *
62 * @return <code>true</code> if the removal war successful, otherwise returns
63 * <code>false</code>.
64 */
65 boolean remove();
66
67 /***
68 *
69 * <p>
70 * getRootDirectory
71 * </p>
72 *
73 * @return the root of the directory structure
74 */
75 File getRootDirectory();
76
77 /***
78 *
79 * <p>
80 * close
81 * </p>
82 *
83 * Cleans up resources opened up specifically by this FileSystemHelper
84 *
85 */
86 void close() throws IOException;
87
88 /***
89 *
90 * <p>
91 * getSourcePath
92 * </p>
93 *
94 * Returns the true location of this FileSystemHelper backing object on
95 * the file system. This IS NOT always as the path of the object returned
96 * from the {@link getRootDirectory} method.
97 *
98 * @return the true location of this FileSystemHelper backing object.
99 */
100 String getSourcePath();
101
102 /***
103 * Given a path to a resource in this file system, return a checksum
104 * on that resource's content.
105 *
106 * @param pathToResource
107 * @return checksum of the content of the resource
108 */
109 long getChecksum(String pathToResource);
110 }