KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > net > protocol > URLLister


1 /*
2   * JBoss, Home of Professional Open Source
3   * Copyright 2005, JBoss Inc., and individual contributors as indicated
4   * by the @authors tag. See the copyright.txt in the distribution for a
5   * full listing of individual contributors.
6   *
7   * This is free software; you can redistribute it and/or modify it
8   * under the terms of the GNU Lesser General Public License as
9   * published by the Free Software Foundation; either version 2.1 of
10   * the License, or (at your option) any later version.
11   *
12   * This software is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15   * Lesser General Public License for more details.
16   *
17   * You should have received a copy of the GNU Lesser General Public
18   * License along with this software; if not, write to the Free
19   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21   */

22 package org.jboss.net.protocol;
23
24 import java.io.IOException JavaDoc;
25 import java.net.URL JavaDoc;
26 import java.util.Collection JavaDoc;
27
28 /**
29  * Interface defining methods that can be used to list the contents of a URL
30  * collection irrespective of the protocol.
31  */

32 public interface URLLister {
33    /**
34     * List the members of the given collection URL that match the patterns
35     * supplied and, if it contains directory that contains NO dot in the name and
36     * scanNonDottedSubDirs is true, recursively finds URL in these directories.
37     * @param baseUrl the URL to list; must end in "/"
38     * @param patterns the patterns to match (separated by ',')
39     * @param scanNonDottedSubDirs enables recursive search for directories containing no dots
40     * @return a Collection of URLs that match
41     * @throws IOException if there was a problem getting the list
42     */

43    Collection JavaDoc listMembers(URL JavaDoc baseUrl, String JavaDoc patterns, boolean scanNonDottedSubDirs) throws IOException JavaDoc;
44    
45    /**
46     * List the members of the given collection URL that match the patterns
47     * supplied. Doesn't recursively list files contained in directories.
48     * @param baseUrl the URL to list; must end in "/"
49     * @param patterns the patterns to match (separated by ',')
50     * @return a Collection of URLs that match
51     * @throws IOException if there was a problem getting the list
52     */

53    Collection JavaDoc listMembers(URL JavaDoc baseUrl, String JavaDoc patterns) throws IOException JavaDoc;
54
55    /**
56     * List the members of the given collection that are accepted by the filter
57     * @param baseUrl the URL to list; must end in "/"
58     * @param filter a filter that is called to determine if a member should
59     * be returned
60     * @param scanNonDottedSubDirs enables recursive search for directories containing no dots
61     * @return a Collection of URLs that match
62     * @throws IOException if there was a problem getting the list
63     */

64    Collection JavaDoc listMembers(URL JavaDoc baseUrl, URLFilter filter, boolean scanNonDottedSubDirs) throws IOException JavaDoc;
65
66    /**
67     * List the members of the given collection that are accepted by the filter
68     * @param baseUrl the URL to list; must end in "/"
69     * @param filter a filter that is called to determine if a member should
70     * be returned
71     * @return a Collection of URLs that match
72     * @throws IOException if there was a problem getting the list
73     */

74    Collection JavaDoc listMembers(URL JavaDoc baseUrl, URLFilter filter) throws IOException JavaDoc;
75
76    /**
77     * Interface defining a filter for listed members.
78     */

79    public interface URLFilter {
80       /**
81        * Determine whether the supplied memberName should be accepted
82        * @param baseURL the URL of the collection
83        * @param memberName the member of the collection
84        * @return
85        */

86       boolean accept(URL JavaDoc baseURL, String JavaDoc memberName);
87    }
88 }
89
Popular Tags