Spring for Apache Hadoop

org.springframework.yarn.config.annotation.builders
Class YarnConfigBuilder

java.lang.Object
  extended by org.springframework.data.hadoop.config.common.annotation.AbstractAnnotationBuilder<O>
      extended by org.springframework.data.hadoop.config.common.annotation.AbstractConfiguredAnnotationBuilder<org.apache.hadoop.yarn.conf.YarnConfiguration,YarnConfigConfigurer,YarnConfigBuilder>
          extended by org.springframework.yarn.config.annotation.builders.YarnConfigBuilder
All Implemented Interfaces:
AnnotationBuilder<org.apache.hadoop.yarn.conf.YarnConfiguration>, PropertiesConfigurerAware, ResourceConfigurerAware, YarnConfigConfigurer

public final class YarnConfigBuilder
extends AbstractConfiguredAnnotationBuilder<org.apache.hadoop.yarn.conf.YarnConfiguration,YarnConfigConfigurer,YarnConfigBuilder>
implements PropertiesConfigurerAware, ResourceConfigurerAware, YarnConfigConfigurer

AnnotationBuilder for YarnConfiguration.

Author:
Janne Valkealahti

Constructor Summary
YarnConfigBuilder()
          Instantiates a new yarn config builder.
YarnConfigBuilder(ObjectPostProcessor<java.lang.Object> objectPostProcessor)
          Instantiates a new yarn config builder.
 
Method Summary
 void configureProperties(java.util.Properties properties)
          Configure Properties.
 void configureResources(java.util.Set<org.springframework.core.io.Resource> resources)
          Configure Resources.
 YarnConfigConfigurer fileSystemUri(java.lang.String uri)
          Specify a Hdfs file system uri.
 java.util.Properties getProperties()
          Gets the Properties.
 java.util.Set<org.springframework.core.io.Resource> getResources()
          Gets the Resources.
 YarnConfigConfigurer loadDefaults(boolean loadDefaults)
          Specify if Hadoop Configuration is initially based on default values.
protected  org.apache.hadoop.yarn.conf.YarnConfiguration performBuild()
          Subclasses must implement this method to build the object that is being returned.
 YarnConfigConfigurer resourceManagerAddress(java.lang.String address)
          Specify a Yarn resource manager address.
 YarnConfigConfigurer schedulerAddress(java.lang.String address)
          Specify a Yarn resource manager scheduler address.
 PropertiesConfigurer<YarnConfigConfigurer> withProperties()
          Specify configuration options as properties with a PropertiesConfigurer.
 ResourceConfigurer<YarnConfigConfigurer> withResources()
          Specify configuration options as resource properties with a ResourceConfigurer.
 
Methods inherited from class org.springframework.data.hadoop.config.common.annotation.AbstractConfiguredAnnotationBuilder
apply, apply, beforeConfigureMains, beforeConfigurePosts, beforeInit, doBuild, getConfigurer, getConfigurers, getOrApply, getOrBuild, getSharedObject, getSharedObjects, objectPostProcessor, postProcess, removeConfigurer, removeConfigurers, setSharedObject
 
Methods inherited from class org.springframework.data.hadoop.config.common.annotation.AbstractAnnotationBuilder
build, getObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

YarnConfigBuilder

public YarnConfigBuilder()
Instantiates a new yarn config builder.


YarnConfigBuilder

public YarnConfigBuilder(ObjectPostProcessor<java.lang.Object> objectPostProcessor)
Instantiates a new yarn config builder.

Parameters:
objectPostProcessor - the object post processor
Method Detail

performBuild

protected org.apache.hadoop.yarn.conf.YarnConfiguration performBuild()
                                                              throws java.lang.Exception
Description copied from class: AbstractConfiguredAnnotationBuilder
Subclasses must implement this method to build the object that is being returned.

Specified by:
performBuild in class AbstractConfiguredAnnotationBuilder<org.apache.hadoop.yarn.conf.YarnConfiguration,YarnConfigConfigurer,YarnConfigBuilder>
Returns:
Object build by this builder
Throws:
java.lang.Exception

configureProperties

public void configureProperties(java.util.Properties properties)
Description copied from interface: PropertiesConfigurerAware
Configure Properties.

Specified by:
configureProperties in interface PropertiesConfigurerAware
Parameters:
properties - the properties

configureResources

public void configureResources(java.util.Set<org.springframework.core.io.Resource> resources)
Description copied from interface: ResourceConfigurerAware
Configure Resources.

Specified by:
configureResources in interface ResourceConfigurerAware
Parameters:
resources - the resources

withResources

public ResourceConfigurer<YarnConfigConfigurer> withResources()
                                                       throws java.lang.Exception
Description copied from interface: YarnConfigConfigurer
Specify configuration options as resource properties with a ResourceConfigurer.

JavaConfig:

 public void configure(YarnConfigConfigure config) throws Exception {
   Properties props = new Properties();
   config
     .withResources()
       .resource("cfg-1.properties")
       .resource("cfg-2.properties")
       .and();
 }
 

XML:

 <yarn:configuration properties-location="cfg-1.properties, cfg-2.properties"/>
 

Specified by:
withResources in interface YarnConfigConfigurer
Returns:
ResourceConfigurer for chaining
Throws:
java.lang.Exception - if error occurred

withProperties

public PropertiesConfigurer<YarnConfigConfigurer> withProperties()
                                                          throws java.lang.Exception
Description copied from interface: YarnConfigConfigurer
Specify configuration options as properties with a PropertiesConfigurer.

JavaConfig:

 public void configure(YarnConfigConfigure config) throws Exception {
   Properties props = new Properties();
   config
     .withProperties()
       .properties(props)
       .property("myKey1", ",myValue1")
       .and();
 }
 

XML:

 <util:properties id="props" location="props.properties"/>
   myValue1
 </util:properties>
 <yarn:configuration properties-ref="props"/>
 

Specified by:
withProperties in interface YarnConfigConfigurer
Returns:
PropertiesConfigurer for chaining
Throws:
java.lang.Exception - if error occurred

fileSystemUri

public YarnConfigConfigurer fileSystemUri(java.lang.String uri)
Description copied from interface: YarnConfigConfigurer
Specify a Hdfs file system uri.

JavaConfig:

 public void configure(YarnConfigConfigure config) throws Exception {
   config
     .fileSystemUri("hdfs://myhost:8020");
 }
 

XML:

 <yarn:configuration fs-uri="hdfs://myhost:8020"/>
 

Specified by:
fileSystemUri in interface YarnConfigConfigurer
Parameters:
uri - The Hdfs uri
Returns:
YarnConfigConfigurer for chaining

resourceManagerAddress

public YarnConfigConfigurer resourceManagerAddress(java.lang.String address)
Description copied from interface: YarnConfigConfigurer
Specify a Yarn resource manager address.

JavaConfig:

 public void configure(YarnConfigConfigure config) throws Exception {
   config
     .resourceManagerAddress("myRmHost:8032");
 }
 

XML:

 <yarn:configuration rm-address="myRmHost:8032"/>
 

Specified by:
resourceManagerAddress in interface YarnConfigConfigurer
Parameters:
address - The Yarn resource manager address
Returns:
YarnConfigConfigurer for chaining

schedulerAddress

public YarnConfigConfigurer schedulerAddress(java.lang.String address)
Description copied from interface: YarnConfigConfigurer
Specify a Yarn resource manager scheduler address.

JavaConfig:

 public void configure(YarnConfigConfigure config) throws Exception {
   config
     .schedulerAddress("myRmHost:8030");
 }
 

XML:

 <yarn:configuration scheduler-address="myRmHost:8030"/>
 

Specified by:
schedulerAddress in interface YarnConfigConfigurer
Parameters:
address - The Yarn resource manager scheduler address
Returns:
YarnConfigConfigurer for chaining

loadDefaults

public YarnConfigConfigurer loadDefaults(boolean loadDefaults)
Description copied from interface: YarnConfigConfigurer
Specify if Hadoop Configuration is initially based on default values. Default is true.

JavaConfig:

 public void configure(YarnConfigConfigure config) throws Exception {
   config
     .loadDefaults(true);
 }
 

XML:

No equivalent

Specified by:
loadDefaults in interface YarnConfigConfigurer
Parameters:
loadDefaults - The flag if defaults should be loaded
Returns:
YarnConfigConfigurer for chaining

getProperties

public java.util.Properties getProperties()
Gets the Properties.

Returns:
the properties

getResources

public java.util.Set<org.springframework.core.io.Resource> getResources()
Gets the Resources.

Returns:
the resources

Spring for Apache Hadoop