Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2010-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License").
   * You may not use this file except in compliance with the License.
   * A copy of the License is located at
   * 
   *  http://aws.amazon.com/apache2.0
   * 
  * or in the "license" file accompanying this file. This file is distributed
  * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
  * express or implied. See the License for the specific language governing
  * permissions and limitations under the License.
  */
 package com.amazonaws.services.elasticmapreduce.model;
 

A cluster step consisting of a JAR file whose main function will be executed. The main function submits a job for Hadoop to execute and waits for the job to finish or fail.

 
 public class HadoopStepConfig implements SerializableCloneable {

    
The path to the JAR file that runs during the step.
 
     private String jar;

    
The list of Java properties that are set when the step runs. You can use these properties to pass key value pairs to your main function.
 
     private java.util.Map<String,Stringproperties;

    
The name of the main class in the specified Java file. If not specified, the JAR file should specify a main class in its manifest file.
 
     private String mainClass;

    
The list of command line arguments to pass to the JAR file's main function for execution.
 
The path to the JAR file that runs during the step.

Returns:
The path to the JAR file that runs during the step.
 
     public String getJar() {
         return ;
     }
    
    
The path to the JAR file that runs during the step.

Parameters:
jar The path to the JAR file that runs during the step.
 
     public void setJar(String jar) {
         this. = jar;
     }
    
    
The path to the JAR file that runs during the step.

Returns a reference to this object so that method calls can be chained together.

Parameters:
jar The path to the JAR file that runs during the step.
Returns:
A reference to this updated object so that method calls can be chained together.
 
     public HadoopStepConfig withJar(String jar) {
         this. = jar;
         return this;
     }

    
The list of Java properties that are set when the step runs. You can use these properties to pass key value pairs to your main function.

Returns:
The list of Java properties that are set when the step runs. You can use these properties to pass key value pairs to your main function.
 
     public java.util.Map<String,StringgetProperties() {
         
         if ( == null) {
              = new java.util.HashMap<String,String>();
         }
         return ;
     }
    
    
The list of Java properties that are set when the step runs. You can use these properties to pass key value pairs to your main function.

Parameters:
properties The list of Java properties that are set when the step runs. You can use these properties to pass key value pairs to your main function.
    public void setProperties(java.util.Map<String,Stringproperties) {
        this. = properties;
    }
    
    
The list of Java properties that are set when the step runs. You can use these properties to pass key value pairs to your main function.

Returns a reference to this object so that method calls can be chained together.

Parameters:
properties The list of Java properties that are set when the step runs. You can use these properties to pass key value pairs to your main function.
Returns:
A reference to this updated object so that method calls can be chained together.
    public HadoopStepConfig withProperties(java.util.Map<String,Stringproperties) {
        setProperties(properties);
        return this;
    }

    
The list of Java properties that are set when the step runs. You can use these properties to pass key value pairs to your main function.

The method adds a new key-value pair into Properties parameter, and returns a reference to this object so that method calls can be chained together.

Parameters:
key The key of the entry to be added into Properties.
value The corresponding value of the entry to be added into Properties.
  public HadoopStepConfig addPropertiesEntry(String keyString value) {
    if (null == this.) {
      this. = new java.util.HashMap<String,String>();
    }
    if (this..containsKey(key))
      throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided.");
    this..put(keyvalue);
    return this;
  }

  
Removes all the entries added into Properties.

Returns a reference to this object so that method calls can be chained together.

    this. = null;
    return this;
  }
  
    
The name of the main class in the specified Java file. If not specified, the JAR file should specify a main class in its manifest file.

Returns:
The name of the main class in the specified Java file. If not specified, the JAR file should specify a main class in its manifest file.
    public String getMainClass() {
        return ;
    }
    
    
The name of the main class in the specified Java file. If not specified, the JAR file should specify a main class in its manifest file.

Parameters:
mainClass The name of the main class in the specified Java file. If not specified, the JAR file should specify a main class in its manifest file.
    public void setMainClass(String mainClass) {
        this. = mainClass;
    }
    
    
The name of the main class in the specified Java file. If not specified, the JAR file should specify a main class in its manifest file.

Returns a reference to this object so that method calls can be chained together.

Parameters:
mainClass The name of the main class in the specified Java file. If not specified, the JAR file should specify a main class in its manifest file.
Returns:
A reference to this updated object so that method calls can be chained together.
    public HadoopStepConfig withMainClass(String mainClass) {
        this. = mainClass;
        return this;
    }

    
The list of command line arguments to pass to the JAR file's main function for execution.

Returns:
The list of command line arguments to pass to the JAR file's main function for execution.
    public java.util.List<StringgetArgs() {
        if ( == null) {
               = new com.amazonaws.internal.ListWithAutoConstructFlag<String>();
              .setAutoConstruct(true);
        }
        return ;
    }
    
    
The list of command line arguments to pass to the JAR file's main function for execution.

Parameters:
args The list of command line arguments to pass to the JAR file's main function for execution.
    public void setArgs(java.util.Collection<Stringargs) {
        if (args == null) {
            this. = null;
            return;
        }
        argsCopy.addAll(args);
        this. = argsCopy;
    }
    
    
The list of command line arguments to pass to the JAR file's main function for execution.

NOTE: This method appends the values to the existing list (if any). Use setArgs(java.util.Collection) or withArgs(java.util.Collection) if you want to override the existing values.

Returns a reference to this object so that method calls can be chained together.

Parameters:
args The list of command line arguments to pass to the JAR file's main function for execution.
Returns:
A reference to this updated object so that method calls can be chained together.
    public HadoopStepConfig withArgs(String... args) {
        if (getArgs() == nullsetArgs(new java.util.ArrayList<String>(args.length));
        for (String value : args) {
            getArgs().add(value);
        }
        return this;
    }
    
    
The list of command line arguments to pass to the JAR file's main function for execution.

Returns a reference to this object so that method calls can be chained together.

Parameters:
args The list of command line arguments to pass to the JAR file's main function for execution.
Returns:
A reference to this updated object so that method calls can be chained together.
        if (args == null) {
            this. = null;
        } else {
            argsCopy.addAll(args);
            this. = argsCopy;
        }
        return this;
    }

    
Returns a string representation of this object; useful for testing and debugging.

Returns:
A string representation of this object.
See also:
java.lang.Object.toString()
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getJar() != nullsb.append("Jar: " + getJar() + ",");
        if (getProperties() != nullsb.append("Properties: " + getProperties() + ",");
        if (getMainClass() != nullsb.append("MainClass: " + getMainClass() + ",");
        if (getArgs() != nullsb.append("Args: " + getArgs() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        hashCode = prime * hashCode + ((getJar() == null) ? 0 : getJar().hashCode()); 
        hashCode = prime * hashCode + ((getProperties() == null) ? 0 : getProperties().hashCode()); 
        hashCode = prime * hashCode + ((getMainClass() == null) ? 0 : getMainClass().hashCode()); 
        hashCode = prime * hashCode + ((getArgs() == null) ? 0 : getArgs().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof HadoopStepConfig == falsereturn false;
        HadoopStepConfig other = (HadoopStepConfig)obj;
        
        if (other.getJar() == null ^ this.getJar() == nullreturn false;
        if (other.getJar() != null && other.getJar().equals(this.getJar()) == falsereturn false
        if (other.getProperties() == null ^ this.getProperties() == nullreturn false;
        if (other.getProperties() != null && other.getProperties().equals(this.getProperties()) == falsereturn false
        if (other.getMainClass() == null ^ this.getMainClass() == nullreturn false;
        if (other.getMainClass() != null && other.getMainClass().equals(this.getMainClass()) == falsereturn false
        if (other.getArgs() == null ^ this.getArgs() == nullreturn false;
        if (other.getArgs() != null && other.getArgs().equals(this.getArgs()) == falsereturn false
        return true;
    }
    
    @Override
    public HadoopStepConfig clone() {
        try {
            return (HadoopStepConfigsuper.clone();
        
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException(
                    "Got a CloneNotSupportedException from Object.clone() "
                    + "even though we're Cloneable!",
                    e);
        }
        
    }
}
    
New to GrepCode? Check out our FAQ X