org.eclipse.ecf.provider.fileshare
Class BaseFileShareReceiver

java.lang.Object
  extended by org.eclipse.ecf.core.sharedobject.AbstractSharedObject
      extended by org.eclipse.ecf.core.sharedobject.TransactionSharedObject
          extended by org.eclipse.ecf.provider.fileshare.BaseFileShareReceiver
All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable, IIdentifiable, ISharedObject, IEventHandler

public class BaseFileShareReceiver
extends TransactionSharedObject


Field Summary
protected  ID localTarget
           
protected  java.io.OutputStream out
           
 
Fields inherited from class org.eclipse.ecf.core.sharedobject.TransactionSharedObject
configuration, transaction
 
Constructor Summary
BaseFileShareReceiver()
           
 
Method Summary
protected  void closeOutput()
           
protected  java.lang.String getLocalFileNameFromLocalTarget()
           
protected  void handleExceptionOnDataReceive(java.lang.Throwable e)
           
protected  boolean handleSharedObjectMsg(SharedObjectMsg msg)
          SharedObjectMsg handler method.
 void initialize()
          Initialize this shared object.
protected  void receive(FileShareMessage message)
          This method will be invoked via handleSharedObjectMsg when data are received
protected  void receiveAndSaveToFile(FileShareMessage message)
           
 
Methods inherited from class org.eclipse.ecf.core.sharedobject.TransactionSharedObject
getAdapter
 
Methods inherited from class org.eclipse.ecf.core.sharedobject.AbstractSharedObject
addEventProcessor, clearEventProcessors, creationCompleted, destroyRemote, destroySelf, destroySelfLocal, dispose, fireEventProcessors, getConfig, getContext, getGroupID, getHomeContainerID, getID, getLocalContainerID, getProperties, getReplicaDescription, 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
 

Field Detail

localTarget

protected ID localTarget

out

protected java.io.OutputStream out
Constructor Detail

BaseFileShareReceiver

public BaseFileShareReceiver()
Method Detail

initialize

public void initialize()
                throws SharedObjectInitException
Description copied from class: AbstractSharedObject
Initialize this shared object. Subclasses may override as appropriate to define custom initialization behavior. If initialization should fail, then a SharedObjectInitException should be thrown by implementing code. Also, subclasses overriding this method should call super.initialize() before running their own code.

Overrides:
initialize in class TransactionSharedObject
Throws:
SharedObjectInitException - if initialization should throw

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

receive

protected void receive(FileShareMessage message)
This method will be invoked via handleSharedObjectMsg when data are received

Parameters:
message - the content of the file share message (data or complete)

getLocalFileNameFromLocalTarget

protected java.lang.String getLocalFileNameFromLocalTarget()

receiveAndSaveToFile

protected void receiveAndSaveToFile(FileShareMessage message)

handleExceptionOnDataReceive

protected void handleExceptionOnDataReceive(java.lang.Throwable e)

closeOutput

protected void closeOutput()