Design


Distance Learning is a standalone application with two main components: a user interface (client/front end) and JXTA integration (back end), both of which utilize the latest JXTA platform release. The user interface displays data pertaining to communication among peers, while the JXTA integration handles the update of such data.

This JXTA application is based on a simple peer-to-peer architecture. The teacher is a peer, the agent is a peer, and each student is a peer.

In this program, communication between peers occurs back and forth in the following way:

The teacher receives a request from the student for a question, gets a question from the agent for the student, sends that question to the student, receives an answer from the student, sends that answer to the agent, obtains the next question from the agent, and sends that question to the student. The question-answer session ends when there are no further questions.

Application Details

The code for this application is contained in a zip file. Extract the contents of this zip file to a directory on your local disk. For your convenience, subdirectories for peers participating in this program are also available in this directory. The teacher subdirectory has a runTeacher.bat file, and each student subdirectory has a runStudent.bat file. The runTeacher.bat file launches the program, and the runStudent.bat file lets a peer join the program.

Creating the Classroom with the Teacher

First, you must create the virtual classroom with the teacher as the first peer. To create the teacher, run the runTeacher.bat program. The program launches a window for entering the configuration information about this peer. Then proceed as follows:

  1. Select the Basics tab.

  2. Enter a name for the peer (say, peer 1) in the Peer Name text field.

  3. Click the OK button to proceed and provide other configuration details for this peer.

  4. In the window that pops up, select the Advanced tab.

  5. Under the Advanced tab, make note of the TCP port number, which must be unique for this peer.

  6. Select the Security tab. Under the Security tab, provide a unique username and password for this peer.

  7. Select the Rendezvous/Routers tab. Ensure that the Use A Gateway box is unchecked.

  8. Click the OK button. The program launches a client window for this peer.

Upon launching the program, the teacher, peer 1, announces the teaching service and waits for students to join the class, as shown in Figure 22.1.

Figure 22.1. The teacher's advertisement ready to teach.

graphics/22fig01.jpg

Creating a Student and Running the Program

To create a student as the second peer, run the runStudent.bat program in one of the student subdirectories, student01 or student02, in the installation directory. The program launches a window and prompts for information about this peer. Create this peer similarly to peer1, ensuring that this peer has a unique port number, username, and password. By creating the second peer, the application creates the community. Let's name this one peer 2.

Upon launching, peer 2 (the student) forms a message requesting peer 1 (the teacher) to create a new session (examination), then sends this message to peer 1. peer 2 then waits indefinitely for an incoming message from peer 1.

Upon receiving the message for a new session, the teacher creates an agent that handles the questions and answers, and also keeps track of the number of correctly answered questions. The teacher obtains the first question from the agent for the student and sends that question to the student, as shown in Figure 22.2.

Figure 22.2. The teacher sends the first question.

graphics/22fig02.jpg

The student responds with an answer. After evaluating the student's answer, the teacher sends the next question to the student, as shown in Figure 22.3.

Figure 22.3. The teacher's response after evaluating the first answer.

graphics/22fig03.jpg

Figure 22.4 shows how the teacher receives messages from the student and responds.

Figure 22.4. The teacher's screen.

graphics/22fig04.jpg

When the student doesn't know the answer to a question and responds with a few question marks, the teacher provides the correct answer before sending the next question, as shown in Figure 22.5.

Figure 22.5. The student doesn't know the answer to a question.

graphics/22fig05.jpg

The teacher and student pass questions and answers back and forth until no more questions remain. The teacher supplies the correct answer if the student's answer is incorrect. When there are no more questions, the teacher returns a suggestion based on the number of questions answered correctly. The student displays the suggestion and then exits the virtual classroom, as shown in Figure 22.6.

Figure 22.6. The teacher provides additional references.

graphics/22fig06.jpg

Use Cases

Automation is useful in peer-to-peer communication. One of the use cases for peer-to-peer communication is automating technical support.

Tech Support

In an environment where technical support is necessary, clients needing technical help can type in a topic such as "software installation," and instead of having live people answering phone calls, the server can take over and ask a series of questions. Based on the client's answers, the server can attempt to resolve the problem or point to other resources for further information. Furthermore, the server can be versatile and base its questions on problems encountered by other clients. The server can also formulate questions based on the answers provided. In this sample program, P2P is mainly used to facilitate communication and distribute knowledge.

Class Design

The Distance Learning program uses four classes Teacher.class, AgentFactory.class, Agent.class, and Student.class to create the virtual classroom and peers, and provide an environment for communication between peers.

  • Teacher The Teacher class is responsible for setting up the JXTA environment and establishing a communication link to the student.

  • AgentFactory The AgentFactory is a singleton class responsible for constructing the Agent object.

  • Agent The Agent class collects questions and answers. It also responds to the answers the student provides and gives recommendations at the end of the question-answer session.

Special Details

The current implementation of the graphical user interface depends on a JAR file from the latest version of the integrated development environment called NetBeans Version 3.3. The file AbsoluteLayout.jar is required to build and/or run the Distance Learning program.



JavaT P2P Unleashed
JavaT P2P Unleashed
ISBN: N/A
EAN: N/A
Year: 2002
Pages: 209

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net