org.springframework.data.hadoop.hive
Class HiveClientFactoryBean

java.lang.Object
  extended by org.springframework.data.hadoop.hive.HiveClientFactoryBean
All Implemented Interfaces:
FactoryBean<HiveClientFactory>

public class HiveClientFactoryBean
extends Object
implements FactoryBean<HiveClientFactory>

FactoryBean for easy declaration and creation of a HiveClient using ThriftHive. Since Thrift clients are not thread-safe, neither is HiveClient. And since the Hive API does not provide some type of factory, the factory bean returns an instance of ObjectFactory (that handles the creation of HiveClient instances) instead of the raw HiveClient instance. Note that the caller needs to handle the object clean-up, specifically calling FacebookService.Client.shutdown(). In general, to avoid leaks it is recommended to use the HiveTemplate.

Author:
Costin Leau

Constructor Summary
HiveClientFactoryBean()
           
 
Method Summary
protected  HiveClient createHiveClient()
           
 String getHost()
          Returns the host.
 HiveClientFactory getObject()
           
 Class<?> getObjectType()
           
 int getPhase()
           
 int getPort()
          Returns the port.
 int getTimeout()
          Returns the timeout.
 boolean isSingleton()
           
 void setHost(String host)
          Sets the server host.
 void setPort(int port)
          Sets the server port.
 void setScripts(Collection<HiveScript> scripts)
          Sets the scripts to execute once the client connects.
 void setTimeout(int timeout)
          Sets the connection timeout.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HiveClientFactoryBean

public HiveClientFactoryBean()
Method Detail

getObject

public HiveClientFactory getObject()
Specified by:
getObject in interface FactoryBean<HiveClientFactory>

getObjectType

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

isSingleton

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

createHiveClient

protected HiveClient createHiveClient()

getPhase

public int getPhase()

getHost

public String getHost()
Returns the host.

Returns:
Returns the host

setHost

public void setHost(String host)
Sets the server host.

Parameters:
host - The host to set.

getPort

public int getPort()
Returns the port.

Returns:
Returns the port

setPort

public void setPort(int port)
Sets the server port.

Parameters:
port - The port to set.

getTimeout

public int getTimeout()
Returns the timeout.

Returns:
Returns the timeout

setTimeout

public void setTimeout(int timeout)
Sets the connection timeout.

Parameters:
timeout - The timeout to set.

setScripts

public void setScripts(Collection<HiveScript> scripts)
Sets the scripts to execute once the client connects.

Parameters:
scripts - The scripts to set.