| 1 | = DataAccessors = |
| 2 | |
| 3 | == Java Interface == |
| 4 | |
| 5 | {{{ |
| 6 | /** |
| 7 | * A DataAccessor provides access to physical resources by creating DataObjects |
| 8 | * representing the resource, based on a url and optionally data about a previous access |
| 9 | * and other parameters. |
| 10 | */ |
| 11 | public interface DataAccessor { |
| 12 | |
| 13 | /** |
| 14 | * Get a DataObject for the specified url. The resulting DataObject's ID may differ |
| 15 | * from the specified url due to normalization schemes, following of redirected URLs, etc. |
| 16 | * |
| 17 | * An AccessData instance can optionally be specified with which the DataAccessor can store |
| 18 | * and retrieve information about previous accesses to resources. This is mostly useful |
| 19 | * for DataCrawlers who want to be able to incrementally scan a DataSource. |
| 20 | * When an AccessData instance is specified, the resulting DataObject can be null, |
| 21 | * indicating that the binary resource has not been modified since the last access. |
| 22 | * |
| 23 | * A DataAccessor is always required to store something in the AccessData when a |
| 24 | * url is accessed, so that afterwards AccessData.isKnownId will return true. |
| 25 | * |
| 26 | * Specific DataAccessor implementations may accept additional parameters through the params Map. |
| 27 | * |
| 28 | * @param url The url used to address the resource. |
| 29 | * @param dataSource The source that will be registered as the source of the DataObject. |
| 30 | * @param accessData Optional database containing information about previous accesses. |
| 31 | * @param params Optional additional parameters needed to access the physical resource. |
| 32 | * @return A DataObject for the specified URI, or null when an AccessData instance has been |
| 33 | * specified and the binary resource has not been modified since the last access. |
| 34 | * @throws UrlNotFoundException when the binary resource could not be found |
| 35 | * @throws IOException When any other kind of I/O error occurs. |
| 36 | */ |
| 37 | public DataObject get(String url, DataSource source, |
| 38 | AccessData accessData, Map<?,?> params) throws UrlNotFoundException, IOException; |
| 39 | } |
| 40 | }}} |