public class KeepAliveDataSource extends Object implements DirectDataSource
DirectDataSource that sends heartbeat continuously.| Constructor and Description |
|---|
KeepAliveDataSource(DirectDataSource entity,
long interval)
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 KeepAliveDataSource(DirectDataSource entity, long interval)
entity - component DirectDataSourceinterval - heartbeat intervalIllegalArgumentException - if some parameters were nullpublic String path(String basePath, ResourcePattern resourcePattern)
DirectDataSourcepath in interface DirectDataSourcebasePath - base path of target resourcesresourcePattern - search pattern of target resources from basePathpublic String path(String basePath)
DirectDataSourcepath in interface DirectDataSourcebasePath - base path of target resourcespublic <T> List<DirectInputFragment> findInputFragments(DataDefinition<T> definition, String basePath, ResourcePattern resourcePattern) throws IOException, InterruptedException
DirectDataSourcefindInputFragments in interface DirectDataSourceT - target data typedefinition - the data definitionbasePath - base path of target resourcesresourcePattern - search pattern of target resources from basePathIOException - 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
DirectDataSourceopenInput in interface DirectDataSourceT - 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
DirectDataSourceopenOutput in interface DirectDataSourceT - target data typecontext - current output attempt contextdefinition - the data definitionbasePath - base path of target resourceresourcePath - target resource path from basePathcounter - 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
DirectDataSourcelist in interface DirectDataSourcebasePath - base path of target resourcesresourcePattern - search pattern of target resources from basePathcounter - 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
DirectDataSourcedelete in interface DirectDataSourcebasePath - base path of target resourcesresourcePattern - search pattern of target resources from basePathrecursive - also deletes containers and thier components recursively
(only if this datasource supports containers)counter - the resource countertrue if successfully deleted, otherwise falseIOException - if failed to delete resources by I/O errorInterruptedException - if interruptedpublic void setupAttemptOutput(OutputAttemptContext context) throws IOException, InterruptedException
DirectDataSourcesetupAttemptOutput in interface DirectDataSourcecontext - current attempt contextIOException - if failed by I/O errorInterruptedException - if interruptedpublic void commitAttemptOutput(OutputAttemptContext context) throws IOException, InterruptedException
DirectDataSourcecommitAttemptOutput in interface DirectDataSourcecontext - current attempt contextIOException - if failed by I/O errorInterruptedException - if interruptedpublic void cleanupAttemptOutput(OutputAttemptContext context) throws IOException, InterruptedException
DirectDataSourcecleanupAttemptOutput in interface DirectDataSourcecontext - current attempt contextIOException - if failed by I/O errorInterruptedException - if interruptedpublic void setupTransactionOutput(OutputTransactionContext context) throws IOException, InterruptedException
DirectDataSourcesetupTransactionOutput in interface DirectDataSourcecontext - current transaction contextIOException - if failed by I/O errorInterruptedException - if interruptedpublic void commitTransactionOutput(OutputTransactionContext context) throws IOException, InterruptedException
DirectDataSourcecommitTransactionOutput in interface DirectDataSourcecontext - current transaction contextIOException - if failed by I/O errorInterruptedException - if interruptedpublic void cleanupTransactionOutput(OutputTransactionContext context) throws IOException, InterruptedException
DirectDataSourcecleanupTransactionOutput in interface DirectDataSourcecontext - current transaction contextIOException - if failed by I/O errorInterruptedException - if interruptedpublic <T> Optional<T> findProperty(Class<T> propertyType)
DirectDataSourcefindProperty in interface DirectDataSourceT - the property typepropertyType - the property typeempty if it is not definedCopyright © 2011–2018 Asakusa Framework Team. All rights reserved.