|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpeer2me.framework.FrameworkFrontEnd
This is the main class of the Peer2Me framework. It manages and connects the resources and functions of the framework. It also handles all communication and interaction with the MIDlets running the framework.
Method Summary | |
void |
connectToNodes(java.lang.String[] addresses)
This method establishes a connection to the chosen nodes. |
java.util.Enumeration |
getFileList(java.lang.String root)
This method returns a list of the files in the given root directory on the device |
Group |
getGroup()
This method returns the local representation of the group. |
static Framework |
getInstance(FrameworkListener midlet)
This method creates an instance of FrameworkFrontEnd and returns it as a reference of type Framework. |
Node |
getLocalNode()
This method returns a reference to the local node. |
void |
initFramework(java.lang.String nodeName,
java.lang.String midletName,
java.lang.String preferredNetwork)
This method initiates the framework, and is the first method that should be run after getting a instance of the framework. |
void |
notifyAboutException(java.lang.String location,
java.lang.Exception exception)
This method passes on the Exception notice from the Log to the MIDlet. |
void |
notifyAboutFoundNode(java.lang.String address,
java.lang.String remoteNodeName)
This method is called from the nodeFound() method in the Network class whenever a node is found |
void |
notifyAboutLostNode(java.lang.String address)
This method removes a lost node from the group. |
void |
notifyAboutReceivedFilePackage(FilePackage filePackage)
This method is called from NodeConnection.processIncomingData() whenever a file package is received from a remote node. |
void |
notifyAboutReceivedGroupSyncPackage(GroupSyncPackage groupSyncPackage)
This method is called from NodeConnection.processIncomingData() whenever a groupSyncPackage is received from a remote node. |
void |
notifyAboutReceivedTextPackage(TextPackage textPackage)
This method is called from NodeConnection.processIncomingData() whenever a text package is received from a remote node. |
void |
sendFilePackage(java.lang.String[] recipients,
java.lang.String filePath)
This method is used by the MIDlet to send a file package over the network. |
void |
sendTextPackage(java.lang.String[] recipients,
java.lang.String textMessage)
This method is used by the MIDlet to send a text package over the network. |
void |
shutdownFramework()
This method shuts down the framework and closes all the open network connections and streams. |
void |
startNodeSearch()
This method starts a search for devices running the same MIDlet. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static Framework getInstance(FrameworkListener midlet)
midlet
- A reference to the MIDlet (The MIDlet must implement the FrameworkListener interface).
public void initFramework(java.lang.String nodeName, java.lang.String midletName, java.lang.String preferredNetwork) throws java.lang.ClassNotFoundException, java.lang.IllegalAccessException, java.lang.InstantiationException, java.io.IOException, java.lang.Exception
initFramework
in interface Framework
nodeName
- The name of the user of the MIDlet.midletName
- The name of the MIDlet, eventually translated into a ServiceID used to find other devices running the same MIDlet.preferredNetwork
- Deciding 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 invalid
java.io.IOException
- Error initiating framework
java.lang.Exception
- Error initiating frameworkpublic void shutdownFramework()
shutdownFramework
in interface Framework
public Group getGroup()
public void startNodeSearch() throws java.io.IOException
startNodeSearch
in interface Framework
java.io.IOException
- Thrown if the search crashespublic void connectToNodes(java.lang.String[] addresses)
connectToNodes
in interface Framework
addresses
- The addresses to the nodes to connect to.public Node getLocalNode()
public void sendTextPackage(java.lang.String[] recipients, java.lang.String textMessage)
sendTextPackage
in interface Framework
recipients
- A list containing the addresses of the recipient nodestextMessage
- The text to be sentpublic void sendFilePackage(java.lang.String[] recipients, java.lang.String filePath)
sendFilePackage
in interface Framework
recipients
- A list containing the addresses of the recipient nodesfilePath
- The path of the file to sendpublic java.util.Enumeration getFileList(java.lang.String root)
getFileList
in interface Framework
root
- The path to the root directory
public void notifyAboutFoundNode(java.lang.String address, java.lang.String remoteNodeName)
address
- The network address of the noderemoteNodeName
- The name of the found remote nodepublic void notifyAboutLostNode(java.lang.String address)
address
- The address to the lost nodepublic void notifyAboutException(java.lang.String location, java.lang.Exception exception)
location
- The location (class and method) where the Exception occuredexception
- The actual Exceptionpublic void notifyAboutReceivedGroupSyncPackage(GroupSyncPackage groupSyncPackage)
groupSyncPackage
- The received groupSyncPackage.public void notifyAboutReceivedTextPackage(TextPackage textPackage)
textPackage
- The received text package.public void notifyAboutReceivedFilePackage(FilePackage filePackage)
filePackage
- The received file package.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |