Package org.apache.tika.parser.sqlite3
Class SQLite3DBParser
- java.lang.Object
-
- org.apache.tika.parser.jdbc.AbstractDBParser
-
- org.apache.tika.parser.sqlite3.SQLite3DBParser
-
- All Implemented Interfaces:
Serializable,Parser
public class SQLite3DBParser extends AbstractDBParser
This is the implementation of the db parser for SQLite. This parser is internal only; it should not be registered in the services file or configured in the TikaConfig xml file.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected static Map<Property,String>METADATA_KEYSprotected static StringSQLITE_CLASS_NAME
-
Constructor Summary
Constructors Constructor Description SQLite3DBParser()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Override this for any special handling of closing the connection.protected voidextractMetadata(Connection connection, Metadata metadata)This is called before parsing the tables to extract metadata from the db, if any.protected ConnectiongetConnection(InputStream stream, Metadata metadata, ParseContext context)Override this for special configuration of the connection, such as limiting the number of rows to be held in memory.protected StringgetConnectionString(InputStream is, Metadata metadata, ParseContext context)Implement for db specific connection information, e.g.protected StringgetJDBCClassName()JDBC class name, e.g. org.sqlite.JDBCSet<MediaType>getSupportedTypes(ParseContext context)Returns the set of media types supported by this parser when used with the given parse context.protected List<String>getTableNames(Connection connection, Metadata metadata, ParseContext context)Returns the names of the tables to processprotected JDBCTableReadergetTableReader(Connection connection, String tableName, EmbeddedDocumentUtil embeddedDocumentUtil)Given a connection and a table name, return the JDBCTableReader for this db.JDBCTableReadergetTableReader(Connection connection, String tableName, ParseContext context)Given a connection and a table name, return the JDBCTableReader for this db.-
Methods inherited from class org.apache.tika.parser.jdbc.AbstractDBParser
parse
-
-
-
-
Field Detail
-
SQLITE_CLASS_NAME
protected static final String SQLITE_CLASS_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
getSupportedTypes
public Set<MediaType> getSupportedTypes(ParseContext context)
Description copied from interface:ParserReturns the set of media types supported by this parser when used with the given parse context.- Specified by:
getSupportedTypesin interfaceParser- Overrides:
getSupportedTypesin classAbstractDBParser- Parameters:
context- context- Returns:
- null (always)
-
getConnection
protected Connection getConnection(InputStream stream, Metadata metadata, ParseContext context) throws IOException
Description copied from class:AbstractDBParserOverride this for special configuration of the connection, such as limiting the number of rows to be held in memory.- Overrides:
getConnectionin classAbstractDBParser- Parameters:
stream- stream to usemetadata- metadata that could be used in parameterizing the connectioncontext- parsecontext that could be used in parameterizing the connection- Returns:
- connection
- Throws:
IOException
-
getConnectionString
protected String getConnectionString(InputStream is, Metadata metadata, ParseContext context) throws IOException
Description copied from class:AbstractDBParserImplement for db specific connection information, e.g. "jdbc:sqlite:/docs/mydb.db" Include any optimization settings, user name, password, etc.- Specified by:
getConnectionStringin classAbstractDBParser- Parameters:
is- stream for processingmetadata- metadata might be useful in determining connection infocontext- context to use to help create connectionString- Returns:
- connection string to be used by
AbstractDBParser.getConnection(java.io.InputStream, org.apache.tika.metadata.Metadata, org.apache.tika.parser.ParseContext). - Throws:
IOException
-
close
public void close() throws SQLException, IOExceptionDescription copied from class:AbstractDBParserOverride this for any special handling of closing the connection.- Overrides:
closein classAbstractDBParser- Throws:
SQLExceptionIOException
-
getJDBCClassName
protected String getJDBCClassName()
Description copied from class:AbstractDBParserJDBC class name, e.g. org.sqlite.JDBC- Specified by:
getJDBCClassNamein classAbstractDBParser- Returns:
- jdbc class name
-
getTableNames
protected List<String> getTableNames(Connection connection, Metadata metadata, ParseContext context) throws SQLException
Description copied from class:AbstractDBParserReturns the names of the tables to process- Specified by:
getTableNamesin classAbstractDBParser- Parameters:
connection- Connection to use to make the sql call(s) to get the names of the tablesmetadata- Metadata to use (potentially) in decision about which tables to extractcontext- ParseContext to use (potentially) in decision about which tables to extract- Returns:
- Throws:
SQLException
-
getTableReader
public JDBCTableReader getTableReader(Connection connection, String tableName, ParseContext context)
Description copied from class:AbstractDBParserGiven a connection and a table name, return the JDBCTableReader for this db.- Specified by:
getTableReaderin classAbstractDBParser- Returns:
- a reader
-
getTableReader
protected JDBCTableReader getTableReader(Connection connection, String tableName, EmbeddedDocumentUtil embeddedDocumentUtil)
Description copied from class:AbstractDBParserGiven a connection and a table name, return the JDBCTableReader for this db.- Specified by:
getTableReaderin classAbstractDBParserembeddedDocumentUtil- embedded doc util- Returns:
-
extractMetadata
protected void extractMetadata(Connection connection, Metadata metadata)
Description copied from class:AbstractDBParserThis is called before parsing the tables to extract metadata from the db, if any. Override this for db specific metadata. This implementation is a no-op- Overrides:
extractMetadatain classAbstractDBParser
-
-