org.eclipse.ecf.provider.fileshare
Class BaseFileShareSender
java.lang.Object
org.eclipse.ecf.core.sharedobject.AbstractSharedObject
org.eclipse.ecf.core.sharedobject.TransactionSharedObject
org.eclipse.ecf.provider.fileshare.BaseFileShareSender
- All Implemented Interfaces:
- org.eclipse.core.runtime.IAdaptable, IIdentifiable, ISharedObject, IEventHandler, IFileShare
public class BaseFileShareSender
- extends TransactionSharedObject
- implements IFileShare
Methods inherited from class org.eclipse.ecf.core.sharedobject.AbstractSharedObject |
addEventProcessor, clearEventProcessors, creationCompleted, destroyRemote, destroySelf, destroySelfLocal, fireEventProcessors, getConfig, getContext, getGroupID, getHomeContainerID, getID, getLocalContainerID, getProperties, getReplicaDescriptions, getSharedObjectMsgFromEvent, handleEvent, handleEvents, handleSharedObjectCreateResponseEvent, handleSharedObjectMsgEvent, handleUnhandledEvent, init, isConnected, isPrimary, removeEventProcessor, replicateToRemoteContainers, sendSharedObjectMsgTo, sendSharedObjectMsgToPrimary, sendSharedObjectMsgToSelf |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
REMOTE_TARGET_PROP
protected static final java.lang.String REMOTE_TARGET_PROP
SEND_METHOD
protected static final java.lang.String SEND_METHOD
- See Also:
- Constant Field Values
DEFAULT_SEND_BUF_SIZE
public static final int DEFAULT_SEND_BUF_SIZE
- See Also:
- Constant Field Values
RECEIVE_METHOD_NAME
public static final java.lang.String RECEIVE_METHOD_NAME
- See Also:
- Constant Field Values
listener
protected IFileShareListener listener
inputstream
protected java.io.InputStream inputstream
bytesRead
protected int bytesRead
fileLength
protected java.lang.Long fileLength
exception
protected java.lang.Throwable exception
remoteTarget
protected ID remoteTarget
BaseFileShareSender
public BaseFileShareSender(ISharedObjectTransactionConfig transactionConfig,
IFileShareListener listener,
java.io.InputStream input,
ID remoteTarget,
java.lang.Long fileLength)
getRemoteTarget
protected ID getRemoteTarget()
fireSendStart
protected void fireSendStart()
fireSendData
protected void fireSendData(long bytesSent)
fireSendComplete
protected void fireSendComplete()
setListener
protected void setListener(IFileShareListener listener)
getReplicaDescription
protected ReplicaSharedObjectDescription getReplicaDescription(ID receiver)
- Description copied from class:
AbstractSharedObject
- Get a ReplicaSharedObjectDescription for a replica to be created on a
given receiver.
- Overrides:
getReplicaDescription
in class AbstractSharedObject
- Parameters:
receiver
- the receiver the ReplicaSharedObjectDescription is for
- Returns:
- ReplicaSharedObjectDescription to be associated with given
receiver. A non-null ReplicaSharedObjectDescription must
be returned.
start
public void start()
- Description copied from interface:
IFileShare
- Start the file transfer
- Specified by:
start
in interface IFileShare
send
protected void send()
closeStream
protected void closeStream()
dispose
public void dispose(ID containerID)
- Description copied from interface:
ISharedObject
- Method called by the ISharedObjectContainer upon ISharedObject
destruction. Once this method is called, no more Events will be passed to
a ISharedObject until the init method is called again.
- Specified by:
dispose
in interface ISharedObject
- Overrides:
dispose
in class AbstractSharedObject
- Parameters:
containerID
- the ID of the container that is disposing this ISharedObject
handleSharedObjectMsg
protected boolean handleSharedObjectMsg(SharedObjectMsg msg)
- Description copied from class:
AbstractSharedObject
- SharedObjectMsg handler method. This method will be called by
AbstractSharedObject.handleSharedObjectMsgEvent(ISharedObjectMessageEvent)
when a
SharedObjectMsg is received either from a local source or a remote
source. This default implementation simply returns false so that other
processing of of the given msg can occur. Subclasses should override this
behavior to define custom logic for handling SharedObjectMsgs.
- Overrides:
handleSharedObjectMsg
in class AbstractSharedObject
- Parameters:
msg
- the SharedObjectMsg received
- Returns:
- true if the msg has been completely handled and subsequent
processing should stop. False if processing should continue
cleanUp
protected void cleanUp()
closeStreams
protected void closeStreams()
cancel
public void cancel()
- Description copied from interface:
IFileShare
- Cancel the file transfer
- Specified by:
cancel
in interface IFileShare
getAdapter
public java.lang.Object getAdapter(java.lang.Class clazz)
- Specified by:
getAdapter
in interface org.eclipse.core.runtime.IAdaptable
- Overrides:
getAdapter
in class TransactionSharedObject
remove
public void remove()