public class HadoopDataSource extends AbstractDirectDataSource implements org.apache.hadoop.conf.Configurable
AbstractDirectDataSource
using FileSystem
.Constructor and Description |
---|
HadoopDataSource() |
Modifier and Type | Method and Description |
---|---|
void |
cleanupAttemptOutput(OutputAttemptContext context)
Cleanup output on the attempt.
|
void |
cleanupTransactionOutput(OutputTransactionContext context)
Cleanup output on the transaction.
|
void |
commitAttemptOutput(OutputAttemptContext context)
Commits output on the attempt.
|
void |
commitTransactionOutput(OutputTransactionContext context)
Commits output on the transaction.
|
void |
configure(DirectDataSourceProfile profile)
Configures this data source.
|
boolean |
delete(String basePath,
ResourcePattern resourcePattern,
boolean recursive,
Counter counter)
Deletes resources.
|
<T> List<DirectInputFragment> |
findInputFragments(DataDefinition<T> definition,
String basePath,
ResourcePattern resourcePattern)
Collects input fragments about target resources.
|
<T> Optional<T> |
findProperty(Class<T> propertyType)
Returns the property of this data source.
|
org.apache.hadoop.conf.Configuration |
getConf() |
List<ResourceInfo> |
list(String basePath,
ResourcePattern resourcePattern,
Counter counter)
List resources.
|
<T> ModelInput<T> |
openInput(DataDefinition<T> definition,
DirectInputFragment fragment,
Counter counter)
Opens a fragment for input.
|
<T> ModelOutput<T> |
openOutput(OutputAttemptContext context,
DataDefinition<T> definition,
String basePath,
String resourcePath,
Counter counter)
Opens a resource for output.
|
String |
path(String basePath)
Returns a textually representation of the target path.
|
String |
path(String basePath,
ResourcePattern resourcePattern)
Returns a textually representation of the target path pattern.
|
void |
setConf(org.apache.hadoop.conf.Configuration conf) |
void |
setupAttemptOutput(OutputAttemptContext context)
Prepares output area for the attempt.
|
void |
setupTransactionOutput(OutputTransactionContext context)
Prepares output area for the transaction.
|
public org.apache.hadoop.conf.Configuration getConf()
getConf
in interface org.apache.hadoop.conf.Configurable
public void setConf(org.apache.hadoop.conf.Configuration conf)
setConf
in interface org.apache.hadoop.conf.Configurable
public void configure(DirectDataSourceProfile profile) throws IOException, InterruptedException
AbstractDirectDataSource
configure
in class AbstractDirectDataSource
profile
- profile objectIOException
- if failed to configure this objectInterruptedException
- if interruptedpublic String path(String basePath, ResourcePattern resourcePattern)
DirectDataSource
path
in interface DirectDataSource
basePath
- base path of target resourcesresourcePattern
- search pattern of target resources from basePath
public String path(String basePath)
DirectDataSource
path
in interface DirectDataSource
basePath
- base path of target resourcespublic <T> List<DirectInputFragment> findInputFragments(DataDefinition<T> definition, String basePath, ResourcePattern resourcePattern) throws IOException, InterruptedException
DirectDataSource
findInputFragments
in interface DirectDataSource
T
- target data typedefinition
- the data definitionbasePath
- base path of target resourcesresourcePattern
- search pattern of target resources from basePath
IOException
- if failed to find resources by I/O errorInterruptedException
- if interrupted while finding fragmentspublic <T> ModelInput<T> openInput(DataDefinition<T> definition, DirectInputFragment fragment, Counter counter) throws IOException, InterruptedException
DirectDataSource
openInput
in interface DirectDataSource
T
- target data typedefinition
- the data definitionfragment
- target fragmentcounter
- counter objectModelInput
to obtain contents in the fragmentIOException
- if failed to open the fragment by I/O errorInterruptedException
- if interruptedpublic <T> ModelOutput<T> openOutput(OutputAttemptContext context, DataDefinition<T> definition, String basePath, String resourcePath, Counter counter) throws IOException, InterruptedException
DirectDataSource
openOutput
in interface DirectDataSource
T
- target data typecontext
- current output attempt contextdefinition
- the data definitionbasePath
- base path of target resourceresourcePath
- target resource path from basePath
counter
- counter objectModelOutput
to put contents to the resourceIOException
- if failed to open the resource by I/O errorInterruptedException
- if interruptedpublic List<ResourceInfo> list(String basePath, ResourcePattern resourcePattern, Counter counter) throws IOException, InterruptedException
DirectDataSource
list
in interface DirectDataSource
basePath
- base path of target resourcesresourcePattern
- search pattern of target resources from basePath
counter
- the resource counterIOException
- if failed to list resources by I/O errorInterruptedException
- if interruptedpublic boolean delete(String basePath, ResourcePattern resourcePattern, boolean recursive, Counter counter) throws IOException, InterruptedException
DirectDataSource
delete
in interface DirectDataSource
basePath
- base path of target resourcesresourcePattern
- search pattern of target resources from basePath
recursive
- also deletes containers and thier components recursively
(only if this datasource supports containers)counter
- the resource countertrue
if successfully deleted, otherwise false
IOException
- if failed to delete resources by I/O errorInterruptedException
- if interruptedpublic void setupAttemptOutput(OutputAttemptContext context) throws IOException, InterruptedException
DirectDataSource
setupAttemptOutput
in interface DirectDataSource
context
- current attempt contextIOException
- if failed by I/O errorInterruptedException
- if interruptedpublic void commitAttemptOutput(OutputAttemptContext context) throws IOException, InterruptedException
DirectDataSource
commitAttemptOutput
in interface DirectDataSource
context
- current attempt contextIOException
- if failed by I/O errorInterruptedException
- if interruptedpublic void cleanupAttemptOutput(OutputAttemptContext context) throws IOException, InterruptedException
DirectDataSource
cleanupAttemptOutput
in interface DirectDataSource
context
- current attempt contextIOException
- if failed by I/O errorInterruptedException
- if interruptedpublic void setupTransactionOutput(OutputTransactionContext context) throws IOException, InterruptedException
DirectDataSource
setupTransactionOutput
in interface DirectDataSource
context
- current transaction contextIOException
- if failed by I/O errorInterruptedException
- if interruptedpublic void commitTransactionOutput(OutputTransactionContext context) throws IOException, InterruptedException
DirectDataSource
commitTransactionOutput
in interface DirectDataSource
context
- current transaction contextIOException
- if failed by I/O errorInterruptedException
- if interruptedpublic void cleanupTransactionOutput(OutputTransactionContext context) throws IOException, InterruptedException
DirectDataSource
cleanupTransactionOutput
in interface DirectDataSource
context
- current transaction contextIOException
- if failed by I/O errorInterruptedException
- if interruptedpublic <T> Optional<T> findProperty(Class<T> propertyType)
DirectDataSource
findProperty
in interface DirectDataSource
T
- the property typepropertyType
- the property typeempty
if it is not definedCopyright © 2011–2019 Asakusa Framework Team. All rights reserved.