001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: package org.apache.jetspeed.util;
018:
019: import java.io.File;
020: import java.io.FileFilter;
021: import java.io.IOException;
022:
023: /**
024: * @author <a href="mailto:weaver@apache.org">Scott T. Weaver</a>
025: *
026: * TODO To change the template for this generated type comment go to
027: * Window - Preferences - Java - Code Generation - Code and Comments
028: */
029: public interface FileSystemHelper {
030: /**
031: *
032: * <p>
033: * copyFrom
034: * </p>
035: *
036: * @param directory Directory to copy content from
037: * @throws {@link java.io.IlleaglArgumentException} if the <code>directory.isDirectory</code>
038: * returns <code>false</code>
039: */
040: void copyFrom(File directory) throws IOException;
041:
042: /**
043: *
044: * <p>
045: * copyFrom
046: * </p>
047: *
048: * @param directory
049: * @param fileFilter
050: * @throws IOException
051: */
052: void copyFrom(File directory, FileFilter fileFilter)
053: throws IOException;
054:
055: /**
056: *
057: * <p>
058: * remove
059: * </p>
060: * Removes the underlying directory structure from the root directory down.
061: *
062: * @return <code>true</code> if the removal war successful, otherwise returns
063: * <code>false</code>.
064: */
065: boolean remove();
066:
067: /**
068: *
069: * <p>
070: * getRootDirectory
071: * </p>
072: *
073: * @return the root of the directory structure
074: */
075: File getRootDirectory();
076:
077: /**
078: *
079: * <p>
080: * close
081: * </p>
082: *
083: * Cleans up resources opened up specifically by this FileSystemHelper
084: *
085: */
086: void close() throws IOException;
087:
088: /**
089: *
090: * <p>
091: * getSourcePath
092: * </p>
093: *
094: * Returns the true location of this FileSystemHelper backing object on
095: * the file system. This IS NOT always as the path of the object returned
096: * from the {@link getRootDirectory} method.
097: *
098: * @return the true location of this FileSystemHelper backing object.
099: */
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: }
|