|
|||||||||
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 DataAccessException |
convertPigAccessException(ExecException ex)
Converts the given Pig exception to an appropriate exception from the org.springframework.dao hierarchy. |
|
protected DataAccessException |
convertPigAccessException(IOException ex)
Converts the given Pig exception to an appropriate exception from the org.springframework.dao hierarchy. |
|
protected PigServer |
createPigServer()
|
|
|
execute(PigCallback<T> action)
Executes the action specified by the given callback object within an active PigServer . |
|
List<ExecJob> |
executeScript(Iterable<PigScript> scripts)
Executes multiple scripts that result in a list of job executions. |
|
List<ExecJob> |
executeScript(PigScript script)
Executes the given script identified by location and arguments that results in a list of job executions. |
|
List<ExecJob> |
executeScript(String script)
Executes the given Pig Latin that results in a list of job executions. |
|
List<ExecJob> |
executeScript(String script,
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(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 InitializingBean
public <T> T execute(PigCallback<T> action) throws DataAccessException
PigServer
.
execute
in interface PigOperations
action
- callback object that specifies the Hive action
DataAccessException
protected DataAccessException convertPigAccessException(IOException ex)
ex
- Pig exception
protected DataAccessException convertPigAccessException(ExecException ex)
ex
- Pig exception
public List<ExecJob> executeScript(String script) throws DataAccessException
executeScript
in interface PigOperations
script
- script URL or pig latin statement
DataAccessException
public List<ExecJob> executeScript(String script, Map<?,?> arguments) throws DataAccessException
executeScript
in interface PigOperations
script
- script URL or pig latin statementarguments
- script arguments
DataAccessException
public List<ExecJob> executeScript(PigScript script) throws DataAccessException
executeScript
in interface PigOperations
script
- script location and arguments
DataAccessException
public List<ExecJob> executeScript(Iterable<PigScript> scripts) throws DataAccessException
executeScript
in interface PigOperations
scripts
- scripts location and arguments
DataAccessException
protected PigServer createPigServer()
public void setPigFactory(PigServerFactory pigServerFactory)
PigServer
factory.
pigServerFactory
- public void setResourceLoader(ResourceLoader resourceLoader)
setResourceLoader
in interface ResourceLoaderAware
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |