5582 |
15 Mar 11 |
nicklas |
1 |
/** |
5582 |
15 Mar 11 |
nicklas |
$Id$ |
5582 |
15 Mar 11 |
nicklas |
3 |
|
5582 |
15 Mar 11 |
nicklas |
Copyright (C) 2011 Nicklas Nordborg |
5582 |
15 Mar 11 |
nicklas |
5 |
|
5582 |
15 Mar 11 |
nicklas |
This file is part of BASE - BioArray Software Environment. |
5582 |
15 Mar 11 |
nicklas |
Available at http://base.thep.lu.se/ |
5582 |
15 Mar 11 |
nicklas |
8 |
|
5582 |
15 Mar 11 |
nicklas |
BASE is free software; you can redistribute it and/or |
5582 |
15 Mar 11 |
nicklas |
modify it under the terms of the GNU General Public License |
5582 |
15 Mar 11 |
nicklas |
as published by the Free Software Foundation; either version 3 |
5582 |
15 Mar 11 |
nicklas |
of the License, or (at your option) any later version. |
5582 |
15 Mar 11 |
nicklas |
13 |
|
5582 |
15 Mar 11 |
nicklas |
BASE is distributed in the hope that it will be useful, |
5582 |
15 Mar 11 |
nicklas |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
5582 |
15 Mar 11 |
nicklas |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
5582 |
15 Mar 11 |
nicklas |
GNU General Public License for more details. |
5582 |
15 Mar 11 |
nicklas |
18 |
|
5582 |
15 Mar 11 |
nicklas |
You should have received a copy of the GNU General Public License |
5582 |
15 Mar 11 |
nicklas |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
5582 |
15 Mar 11 |
nicklas |
21 |
*/ |
5582 |
15 Mar 11 |
nicklas |
22 |
package net.sf.basedb.util.uri; |
5582 |
15 Mar 11 |
nicklas |
23 |
|
5582 |
15 Mar 11 |
nicklas |
24 |
import java.io.IOException; |
5582 |
15 Mar 11 |
nicklas |
25 |
import java.io.InputStream; |
5582 |
15 Mar 11 |
nicklas |
26 |
import java.net.URI; |
5582 |
15 Mar 11 |
nicklas |
27 |
|
5582 |
15 Mar 11 |
nicklas |
28 |
/** |
5582 |
15 Mar 11 |
nicklas |
A connection manager is used to access the contents and metadata about |
5582 |
15 Mar 11 |
nicklas |
the resource pointed to by a given URI. Connection managers are usually |
5582 |
15 Mar 11 |
nicklas |
created by {@link ConnectionManagerFactory} objects. Implementations |
5582 |
15 Mar 11 |
nicklas |
doesn't have to be thread-safe since a new connection manager is created |
5582 |
15 Mar 11 |
nicklas |
for each use of an URI. Implementations doens't have to provide a public |
5582 |
15 Mar 11 |
nicklas |
no-argument constructor. |
6497 |
26 Jun 14 |
nicklas |
<p> |
6497 |
26 Jun 14 |
nicklas |
NOTE! Also consider implementing the {@link ResumableConnectionManager} |
6497 |
26 Jun 14 |
nicklas |
interface if the protocol supports setting a start offset for the |
6497 |
26 Jun 14 |
nicklas |
download. |
5582 |
15 Mar 11 |
nicklas |
39 |
|
5582 |
15 Mar 11 |
nicklas |
@author Nicklas |
5582 |
15 Mar 11 |
nicklas |
@since 3.0 |
5582 |
15 Mar 11 |
nicklas |
@base.modified $Date$ |
5582 |
15 Mar 11 |
nicklas |
43 |
*/ |
5582 |
15 Mar 11 |
nicklas |
44 |
public interface ConnectionManager |
5582 |
15 Mar 11 |
nicklas |
45 |
{ |
5582 |
15 Mar 11 |
nicklas |
46 |
|
5582 |
15 Mar 11 |
nicklas |
47 |
/** |
5582 |
15 Mar 11 |
nicklas |
Get the URI of the resource we are interested in. |
5582 |
15 Mar 11 |
nicklas |
@return An URI |
5582 |
15 Mar 11 |
nicklas |
50 |
*/ |
5582 |
15 Mar 11 |
nicklas |
51 |
public URI getURI(); |
5582 |
15 Mar 11 |
nicklas |
52 |
|
5582 |
15 Mar 11 |
nicklas |
53 |
/** |
5582 |
15 Mar 11 |
nicklas |
Get an InputStream for reading the contents of the resource. |
5582 |
15 Mar 11 |
nicklas |
@return An InputStream object, or null if the no data is available |
5582 |
15 Mar 11 |
nicklas |
@throws IOException If there is an error creating the stream |
5582 |
15 Mar 11 |
nicklas |
57 |
*/ |
5582 |
15 Mar 11 |
nicklas |
58 |
public InputStream getInputStream() |
5582 |
15 Mar 11 |
nicklas |
59 |
throws IOException; |
5582 |
15 Mar 11 |
nicklas |
60 |
|
5582 |
15 Mar 11 |
nicklas |
61 |
/** |
5582 |
15 Mar 11 |
nicklas |
Get metadata about the resource. If no metadata can be obtained |
5582 |
15 Mar 11 |
nicklas |
the handler should still create an empty UriMetadata object. |
5582 |
15 Mar 11 |
nicklas |
@return A metadata object |
5582 |
15 Mar 11 |
nicklas |
@throws IOException If there is an error getting the metadata |
5582 |
15 Mar 11 |
nicklas |
66 |
*/ |
5582 |
15 Mar 11 |
nicklas |
67 |
public UriMetadata getMetadata() |
5582 |
15 Mar 11 |
nicklas |
68 |
throws IOException; |
5582 |
15 Mar 11 |
nicklas |
69 |
|
5582 |
15 Mar 11 |
nicklas |
70 |
} |
5582 |
15 Mar 11 |
nicklas |
71 |
|