T
- the type of entity to writeR
- the type of entity in writerpublic abstract class AbstractDatasetStoreWriter<T,R> extends DatasetStoreObjectSupport implements DataStoreWriter<T>
DataStoreWriter
to be extended for providing Dataset writing
capabilities for specific use cases.Modifier | Constructor and Description |
---|---|
protected |
AbstractDatasetStoreWriter(java.lang.Class<T> entityClass,
DatasetRepositoryFactory datasetRepositoryFactory,
DatasetDefinition datasetDefinition)
Instantiates a new
DataStoreWriter for writing to a org.kitesdk.data.Dataset . |
Modifier and Type | Method and Description |
---|---|
void |
close() |
protected abstract R |
convertEntity(T entity)
Convert entity to be written into a entity used
by a writer.
|
protected abstract org.kitesdk.data.DatasetWriter<R> |
createWriter()
Creates a
DatasetWriter . |
void |
flush() |
protected DatasetDefinition |
getDatasetDefinition()
Gets the dataset definition.
|
protected DatasetRepositoryFactory |
getDatasetRepositoryFactory()
Gets the dataset repository factory.
|
protected java.lang.Class<T> |
getEntityClass()
Gets the entity class.
|
protected void |
handleTimeout()
Handle idle timeout.
|
void |
write(T entity)
Write an entity.
|
doStart, doStop, onInit, resetIdleTimeout, setCloseTimeout, setIdleTimeout
afterPropertiesSet, getBeanFactory, getPhase, getStoreEventPublisher, getTaskExecutor, getTaskScheduler, isAutoStartup, isRunning, setAutoStartup, setBeanFactory, setPhase, setStoreEventPublisher, setTaskExecutor, setTaskScheduler, start, stop, stop
protected AbstractDatasetStoreWriter(java.lang.Class<T> entityClass, DatasetRepositoryFactory datasetRepositoryFactory, DatasetDefinition datasetDefinition)
DataStoreWriter
for writing to a org.kitesdk.data.Dataset
.entityClass
- the Class
that the writer will write to the DatasetdatasetRepositoryFactory
- the DatasetRepositoryFactory
to be used for the writerdatasetDefinition
- the DatasetDefinition
to be used for the writerpublic void write(T entity) throws java.io.IOException
DataWriter
write
in interface DataWriter<T>
entity
- the entity to writejava.io.IOException
- if an I/O error occurspublic void flush() throws java.io.IOException
flush
in interface java.io.Flushable
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
java.io.IOException
protected void handleTimeout()
DatasetStoreObjectSupport
handleTimeout
in class DatasetStoreObjectSupport
protected abstract R convertEntity(T entity)
entity
- the entityprotected java.lang.Class<T> getEntityClass()
protected DatasetRepositoryFactory getDatasetRepositoryFactory()
protected DatasetDefinition getDatasetDefinition()
protected abstract org.kitesdk.data.DatasetWriter<R> createWriter()
DatasetWriter
.