Spring for Apache Hadoop

org.springframework.data.hadoop.test.support.compat
Class MiniMRClusterCompat

java.lang.Object
  extended by org.springframework.data.hadoop.test.support.compat.MiniMRClusterCompat

public abstract class MiniMRClusterCompat
extends java.lang.Object

Compatibility class accessing minimr classes at runtime without knowing implementations during the compile time.

Usually minimr clusters are constructed via MiniMRClientClusterFactory which have same methods for hadoop 1.x and 2.x. Hadoop have this to easy testing for both versions. However at least hadoop 1.x distribution from a Cloudera(chd3, chd4) don't have this factory method for we need to resolve underlying cluster classes at runtime. Effectively these legacy classes cannot be resolved at compile time because Hadoop 2.x is based on Yarn and thus have different minimr cluster implementations.

Author:
Janne Valkealahti

Constructor Summary
MiniMRClusterCompat()
           
 
Method Summary
static org.apache.hadoop.conf.Configuration getConfiguration(java.lang.Object mrClusterObject)
          Gets the Configuration from a cluster.
static java.lang.Object instantiateCluster(java.lang.Class<?> caller, int nodes, org.apache.hadoop.conf.Configuration configuration, org.apache.hadoop.fs.FileSystem fileSystem, java.lang.ClassLoader classLoader)
          Instantiates a minimrcluster.
static void stopCluster(java.lang.Object mrClusterObject)
          Finds and calls lifecycle stop method for given cluster via reflection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MiniMRClusterCompat

public MiniMRClusterCompat()
Method Detail

instantiateCluster

public static java.lang.Object instantiateCluster(java.lang.Class<?> caller,
                                                  int nodes,
                                                  org.apache.hadoop.conf.Configuration configuration,
                                                  org.apache.hadoop.fs.FileSystem fileSystem,
                                                  java.lang.ClassLoader classLoader)
Instantiates a minimrcluster.

Parameters:
caller - the one who called this method
nodes - number of nodes
configuration - passed configuration
fileSystem - hdfs filesystem
classLoader - the class loader
Returns:
the cluster object

stopCluster

public static void stopCluster(java.lang.Object mrClusterObject)
Finds and calls lifecycle stop method for given cluster via reflection.

Parameters:
mrClusterObject - the Cluster Object

getConfiguration

public static org.apache.hadoop.conf.Configuration getConfiguration(java.lang.Object mrClusterObject)
Gets the Configuration from a cluster.

Parameters:
mrClusterObject - the Cluster Object
Returns:
the cluster Configuration

Spring for Apache Hadoop