org.jboss.system.server.profileservice.repository.clustered.local.file
Class FileReadAction

java.lang.Object
  extended by org.jboss.system.server.profileservice.repository.clustered.sync.AbstractSynchronizationAction<FileBasedSynchronizationActionContext>
      extended by org.jboss.system.server.profileservice.repository.clustered.local.file.FileReadAction
All Implemented Interfaces:
SynchronizationAction<FileBasedSynchronizationActionContext>, SynchronizationReadAction<FileBasedSynchronizationActionContext>, TwoPhaseCommitAction<FileBasedSynchronizationActionContext>

public class FileReadAction
extends AbstractSynchronizationAction<FileBasedSynchronizationActionContext>
implements SynchronizationReadAction<FileBasedSynchronizationActionContext>

SynchronizationReadAction that reads from a File.

Version:
$Revision: $
Author:
Brian Stansberry

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jboss.system.server.profileservice.repository.clustered.sync.AbstractSynchronizationAction
AbstractSynchronizationAction.State
 
Field Summary
static int MAX_CHUNK_BUFFER_SIZE
          Max file transfer buffer size that we read at a time.
 
Constructor Summary
FileReadAction(File file, FileBasedSynchronizationActionContext context, ContentModification modification)
          Create a new FileReadAction.
 
Method Summary
protected  void doCancel()
           
protected  void doCommit()
           
protected  void doComplete()
           
protected  boolean doPrepare()
           
protected  void doRollbackFromCancelled()
           
protected  void doRollbackFromComplete()
           
protected  void doRollbackFromOpen()
           
protected  void doRollbackFromPrepared()
           
protected  void doRollbackFromRollbackOnly()
           
 ByteChunk getNextBytes()
          Gets the next chunk of bytes from the item associated with this action.
 
Methods inherited from class org.jboss.system.server.profileservice.repository.clustered.sync.AbstractSynchronizationAction
cancel, commit, complete, getContext, getMarkedRemovedItem, getRepositoryContentModification, getState, isCancelled, isComplete, prepare, rollback
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jboss.system.server.profileservice.repository.clustered.sync.SynchronizationAction
cancel, complete, getContext, getRepositoryContentModification, isCancelled, isComplete
 

Field Detail

MAX_CHUNK_BUFFER_SIZE

public static final int MAX_CHUNK_BUFFER_SIZE
Max file transfer buffer size that we read at a time. This influences the number of times that we will invoke disk read/write file operations versus how much memory we will consume for a file transfer.

See Also:
Constant Field Values
Constructor Detail

FileReadAction

public FileReadAction(File file,
                      FileBasedSynchronizationActionContext context,
                      ContentModification modification)
Create a new FileReadAction.

Parameters:
file - the file to read
context - the overall context of the modification
modification - the modification
Method Detail

getNextBytes

public ByteChunk getNextBytes()
                       throws IOException
Description copied from interface: SynchronizationReadAction
Gets the next chunk of bytes from the item associated with this action. Each call to this method will retrieve more bytes

Specified by:
getNextBytes in interface SynchronizationReadAction<FileBasedSynchronizationActionContext>
Returns:
a ByteChunk.
Throws:
IOException - if there is a problem reading the bytes.

doCancel

protected void doCancel()
Specified by:
doCancel in class AbstractSynchronizationAction<FileBasedSynchronizationActionContext>

doCommit

protected void doCommit()
Specified by:
doCommit in class AbstractSynchronizationAction<FileBasedSynchronizationActionContext>

doComplete

protected void doComplete()
                   throws Exception
Specified by:
doComplete in class AbstractSynchronizationAction<FileBasedSynchronizationActionContext>
Throws:
Exception

doPrepare

protected boolean doPrepare()
Specified by:
doPrepare in class AbstractSynchronizationAction<FileBasedSynchronizationActionContext>

doRollbackFromCancelled

protected void doRollbackFromCancelled()
Specified by:
doRollbackFromCancelled in class AbstractSynchronizationAction<FileBasedSynchronizationActionContext>

doRollbackFromComplete

protected void doRollbackFromComplete()
Specified by:
doRollbackFromComplete in class AbstractSynchronizationAction<FileBasedSynchronizationActionContext>

doRollbackFromOpen

protected void doRollbackFromOpen()
Specified by:
doRollbackFromOpen in class AbstractSynchronizationAction<FileBasedSynchronizationActionContext>

doRollbackFromPrepared

protected void doRollbackFromPrepared()
Specified by:
doRollbackFromPrepared in class AbstractSynchronizationAction<FileBasedSynchronizationActionContext>

doRollbackFromRollbackOnly

protected void doRollbackFromRollbackOnly()
Specified by:
doRollbackFromRollbackOnly in class AbstractSynchronizationAction<FileBasedSynchronizationActionContext>


Copyright © 2009 JBoss, a division of Red Hat, Inc.. All Rights Reserved.