View Javadoc

1   /*
2    * Copyright 2011-2013 smartics, Kronseder & Reiner GmbH
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, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package de.smartics.util.lang.classpath;
17  
18  import java.util.List;
19  
20  /**
21   * Service to list the contents of a folder on the class path.
22   */
23  public interface ClassPathListing
24  {
25    // ********************************* Fields *********************************
26  
27    // --- constants ------------------------------------------------------------
28  
29    // ****************************** Initializer *******************************
30  
31    // ****************************** Inner Classes *****************************
32  
33    // ********************************* Methods ********************************
34  
35    // --- get&set --------------------------------------------------------------
36  
37    // --- business -------------------------------------------------------------
38  
39    /**
40     * Lists the contents of the resource path.
41     *
42     * @param context the context to load the resource from the class path.
43     * @param resourcePath the path to the resource whose contents is to be
44     *          listed. The empty string returns the contents of the class
45     *          loader's root directory (which is usually the parent class
46     *          loader's root).
47     * @return the contents of the resource as names. The list may be empty, but
48     *         is never <code>null</code>.
49     * @throws NullPointerException if {@code context} or {@code resourcePath} is
50     *           <code>null</code>.
51     * @throws IllegalArgumentException if resource path cannot be resolved to
52     *           determine the contents. Either the protocol is unknown or there
53     *           is a problem to access the resource's content physically.
54     */
55    List<String> list(ClassPathContext context, String resourcePath)
56      throws NullPointerException, IllegalArgumentException;
57  
58    // --- object basics --------------------------------------------------------
59  
60  }