1 /*
2 * Copyright 2004-2008 the Seasar Foundation and the Others.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13 * either express or implied. See the License for the specific language
14 * governing permissions and limitations under the License.
15 */
16 package org.seasar.uruma.util.resource;
17
18 import java.net.URL;
19
20 /**
21 * リソースツリーをトラバースするクラスのためのインターフェースです。<br />
22 *
23 * @author y-komori
24 */
25 public interface ResourceTraverser {
26 /**
27 * リソースツリーをたどり、各リソースに対して {@link ResourceHandler} を呼び出します。<br />
28 * <code>root</code> で指定された URL を起点として、リソースツリーを再帰的にたどります。<br />
29 * 発見した各リソースに対して、
30 * {@link ResourceHandler#handle(String, String, java.io.InputStream)}
31 * メソッドを呼び出します。<br />
32 *
33 * @param root
34 * クラスパス上のルート URL (<code>null</code> でもよい)
35 * @param origin
36 * リソースをたどる際の起点 URL
37 * @param handler
38 * {@link ResourceHandler} オブジェクト
39 */
40 public void traverse(URL root, URL origin, ResourceHandler handler);
41
42 /**
43 * リソースツリーをたどり、条件に一致するリソースに対して {@link ResourceHandler} を呼び出します。<br />
44 * <code>root</code> で指定された URL を起点として、リソースツリーを再帰的にたどります。<br />
45 * 発見した各リソースに対して、<code>filter</code> を適用し、マッチしたリソースに対して
46 * {@link ResourceHandler#handle(String, String, java.io.InputStream)}
47 * メソッドを呼び出します。<br />
48 *
49 * @param root
50 * クラスパス上のルート URL (<code>null</code> でもよい)
51 * @param origin
52 * リソースをたどる際の起点 URL
53 * @param handler
54 * {@link ResourceHandler} オブジェクト
55 * @param filter
56 * 条件を指定するフィルタ
57 * @see ResourceFilter
58 */
59 public void traverse(URL root, URL origin, ResourceHandler handler,
60 ResourceFilter filter);
61
62 /**
63 * 対応するプロトコルを返します。<br />
64 *
65 * @return 対応するプロトコル
66 */
67 public String getProtocol();
68 }