public abstract class OutputStoreObjectSupport extends StoreObjectSupport
OutputStoreObjectSupport
is meant to be used from a store
DataWriter
implementations by keeping current writing state.Constructor and Description |
---|
OutputStoreObjectSupport(org.apache.hadoop.conf.Configuration configuration,
org.apache.hadoop.fs.Path basePath,
CodecInfo codec)
Instantiates a new abstract output store support.
|
Modifier and Type | Method and Description |
---|---|
protected org.apache.hadoop.fs.FileStatus[] |
findInitFiles(org.apache.hadoop.fs.Path basePath) |
OutputContext |
getOutputContext()
Gets the strategy context.
|
protected org.apache.hadoop.fs.Path |
getResolvedPath()
Gets the resolved path.
|
protected void |
initOutputContext() |
boolean |
isAppendable()
Checks if file is appendable
|
protected boolean |
isFileWriteable(org.apache.hadoop.fs.Path p) |
boolean |
isOverwrite()
Checks if overwrite is enabled.
|
boolean |
isSyncable()
Checks if syncable is enabled.
|
protected void |
onInit()
Subclasses may implement this for initialization logic.
|
protected org.apache.hadoop.fs.Path |
renameFile(org.apache.hadoop.fs.Path path)
Rename file using prefix and suffix settings.
|
void |
setAppendable(boolean append)
Set stream as append mode.
|
void |
setFileNamingStrategy(FileNamingStrategy fileNamingStrategy)
Sets the file naming strategy.
|
void |
setInWritingPrefix(java.lang.String prefix)
Sets the in writing prefix.
|
void |
setInWritingSuffix(java.lang.String suffix)
Sets the in writing suffix.
|
void |
setOverwrite(boolean overwrite)
Sets the flag indicating if written files may be overwritten.
|
void |
setRolloverStrategy(RolloverStrategy rolloverStrategy)
Sets the rollover strategy.
|
void |
setSyncable(boolean syncable)
Sets the syncable.
|
protected void |
setWritePosition(long position)
Sets the write position.
|
doStart, doStop, flushTimeout, getCodec, getConfiguration, getPath, handleTimeout, isCompressed, resetIdleTimeout, setCloseTimeout, setFlushTimeout, setIdleTimeout
afterPropertiesSet, getBeanFactory, getPhase, getStoreEventPublisher, getTaskExecutor, getTaskScheduler, isAutoStartup, isRunning, setAutoStartup, setBeanFactory, setPhase, setStoreEventPublisher, setTaskExecutor, setTaskScheduler, start, stop, stop
public OutputStoreObjectSupport(org.apache.hadoop.conf.Configuration configuration, org.apache.hadoop.fs.Path basePath, CodecInfo codec)
configuration
- the hadoop configurationbasePath
- the hdfs pathcodec
- the compression codec infoprotected void onInit() throws java.lang.Exception
LifecycleObjectSupport
InitializingBean
phase.
Implementor should always call super method not to break initialization chain.onInit
in class StoreObjectSupport
java.lang.Exception
- if error occurred during initprotected void initOutputContext() throws java.lang.Exception
java.lang.Exception
protected org.apache.hadoop.fs.FileStatus[] findInitFiles(org.apache.hadoop.fs.Path basePath) throws java.lang.Exception
java.lang.Exception
public OutputContext getOutputContext()
public void setFileNamingStrategy(FileNamingStrategy fileNamingStrategy)
StrategyContext
.fileNamingStrategy
- the new file naming strategypublic void setRolloverStrategy(RolloverStrategy rolloverStrategy)
StrategyContext
.rolloverStrategy
- the new rollover strategypublic void setInWritingSuffix(java.lang.String suffix)
suffix
- the new in writing suffixpublic void setInWritingPrefix(java.lang.String prefix)
prefix
- the new in writing prefixpublic void setOverwrite(boolean overwrite)
FALSE
meaning StoreException
is thrown if file is about to get overwritten.overwrite
- the new overwritepublic boolean isOverwrite()
setOverwrite(boolean)
public boolean isAppendable()
public void setAppendable(boolean append)
append
- the append flagpublic boolean isSyncable()
public void setSyncable(boolean syncable)
syncable
- the syncable flagprotected org.apache.hadoop.fs.Path getResolvedPath()
protected boolean isFileWriteable(org.apache.hadoop.fs.Path p)
protected void setWritePosition(long position)
position
- the new write positionprotected org.apache.hadoop.fs.Path renameFile(org.apache.hadoop.fs.Path path)
path
- the path to rename