public class HadoopDataSourceCore extends Object implements DirectDataSource
DirectDataSource
using FileSystem
.Constructor and Description |
---|
HadoopDataSourceCore(HadoopDataSourceProfile profile)
Creates a new instance.
|
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.
|
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.
|
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 |
setupAttemptOutput(OutputAttemptContext context)
Prepares output area for the attempt.
|
void |
setupTransactionOutput(OutputTransactionContext context)
Prepares output area for the transaction.
|
public HadoopDataSourceCore(HadoopDataSourceProfile profile)
profile
- profile of target data sourceIllegalArgumentException
- if some parameters were null
public 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.