01: /*
02: * Copyright 2006 Google Inc.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License"); you may not
05: * use this file except in compliance with the License. You may obtain a copy of
06: * the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12: * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13: * License for the specific language governing permissions and limitations under
14: * the License.
15: */
16: package com.google.gwt.dev.util;
17:
18: import java.net.URL;
19:
20: /**
21: * An abstraction for finding and retrieving a set of URLs by logical name.
22: * Intuitively, it works like a jar in that each URL is uniquely located
23: * somewhere in an abstract namespace. The abstract names must be constructed
24: * from a series of zero or more valid Java identifiers followed the '/'
25: * character and finally ending in a valid filename, for example,
26: * "com/google/gwt/blah.txt". Each contained abstract path corresponds to a
27: * physical URL.
28: */
29: public abstract class FileOracle {
30:
31: /**
32: * Finds a URL by abstract path.
33: *
34: * @param abstractPath the abstract path of the URL to find.
35: * @return the physical URL of the contained URL, or <code>null</code> the
36: * abstract path does not refer to a contained URL.
37: */
38: public abstract URL find(String abstractPath);
39:
40: /**
41: * Gets the abstract path for every URL indexed by this FileOracle. Elements
42: * of the result set can be passed into {@link #find(String)} to retrieve the
43: * physical URL.
44: *
45: * @return the abstract path of every URL indexed by this FileOracle
46: */
47: public abstract String[] getAllFiles();
48:
49: /**
50: * Tests if this FileOracle has URLs.
51: *
52: * @return <tt>true</tt> if this list has no elements; <tt>false</tt>
53: * otherwise.
54: */
55: public abstract boolean isEmpty();
56:
57: }
|