This project has retired. For details please refer to its Attic page.
JDBCDriver (Lens 2.0.1-beta-incubating API)

org.apache.lens.driver.jdbc
Class JDBCDriver

java.lang.Object
  extended by org.apache.lens.driver.jdbc.JDBCDriver
All Implemented Interfaces:
Externalizable, Serializable, LensDriver

public class JDBCDriver
extends Object
implements LensDriver

This driver is responsible for running queries against databases which can be queried using the JDBC API.

See Also:
Serialized Form

Nested Class Summary
static class JDBCDriver.DummyQueryRewriter
          The Class DummyQueryRewriter.
 
Field Summary
static org.apache.log4j.Logger LOG
          The Constant LOG.
static AtomicInteger THID
          The Constant THID.
 
Constructor Summary
JDBCDriver()
           
 
Method Summary
 boolean cancelQuery(QueryHandle handle)
          Cancel the execution of the query, specified by the handle.
 void close()
          Close the driver, releasing all resouces used up by the driver.
 void closePreparedQuery(QueryPrepareHandle handle)
          Close the prepare query specified by the prepared handle, releases all the resources held by the prepared query.
 void closeQuery(QueryHandle handle)
          Close the query specified by the handle, releases all the resources held by the query.
 void closeResultSet(QueryHandle handle)
          Close the resultset for the query.
 void configure(org.apache.hadoop.conf.Configuration conf)
          Configure driver with Configuration passed
 LensResultSet execute(QueryContext context)
          Blocking execute of the query.
 void executeAsync(QueryContext context)
          Asynchronously execute the query.
 DriverQueryPlan explain(AbstractQueryContext explainCtx)
          Explain the given query.
 DriverQueryPlan explainAndPrepare(PreparedQueryContext pContext)
          Explain and prepare the given query.
 LensResultSet fetchResultSet(QueryContext context)
          Fetch the results of the query, specified by the handle.
 org.apache.hadoop.conf.Configuration getConf()
          Get driver configuration
 void prepare(PreparedQueryContext pContext)
          Prepare the given query.
 void readExternal(ObjectInput arg0)
           
 void registerDriverEventListener(LensEventListener<DriverEvent> driverEventListener)
          Add a listener for driver events.
 void registerForCompletionNotification(QueryHandle handle, long timeoutMillis, QueryCompletionListener listener)
          Register for query completion notification.
 void updateStatus(QueryContext context)
          Get status of the query, specified by the handle.
 void writeExternal(ObjectOutput arg0)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

public static final org.apache.log4j.Logger LOG
The Constant LOG.


THID

public static final AtomicInteger THID
The Constant THID.

Constructor Detail

JDBCDriver

public JDBCDriver()
Method Detail

getConf

public org.apache.hadoop.conf.Configuration getConf()
Get driver configuration

Specified by:
getConf in interface LensDriver

configure

public void configure(org.apache.hadoop.conf.Configuration conf)
               throws LensException
Configure driver with Configuration passed

Specified by:
configure in interface LensDriver
Parameters:
conf - The configuration object
Throws:
LensException - the lens exception

explain

public DriverQueryPlan explain(AbstractQueryContext explainCtx)
                        throws LensException
Explain the given query.

Specified by:
explain in interface LensDriver
Parameters:
explainCtx - The explain context
Returns:
The query plan object;
Throws:
LensException - the lens exception

prepare

public void prepare(PreparedQueryContext pContext)
             throws LensException
Prepare the given query.

Specified by:
prepare in interface LensDriver
Parameters:
pContext - the context
Throws:
LensException - the lens exception

explainAndPrepare

public DriverQueryPlan explainAndPrepare(PreparedQueryContext pContext)
                                  throws LensException
Explain and prepare the given query.

Specified by:
explainAndPrepare in interface LensDriver
Parameters:
pContext - the context
Returns:
The query plan object;
Throws:
LensException - the lens exception

closePreparedQuery

public void closePreparedQuery(QueryPrepareHandle handle)
                        throws LensException
Close the prepare query specified by the prepared handle, releases all the resources held by the prepared query.

Specified by:
closePreparedQuery in interface LensDriver
Parameters:
handle - The query handle
Throws:
LensException - the lens exception

execute

public LensResultSet execute(QueryContext context)
                      throws LensException
Blocking execute of the query.

Specified by:
execute in interface LensDriver
Parameters:
context - the context
Returns:
returns the result set
Throws:
LensException - the lens exception

executeAsync

public void executeAsync(QueryContext context)
                  throws LensException
Asynchronously execute the query.

Specified by:
executeAsync in interface LensDriver
Parameters:
context - The query context
Throws:
LensException - the lens exception

registerForCompletionNotification

public void registerForCompletionNotification(QueryHandle handle,
                                              long timeoutMillis,
                                              QueryCompletionListener listener)
                                       throws LensException
Register for query completion notification.

Specified by:
registerForCompletionNotification in interface LensDriver
Parameters:
handle - the handle
timeoutMillis - the timeout millis
listener - the listener
Throws:
LensException - the lens exception

updateStatus

public void updateStatus(QueryContext context)
                  throws LensException
Get status of the query, specified by the handle.

Specified by:
updateStatus in interface LensDriver
Parameters:
context - The query handle
Throws:
LensException - the lens exception

fetchResultSet

public LensResultSet fetchResultSet(QueryContext context)
                             throws LensException
Fetch the results of the query, specified by the handle.

Specified by:
fetchResultSet in interface LensDriver
Parameters:
context - the context
Returns:
returns the LensResultSet.
Throws:
LensException - the lens exception

closeResultSet

public void closeResultSet(QueryHandle handle)
                    throws LensException
Close the resultset for the query.

Specified by:
closeResultSet in interface LensDriver
Parameters:
handle - The query handle
Throws:
LensException - the lens exception

cancelQuery

public boolean cancelQuery(QueryHandle handle)
                    throws LensException
Cancel the execution of the query, specified by the handle.

Specified by:
cancelQuery in interface LensDriver
Parameters:
handle - The query handle.
Returns:
true if cancel was successful, false otherwise
Throws:
LensException - the lens exception

closeQuery

public void closeQuery(QueryHandle handle)
                throws LensException
Close the query specified by the handle, releases all the resources held by the query.

Specified by:
closeQuery in interface LensDriver
Parameters:
handle - The query handle
Throws:
LensException - the lens exception

close

public void close()
           throws LensException
Close the driver, releasing all resouces used up by the driver.

Specified by:
close in interface LensDriver
Throws:
LensException - the lens exception

registerDriverEventListener

public void registerDriverEventListener(LensEventListener<DriverEvent> driverEventListener)
Add a listener for driver events.

Specified by:
registerDriverEventListener in interface LensDriver
Parameters:
driverEventListener - the driver event listener

readExternal

public void readExternal(ObjectInput arg0)
                  throws IOException,
                         ClassNotFoundException
Specified by:
readExternal in interface Externalizable
Throws:
IOException
ClassNotFoundException

writeExternal

public void writeExternal(ObjectOutput arg0)
                   throws IOException
Specified by:
writeExternal in interface Externalizable
Throws:
IOException


Copyright © 2014–2015 Apache Software Foundation. All rights reserved.