public final class ExcelDataContext extends QueryPostprocessDataContext implements UpdateableDataContext
DataContext
implementation to use for Excel spreadsheets.
This DataContext supports both the "old" .xls format and the "new" .xlsx
format, and saves the user the trouble of figuring out which one to use,
simply by detecting it at runtime and delegating to the appropriate
implementation.INFORMATION_SCHEMA_NAME
Constructor and Description |
---|
ExcelDataContext(File file)
Constructs an Excel DataContext based on a file, with default
configuration
|
ExcelDataContext(File file,
ExcelConfiguration configuration)
Constructs an Excel DataContext based on a resource and a custom
configuration.
|
ExcelDataContext(Resource resource,
ExcelConfiguration configuration) |
Modifier and Type | Method and Description |
---|---|
void |
executeUpdate(UpdateScript update)
Submits an
UpdateScript for execution on the DataContext . |
ExcelConfiguration |
getConfiguration()
Gets the Excel configuration used.
|
File |
getFile()
Deprecated.
|
protected Schema |
getMainSchema() |
protected String |
getMainSchemaName() |
Resource |
getResource()
Gets the Excel resource being read
|
protected Class<? extends org.apache.metamodel.excel.SpreadsheetReaderDelegate> |
getSpreadsheetReaderDelegateClass()
Convenient method for testing and inspecting internal state.
|
DataSet |
materializeMainSchemaTable(Table table,
Column[] columns,
int maxRows)
Executes a simple one-table query against a table in the main schema of
the subclasses of this class.
|
protected void |
notifyTablesModified() |
addConverter, executeCountQuery, executePrimaryKeyLookupQuery, executeQuery, getDefaultSchemaName, getMainSchemaInternal, getSchemaByNameInternal, getSchemaNamesInternal, isMainSchemaTable, materializeFromItem, materializeMainSchemaTable, materializeMainSchemaTable, materializeTable
compileQuery, executeQuery, executeQuery, getColumnByQualifiedLabel, getDefaultSchema, getSchemaByName, getSchemaNames, getSchemas, getTableByQualifiedLabel, isQualifiedPathDelim, parseQuery, query, refreshSchemas
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
compileQuery, executeQuery, executeQuery, executeQuery, getColumnByQualifiedLabel, getDefaultSchema, getSchemaByName, getSchemaNames, getSchemas, getTableByQualifiedLabel, parseQuery, query, refreshSchemas
public ExcelDataContext(File file)
file
- public ExcelDataContext(File file, ExcelConfiguration configuration)
file
- configuration
- public ExcelDataContext(Resource resource, ExcelConfiguration configuration)
public ExcelConfiguration getConfiguration()
@Deprecated public File getFile()
public Resource getResource()
protected String getMainSchemaName() throws MetaModelException
getMainSchemaName
in class QueryPostprocessDataContext
MetaModelException
public DataSet materializeMainSchemaTable(Table table, Column[] columns, int maxRows)
QueryPostprocessDataContext
materializeMainSchemaTable
in class QueryPostprocessDataContext
table
- the table to querycolumns
- the columns of the table to querymaxRows
- the maximum amount of rows needed or -1 if all rows are
wanted.protected Schema getMainSchema() throws MetaModelException
getMainSchema
in class QueryPostprocessDataContext
MetaModelException
protected Class<? extends org.apache.metamodel.excel.SpreadsheetReaderDelegate> getSpreadsheetReaderDelegateClass()
protected void notifyTablesModified()
public void executeUpdate(UpdateScript update)
UpdateableDataContext
UpdateScript
for execution on the DataContext
.
Since implementations of the DataContext
vary quite a lot, there
is no golden rule as to how an update script will be executed. But the
implementors should strive towards handling an UpdateScript
as a
single transactional change to the data store.executeUpdate
in interface UpdateableDataContext
update
- the update script to executeCopyright © 2007–2014 The Apache Software Foundation. All rights reserved.