public class DatasetTemplate extends java.lang.Object implements org.springframework.beans.factory.InitializingBean, DatasetOperations
Dataset
s,
DatasetReader
s and DatasetWriter
sConstructor and Description |
---|
DatasetTemplate() |
DatasetTemplate(DatasetRepositoryFactory dsFactory) |
DatasetTemplate(DatasetRepositoryFactory dsFactory,
DatasetDefinition defaultDatasetDefinition) |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet() |
void |
execute(DatasetRepositoryCallback callback)
Execute a callback for the
DatasetRepository |
java.util.Collection<DatasetDefinition> |
getDatasetDefinitions()
The
DatasetDefinition s used for this template. |
<T> org.kitesdk.data.DatasetDescriptor |
getDatasetDescriptor(java.lang.Class<T> targetClass)
Get the
DatasetDescriptor for the given class |
<T> java.lang.String |
getDatasetName(java.lang.Class<T> clazz)
Get the dataset name to be used for the given class
|
DatasetDefinition |
getDefaultDatasetDefinition()
The default
DatasetDefinition used for this template. |
<T> java.util.Collection<T> |
read(java.lang.Class<T> targetClass)
Read all records in the dataset and return as a collection.
|
<T> void |
read(java.lang.Class<T> targetClass,
RecordCallback<T> callback)
Read all records in the dataset and call the provided callback for each record.
|
<T> void |
read(java.lang.Class<T> targetClass,
RecordCallback<T> callback,
ViewCallback viewCallback)
Read records in the dataset partition based on a
RefinableView and call the provided callback for each record. |
<T> java.util.Collection<T> |
read(java.lang.Class<T> targetClass,
ViewCallback viewCallback)
Read records in the dataset partition based on the
RefinableView and return as a collection. |
void |
setDatasetDefinitions(java.util.Collection<DatasetDefinition> datasetDefinitions)
The list of
DatasetDefinition s to use for this template. |
void |
setDatasetRepositoryFactory(DatasetRepositoryFactory datasetRepositoryFactory)
The
DatasetRepositoryFactory to use for this template. |
void |
setDefaultDatasetDefinition(DatasetDefinition defaultDatasetDefinition)
The default
DatasetDefinition to use for this template. |
<T> void |
write(java.util.Collection<T> records)
Write all records provided in the record collection
|
public DatasetTemplate()
public DatasetTemplate(DatasetRepositoryFactory dsFactory)
public DatasetTemplate(DatasetRepositoryFactory dsFactory, DatasetDefinition defaultDatasetDefinition)
public void setDatasetRepositoryFactory(DatasetRepositoryFactory datasetRepositoryFactory)
DatasetRepositoryFactory
to use for this template.datasetRepositoryFactory
- the DatasetRepositoryFactory to usepublic DatasetDefinition getDefaultDatasetDefinition()
DatasetDefinition
used for this template.public void setDefaultDatasetDefinition(DatasetDefinition defaultDatasetDefinition)
DatasetDefinition
to use for this template.defaultDatasetDefinition
- the DatasetDefinition to usepublic java.util.Collection<DatasetDefinition> getDatasetDefinitions()
DatasetDefinition
s used for this template.public void setDatasetDefinitions(java.util.Collection<DatasetDefinition> datasetDefinitions)
DatasetDefinition
s to use for this template.datasetDefinitions
- the DatasetDefinitions to usepublic void afterPropertiesSet() throws java.lang.Exception
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
java.lang.Exception
public <T> void read(java.lang.Class<T> targetClass, RecordCallback<T> callback)
DatasetOperations
read
in interface DatasetOperations
T
- the class typetargetClass
- the class that is stored in the datasetcallback
- the callback to be called for each recordpublic <T> java.util.Collection<T> read(java.lang.Class<T> targetClass)
DatasetOperations
read
in interface DatasetOperations
T
- the class typetargetClass
- the class that is stored in the datasetpublic <T> void read(java.lang.Class<T> targetClass, RecordCallback<T> callback, ViewCallback viewCallback)
DatasetOperations
RefinableView
and call the provided callback for each record.read
in interface DatasetOperations
T
- the class typetargetClass
- the class that is stored in the datasetcallback
- the callback to be called for each recordviewCallback
- the view callback to create the viewpublic <T> java.util.Collection<T> read(java.lang.Class<T> targetClass, ViewCallback viewCallback)
DatasetOperations
RefinableView
and return as a collection.read
in interface DatasetOperations
T
- the class typetargetClass
- the class that is stored in the datasetviewCallback
- the view callback to create the viewpublic <T> void write(java.util.Collection<T> records)
DatasetOperations
write
in interface DatasetOperations
T
- the class typerecords
- the records to writepublic void execute(DatasetRepositoryCallback callback)
DatasetOperations
DatasetRepository
execute
in interface DatasetOperations
callback
- the callbackpublic <T> org.kitesdk.data.DatasetDescriptor getDatasetDescriptor(java.lang.Class<T> targetClass)
DatasetOperations
DatasetDescriptor
for the given classgetDatasetDescriptor
in interface DatasetOperations
T
- the class typetargetClass
- the class stored in the datasetpublic <T> java.lang.String getDatasetName(java.lang.Class<T> clazz)
DatasetOperations
getDatasetName
in interface DatasetOperations
T
- the class typeclazz
- the class stored in the dataset