edu.mit.jwi.data
Interface IDataProvider

All Superinterfaces:
IClosable, IHasLifecycle, IHasVersion
All Known Implementing Classes:
FileProvider

public interface IDataProvider
extends IHasVersion, IHasLifecycle

Objects that implement this interface manage access to data source objects. Before the provider can be used, a client must call setSource(URL) (or call the appropriate constructor) followed by IHasLifecycle.open(). Otherwise, the provider will throw an exception.

Since:
JWI 1.0
Version:
2.2.5
Author:
Mark A. Finlayson

Nested Class Summary
 
Nested classes/interfaces inherited from interface edu.mit.jwi.data.IHasLifecycle
IHasLifecycle.ObjectClosedException
 
Method Summary
 java.net.URL getSource()
          Returns the URL that points to the resource location; should never return null.
<T> IDataSource<T>
getSource(IContentType<T> type)
          Returns a data source object for the specified content type, if one is available; otherwise returns null.
 java.util.Set<? extends IContentType<?>> getTypes()
          Returns a set containing all the content types this provider looks for at the resource location.
 void setSource(java.net.URL url)
          This method is used to set the source URL from which the provider accesses the data from which it instantiates data sources.
 
Methods inherited from interface edu.mit.jwi.item.IHasVersion
getVersion
 
Methods inherited from interface edu.mit.jwi.data.IHasLifecycle
isOpen, open
 
Methods inherited from interface edu.mit.jwi.data.IClosable
close
 

Method Detail

setSource

void setSource(java.net.URL url)
This method is used to set the source URL from which the provider accesses the data from which it instantiates data sources. The data at the specified location may be in an implementation-specific format. If the provider is currently open, this method throws an IllegalStateException.

Parameters:
url - the location of the data, may not be null
Throws:
java.lang.IllegalStateException - if the provider is currently open
java.lang.NullPointerException - if the specified URL is null.
Since:
JWI 1.0

getSource

java.net.URL getSource()
Returns the URL that points to the resource location; should never return null.

Returns:
theURL that points to the resource location; must not be null
Since:
JWI 1.0

getTypes

java.util.Set<? extends IContentType<?>> getTypes()
Returns a set containing all the content types this provider looks for at the resource location. The returned collection may be unmodifiable, or may be a copy of an internal array; in any event modification of the returned collection should not affect the set of types used by the provider.

Returns:
a non-null, non-empty set of content types for this provider
Since:
JWI 2.2.0

getSource

<T> IDataSource<T> getSource(IContentType<T> type)
Returns a data source object for the specified content type, if one is available; otherwise returns null.

Type Parameters:
T - the content type of the data source
Parameters:
type - the content type of the data source to be retrieved
Returns:
the data source for the specified content type, or null if this provider has no such data source
Throws:
java.lang.NullPointerException - if the type is null
ObjectClosedException - if the provider is not open when this call is made
Since:
JWI 2.0.0


Copyright © 2007-2013 Massachusetts Institute of Technology. All Rights Reserved.