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_KEYS
protected static String
SQLITE_CLASS_NAME
-
Constructor Summary
Constructors Constructor Description SQLite3DBParser()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Override this for any special handling of closing the connection.protected void
extractMetadata(Connection connection, Metadata metadata)
This is called before parsing the tables to extract metadata from the db, if any.protected Connection
getConnection(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 String
getConnectionString(InputStream is, Metadata metadata, ParseContext context)
Implement for db specific connection information, e.g.protected String
getJDBCClassName()
JDBC class name, e.g.Set<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 JDBCTableReader
getTableReader(Connection connection, String tableName, EmbeddedDocumentUtil embeddedDocumentUtil)
Given a connection and a table name, return the JDBCTableReader for this db.JDBCTableReader
getTableReader(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:Parser
Returns the set of media types supported by this parser when used with the given parse context.- Specified by:
getSupportedTypes
in interfaceParser
- Overrides:
getSupportedTypes
in classAbstractDBParser
- Parameters:
context
- context- Returns:
- null (always)
-
getConnection
protected Connection getConnection(InputStream stream, Metadata metadata, ParseContext context) throws IOException
Description copied from class:AbstractDBParser
Override this for special configuration of the connection, such as limiting the number of rows to be held in memory.- Overrides:
getConnection
in 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:AbstractDBParser
Implement for db specific connection information, e.g. "jdbc:sqlite:/docs/mydb.db" Include any optimization settings, user name, password, etc.- Specified by:
getConnectionString
in 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, IOException
Description copied from class:AbstractDBParser
Override this for any special handling of closing the connection.- Overrides:
close
in classAbstractDBParser
- Throws:
SQLException
IOException
-
getJDBCClassName
protected String getJDBCClassName()
Description copied from class:AbstractDBParser
JDBC class name, e.g. org.sqlite.JDBC- Specified by:
getJDBCClassName
in classAbstractDBParser
- Returns:
- jdbc class name
-
getTableNames
protected List<String> getTableNames(Connection connection, Metadata metadata, ParseContext context) throws SQLException
Description copied from class:AbstractDBParser
Returns the names of the tables to process- Specified by:
getTableNames
in 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:AbstractDBParser
Given a connection and a table name, return the JDBCTableReader for this db.- Specified by:
getTableReader
in classAbstractDBParser
- Returns:
- a reader
-
getTableReader
protected JDBCTableReader getTableReader(Connection connection, String tableName, EmbeddedDocumentUtil embeddedDocumentUtil)
Description copied from class:AbstractDBParser
Given a connection and a table name, return the JDBCTableReader for this db.- Specified by:
getTableReader
in classAbstractDBParser
embeddedDocumentUtil
- embedded doc util- Returns:
-
extractMetadata
protected void extractMetadata(Connection connection, Metadata metadata)
Description copied from class:AbstractDBParser
This 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:
extractMetadata
in classAbstractDBParser
-
-