1 /*
2 * JaspertReports JSF Plugin Copyright (C) 2011 A. Alonso Dominguez
3 *
4 * This library is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or (at
7 * your option) any later version. This library is distributed in the hope
8 * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
9 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 *
11 * See the GNU Lesser General Public License for more details. You should have
12 * received a copy of the GNU Lesser General Public License along with this
13 * library; if not, write to the Free Software Foundation, Inc., 59 Temple
14 * Place, Suite 330, Boston, MA 02111-1307 USA A.
15 *
16 * Alonso Dominguez
17 * alonsoft@users.sf.net
18 */
19 package net.sf.jasperreports.jsf.resource;
20
21 import java.io.IOException;
22 import java.io.InputStream;
23 import java.net.URL;
24
25 /**
26 * Resource abstraction which can be used to load reports from any kind of
27 * source
28 *
29 * @author antonio.alonso
30 *
31 */
32 public interface Resource {
33
34 /**
35 * Name of the resource.
36 */
37 public String getName();
38
39 public String getSimpleName();
40
41 /**
42 * Obtains the URL location of this resource.
43 *
44 * @return The location of the resource
45 * @throws IOException
46 */
47 public URL getLocation() throws IOException;
48
49 /**
50 * Obtains an InputStream which can be used to read the resource data.
51 * <p>
52 * Users of this stream are responsible of closing it
53 *
54 * @return An InputStream to read the resource data
55 * @throws IOException
56 */
57 public InputStream getInputStream() throws IOException;
58
59 /**
60 * The path part of the resource.
61 *
62 * @return the absolute path to the resource.
63 */
64 public String getPath();
65 }