Spring for Apache Hadoop

org.springframework.data.hadoop.store.support
Class OutputStoreObjectSupport

java.lang.Object
  extended by org.springframework.data.hadoop.store.support.LifecycleObjectSupport
      extended by org.springframework.data.hadoop.store.support.StoreObjectSupport
          extended by org.springframework.data.hadoop.store.support.OutputStoreObjectSupport
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.InitializingBean, org.springframework.context.Lifecycle, org.springframework.context.Phased, org.springframework.context.SmartLifecycle
Direct Known Subclasses:
AbstractDataStreamWriter, AbstractSequenceFileWriter

public abstract class OutputStoreObjectSupport
extends StoreObjectSupport

A OutputStoreObjectSupport is meant to be used from a store DataWriter implementations by keeping current writing state.

Author:
Janne Valkealahti

Constructor Summary
OutputStoreObjectSupport(org.apache.hadoop.conf.Configuration configuration, org.apache.hadoop.fs.Path basePath, CodecInfo codec)
          Instantiates a new abstract output store support.
 
Method Summary
 OutputContext getOutputContext()
          Gets the strategy context.
protected  org.apache.hadoop.fs.Path getResolvedPath()
          Gets the resolved path.
protected  void onInit()
          Subclasses may implement this for initialization logic.
protected  void renameFile(org.apache.hadoop.fs.Path path)
          Rename file using prefix and suffix settings.
 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.
protected  void setWritePosition(long position)
          Sets the write position.
 
Methods inherited from class org.springframework.data.hadoop.store.support.StoreObjectSupport
doStart, doStop, getCodec, getConfiguration, getPath, handleIdleTimeout, isCompressed, resetIdleTimeout, setIdleTimeout
 
Methods inherited from class org.springframework.data.hadoop.store.support.LifecycleObjectSupport
afterPropertiesSet, getBeanFactory, getPhase, getStoreEventPublisher, getTaskExecutor, getTaskScheduler, isAutoStartup, isRunning, setAutoStartup, setBeanFactory, setPhase, setStoreEventPublisher, setTaskExecutor, setTaskScheduler, start, stop, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OutputStoreObjectSupport

public OutputStoreObjectSupport(org.apache.hadoop.conf.Configuration configuration,
                                org.apache.hadoop.fs.Path basePath,
                                CodecInfo codec)
Instantiates a new abstract output store support.

Parameters:
configuration - the hadoop configuration
basePath - the hdfs path
codec - the compression codec info
Method Detail

onInit

protected void onInit()
               throws java.lang.Exception
Description copied from class: LifecycleObjectSupport
Subclasses may implement this for initialization logic. Called during the InitializingBean phase. Implementor should always call super method not to break initialization chain.

Overrides:
onInit in class StoreObjectSupport
Throws:
java.lang.Exception

getOutputContext

public OutputContext getOutputContext()
Gets the strategy context.

Returns:
the strategy context

setFileNamingStrategy

public void setFileNamingStrategy(FileNamingStrategy fileNamingStrategy)
Sets the file naming strategy. Default implementation delegates to StrategyContext.

Parameters:
fileNamingStrategy - the new file naming strategy

setRolloverStrategy

public void setRolloverStrategy(RolloverStrategy rolloverStrategy)
Sets the rollover strategy. Default implementation delegates to StrategyContext.

Parameters:
rolloverStrategy - the new rollover strategy

setInWritingSuffix

public void setInWritingSuffix(java.lang.String suffix)
Sets the in writing suffix.

Parameters:
suffix - the new in writing suffix

setInWritingPrefix

public void setInWritingPrefix(java.lang.String prefix)
Sets the in writing prefix.

Parameters:
prefix - the new in writing prefix

setOverwrite

public void setOverwrite(boolean overwrite)
Sets the flag indicating if written files may be overwritten. Default value is FALSE meaning StoreException is thrown if file is about to get overwritten.

Parameters:
overwrite - the new overwrite

getResolvedPath

protected org.apache.hadoop.fs.Path getResolvedPath()
Gets the resolved path.

Returns:
the resolved path

setWritePosition

protected void setWritePosition(long position)
Sets the write position.

Parameters:
position - the new write position

renameFile

protected void renameFile(org.apache.hadoop.fs.Path path)
Rename file using prefix and suffix settings.

Parameters:
path - the path to rename

Spring for Apache Hadoop