protected DataSet materializeMainSchemaTable(Table table, Column[] columns, int firstRow, int maxRows) {
// the connector represents a handle to the the couchdb "database".
final String databaseName = table.getName();
final CouchDbConnector connector = _couchDbInstance.createConnector(databaseName, false);
ViewQuery query = new ViewQuery().allDocs().includeDocs(true);
if (maxRows > 0) {
query = query.limit(maxRows);
}
if (firstRow > 1) {
final int skip = firstRow - 1;
query = query.skip(skip);
}
final StreamingViewResult streamingView = connector.queryForStreamingView(query);
final SelectItem[] selectItems = MetaModelHelper.createSelectItems(columns);