org.springframework.data.hadoop.fs
Class FileSystemFactoryBean

java.lang.Object
  extended by org.springframework.data.hadoop.fs.FileSystemFactoryBean
All Implemented Interfaces:
DisposableBean, FactoryBean<FileSystem>, InitializingBean

public class FileSystemFactoryBean
extends Object
implements InitializingBean, DisposableBean, FactoryBean<FileSystem>

FactoryBean for creating Hadoop FileSystem instances. Useful for interacting with HDFS from outside a Map Reduce job. If no parameter is given, a file system using the installed Hadoop defaults will be created.

Author:
Costin Leau

Constructor Summary
FileSystemFactoryBean()
           
 
Method Summary
 void afterPropertiesSet()
           
 void destroy()
           
 FileSystem getObject()
           
 Class<?> getObjectType()
           
 boolean isSingleton()
           
 void setClose(boolean close)
          Indicates whether the Hadoop file systems should be closed once this factory is destroyed.
 void setCloseAll(boolean closeAll)
          Indicates whether all the Hadoop file systems should be closed once this factory is destroyed.
 void setConfiguration(Configuration configuration)
          Sets the Hadoop configuration for this file system.
 void setUri(URI uri)
          Sets the URI (if available) for this file system.
 void setUser(String user)
          Sets the user impersonation (optional) for creating this file-system.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileSystemFactoryBean

public FileSystemFactoryBean()
Method Detail

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Specified by:
afterPropertiesSet in interface InitializingBean
Throws:
Exception

destroy

public void destroy()
             throws Exception
Specified by:
destroy in interface DisposableBean
Throws:
Exception

getObject

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

getObjectType

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

isSingleton

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

setConfiguration

public void setConfiguration(Configuration configuration)
Sets the Hadoop configuration for this file system.

Parameters:
configuration - The configuration to set.

setUri

public void setUri(URI uri)
Sets the URI (if available) for this file system.

Parameters:
uri - The uri to set.

setUser

public void setUser(String user)
Sets the user impersonation (optional) for creating this file-system. Should be used when running against a Hadoop Kerberos cluster.

Parameters:
user - user/group information

setCloseAll

public void setCloseAll(boolean closeAll)
Indicates whether all the Hadoop file systems should be closed once this factory is destroyed. False by default - should be turned on as a safety measure when the app controls the entire lifecycle of Hadoop inside a JVM.

Parameters:
closeAll - the close all
See Also:
FileSystem.closeAll()

setClose

public void setClose(boolean close)
Indicates whether the Hadoop file systems should be closed once this factory is destroyed. True by default - should be turned off when running 'embedded' or if long running operations outlive the application context.

Parameters:
close -
See Also:
FileSystem.close()