org.apache.oozie.service
Class HadoopAccessorService

java.lang.Object
  extended by org.apache.oozie.service.HadoopAccessorService
All Implemented Interfaces:
Service
Direct Known Subclasses:
KerberosHadoopAccessorService

public class HadoopAccessorService
extends Object
implements Service

The HadoopAccessorService returns HadoopAccessor instances configured to work on behalf of a user-group.

The default accessor used is the base accessor which just injects the UGI into the configuration instance used to create/obtain JobClient and ileSystem instances.

The HadoopAccess class to use can be configured in the oozie-site.xml using the oozie.service.HadoopAccessorService.accessor.class property.


Field Summary
static String CONF_PREFIX
           
static String JOB_TRACKER_WHITELIST
           
static String NAME_NODE_WHITELIST
           
 
Fields inherited from interface org.apache.oozie.service.Service
DEFAULT_LOCK_TIMEOUT, lockTimeout, USE_XCOMMAND
 
Constructor Summary
HadoopAccessorService()
           
 
Method Summary
 void addFileToClassPath(String user, String group, org.apache.hadoop.fs.Path file, org.apache.hadoop.conf.Configuration conf)
          Add a file to the ClassPath via the DistributedCache.
 org.apache.hadoop.fs.FileSystem createFileSystem(String user, String group, org.apache.hadoop.conf.Configuration conf)
          Return a FileSystem created with the provided user/group.
 org.apache.hadoop.fs.FileSystem createFileSystem(String user, String group, URI uri, org.apache.hadoop.conf.Configuration conf)
          Return a FileSystem created with the provided user/group for the specified URI.
 org.apache.hadoop.mapred.JobClient createJobClient(String user, String group, org.apache.hadoop.mapred.JobConf conf)
          Return a JobClient created with the provided user/group.
 void destroy()
          Destroy the service.
 Class<? extends Service> getInterface()
          Return the public interface of the service.
 void init(org.apache.hadoop.conf.Configuration serviceConf)
           
 void init(Services services)
          Initialize the service.
protected  void validateJobTracker(String jobTrackerUri)
          Validate Job tracker
protected  void validateNameNode(String nameNodeUri)
          Validate Namenode list
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONF_PREFIX

public static final String CONF_PREFIX
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

HadoopAccessorService

public HadoopAccessorService()
Method Detail

init

public void init(Services services)
          throws ServiceException
Description copied from interface: Service
Initialize the service.

Invoked by the Service singleton at start up time.

Specified by:
init in interface Service
Parameters:
services - services singleton initializing the service.
Throws:
ServiceException - thrown if the service could not initialize.

init

public void init(org.apache.hadoop.conf.Configuration serviceConf)
          throws ServiceException
Throws:
ServiceException

destroy

public void destroy()
Description copied from interface: Service
Destroy the service.

Invoked by the Service singleton at shutdown time.

Specified by:
destroy in interface Service

getInterface

public Class<? extends Service> getInterface()
Description copied from interface: Service
Return the public interface of the service.

Services are retrieved by its public interface. Specializations of services must return the public interface.

Specified by:
getInterface in interface Service
Returns:
the interface of the service.

createJobClient

public org.apache.hadoop.mapred.JobClient createJobClient(String user,
                                                          String group,
                                                          org.apache.hadoop.mapred.JobConf conf)
                                                   throws HadoopAccessorException
Return a JobClient created with the provided user/group.

Parameters:
conf - JobConf with all necessary information to create the JobClient.
Returns:
JobClient created with the provided user/group.
Throws:
HadoopAccessorException - if the client could not be created.

createFileSystem

public org.apache.hadoop.fs.FileSystem createFileSystem(String user,
                                                        String group,
                                                        org.apache.hadoop.conf.Configuration conf)
                                                 throws HadoopAccessorException
Return a FileSystem created with the provided user/group.

Parameters:
conf - Configuration with all necessary information to create the FileSystem.
Returns:
FileSystem created with the provided user/group.
Throws:
HadoopAccessorException - if the filesystem could not be created.

createFileSystem

public org.apache.hadoop.fs.FileSystem createFileSystem(String user,
                                                        String group,
                                                        URI uri,
                                                        org.apache.hadoop.conf.Configuration conf)
                                                 throws HadoopAccessorException
Return a FileSystem created with the provided user/group for the specified URI.

Parameters:
uri - file system URI.
conf - Configuration with all necessary information to create the FileSystem.
Returns:
FileSystem created with the provided user/group.
Throws:
HadoopAccessorException - if the filesystem could not be created.

validateJobTracker

protected void validateJobTracker(String jobTrackerUri)
                           throws HadoopAccessorException
Validate Job tracker

Parameters:
jobTrackerUri -
Throws:
HadoopAccessorException

validateNameNode

protected void validateNameNode(String nameNodeUri)
                         throws HadoopAccessorException
Validate Namenode list

Parameters:
nameNodeUri -
Throws:
HadoopAccessorException

addFileToClassPath

public void addFileToClassPath(String user,
                               String group,
                               org.apache.hadoop.fs.Path file,
                               org.apache.hadoop.conf.Configuration conf)
                        throws IOException
Add a file to the ClassPath via the DistributedCache.

Throws:
IOException


Copyright © 2012 Apache Software Foundation. All Rights Reserved.