Spring for Apache Hadoop

org.springframework.yarn.fs
Class AbstractLocalResourcesSelector

java.lang.Object
  extended by org.springframework.yarn.fs.AbstractLocalResourcesSelector
All Implemented Interfaces:
LocalResourcesSelector
Direct Known Subclasses:
BootLocalResourcesSelector

public abstract class AbstractLocalResourcesSelector
extends java.lang.Object
implements LocalResourcesSelector

Base implementation for LocalResourcesSelector supporting simple use cases where user needs to localise properties, zip and jar files.

Author:
Janne Valkealahti

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.springframework.yarn.fs.LocalResourcesSelector
LocalResourcesSelector.Entry
 
Constructor Summary
AbstractLocalResourcesSelector()
           
 
Method Summary
 void addPattern(java.lang.String pattern)
          Adds a pattern to be returned selected.
 void addPatterns(java.util.List<java.lang.String> patterns)
          Adds a patterns to be returned as selected.
 void addPatterns(java.lang.String... patterns)
          Adds a patterns to be returned as selected.
 java.util.List<java.lang.String> getPatterns()
          Gets the patterns.
 java.lang.String[] getPropertiesNames()
          Gets the properties fiels base names.
 java.lang.String[] getPropertiesSuffixes()
          Gets the properties files suffixes.
 java.lang.String getZipArchivePattern()
          Gets the current zip archive pattern.
protected  boolean isZipArchive(java.lang.String name)
          Matching if argument is determined to be a zip archive.
 java.util.List<LocalResourcesSelector.Entry> select(java.lang.String dir)
          Select a List of LocalResourcesSelector.Entrys.
protected  java.util.List<LocalResourcesSelector.Entry> selectInternal(java.lang.String dir)
          Select internal.
 void setPropertiesNames(java.util.List<java.lang.String> propertiesNames)
          Sets the properties names.
 void setPropertiesNames(java.lang.String... propertiesNames)
          Sets the properties names.
 void setPropertiesSuffixes(java.util.List<java.lang.String> propertiesSuffixes)
          Sets the properties suffixes.
 void setPropertiesSuffixes(java.lang.String... propertiesSuffixes)
          Sets the properties suffixes.
 void setZipArchivePattern(java.lang.String zipArchivePattern)
          Sets the zip archive pattern.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractLocalResourcesSelector

public AbstractLocalResourcesSelector()
Method Detail

select

public final java.util.List<LocalResourcesSelector.Entry> select(java.lang.String dir)
Description copied from interface: LocalResourcesSelector
Select a List of LocalResourcesSelector.Entrys. This method cannot not return NULL.

Specified by:
select in interface LocalResourcesSelector
Parameters:
dir - the base directory
Returns:
the list of entries

addPattern

public void addPattern(java.lang.String pattern)
Adds a pattern to be returned selected. Empty pattern is not added.

Parameters:
pattern - the pattern

addPatterns

public void addPatterns(java.lang.String... patterns)
Adds a patterns to be returned as selected.

Parameters:
patterns - the patterns
See Also:
addPattern(String)

addPatterns

public void addPatterns(java.util.List<java.lang.String> patterns)
Adds a patterns to be returned as selected.

Parameters:
patterns - the patterns
See Also:
addPattern(String)

getPatterns

public java.util.List<java.lang.String> getPatterns()
Gets the patterns.

Returns:
the patterns

setZipArchivePattern

public void setZipArchivePattern(java.lang.String zipArchivePattern)
Sets the zip archive pattern. Default pattern defined as DEFAULT_PATTERN_ZIP_ARCHIVE. Setting this pattern as NULL effectively disables zip matching.

Parameters:
zipArchivePattern - the new zip archive pattern

getZipArchivePattern

public java.lang.String getZipArchivePattern()
Gets the current zip archive pattern.

Returns:
the zip archive pattern

setPropertiesNames

public void setPropertiesNames(java.lang.String... propertiesNames)
Sets the properties names. These will be used as property file names together with values returned from getPropertiesSuffixes().

Parameters:
propertiesNames - the new properties names

setPropertiesNames

public void setPropertiesNames(java.util.List<java.lang.String> propertiesNames)
Sets the properties names.

Parameters:
propertiesNames - the new properties names
See Also:
setPropertiesNames(String...)

getPropertiesNames

public java.lang.String[] getPropertiesNames()
Gets the properties fiels base names.

Returns:
the properties names

setPropertiesSuffixes

public void setPropertiesSuffixes(java.lang.String... propertiesSuffixes)
Sets the properties suffixes. These will be used as property file names together with values returned from getPropertiesNames().

Parameters:
propertiesSuffixes - the new properties suffixes

setPropertiesSuffixes

public void setPropertiesSuffixes(java.util.List<java.lang.String> propertiesSuffixes)
Sets the properties suffixes.

Parameters:
propertiesSuffixes - the new properties suffixes
See Also:
setPropertiesSuffixes(String...)

getPropertiesSuffixes

public java.lang.String[] getPropertiesSuffixes()
Gets the properties files suffixes.

Returns:
the properties suffixes

selectInternal

protected java.util.List<LocalResourcesSelector.Entry> selectInternal(java.lang.String dir)
Select internal.

Parameters:
dir - the dir
Returns:
the list
See Also:
select(String)

isZipArchive

protected boolean isZipArchive(java.lang.String name)
Matching if argument is determined to be a zip archive. Uses PatternMatchUtils.simpleMatch(String, String) for actual matching. Match pattern is defined in variable zipArchivePattern and can be altered using method setZipArchivePattern(String).

Parameters:
name - the name to match
Returns:
true, if is matched as zip archive

Spring for Apache Hadoop