org.eclipse.ecf.provider.fileshare
Class FileShareContainer

java.lang.Object
  extended by org.eclipse.ecf.provider.generic.SOContainer
      extended by org.eclipse.ecf.provider.generic.ClientSOContainer
          extended by org.eclipse.ecf.provider.generic.TCPClientSOContainer
              extended by org.eclipse.ecf.provider.fileshare.FileShareContainer
All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable, org.eclipse.ecf.core.IContainer, IIdentifiable, org.eclipse.ecf.core.IReliableContainer, ISharedObjectContainer, IFileShareContainerAdapter

public class FileShareContainer
extends TCPClientSOContainer
implements IFileShareContainerAdapter


Field Summary
protected static int DEFAULT_CONTAINER_KEEP_ALIVE
           
protected static int DEFAULT_TRANSACTION_WAIT
           
 
Fields inherited from class org.eclipse.ecf.provider.generic.TCPClientSOContainer
DEFAULT_COMM_NAME, DEFAULT_TCP_CONNECT_TIMEOUT
 
Fields inherited from class org.eclipse.ecf.provider.generic.ClientSOContainer
CONNECTED, CONNECTING, connection, connectionState, connectLock, DISCONNECTED, remoteServerID
 
Fields inherited from class org.eclipse.ecf.provider.generic.SOContainer
config, DEFAULT_OBJECT_ARG_KEY, DEFAULT_OBJECT_ARGTYPES_KEY, groupManager, isClosing, loadingThreadGroup, policy, receiver, sharedObjectManager, sharedObjectThreadGroup
 
Constructor Summary
FileShareContainer(ISharedObjectContainerConfig config)
           
 
Method Summary
 IFileShare createRetriever(ID fileShareID, ID remoteSrc, java.io.File targetFile, IFileShareListener listener, java.util.Map properties)
          Create IFileShare instance for receiving a file
 IFileShare createRetriever(IFileShareRetrieveConfig config)
          Create IFileShare instance for receiving a file
protected  ISharedObject createRetrieverSharedObject(SharedObjectTypeDescription typeDescription, ID targetFileID, java.io.File localTarget, IFileShareListener listener)
           
 IFileShare createSender(ID fileShareID, java.io.InputStream inputToSend, ID remoteTarget, IFileShareListener listener, java.util.Map properties)
          Create IFileShare instance for sending a file
 IFileShare createSender(IFileShareSenderConfig config)
          Create IFileShare instance for sending a file
protected  ISharedObject createSenderSharedObject(SharedObjectTypeDescription typeDescription, ISharedObjectTransactionConfig transactionConfig, IFileShareListener listener, java.io.InputStream ins, ID remoteTarget, java.lang.Long l)
           
 java.lang.Object getAdapter(java.lang.Class clazz)
           
 Namespace getFileNamespace()
          Get Namespace for identifying remote files.
 IFileShare getFileShare(ID fileShareID)
          Get IFileShare instance from container
 Namespace getFileShareNamespace()
          Get Namespace for creating new IFileShare IDs.
protected  SharedObjectDescription getFileShareRetrieverDescription()
           
protected  SharedObjectDescription getFileShareSenderDescription()
           
protected  ISharedObjectTransactionConfig getFileShareSenderTransactionConfig()
           
 boolean removeFileShare(ID fileShareID)
          Remove IFileShare instance from container
 
Methods inherited from class org.eclipse.ecf.provider.generic.TCPClientSOContainer
createConnection, getConnectTimeout, main
 
Methods inherited from class org.eclipse.ecf.provider.generic.ClientSOContainer
connect, createAuthorizationCallbacks, createConnectData, disconnect, dispose, forwardExcluding, forwardExcluding, forwardToRemote, getConnectedID, getConnection, getConnectLock, getIDForConnection, getLeaveData, handleConnectResponse, handleLeaveGroupMessage, handleViewChangeMessage, isConnected, isConnecting, isGroupManager, memberLeave, processAsynch, processDisconnect, processSynch, queueContainerMessage, sendCreateMsg, sendMessage
 
Methods inherited from class org.eclipse.ecf.provider.generic.SOContainer
addListener, addNewRemoteMember, addSharedObject0, addSharedObjectAndWait, addSharedObjectWrapper, addToLoading, checkRemoteCreate, createLoadingThreadGroup, createRemoteSharedObjectConfig, createRemoteSharedObjectContext, createRemoteSharedObjectWrapper, createSharedObjectConfig, createSharedObjectContext, createSharedObjectWrapper, debug, deserializeContainerMessage, deserializeSharedObjectMessage, destroySharedObject, dumpStack, fireContainerEvent, forward, getArgsFromProperties, getArgTypesFromProperties, getClassLoaderForContainer, getClassLoaderForSharedObject, getConfig, getConnectNamespace, getContainerPropertiesForSharedObject, getGroupMemberIDs, getGroupMembershipLock, getID, getMaxGroupMembers, getNewSharedObjectThread, getNextSequenceNumber, getOtherMemberIDs, getReceiver, getSharedObject, getSharedObjectIDs, getSharedObjectManager, getSharedObjectThreadGroup, getSharedObjectWrapper, handleAsynchIOException, handleCreateMessage, handleCreateResponseMessage, handleSharedObjectDisposeMessage, handleSharedObjectMessage, handleUnidentifiedMessage, isClosing, killConnection, load, log, logException, memberLeave, moveFromLoadingToActive, notifySharedObjectActivated, notifySharedObjectDeactivated, removeFromLoading, removeListener, removeRemoteMember, removeSharedObject, sendCreate, sendCreateResponse, sendCreateResponseSharedObjectMessage, sendCreateSharedObjectMessage, sendDispose, sendDisposeSharedObjectMessage, sendMessage, sendSharedObjectMessage, serializeObject, serializeSharedObjectMessage, setIsClosing, setMaxGroupMembers, setRemoteAddPolicy, validateContainerMessage, verifyToIDForSharedObjectMessage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_CONTAINER_KEEP_ALIVE

protected static final int DEFAULT_CONTAINER_KEEP_ALIVE
See Also:
Constant Field Values

DEFAULT_TRANSACTION_WAIT

protected static final int DEFAULT_TRANSACTION_WAIT
See Also:
Constant Field Values
Constructor Detail

FileShareContainer

public FileShareContainer(ISharedObjectContainerConfig config)
Method Detail

getFileShareSenderDescription

protected SharedObjectDescription getFileShareSenderDescription()
                                                         throws IDCreateException
Throws:
IDCreateException

getFileShareRetrieverDescription

protected SharedObjectDescription getFileShareRetrieverDescription()
                                                            throws IDCreateException
Throws:
IDCreateException

createSenderSharedObject

protected ISharedObject createSenderSharedObject(SharedObjectTypeDescription typeDescription,
                                                 ISharedObjectTransactionConfig transactionConfig,
                                                 IFileShareListener listener,
                                                 java.io.InputStream ins,
                                                 ID remoteTarget,
                                                 java.lang.Long l)
                                          throws SharedObjectCreateException
Throws:
SharedObjectCreateException

createRetrieverSharedObject

protected ISharedObject createRetrieverSharedObject(SharedObjectTypeDescription typeDescription,
                                                    ID targetFileID,
                                                    java.io.File localTarget,
                                                    IFileShareListener listener)
                                             throws SharedObjectCreateException
Throws:
SharedObjectCreateException

createSender

public IFileShare createSender(ID fileShareID,
                               java.io.InputStream inputToSend,
                               ID remoteTarget,
                               IFileShareListener listener,
                               java.util.Map properties)
                        throws ECFException
Description copied from interface: IFileShareContainerAdapter
Create IFileShare instance for sending a file

Specified by:
createSender in interface IFileShareContainerAdapter
Parameters:
fileShareID - the ID for the new IFileShare instance. This ID must be created with the namespace returned from IFileShareContainerAdapter.getFileShareNamespace(). Must not be null.
inputToSend - the InputStream representing access to the local file being sent. Must not be null.
remoteTarget - the ID specifying the file name on the remote system. This ID must be created with the namespace returned from IFileShareContainerAdapter.getFileNamespace().
listener - the IFileShareListener to receive asynchronous notifications as the file sharing is performed
properties - a Map of properties associated with the IFileShare instance
Returns:
IFileShare the new IFileShare instance
Throws:
ECFException - if some problem with creating the IFileShare instance given input parameters

getFileShareSenderTransactionConfig

protected ISharedObjectTransactionConfig getFileShareSenderTransactionConfig()

createSender

public IFileShare createSender(IFileShareSenderConfig config)
                        throws ECFException
Description copied from interface: IFileShareContainerAdapter
Create IFileShare instance for sending a file

Specified by:
createSender in interface IFileShareContainerAdapter
Parameters:
config - IFileShareSenderConfig defining the configuration for the new IFileShare instance
Returns:
IFileShare the new IFileShare instance
Throws:
ECFException - if some problem with creating the IFileShare instance given input parameters

getFileShare

public IFileShare getFileShare(ID fileShareID)
Description copied from interface: IFileShareContainerAdapter
Get IFileShare instance from container

Specified by:
getFileShare in interface IFileShareContainerAdapter
Parameters:
fileShareID - the ID of the IFileShare instance to retrieve
Returns:
IFileShare instance with given ID. Returns null if not found.

removeFileShare

public boolean removeFileShare(ID fileShareID)
Description copied from interface: IFileShareContainerAdapter
Remove IFileShare instance from container

Specified by:
removeFileShare in interface IFileShareContainerAdapter
Parameters:
fileShareID - the ID of the IFileShare instance to remove
Returns:
true if IFileShare removed. False if identified instance does not exist within this container

getAdapter

public java.lang.Object getAdapter(java.lang.Class clazz)
Specified by:
getAdapter in interface org.eclipse.core.runtime.IAdaptable
Specified by:
getAdapter in interface org.eclipse.ecf.core.IContainer
Overrides:
getAdapter in class SOContainer

getFileShareNamespace

public Namespace getFileShareNamespace()
Description copied from interface: IFileShareContainerAdapter
Get Namespace for creating new IFileShare IDs. The Namespace returned should be used to create IDs to use in the create methods on this interface.

Specified by:
getFileShareNamespace in interface IFileShareContainerAdapter
Returns:
Namespace to be used for IDs for creating IFileShare instances

createRetriever

public IFileShare createRetriever(IFileShareRetrieveConfig config)
                           throws ECFException
Description copied from interface: IFileShareContainerAdapter
Create IFileShare instance for receiving a file

Specified by:
createRetriever in interface IFileShareContainerAdapter
Parameters:
config - IFileShareSenderConfig defining the configuration for the new IFileShare instance
Returns:
IFileShare the new IFileShare instance
Throws:
ECFException - if some problem with creating the IFileShare instance given input parameters

createRetriever

public IFileShare createRetriever(ID fileShareID,
                                  ID remoteSrc,
                                  java.io.File targetFile,
                                  IFileShareListener listener,
                                  java.util.Map properties)
                           throws ECFException
Description copied from interface: IFileShareContainerAdapter
Create IFileShare instance for receiving a file

Specified by:
createRetriever in interface IFileShareContainerAdapter
Parameters:
fileShareID - the ID for the new IFileShare instance. This ID must be created with the namespace returned from IFileShareContainerAdapter.getFileShareNamespace(). Must not be null.
remoteSrc - the ID specifying the file name on the remote system to retrieve. This ID must be created with the namespace returned from IFileShareContainerAdapter.getFileNamespace().
targetFile - a target file/directory on local file system for storage of the retrieved file
listener - the IFileShareListener to receive asynchronous notifications as the file sharing is performed
properties - a Map of properties associated with the IFileShare instance
Returns:
IFileShare the new IFileShare instance
Throws:
ECFException - if some problem with creating the IFileShare instance given input parameters

getFileNamespace

public Namespace getFileNamespace()
Description copied from interface: IFileShareContainerAdapter
Get Namespace for identifying remote files. The Namespace returned from this method can be used to create IDs that identify remote files. Such IDs can be used for the create methods in this interface (e.g. remoteTarget param in createSender)

Specified by:
getFileNamespace in interface IFileShareContainerAdapter
Returns:
Namespace to be used for IDs for creating IFileShare instances