|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpeer2me.network.Network
This is the super class of the technology specific network classes. Methods that are equal for all the sub classes are located in this super class, and there are abstact methods that the sub classes have to implement. The getInstance() method in this class returns a reference to the preferred network sub class.
Constructor Summary | |
Network()
|
Method Summary | |
abstract void |
connectionEstablished()
This method is called from the ConnectionListener.run() when the acceptAndOpen() method in ConnectionListener.run() is done. |
abstract void |
connectToNode(java.lang.String nodeAddress)
This method establishes a connection to the chosen node. |
java.lang.String |
getApplicationId()
This method returns the applicationId |
ConnectionListener |
getConnectionListener()
This method returns the ConnectionListener reference |
FrameworkFrontEnd |
getFrameworkFrontEnd()
This method returns the FrameworkFrontEnd reference |
static Network |
getInstance()
This method returns a reference to the instance of the preferred network. |
static Network |
getInstance(java.lang.String preferredNetwork)
This method returns an instance of the preferred network. |
abstract java.lang.String |
getNodeAddress(java.lang.Object input)
This method returns the node address. |
abstract java.lang.String |
getRemoteNodeName(java.lang.Object input)
This method fetches the name of the remote node. |
abstract void |
init()
Initiates the network instance. |
abstract void |
nodeFound(java.lang.Object input)
Called when the same MIDlet is found on a remote device |
abstract void |
searchForNodes()
Starts a search for devices running the same MIDlet |
abstract void |
sendDataPackage(DataPackage dataPackage,
java.lang.String[] recipients)
This method is used by the FrameworkFrontEnd to send a data package of any sort to a remote node. |
void |
setApplicationId(java.lang.String applicationID)
This method sets the applicationID. |
void |
setConnectionListener(ConnectionListener connectionListener)
This method sets a reference to the ConnectionListener |
void |
setFrameworkFrontEnd(FrameworkFrontEnd frameworkFrontEnd)
This method sets a reference to the FrameworkFrontEnd |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Network()
Method Detail |
public static Network getInstance(java.lang.String preferredNetwork) throws java.lang.ClassNotFoundException, java.lang.IllegalAccessException, java.lang.InstantiationException
preferredNetwork
- Indicating which network implementation to use.
java.lang.ClassNotFoundException
- The input preferredNetwork is invalid
java.lang.IllegalAccessException
- The input preferredNetwork is invalid
java.lang.InstantiationException
- The input preferredNetwork is invalidpublic static Network getInstance()
java.lang.ClassNotFoundException
- The input preferredNetwork is invalid
java.lang.IllegalAccessException
- The input preferredNetwork is invalid
java.lang.InstantiationException
- The input preferredNetwork is invalidpublic void setConnectionListener(ConnectionListener connectionListener)
connectionListener
- A reference to the ConnectionListenerpublic ConnectionListener getConnectionListener()
public void setFrameworkFrontEnd(FrameworkFrontEnd frameworkFrontEnd)
frameworkFrontEnd
- A reference to the FrameworkFrontEndpublic FrameworkFrontEnd getFrameworkFrontEnd()
public void setApplicationId(java.lang.String applicationID)
applicationID
- The ID of the MIDlet (e.g. the MIDlet name)public java.lang.String getApplicationId()
public abstract void init() throws java.lang.Exception
java.lang.Exception
- Failed to initiate the networkpublic abstract void searchForNodes() throws java.io.IOException
java.io.IOException
- Error during the searchpublic abstract void nodeFound(java.lang.Object input) throws java.io.IOException
input
- An object representing the connection to the found node.
java.io.IOException
public abstract java.lang.String getRemoteNodeName(java.lang.Object input)
input
- An object representing the connection to the found node.
public abstract void connectToNode(java.lang.String nodeAddress)
nodeAddress
- The address to the node to connect topublic abstract void connectionEstablished()
public abstract java.lang.String getNodeAddress(java.lang.Object input) throws java.io.IOException
input
- String "localNode" to retreive the address of the local device.
A object representing the connection to the remote node to retreive the
address of a remote device.
java.io.IOException
public abstract void sendDataPackage(DataPackage dataPackage, java.lang.String[] recipients)
dataPackage
- The data package to be sentrecipients
- A list containing addresses to the recipient nodes
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |