org.apache.metamodel.excel
Class ExcelDataContext

java.lang.Object
  extended by org.apache.metamodel.AbstractDataContext
      extended by org.apache.metamodel.QueryPostprocessDataContext
          extended by org.apache.metamodel.excel.ExcelDataContext
All Implemented Interfaces:
HasReadTypeConverters, DataContext, UpdateableDataContext

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.


Field Summary
 
Fields inherited from class org.apache.metamodel.QueryPostprocessDataContext
INFORMATION_SCHEMA_NAME
 
Constructor Summary
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)
           
 
Method Summary
 void executeUpdate(UpdateScript update)
           
 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)
           
protected  void notifyTablesModified()
           
 
Methods inherited from class org.apache.metamodel.QueryPostprocessDataContext
addConverter, executeCountQuery, executePrimaryKeyLookupQuery, executeQuery, getDefaultSchemaName, getMainSchemaInternal, getSchemaByNameInternal, getSchemaNamesInternal, isMainSchemaTable, materializeFromItem, materializeMainSchemaTable, materializeMainSchemaTable, materializeTable
 
Methods inherited from class org.apache.metamodel.AbstractDataContext
compileQuery, executeQuery, executeQuery, getColumnByQualifiedLabel, getDefaultSchema, getSchemaByName, getSchemaNames, getSchemas, getTableByQualifiedLabel, isQualifiedPathDelim, parseQuery, query, refreshSchemas
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.metamodel.DataContext
compileQuery, executeQuery, executeQuery, executeQuery, getColumnByQualifiedLabel, getDefaultSchema, getSchemaByName, getSchemaNames, getSchemas, getTableByQualifiedLabel, parseQuery, query, refreshSchemas
 

Constructor Detail

ExcelDataContext

public ExcelDataContext(File file)
Constructs an Excel DataContext based on a file, with default configuration

Parameters:
file -

ExcelDataContext

public ExcelDataContext(File file,
                        ExcelConfiguration configuration)
Constructs an Excel DataContext based on a resource and a custom configuration.

Parameters:
file -
configuration -

ExcelDataContext

public ExcelDataContext(Resource resource,
                        ExcelConfiguration configuration)
Method Detail

getConfiguration

public ExcelConfiguration getConfiguration()
Gets the Excel configuration used.

Returns:
an excel configuration.

getFile

@Deprecated
public File getFile()
Deprecated. 

Gets the Excel file being read.

Returns:
a file.

getResource

public Resource getResource()
Gets the Excel resource being read

Returns:

getMainSchemaName

protected String getMainSchemaName()
                            throws MetaModelException
Specified by:
getMainSchemaName in class QueryPostprocessDataContext
Throws:
MetaModelException

materializeMainSchemaTable

public DataSet materializeMainSchemaTable(Table table,
                                          Column[] columns,
                                          int maxRows)
Specified by:
materializeMainSchemaTable in class QueryPostprocessDataContext

getMainSchema

protected Schema getMainSchema()
                        throws MetaModelException
Specified by:
getMainSchema in class QueryPostprocessDataContext
Throws:
MetaModelException

getSpreadsheetReaderDelegateClass

protected Class<? extends org.apache.metamodel.excel.SpreadsheetReaderDelegate> getSpreadsheetReaderDelegateClass()
Convenient method for testing and inspecting internal state.

Returns:
the class of the spreadsheet reader delegate.

notifyTablesModified

protected void notifyTablesModified()

executeUpdate

public void executeUpdate(UpdateScript update)
Specified by:
executeUpdate in interface UpdateableDataContext


Copyright © 2007-2014 The Apache Software Foundation. All Rights Reserved.