View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    * 
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   * 
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
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 }