org.apache.sling.nosql.generic.adapter

## Interface NoSqlAdapter

All Known Implementing Classes:
  AbstractNoSqlAdapter, MetricsNoSqlAdapterWrapper

    public interface NoSqlAdapter

Adapter for NoSQL databases to be hooked into the Generic NoSQL resource provider. All implementors should should extend `AbstractNoSqlAdapter` to be compatible for future extensions.

### Method Summary

All Methods Instance Methods Abstract Methods
`void` `checkConnection()` Checks whether the connection to the NoSQL database is possible
`void` `createIndexDefinitions()` Creates index definitions for accessing the NoSQL database.
`boolean` `deleteRecursive(String path)` Remove data including all path-related children from NoSQL database.
`NoSqlData` `get(String path)` Get data for a single resource from NoSQL database.
`Iterator<NoSqlData>` `getChildren(String parentPath)` Get data for all children of a resource from NoSQL database.
`Iterator<NoSqlData>` `query(String query, String language)` Query for data.
`boolean` `store(NoSqlData data)` Store data with the given path in NoSQL database.
`boolean` `validPath(String path)` True if the given path is valid and supported by the NoSQL database.

### Method Detail

#### validPath

    boolean validPath(String path)

True if the given path is valid and supported by the NoSQL database.

Parameters:
  `path` - Path
Returns:
  true if valid, false if invalid

#### get

    NoSqlData get(String path)

Get data for a single resource from NoSQL database.

Parameters:
  `path` - Path
Returns:
  Data or null if non exists

#### getChildren

    Iterator<NoSqlData> getChildren(String parentPath)

Get data for all children of a resource from NoSQL database.

Parameters:
  `parentPath` - Parent path
Returns:
  List if child data or empty iterator

#### store

    boolean store(NoSqlData data)

Store data with the given path in NoSQL database. It is guaranteed that the map of the NoSqlData object does only contain primitive value types String, Integer, Long, Double, Boolean or arrays of them.

Parameters:
  `data` - Data with path
Returns:
  true if a new entry was created, false if an existing was overridden.

#### deleteRecursive

    boolean deleteRecursive(String path)

Remove data including all path-related children from NoSQL database.

Parameters:
  `path` - Path to remove
Returns:
  true if anything was removed

#### query

    Iterator<NoSqlData> query(String query,
                              String language)

Query for data.

Parameters:
  `query` - Query
  `language` - Query language
Returns:
  Query result or null if query not supported

#### checkConnection

    void checkConnection()
                  throws org.apache.sling.api.resource.LoginException

Checks whether the connection to the NoSQL database is possible

Throws:
  `org.apache.sling.api.resource.LoginException` - in case of any errors

#### createIndexDefinitions

    void createIndexDefinitions()

Creates index definitions for accessing the NoSQL database. This is called every time an adapter instances is created. If the indexes are already present it should do nothing. It is only called when the `checkConnection()` call succeeds.