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<YarnConfiguration,YarnConfigConfigurer,YarnConfigBuilder>
          extended by org.springframework.yarn.config.annotation.builders.YarnConfigBuilder
All Implemented Interfaces:
org.springframework.data.hadoop.config.common.annotation.AnnotationBuilder<YarnConfiguration>, org.springframework.data.hadoop.config.common.annotation.configurers.PropertiesConfigurerAware, org.springframework.data.hadoop.config.common.annotation.configurers.ResourceConfigurerAware, YarnConfigConfigurer

public final class YarnConfigBuilder
extends org.springframework.data.hadoop.config.common.annotation.AbstractConfiguredAnnotationBuilder<YarnConfiguration,YarnConfigConfigurer,YarnConfigBuilder>
implements org.springframework.data.hadoop.config.common.annotation.configurers.PropertiesConfigurerAware, org.springframework.data.hadoop.config.common.annotation.configurers.ResourceConfigurerAware, YarnConfigConfigurer

AnnotationBuilder for YarnConfiguration.

Author:
Janne Valkealahti

Constructor Summary
YarnConfigBuilder()
          Instantiates a new yarn config builder.
YarnConfigBuilder(org.springframework.data.hadoop.config.common.annotation.ObjectPostProcessor<Object> objectPostProcessor)
          Instantiates a new yarn config builder.
 
Method Summary
 void configureProperties(Properties properties)
           
 void configureResources(Set<Resource> resources)
           
 YarnConfigConfigurer fileSystemUri(String uri)
          Specify a Hdfs file system uri.
 Properties getProperties()
          Gets the Properties.
 Set<Resource> getResources()
          Gets the Resources.
 YarnConfigConfigurer loadDefaults(boolean loadDefaults)
          Specify if Hadoop Configuration is initially based on default values.
protected  YarnConfiguration performBuild()
           
 YarnConfigConfigurer resourceManagerAddress(String address)
          Specify a Yarn resource manager address.
 YarnConfigConfigurer schedulerAddress(String address)
          Specify a Yarn resource manager scheduler address.
 org.springframework.data.hadoop.config.common.annotation.configurers.PropertiesConfigurer<YarnConfigConfigurer> withProperties()
          Specify configuration options as properties with a PropertiesConfigurer.
 org.springframework.data.hadoop.config.common.annotation.configurers.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(org.springframework.data.hadoop.config.common.annotation.ObjectPostProcessor<Object> objectPostProcessor)
Instantiates a new yarn config builder.

Parameters:
objectPostProcessor - the object post processor
Method Detail

performBuild

protected YarnConfiguration performBuild()
                                  throws Exception
Specified by:
performBuild in class org.springframework.data.hadoop.config.common.annotation.AbstractConfiguredAnnotationBuilder<YarnConfiguration,YarnConfigConfigurer,YarnConfigBuilder>
Throws:
Exception

configureProperties

public void configureProperties(Properties properties)
Specified by:
configureProperties in interface org.springframework.data.hadoop.config.common.annotation.configurers.PropertiesConfigurerAware

configureResources

public void configureResources(Set<Resource> resources)
Specified by:
configureResources in interface org.springframework.data.hadoop.config.common.annotation.configurers.ResourceConfigurerAware

withResources

public org.springframework.data.hadoop.config.common.annotation.configurers.ResourceConfigurer<YarnConfigConfigurer> withResources()
                                                                                                                            throws 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:
Exception - if error occurred

withProperties

public org.springframework.data.hadoop.config.common.annotation.configurers.PropertiesConfigurer<YarnConfigConfigurer> withProperties()
                                                                                                                               throws 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:
Exception - if error occurred

fileSystemUri

public YarnConfigConfigurer fileSystemUri(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(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(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 Properties getProperties()
Gets the Properties.

Returns:
the properties

getResources

public Set<Resource> getResources()
Gets the Resources.

Returns:
the resources