org.springframework.data.hadoop.pig
Class PigServerFactoryBean

java.lang.Object
  extended by org.springframework.data.hadoop.pig.PigServerFactoryBean
All Implemented Interfaces:
BeanNameAware, FactoryBean<PigServerFactory>

public class PigServerFactoryBean
extends Object
implements FactoryBean<PigServerFactory>, BeanNameAware

Factory for creating a PigServer instance. Note that since PigServer is not thread-safe and the Pig API does not provide some type of factory, the factory bean returns an instance of ObjectFactory (which handles the creation of PigServer instances) instead of the raw PigServer object which cannot be reused. Note that the caller needs to handle the object clean-up, specifically calling PigServer.shutdown(). In general, to avoid leaks it is recommended to use the PigTemplate.

Author:
Costin Leau

Constructor Summary
PigServerFactoryBean()
           
 
Method Summary
protected  PigServer createPigInstance()
           
 PigServerFactory getObject()
           
 Class<?> getObjectType()
           
 boolean isSingleton()
           
 void setBeanName(String name)
           
 void setJobName(String jobName)
          Sets the job name.
 void setJobPriority(String jobPriority)
          Sets the job priority.
 void setParallelism(Integer parallelism)
          Sets the parallelism.
 void setPathsToSkip(Collection<String> pathToSkip)
          Sets the paths to skip.
 void setPigContext(PigContext pigContext)
          Sets the PigContext to use.
 void setScripts(Collection<PigScript> scripts)
          Sets the scripts to execute at startup.
 void setUser(String user)
          Sets the user impersonation (optional) for executing Pig jobs.
 void setValidateEachStatement(Boolean validateEachStatement)
          Indicates whether each statement should be validated or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PigServerFactoryBean

public PigServerFactoryBean()
Method Detail

getObject

public PigServerFactory getObject()
                           throws Exception
Specified by:
getObject in interface FactoryBean<PigServerFactory>
Throws:
Exception

getObjectType

public Class<?> getObjectType()
Specified by:
getObjectType in interface FactoryBean<PigServerFactory>

isSingleton

public boolean isSingleton()
Specified by:
isSingleton in interface FactoryBean<PigServerFactory>

createPigInstance

protected PigServer createPigInstance()
                               throws Exception
Throws:
Exception

setBeanName

public void setBeanName(String name)
Specified by:
setBeanName in interface BeanNameAware

setPigContext

public void setPigContext(PigContext pigContext)
Sets the PigContext to use.

Parameters:
pigContext - The pigContext to set.

setPathsToSkip

public void setPathsToSkip(Collection<String> pathToSkip)
Sets the paths to skip.

Parameters:
pathToSkip - The pathToSkip to set.

setScripts

public void setScripts(Collection<PigScript> scripts)
Sets the scripts to execute at startup.

Parameters:
scripts - The scripts to set.

setParallelism

public void setParallelism(Integer parallelism)
Sets the parallelism.

Parameters:
parallelism - The parallelism to set.

setJobName

public void setJobName(String jobName)
Sets the job name.

Parameters:
jobName - The jobName to set.

setJobPriority

public void setJobPriority(String jobPriority)
Sets the job priority.

Parameters:
jobPriority - The jobPriority to set.

setValidateEachStatement

public void setValidateEachStatement(Boolean validateEachStatement)
Indicates whether each statement should be validated or not. By default it is unset, relying on the Pig defaults.

Parameters:
validateEachStatement - whether to validate each statement or not.

setUser

public void setUser(String user)
Sets the user impersonation (optional) for executing Pig jobs. Should be used when running against a Hadoop Kerberos cluster.

Parameters:
user - user/group information