|
Spring for Apache Hadoop | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.data.hadoop.pig.PigTemplate
public class PigTemplate
Helper class that simplifies Pig data access code. Automatically handles the creation of a PigServer (which is non-thread-safe) and converts Pig exceptions into DataAccessExceptions.
Constructor Summary | |
---|---|
PigTemplate()
Constructs a new PigTemplate instance. |
|
PigTemplate(PigServerFactory pigFactory)
Constructs a new PigTemplate instance. |
Method Summary | ||
---|---|---|
void |
afterPropertiesSet()
|
|
protected org.springframework.dao.DataAccessException |
convertPigAccessException(org.apache.pig.backend.executionengine.ExecException ex)
Converts the given Pig exception to an appropriate exception from the org.springframework.dao hierarchy. |
|
protected org.springframework.dao.DataAccessException |
convertPigAccessException(java.io.IOException ex)
Converts the given Pig exception to an appropriate exception from the org.springframework.dao hierarchy. |
|
protected org.apache.pig.PigServer |
createPigServer()
|
|
|
execute(PigCallback<T> action)
Executes the action specified by the given callback object within an active PigServer . |
|
java.util.List<org.apache.pig.backend.executionengine.ExecJob> |
executeScript(java.lang.Iterable<PigScript> scripts)
Executes multiple scripts that result in a list of job executions. |
|
java.util.List<org.apache.pig.backend.executionengine.ExecJob> |
executeScript(PigScript script)
Executes the given script identified by location and arguments that results in a list of job executions. |
|
java.util.List<org.apache.pig.backend.executionengine.ExecJob> |
executeScript(java.lang.String script)
Executes the given Pig Latin that results in a list of job executions. |
|
java.util.List<org.apache.pig.backend.executionengine.ExecJob> |
executeScript(java.lang.String script,
java.util.Map<?,?> arguments)
Executes the given Pig Latin with arguments that results in a list of job executions. |
|
void |
setPigFactory(PigServerFactory pigServerFactory)
Sets the PigServer factory. |
|
void |
setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PigTemplate()
PigTemplate
instance.
Expects setPigFactory(PigServerFactory)
to be called before using it.
public PigTemplate(PigServerFactory pigFactory)
PigTemplate
instance.
pigFactory
- pig factoryMethod Detail |
---|
public void afterPropertiesSet()
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
public <T> T execute(PigCallback<T> action) throws org.springframework.dao.DataAccessException
PigServer
.
execute
in interface PigOperations
action
- callback object that specifies the Hive action
org.springframework.dao.DataAccessException
protected org.springframework.dao.DataAccessException convertPigAccessException(java.io.IOException ex)
ex
- Pig exception
protected org.springframework.dao.DataAccessException convertPigAccessException(org.apache.pig.backend.executionengine.ExecException ex)
ex
- Pig exception
public java.util.List<org.apache.pig.backend.executionengine.ExecJob> executeScript(java.lang.String script) throws org.springframework.dao.DataAccessException
executeScript
in interface PigOperations
script
- script URL or pig latin statement
org.springframework.dao.DataAccessException
public java.util.List<org.apache.pig.backend.executionengine.ExecJob> executeScript(java.lang.String script, java.util.Map<?,?> arguments) throws org.springframework.dao.DataAccessException
executeScript
in interface PigOperations
script
- script URL or pig latin statementarguments
- script arguments
org.springframework.dao.DataAccessException
public java.util.List<org.apache.pig.backend.executionengine.ExecJob> executeScript(PigScript script) throws org.springframework.dao.DataAccessException
executeScript
in interface PigOperations
script
- script location and arguments
org.springframework.dao.DataAccessException
public java.util.List<org.apache.pig.backend.executionengine.ExecJob> executeScript(java.lang.Iterable<PigScript> scripts) throws org.springframework.dao.DataAccessException
executeScript
in interface PigOperations
scripts
- scripts location and arguments
org.springframework.dao.DataAccessException
protected org.apache.pig.PigServer createPigServer()
public void setPigFactory(PigServerFactory pigServerFactory)
PigServer
factory.
pigServerFactory
- public void setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader)
setResourceLoader
in interface org.springframework.context.ResourceLoaderAware
|
Spring for Apache Hadoop | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |