|
Spring for Apache Hadoop | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.springframework.core.io.DefaultResourceLoader
org.springframework.data.hadoop.fs.HdfsResourceLoader
public class HdfsResourceLoader
Spring ResourceLoader over Hadoop FileSystem.
| Field Summary |
|---|
| Fields inherited from interface org.springframework.core.io.support.ResourcePatternResolver |
|---|
CLASSPATH_ALL_URL_PREFIX |
| Fields inherited from interface org.springframework.core.io.ResourceLoader |
|---|
CLASSPATH_URL_PREFIX |
| Fields inherited from interface org.springframework.core.Ordered |
|---|
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE |
| Constructor Summary | |
|---|---|
HdfsResourceLoader(org.apache.hadoop.conf.Configuration config)
Constructs a new HdfsResourceLoader instance. |
|
HdfsResourceLoader(org.apache.hadoop.conf.Configuration config,
java.net.URI uri)
Constructs a new HdfsResourceLoader instance. |
|
HdfsResourceLoader(org.apache.hadoop.conf.Configuration config,
java.net.URI uri,
java.lang.String user)
Constructs a new HdfsResourceLoader instance. |
|
HdfsResourceLoader(org.apache.hadoop.fs.FileSystem fs)
Constructs a new HdfsResourceLoader instance. |
|
| Method Summary | |
|---|---|
void |
afterPropertiesSet()
|
void |
close()
|
void |
destroy()
|
protected java.lang.String |
determineRootDir(java.lang.String location)
Determine the root directory for the given location. |
protected java.util.Set<org.springframework.core.io.Resource> |
doFindMatchingFileSystemResources(org.apache.hadoop.fs.Path rootDir,
java.lang.String subPattern)
Find all resources in the file system that match the given location pattern via the Ant-style PathMatcher. |
protected java.util.Set<org.springframework.core.io.Resource> |
doFindPathMatchingFileResources(org.springframework.core.io.Resource rootDirResource,
java.lang.String subPattern)
Find all resources in the hdfs file system that match the given location pattern via the Ant-style PathMatcher. |
protected void |
doRetrieveMatchingFiles(java.lang.String fullPattern,
org.apache.hadoop.fs.Path dir,
java.util.Set<org.apache.hadoop.fs.Path> result)
Recursively retrieve files that match the given pattern, adding them to the given result list. |
protected org.springframework.core.io.Resource[] |
findPathMatchingResources(java.lang.String locationPattern)
Find all resources that match the given location pattern via the Ant-style PathMatcher. |
java.lang.ClassLoader |
getClassLoader()
|
org.apache.hadoop.fs.FileSystem |
getFileSystem()
Returns the Hadoop file system used by this resource loader. |
int |
getOrder()
|
org.springframework.core.io.Resource |
getResource(java.lang.String location)
|
protected org.springframework.core.io.Resource |
getResourceByPath(java.lang.String path)
|
org.springframework.core.io.Resource[] |
getResources(java.lang.String locationPattern)
|
protected java.util.Set<org.apache.hadoop.fs.Path> |
retrieveMatchingFiles(org.apache.hadoop.fs.Path rootDir,
java.lang.String pattern)
Retrieve files that match the given path pattern, checking the given directory and its subdirectories. |
void |
setHandleNoprefix(boolean handleNoprefix)
Sets the handle noprefix. |
void |
setResourcePatternResolver(org.springframework.core.io.support.ResourcePatternResolver resourcePatternResolver)
Sets the resource pattern resolver. |
void |
setUseCodecs(boolean useCodecs)
Indicates whether to use (or not) the codecs found inside the Hadoop configuration. |
| Methods inherited from class org.springframework.core.io.DefaultResourceLoader |
|---|
setClassLoader |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public HdfsResourceLoader(org.apache.hadoop.conf.Configuration config)
HdfsResourceLoader instance.
config - Hadoop configuration to use.
public HdfsResourceLoader(org.apache.hadoop.conf.Configuration config,
java.net.URI uri,
java.lang.String user)
HdfsResourceLoader instance.
config - Hadoop configuration to use.uri - Hadoop file system URI.user - Hadoop user for accessing the file system.
public HdfsResourceLoader(org.apache.hadoop.conf.Configuration config,
java.net.URI uri)
HdfsResourceLoader instance.
config - Hadoop configuration to use.uri - Hadoop file system URI.public HdfsResourceLoader(org.apache.hadoop.fs.FileSystem fs)
HdfsResourceLoader instance.
fs - Hadoop file system to use.| Method Detail |
|---|
protected org.springframework.core.io.Resource getResourceByPath(java.lang.String path)
getResourceByPath in class org.springframework.core.io.DefaultResourceLoaderpublic org.springframework.core.io.Resource getResource(java.lang.String location)
getResource in interface org.springframework.core.io.ResourceLoadergetResource in class org.springframework.core.io.DefaultResourceLoader
public org.springframework.core.io.Resource[] getResources(java.lang.String locationPattern)
throws java.io.IOException
getResources in interface org.springframework.core.io.support.ResourcePatternResolverjava.io.IOExceptionpublic int getOrder()
getOrder in interface org.springframework.core.Ordered
public void destroy()
throws java.io.IOException
destroy in interface org.springframework.beans.factory.DisposableBeanjava.io.IOException
public void close()
throws java.io.IOException
close in interface java.io.Closeablejava.io.IOException
public void afterPropertiesSet()
throws java.lang.Exception
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanjava.lang.Exceptionpublic java.lang.ClassLoader getClassLoader()
getClassLoader in interface org.springframework.core.io.ResourceLoadergetClassLoader in class org.springframework.core.io.DefaultResourceLoaderpublic void setHandleNoprefix(boolean handleNoprefix)
handleNoprefix - the new handle noprefixpublic org.apache.hadoop.fs.FileSystem getFileSystem()
public void setUseCodecs(boolean useCodecs)
useCodecs - whether to use any codecs defined in the Hadoop configurationpublic void setResourcePatternResolver(org.springframework.core.io.support.ResourcePatternResolver resourcePatternResolver)
resourcePatternResolver - the new resource pattern resolver
protected org.springframework.core.io.Resource[] findPathMatchingResources(java.lang.String locationPattern)
throws java.io.IOException
locationPattern - the location pattern to match
java.io.IOException - in case of I/O errors
protected java.util.Set<org.springframework.core.io.Resource> doFindPathMatchingFileResources(org.springframework.core.io.Resource rootDirResource,
java.lang.String subPattern)
throws java.io.IOException
rootDirResource - the root directory as ResourcesubPattern - the sub pattern to match (below the root directory)
java.io.IOException - in case of I/O errors
protected java.util.Set<org.springframework.core.io.Resource> doFindMatchingFileSystemResources(org.apache.hadoop.fs.Path rootDir,
java.lang.String subPattern)
throws java.io.IOException
rootDir - the root directory in the file systemsubPattern - the sub pattern to match (below the root directory)
java.io.IOException - in case of I/O errorsPathMatcher
protected java.util.Set<org.apache.hadoop.fs.Path> retrieveMatchingFiles(org.apache.hadoop.fs.Path rootDir,
java.lang.String pattern)
throws java.io.IOException
rootDir - the directory to start frompattern - the pattern to match against, * relative to the root directory
java.io.IOException - if directory contents could not be retrieved
protected void doRetrieveMatchingFiles(java.lang.String fullPattern,
org.apache.hadoop.fs.Path dir,
java.util.Set<org.apache.hadoop.fs.Path> result)
throws java.io.IOException
fullPattern - the pattern to match against, with prepended root directory pathdir - the current directoryresult - the Set of matching File instances to add to
java.io.IOException - if directory contents could not be retrievedprotected java.lang.String determineRootDir(java.lang.String location)
Used for determining the starting point for file matching,
resolving the root directory location and passing it
into doFindPathMatchingPathResources, with the
remainder of the location as pattern.
Will return "/dir/" for the pattern "/dir/*.xml", for example.
location - the location to check
|
Spring for Apache Hadoop | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||