com.cloudera.lib.service.hadoop
Class HadoopService

java.lang.Object
  extended by com.cloudera.lib.server.BaseService
      extended by com.cloudera.lib.service.hadoop.HadoopService
All Implemented Interfaces:
Service, Hadoop

public class HadoopService
extends BaseService
implements Hadoop


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.cloudera.lib.service.Hadoop
Hadoop.FileSystemExecutor<T>, Hadoop.JobClientExecutor<T>
 
Field Summary
static String AUTHENTICATION_TYPE
           
static String JOB_TRACKER_WHITELIST
           
static String KERBEROS_KEYTAB
           
static String KERBEROS_PRINCIPAL
           
static String NAME_NODE_WHITELIST
           
static String PREFIX
           
 
Constructor Summary
HadoopService()
           
 
Method Summary
protected  void checkJobTrackerHealth(org.apache.hadoop.mapred.JobClient jobClient)
           
protected  void checkNameNodeHealth(org.apache.hadoop.fs.FileSystem fileSystem)
           
protected  void closeFileSystem(org.apache.hadoop.fs.FileSystem fs)
           
protected  void closeJobClient(org.apache.hadoop.mapred.JobClient jobClient)
           
protected  org.apache.hadoop.fs.FileSystem createFileSystem(org.apache.hadoop.conf.Configuration namenodeConf)
           
 org.apache.hadoop.fs.FileSystem createFileSystem(String user, org.apache.hadoop.conf.Configuration conf)
           
 org.apache.hadoop.fs.FileSystem createFileSystemInternal(String user, org.apache.hadoop.conf.Configuration conf)
           
protected  org.apache.hadoop.mapred.JobConf createHadoopConf(org.apache.hadoop.conf.Configuration conf)
           
protected  org.apache.hadoop.mapred.JobClient createJobClient(org.apache.hadoop.mapred.JobConf jobtrackerConf)
           
protected  org.apache.hadoop.mapred.JobConf createJobTrackerConf(org.apache.hadoop.conf.Configuration conf)
           
protected  org.apache.hadoop.conf.Configuration createNameNodeConf(org.apache.hadoop.conf.Configuration conf)
           
<T> T
execute(String user, org.apache.hadoop.conf.Configuration conf, Hadoop.FileSystemExecutor<T> executor)
           
<T> T
execute(String user, org.apache.hadoop.conf.Configuration conf, Hadoop.JobClientExecutor<T> executor)
           
 org.apache.hadoop.conf.Configuration getDefaultConfiguration()
           
 Class getInterface()
          Returns the interface implemented by this service.
 Class[] getServiceDependencies()
          Returns the service dependencies of this service.
protected  org.apache.hadoop.security.UserGroupInformation getUGI(String user)
           
protected  void init()
          Initializes the server.
 void postInit()
          Post initializes the service.
 void releaseFileSystem(org.apache.hadoop.fs.FileSystem fs)
           
protected  void setRequiredServiceHadoopConf(org.apache.hadoop.conf.Configuration conf)
           
protected  void validateJobtracker(String jobtracker)
           
protected  void validateNamenode(String namenode)
           
 
Methods inherited from class com.cloudera.lib.server.BaseService
destroy, getPrefix, getPrefixedName, getServer, getServiceConfig, init, serverStatusChange
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PREFIX

public static final String PREFIX
See Also:
Constant Field Values

AUTHENTICATION_TYPE

public static final String AUTHENTICATION_TYPE
See Also:
Constant Field Values

KERBEROS_KEYTAB

public static final String KERBEROS_KEYTAB
See Also:
Constant Field Values

KERBEROS_PRINCIPAL

public static final String KERBEROS_PRINCIPAL
See Also:
Constant Field Values

JOB_TRACKER_WHITELIST

public static final String JOB_TRACKER_WHITELIST
See Also:
Constant Field Values

NAME_NODE_WHITELIST

public static final String NAME_NODE_WHITELIST
See Also:
Constant Field Values
Constructor Detail

HadoopService

public HadoopService()
Method Detail

init

protected void init()
             throws ServiceException
Description copied from class: BaseService
Initializes the server.

This method is called by BaseService.init(Server) after all service properties (properties prefixed with

Specified by:
init in class BaseService
Throws:
ServiceException - thrown if the service could not be initialized.

postInit

public void postInit()
              throws ServiceException
Description copied from class: BaseService
Post initializes the service. This method is called by the Server after all services of the server have been initialized.

This method does a NOP.

Specified by:
postInit in interface Service
Overrides:
postInit in class BaseService
Throws:
ServiceException - thrown if the service could not be post-initialized.

getInterface

public Class getInterface()
Description copied from interface: Service
Returns the interface implemented by this service. This interface is used the Server when the Server.get(Class) method is used to retrieve a service.

Specified by:
getInterface in interface Service
Returns:
the interface that identifies the service.

getServiceDependencies

public Class[] getServiceDependencies()
Description copied from class: BaseService
Returns the service dependencies of this service. The service will be instantiated only if all the service dependencies are already initialized.

This method returns an empty array (size 0)

Specified by:
getServiceDependencies in interface Service
Overrides:
getServiceDependencies in class BaseService
Returns:
an empty array (size 0).

getUGI

protected org.apache.hadoop.security.UserGroupInformation getUGI(String user)
                                                          throws IOException
Throws:
IOException

setRequiredServiceHadoopConf

protected void setRequiredServiceHadoopConf(org.apache.hadoop.conf.Configuration conf)

createHadoopConf

protected org.apache.hadoop.mapred.JobConf createHadoopConf(org.apache.hadoop.conf.Configuration conf)

createJobTrackerConf

protected org.apache.hadoop.mapred.JobConf createJobTrackerConf(org.apache.hadoop.conf.Configuration conf)

createNameNodeConf

protected org.apache.hadoop.conf.Configuration createNameNodeConf(org.apache.hadoop.conf.Configuration conf)

createFileSystem

protected org.apache.hadoop.fs.FileSystem createFileSystem(org.apache.hadoop.conf.Configuration namenodeConf)
                                                    throws IOException
Throws:
IOException

closeFileSystem

protected void closeFileSystem(org.apache.hadoop.fs.FileSystem fs)
                        throws IOException
Throws:
IOException

createJobClient

protected org.apache.hadoop.mapred.JobClient createJobClient(org.apache.hadoop.mapred.JobConf jobtrackerConf)
                                                      throws IOException
Throws:
IOException

closeJobClient

protected void closeJobClient(org.apache.hadoop.mapred.JobClient jobClient)
                       throws IOException
Throws:
IOException

validateJobtracker

protected void validateJobtracker(String jobtracker)
                           throws HadoopException
Throws:
HadoopException

validateNamenode

protected void validateNamenode(String namenode)
                         throws HadoopException
Throws:
HadoopException

checkJobTrackerHealth

protected void checkJobTrackerHealth(org.apache.hadoop.mapred.JobClient jobClient)
                              throws HadoopException
Throws:
HadoopException

checkNameNodeHealth

protected void checkNameNodeHealth(org.apache.hadoop.fs.FileSystem fileSystem)
                            throws HadoopException
Throws:
HadoopException

execute

public <T> T execute(String user,
                     org.apache.hadoop.conf.Configuration conf,
                     Hadoop.FileSystemExecutor<T> executor)
          throws HadoopException
Specified by:
execute in interface Hadoop
Throws:
HadoopException

execute

public <T> T execute(String user,
                     org.apache.hadoop.conf.Configuration conf,
                     Hadoop.JobClientExecutor<T> executor)
          throws HadoopException
Specified by:
execute in interface Hadoop
Throws:
HadoopException

createFileSystemInternal

public org.apache.hadoop.fs.FileSystem createFileSystemInternal(String user,
                                                                org.apache.hadoop.conf.Configuration conf)
                                                         throws IOException,
                                                                HadoopException
Throws:
IOException
HadoopException

createFileSystem

public org.apache.hadoop.fs.FileSystem createFileSystem(String user,
                                                        org.apache.hadoop.conf.Configuration conf)
                                                 throws IOException,
                                                        HadoopException
Specified by:
createFileSystem in interface Hadoop
Throws:
IOException
HadoopException

releaseFileSystem

public void releaseFileSystem(org.apache.hadoop.fs.FileSystem fs)
                       throws IOException
Specified by:
releaseFileSystem in interface Hadoop
Throws:
IOException

getDefaultConfiguration

public org.apache.hadoop.conf.Configuration getDefaultConfiguration()
Specified by:
getDefaultConfiguration in interface Hadoop


Copyright © 2012 Cloudera. All Rights Reserved.