| java.lang.Object org.datashare.client.BroadCastClient
BroadCastClient | public class BroadCastClient implements DataShareClientInterface(Code) | | This class will provide the methods necessary to establish command/status and
data connections over a network to a DataShareServer, and provide the input and
output methods needed to share data with other BroadCast clients.
BroadCastClients do not care to know about other clients that they are sending data to
(they have no way to find out about other clients, if you need to know about other clients,
use the more general DataShareClient class). BroadCastClients always have their data channels
in the session named 'BroadCastClient'. BroadCastClient always uses a TCP connection for it's data.
version: 1.1 |
Constructor Summary | |
public | BroadCastClient() Constructor, note that initialize must be called for this class to do anything useful. |
Method Summary | |
public void | commandStatusConnectionError(boolean fatalError, String errorMsg) do not call this method. | public void | connectionLost(DataShareConnection dsc) do not call this method. | public void | dataChannelIsReady(boolean success) do not call this method. | public void | dataReceived(DataShareObject dataShareObject) This method should not be overidden and is called automatically when data
is received. | public void | initialize(InetAddress serverInetAddress, int serverCommandStatusPort, String clientName, BroadCastInterface bci, String channelName) causes connections to DataShareServer to be established, must be called
before any data
can be shared.
Parameters: serverInetAddress - must be set to the IP address, or name, of the DataShareServer machine Parameters: serverCommandStatusPort - must be set to the port that the DataShareServer is using for command/status connections Parameters: clientName - the name that this client would like to be know by, will be made unique by the DataShareServer and set into the clientUniqueName field Parameters: bci - must be set to the class that implements the BroadCastInterface, used to route any received data and to notifyin case of network problems Parameters: channelName - the name of the channel that this client shoulduse for data. | public void | sendDataToAll(Object object) | public void | sendDataToOthers(Object object) | public void | shutDown() call this when you want the command/status and data connections to be closed
gracefully, like when preparing to exit. | public void | treeReceived(DefaultMutableTreeNode newTreeNode) called when a new tree has been received, not used. | public void | updateReceived(UpdateAvailableMsg msg) called when a change has occured with the session/client tree, not used. |
BroadCastClient | public BroadCastClient()(Code) | | Constructor, note that initialize must be called for this class to do anything useful.
|
commandStatusConnectionError | public void commandStatusConnectionError(boolean fatalError, String errorMsg)(Code) | | do not call this method. It is called automatically when the command/status connection has an error.
The BroadCastInterface will be notified via its commandStatusConnectionLost() method call.
Parameters: fatalError - set to true for non-recoverable errors (none are recoverable at this time) Parameters: errorMsg - describes the nature of the error |
connectionLost | public void connectionLost(DataShareConnection dsc)(Code) | | do not call this method. It is called automatically when the data connection has been lost.
The BroadCastInterface will be notified via its dataConnectionLost() method call.
Parameters: dsc - describes the connection that we lost |
dataChannelIsReady | public void dataChannelIsReady(boolean success)(Code) | | do not call this method. It is called automatically when the data connection is setup and available
for use. The
data channel must not be used before this gets called. The
BroadCastInterface will be
notified via by calling its dataChannelIsReady method call.
Parameters: success - true if the data channel is ready for use, false if we failed to get it established. |
dataReceived | public void dataReceived(DataShareObject dataShareObject)(Code) | | This method should not be overidden and is called automatically when data
is received. This method can ensure that any objects we receive
are sent
to the BroadCastClientInterface.newDataReceived method in a thread safe manner.
dataShareObjects that may cause a GUI update should be made thread safe by
setting the 'useThreads' field to true.
Parameters: dataShareObject - the object received from the data channel |
initialize | public void initialize(InetAddress serverInetAddress, int serverCommandStatusPort, String clientName, BroadCastInterface bci, String channelName)(Code) | | causes connections to DataShareServer to be established, must be called
before any data
can be shared.
Parameters: serverInetAddress - must be set to the IP address, or name, of the DataShareServer machine Parameters: serverCommandStatusPort - must be set to the port that the DataShareServer is using for command/status connections Parameters: clientName - the name that this client would like to be know by, will be made unique by the DataShareServer and set into the clientUniqueName field Parameters: bci - must be set to the class that implements the BroadCastInterface, used to route any received data and to notifyin case of network problems Parameters: channelName - the name of the channel that this client shoulduse for data. Only clients in the same channel will be able to share data. |
sendDataToAll | public void sendDataToAll(Object object)(Code) | | Use this method to send an object to everybody in a Channel (including our instance)
Parameters: object - the data to share, probably should be serializable |
sendDataToOthers | public void sendDataToOthers(Object object)(Code) | | Use this method to send an object to everybody in a Channel (excluding our instance)
Parameters: object - the data to share, probably should be serializable |
shutDown | public void shutDown()(Code) | | call this when you want the command/status and data connections to be closed
gracefully, like when preparing to exit.
|
treeReceived | public void treeReceived(DefaultMutableTreeNode newTreeNode)(Code) | | called when a new tree has been received, not used. (required by the interface we implement)
Parameters: newTreeNode - describes the tree (if we has ever asked for them, which we don't) |
updateReceived | public void updateReceived(UpdateAvailableMsg msg)(Code) | | called when a change has occured with the session/client tree, not used. (required by the interface we implement)
Parameters: msg - describes the update (if we has ever asked for them, which wedon't) |
|
|