MockDataSource (Solr 3.6.2 API)
Keywords: org.apache.solr.handler.dataimport.MockDataSource class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.solr.handler.dataimport
Class MockDataSource

    java.lang.Object
      org.apache.solr.handler.dataimport.DataSource<Iterator<Map<String,Object>>>
          org.apache.solr.handler.dataimport.MockDataSource

    public class MockDataSource

extends DataSource<Iterator<Map<String,Object>>>

A mock DataSource implementation which can be used for testing.

This API is experimental and may change in the future.

Since:
  solr 1.3
Version:
  $Id: MockDataSource.java 1303949 2012-03-22 18:15:33Z jdyer $

Constructor Summary
`MockDataSource()`

Method Summary
`static void` | `clearCache()`
`void` | `close()` Cleans up resources of this DataSource after use.
`Iterator<Map<String,Object>>` | `getData(String query)` Get records for the given query.The return type depends on the implementation .
`void` | `init(Context context, Properties initProps)` Initializes the DataSource with the `Context` and initialization properties.
`static void` | `setCollection(String query, Iterable<Map<String,Object>> collection)`
`static void` | `setIterator(String query, Iterator<Map<String,Object>> iter)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### MockDataSource

    public MockDataSource()

Method Detail

### setIterator

    public static void setIterator(String query,
                                   Iterator<Map<String,Object>> iter)

### setCollection

    public static void setCollection(String query,
                                     Iterable<Map<String,Object>> collection)

### clearCache

    public static void clearCache()

### init

    public void init(Context context,
                     Properties initProps)

  Description copied from class: `DataSource`
  Initializes the DataSource with the `Context` and initialization properties.

  This is invoked by the `DataImporter` after creating an instance of this class.

  Specified by:
    `init` in class `DataSource<Iterator<Map<String,Object>>>`

### getData

    public Iterator<Map<String,Object>> getData(String query)

  Description copied from class: `DataSource`
  Get records for the given query.The return type depends on the implementation .

  Specified by:
    `getData` in class `DataSource<Iterator<Map<String,Object>>>`
  Parameters:
    `query` - The query string. It can be a SQL for JdbcDataSource or a URL for HttpDataSource or a file location for FileDataSource or a custom format for your own custom DataSource.
  Returns:
    Depends on the implementation. For instance JdbcDataSource returns an Iterator >

### close

    public void close()

  Description copied from class: `DataSource`
  Cleans up resources of this DataSource after use.

  Specified by:
    `close` in class `DataSource<Iterator<Map<String,Object>>>`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD