Download presentation
Presentation is loading. Please wait.
Published byJade Conley Modified over 9 years ago
1
Getting Started with JXTA for J2ME Advisor : Dr. Ching-Long Yeh Report : DI.2, 洪泰昌 (89506005) Course: XML 文件管理
2
Abstract Ad hoc networks : a self-configuring network of mobile Self-organization ability: simplify management, robustness, flexible Well suited to the vicissitudes of wireless P2P model enables “mobile devices” to assemble quickly JXTA ("juxtapose"), a set of protocols for P2P networking In this report: How the JXTA protocols are extended to MIDP How to install and run JXTA demonstration programs for MIDP
3
Abstract JXME Proxy (Relay) DEMO JXTA demonstration programs for MIDP Chat MIDlet
4
Agenda Abstract JXTA Java ME (J2ME) JXME Summary Appendix Prerequisite for implementation Implementation of J2ME Chat MIDlet Implementation of JXME Proxy References and Resources
5
JXTA JXTA defines a set of open protocols for peer-to-peer networks JXTA (v2.0) Protocol Specification XML-based protocols Functionalities peer discovery endpoint routing connection binding basic query/response message exchange network propagation through rendezvous peers
6
Java ME Java ME: Java Platform, Micro Edition (Java ME) provides a environment for applications running on mobile and other embedded devices mobile phones, personal digital assistants (PDAs), TV set- top boxes, and printers MIDP: Mobile Information Device Profile (v2.0) Implementation Specification Subset of Java SE (JDK) limited capacity
7
Java ME MIDP: javax.microedition.rms Record Management System, persistence javax.microedition.midlet Environment, lifecycle javax.microedition.io Network javax.microedition.lcdui UI ( User Interface ) Java.lang.* java.util.* MIDlet : application javax.microedition.midlet.MIDlet
8
Java ME MIDlet: Managed by Application Management software (AMS) : Paused , Active , destroyed
9
JXME JXME : JXTA Java Micro Edition (MIDP/CLDC/CDC) Project The goal of the JXME project is to bring JXTA functionality to MIDP devicesJXME A framework Why JXME ? The constraints of Mobile Device XML parser memory limits of MIDP devices? The state of the network needs to be cached memory limits of MIDP devices? MIDP mandates support for HTTP, but socket and datagram connections are optional JXTA protocols exceed the minimum requirements of MIDP JXTA relay
10
JXME Architecture
11
Rendezvous/relays
12
Coordination between J2ME Edge Devices and JXTA Relays 1.J2ME peer send HTTP request messages to a JXTA relay 2.JXTA relay parse each name-value pair in the HTTP request XML messages (JXTA format) relay the messages over the JXTA network 3.JXTA relay receives a message from the JXTA network parse the XML format of the incoming message author a corresponding HTTP response 4.Wait for the J2ME peer to send an HTTP poll request send the HTTP response back to the J2ME peer 1. 2. 3. 4. Response
13
JXME API Element: elements of JXTA Message Message: JXTA Message, access methods PeerNetwork: createInstance(): create PeerNetwork instance connect(): connect to relay create(): peer, group, pipe search(): peer, group, pipe poll() poll the information from relay server listen() and close(): open and close pipe send(): send the message to the pipe
14
JXME Code Example Create pipe Create peer Connect to proxy create pipe
15
JXME Code Example Find the pipe which we created
16
JXME Code Example Send message through the pipe which we just find
17
JXME Code Example Receive message
18
Summary JXTA furnishes an XML-based, platform- independent set of protocols that enable P2P networking JXME project brings JXTA functionality into the MIDP world Vision: Ad hoc network Every mobile device as “Server”
19
Summary Not popular ? Why ? Cost: GPRS, 3G …? Mobile device: Power consumption, UI ? In the future WiMax cost down Wireless Leased-line network connected anytime Google Android platform ? XMPP protocol Trends: P2P network + XML based protocol
20
Appendix
21
Prerequisite for implementation Required libraries from http://download.java.net/jxta/ http://download.java.net/jxta/ jxse-lib-2.5.zip jxse-lib-2.5.zip JXTA core JMEX Proxy libraries jxme-2.1.3-bin.zip jxme-2.1.3-bin.zip JXME framework Chat MIDlet code and libraries Tools: NetBeans (6.0) + Mobility pack http://www.netbeans.org/ http://www.netbeans.org/
22
Implementation of J2ME Chat MIDlet 1. New project Mobile mobile project from existing MIDP source
23
Implementation of J2ME Chat MIDlet 2. Specify the source and JAD file
24
Implementation of J2ME Chat MIDlet 3. Name and Location name chat
25
Implementation of J2ME Chat MIDlet 4. Default Platform Selection : use default
26
Implementation of J2ME Chat MIDlet 5. Add library : chat porject right click properties add Jar/Zip jxta- cldc.jar
27
Implementation of J2ME Chat MIDlet 6. Run : chat project right click run project
28
Implementation of J2ME Chat MIDlet Related files and locations Chat source code \jxme-2.1.3-bin\midp\demo\chat JAD: \jxme-2.1.3-bin\midp\demo\chat\bin\chat.jad Library: \jxme-2.1.3-bin\midp\demo\chat\lib\jxta-cldc.jar
29
Implementation of JXME Proxy 1. New project General project Java Application
30
Implementation of JXME Proxy 2. name proxy finish
31
Implementation of JXME Proxy 3. New Java class place the code which we provide
32
Implementation of JXME Proxy Code: package tommy; import java.io.File; import net.jxta.platform.NetworkManager; public class StartJXME_Proxy { private NetworkManager manager; public StartJXME_Proxy() { } private void startProxy() { try { manager = new NetworkManager(NetworkManager.ConfigMode.PROXY, "ProxyeServer", new File(new File(".cache"), "ProxyeServer").toURI()); manager.startNetwork(); } catch (Exception e) { e.printStackTrace(); System.exit(-1); } public static void main(String[] args){ StartJXME_Proxy startJXME_proxy = new StartJXME_Proxy(); startJXME_proxy.startProxy(); }
33
Implementation of JXME Proxy 4. Add libraries Libraries Add Jar/folder \jxse-lib-2.5\*.jar
34
Implementation of JXME Proxy 5. Run project right click run project
35
References and Resources Getting Started with JXTA for J2ME, http://developers.sun.com/mobility/midp/articles/jxme/index.html http://developers.sun.com/mobility/midp/articles/jxme/index.html JXTA, https://jxta.dev.java.net/https://jxta.dev.java.net/ JXTA v2.0 Protocol Specification, https://jxta- spec.dev.java.net/https://jxta- spec.dev.java.net/ JXTA Community Forum, http://forums.java.net/jive/forum.jspa?forumID=50&start=0 http://forums.java.net/jive/forum.jspa?forumID=50&start=0 JXTA JXSE Programmers Guide, https://jxta- guide.dev.java.net/https://jxta- guide.dev.java.net/ J2ME tutorials, http://developers.sun.com/mobility/learning/tutorial/ http://developers.sun.com/mobility/learning/tutorial/ Sun Java Wireless Toolkit, http://java.sun.com/products/sjwtoolkit/download.html http://java.sun.com/products/sjwtoolkit/download.html NetBeans, http://www.netbeans.org/http://www.netbeans.org/
36
References and Resources Code in Netbeans Project: 網路硬碟二: share name XML-JXME Maybe you need to correct the location of libraries Public JXME proxy: http://rdv.jxtahosts.net/cgi-bin/relays.cgi?2 http://rdv.jxtahosts.net/cgi-bin/relays.cgi?2 http://192.18.37.36:9700 http://192.18.37.37:9700 http://192.18.37.38:9700 http://192.18.37.39:9700
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.