src/core/net/sf/basedb/util/uri/ConnectionManager.java

Code
Comments
Other
Rev Date Author Line
5582 15 Mar 11 nicklas 1 /**
5582 15 Mar 11 nicklas 2   $Id$
5582 15 Mar 11 nicklas 3
5582 15 Mar 11 nicklas 4   Copyright (C) 2011 Nicklas Nordborg
5582 15 Mar 11 nicklas 5
5582 15 Mar 11 nicklas 6   This file is part of BASE - BioArray Software Environment.
5582 15 Mar 11 nicklas 7   Available at http://base.thep.lu.se/
5582 15 Mar 11 nicklas 8
5582 15 Mar 11 nicklas 9   BASE is free software; you can redistribute it and/or
5582 15 Mar 11 nicklas 10   modify it under the terms of the GNU General Public License
5582 15 Mar 11 nicklas 11   as published by the Free Software Foundation; either version 3
5582 15 Mar 11 nicklas 12   of the License, or (at your option) any later version.
5582 15 Mar 11 nicklas 13
5582 15 Mar 11 nicklas 14   BASE is distributed in the hope that it will be useful,
5582 15 Mar 11 nicklas 15   but WITHOUT ANY WARRANTY; without even the implied warranty of
5582 15 Mar 11 nicklas 16   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
5582 15 Mar 11 nicklas 17   GNU General Public License for more details.
5582 15 Mar 11 nicklas 18
5582 15 Mar 11 nicklas 19   You should have received a copy of the GNU General Public License
5582 15 Mar 11 nicklas 20   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 29   A connection manager is used to access the contents and metadata about
5582 15 Mar 11 nicklas 30   the resource pointed to by a given URI. Connection managers are usually
5582 15 Mar 11 nicklas 31   created by {@link ConnectionManagerFactory} objects. Implementations
5582 15 Mar 11 nicklas 32   doesn't have to be thread-safe since a new connection manager is created
5582 15 Mar 11 nicklas 33   for each use of an URI. Implementations doens't have to provide a public
5582 15 Mar 11 nicklas 34   no-argument constructor.
6497 26 Jun 14 nicklas 35   <p>
6497 26 Jun 14 nicklas 36   NOTE! Also consider implementing the {@link ResumableConnectionManager}
6497 26 Jun 14 nicklas 37   interface if the protocol supports setting a start offset for the
6497 26 Jun 14 nicklas 38   download.
5582 15 Mar 11 nicklas 39
5582 15 Mar 11 nicklas 40   @author Nicklas
5582 15 Mar 11 nicklas 41   @since 3.0
5582 15 Mar 11 nicklas 42   @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 48     Get the URI of the resource we are interested in.
5582 15 Mar 11 nicklas 49     @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 54     Get an InputStream for reading the contents of the resource.
5582 15 Mar 11 nicklas 55     @return An InputStream object, or null if the no data is available
5582 15 Mar 11 nicklas 56     @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 62      Get metadata about the resource. If no metadata can be obtained
5582 15 Mar 11 nicklas 63      the handler should still create an empty UriMetadata object.
5582 15 Mar 11 nicklas 64     @return A metadata object
5582 15 Mar 11 nicklas 65     @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