voicenger - software architecture document

17
POLITEHNICA University of Bucharest, Romania Computer Science Department Voicenger Software Architecture Document Final version: 16 th May 2010 Prepared by: Supervisor: Andreica Cristian Egner Alexandru Goge Oana-Alina Petre Vlad-Stefan Serbanescu Vlad-Nicolae

Upload: vlad-petre

Post on 01-Nov-2014

720 views

Category:

Technology


1 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Voicenger - Software Architecture Document

POLITEHNICA University of Bucharest, Romania

Computer Science Department

Voicenger

Software Architecture Document

Final version: 16th

May 2010

Prepared by: Supervisor:

Andreica Cristian Egner Alexandru

Goge Oana-Alina

Petre Vlad-Stefan

Serbanescu Vlad-Nicolae

Page 2: Voicenger - Software Architecture Document

Voicenger - Software Architecture Document

I

Table of Contents 1 Technologies Used ............................................................................................................... 1

1.1 Context .................................................................................................................................................. 1 1.2 Requirements ......................................................................................................................................... 1 1.3 Application Structure ............................................................................................................................ 1 1.4 Client Component.................................................................................................................................. 2

1.4.1 UI (User Interface) ........................................................................................................................ 2 1.4.2 Peer Communication Interface (networking) ................................................................................ 3 1.4.3 Server communication Interface (profile storage) ......................................................................... 3

1.5 Server Component ................................................................................................................................. 3 1.6 Database Storage ................................................................................................................................... 3 1.7 External Libraries .................................................................................................................................. 3 1.8 Development Environment .................................................................................................................... 4

2 High Level Modules .............................................................................................................. 5 2.1 GUI/ GUI Controller ............................................................................................................................. 5 2.2 File Processor/ File Packager ................................................................................................................ 5 2.3 Sound ..................................................................................................................................................... 6 2.4 String Processing ................................................................................................................................... 6 2.5 Message Renderer ................................................................................................................................. 6 2.6 JXTA Peer ............................................................................................................................................. 6 2.7 JXTA Server .......................................................................................................................................... 7 2.8 Database ................................................................................................................................................ 7 2.9 Twitter/Facebook Server ....................................................................................................................... 7

3 Use Cases .............................................................................................................................. 8 3.1 Register .................................................................................................................................................. 8 3.2 Log In .................................................................................................................................................... 8 3.3 Log Out ................................................................................................................................................. 8 3.4 Add a Friend .......................................................................................................................................... 8 3.5 Delete a Friend ...................................................................................................................................... 9 3.6 Ignore a Friend ...................................................................................................................................... 9 3.7 Edit Profile ............................................................................................................................................ 9 3.8 One-on-One Chat .................................................................................................................................. 9 3.9 Call a Friend ........................................................................................................................................ 10 3.10 Initiate a Conference Chat ................................................................................................................... 10 3.11 Set a Discussion Topic ........................................................................................................................ 10 3.12 Create a Poll inside a Conference ........................................................................................................ 10 3.13 Send a File ........................................................................................................................................... 11 3.14 Add a Textual Image ........................................................................................................................... 11 3.15 Tagging while in Conference .............................................................................................................. 11 3.16 Update Facebook Status ...................................................................................................................... 11 3.17 Update Twitter Status .......................................................................................................................... 11

4 Appendices .......................................................................................................................... 12 4.1 Data Send ............................................................................................................................................ 12 4.2 Data Receive........................................................................................................................................ 13 4.3 Server Communication ........................................................................................................................ 14 4.4 Message Renderer ............................................................................................................................... 15

Page 3: Voicenger - Software Architecture Document

Voicenger - Software Architecture Document

Page 1 of 15

1 Technologies Used

1.1 Context

Voicenger is a software application which solves the problem of taking decisions inside groups of

friends. It wants to offer a structured mean of communication, where the conference is topic-based,

focused on planning and delivering results to the whole decision process. The functionality of

Voicenger is split into several components and features, all designed to ensure an accurate,

structured and efficient application for discussing and sharing ideas and plans in an organized and

easy to use environment.

This application combines the features of websites used for socializing and entertainment with the

benefits of a chat and voice application. This will increase efficiency in a chat environment. It will

provide features based on intuition that will help users to logically structure the discussion when

engaged in a conference window, to easily debate on a subject and quickly take decisions.

1.2 Requirements

Voicenger is designed as a communication tool for groups of people. A minimum viable product

should allow the users to chat, both using text messages and voice. The conversation can be easily

enriched if we add features like polling and tagging inside conferences, textual imaging & file send

operations.

Each user has it's own profile, that should be persisted between different logins.

1.3 Application Structure

The decision for which application structure to opt for, client-server architecture vs peer-to-peer

architecture was heavily influenced by the performances need of the application. Voicenger must be

able to allow its users to talk with each other at a very high quality.

A client-server architecture means higher load on the server component. In order to manage high

voice data throughput, the hardware requirements would include an extreme server machine with

Gigabit Ethernet connection with no traffic restrictions whatsoever.

A peer-to-peer architecture eases the server load, by charging the client machines. Nowadays, the

usual applications that run on a computer hardly turn its workload to 50% of the capacity, which

means an extra 5% is barely visible. The disadvantage of such frameworks is that some computers

are not accessible into public networks, due to NAT or proxy situations.

For choosing the best option, we couldn't allow either a full client-server architecture, neither a full

peer-to-peer architecture. The current approach is to use a peer-to-peer architecture for managing

full intensive traffic operations, such as voice data transfer, but to use a centralized authority for

storing user profiles and other persistent data.

Page 4: Voicenger - Software Architecture Document

Voicenger - Software Architecture Document

Page 2 of 15

1.4 Client Component

Each client application is seen as part of the peer-to-peer architecture.

Structure:

UI (user interface);

Peer Communication Interface (networking);

Server Communication Interface (profile storage).

1.4.1 UI (User Interface)

The client application is entirely developed in Java programming language, which benefits from its

high-level object-oriented approach. For visual components and user interaction, we used Swing,

the widget toolkit from SUN which is integrated into the SDK.

Documentation on each of the Swing components used or any of the layout managers can be found

at http://java.sun.com/docs/books/tutorial/uiswing/.

Page 5: Voicenger - Software Architecture Document

Voicenger - Software Architecture Document

Page 3 of 15

1.4.2 Peer Communication Interface (networking)

JXTA (Juxtapose) is an open-source peer-to-peer protocol specification begun by Sun

Microsystems in 2001. The JXTA protocols are defined as a set of XML messages which allow any

device connected to a network to exchange messages and collaborate independently of the

underlying network topology.

As JXTA is based upon a set of open XML protocols, it can be implemented in any modern

computer language. Implementations are currently available for Java SE,C/C++, C# and Java ME.

Voicenger uses a Java implementation for the JXTA protocol. This allows the application to easily

resolve network problems such as bypassing NAT or proxy communication.

The JXTA implementation and documentation can be found at https://jxta.dev.java.net/.

1.4.3 Server communication Interface (profile storage)

The server component in Voicenger is also a peer in the peer-to-peer architecture. Thus, the

communication between client-server is resolved using JXTA protocol.

1.5 Server Component

Besides from being a peer in the JXTA protocol, the server components must handle all the user-

profiles. For internal storage, we used MySQL database system, which is open-source, published

under the GPL license.

1.6 Database Storage

MySQL is a relational database management system (RDBMS) that runs as a server providing

multi-user access to a number of databases. Voicenger uses MySQL databases for storing

information related to user profiles, friends, statuses or any persistent data.

1.7 External Libraries

Voicenger uses 2 external libraries:

a MySQL connector, that allows the application to query SQL commands into the database;

the JXTA implementation in Java, so that we solve peer-to-peer network problems (NAT,

proxy).

The MySQL connector library can be downloaded

from http://www.mysql.com/products/connector/.

Page 6: Voicenger - Software Architecture Document

Voicenger - Software Architecture Document

Page 4 of 15

1.8 Development Environment

The primary IDE we use is Eclipse 3.5. All the members of our team have had many experiences

with this IDE, being proven as the most efficient in collaborative environments.

Page 7: Voicenger - Software Architecture Document

Voicenger - Software Architecture Document

Page 5 of 15

2 High Level Modules

2.1 GUI/ GUI Controller

Role: The GUI provides the user interface for using the Voicenger application. It contains all the

components for voice communication, sending text messages or files of any type.

The GUI controller receives data in the form of a Message on its components and determines the

tab it displays the message or file send request according to the ArrayList field of the message

(there can only be one voice connection at any time so there no need to determine from where a

voice message is received).

As its role is to provide a user interfaces the GUI solely depends on the actions of the user.

The GUI controller depends on the JXTA peer module to deliver data in the form of Messages send

via the peer-to-peer connection.

The following modules depend on GUI:

The File Processor/File Packager module receives the selected file in the GUI when the

"SendFileButton" component of the GUI is pressed;

The String Processing module refers to the data introduced in the "TextBox" component of

the GUI;

The Sound module depends on the "SoundPanel" component of the GUI.

The following modules depend on the GUI controller:

The File Process/File Packager module receives the input file from the GUI controller;

The Sound module receives input sound from the GUI controller.

2.2 File Processor/ File Packager

Role: The File Processor/File Packager splits files into chunks of data to form Messages that are

sent using the Queue Interface repackages data into the original file and manages multiple files

This module depends on:

The GUI module that sends files selected by the user;

The GUI controller that sends chunks of data that form a file.

The following modules depend on the File Processor/File Packaging module:

The JXTA peer module receives the chunks of data in the form of Messages.

Page 8: Voicenger - Software Architecture Document

Voicenger - Software Architecture Document

Page 6 of 15

2.3 Sound

Role: This module processes sound into/from a Message and sends it using the Queue Interface.

This module depends on:

The "SoundPanel" component of the GUI;

The GUI controller that sends input sound in the form of a Message.

The following modules depend on the File Processor/File Packaging module:

The JXTA peer module receives the output sound in the form of a Message.

2.4 String Processing

Role: This module processes normal text into a Message and sends it using the Queue Interface.

This module depends on:

The "TextBox" component of the GUI;

The GUI controller that sends text in the form of a Message.

The following modules depend on the File Processor/File Packaging module:

The JXTA peer module receives the text in the form of a Message.

2.5 Message Renderer

Role: This module is used to process data in the form of a Message and parse elements such as

pictures, HTML text or status updates.

This module depends on the JXTA peer module from which it receives data in the form of a

Message.

The only module that depend on it is the GUI to which it sends the parsed output.

2.6 JXTA Peer

Role: The JXTA Peer module has multiple roles such as:

Establishing a peer-to-peer connnection with other peers;

Taking data in the form of a Message using the Queue Interface;

Determining the destination of the Message and sending it via the peer-to-peer connection.

Receiving data from other peers;

Passing data to the GUI controller.

The JXTA peer module depends on:

Other JXTA peer modules with which it has established a connection;

The JXTA server module that signal any actions taken by clients that concern it;

Page 9: Voicenger - Software Architecture Document

Voicenger - Software Architecture Document

Page 7 of 15

The File Processor/File Packaging module from which it receives split files as Messages

through the Queue Interface;

The Sound Module from which it receives output sound in the form of a Message using the

Queue Interface;

The String Processing module that sends processed text through the Queue Interface.

The following modules depend on the JXTA peer module:

Other JXTA peer modules that have an established connection;

The JXTA server that is frequently notified of a new connection, a client exit, profile

changes, changes to a client's contact list or a "keep alive" acknowledgement signal;

The Message Renderer that receives Messages containing special elements that need to be

parsed.

2.7 JXTA Server

Role: The JXTA server module notifies clients of new connections, exits and provides a list of

updated profiles to any client.

The JXTA server module depends on:

The Database module from which it gets all the necessary data to fulfil its role.

The JXTA peer modules that notify the server of actions such as connecting, exiting, or

status and contact list changes.

The following modules depend on the JXTA server module:

The Database module from which undergoes the latest changes made by the server;

The JXTA peer modules that are notified by the server of actions that concern them.

2.8 Database

Role: The Database stores and provides important data in a fast and secure way.

The Database only exchanges data only with the JXTA server, thus it is the only module it depends

on, and the only module that depends on it.

2.9 Twitter/Facebook Server

Role: The Twitter/Facebook Server post messages that it receives from clients on their respective

accounts of either website.

This module does not depend on any other module.

No other module depends in any way on this module.

Page 10: Voicenger - Software Architecture Document

Voicenger - Software Architecture Document

Page 8 of 15

3 Use Cases

In order to better understand the mechanics behind the use cases, we recommend reviewing the

Appendices section.

3.1 Register

When a user registers (in order to use the application), the information that is filed in the textbox is

from the GUI component to the String Processing component and then to the Queue Interface

(p2p) component. From here, the information is sent over the network from the JXTA Peer entity

to the JXTA Server entity. The server does some checkups, and if everything is ok, it adds the data

into the Database and sends back to the JXTA Peer entity a confirmation message. Once the

confirmation message is received by the JXTA Peer entity, the network component inside the

JXTA Peer entity sends the confirmation to the GUI Controller component, granting the user

access to all available functions.

3.2 Log In

When the user logs in to the system, he fills a username and a password in the corresponding text

fields in the GUI component. By hitting submit, this information is passed to the String Processing

component and then to the Queue Interface (p2p) component. From here, the information leaves

the JXTA Peer entity, and travels over the network infrastructure to the JXTA Server entity. The

server queries the database, in order to establish whether this is a correct login or just a failed

attempt. The JXTA Server sends back to the JXTA Peer a corresponding message. Back in to the

JXTA Peer entity, the message is sent to the GUI Controller which displays an error message in a

Textbox, whether the login failed; or it displays a success message and grants access to the user to

all available functions.

3.3 Log Out

When the user logs out from the system, he must click on the Log Out button. By doing this, the

action is sent from the GUI component of the JXTA Peer entity to the Queue Interface (p2p).

From here, the action passes from the JXTA Peer to the JXTA Server over the network. The

server marks the user as being logged out and sends a message to all other online friends of this

user, announcing that he has gone offline. These other JXTA Peers receive the message over the

network. After receiving the message, each JXTA Peer sends it to their GUI Controller

component.

3.4 Add a Friend

When a user wants to add a new friend in his friends list, he inputs the username of the new friend

in a textbox field, and clicks on Add New Friend button. After clicking the button, the username is

sent from the GUI component to the Queue Interface component, and after this it is sent over the

network from the JXTA Peer entity to the JXTA Server entity. The server checks wheter the

inputted username exists within the Database, and if so, it updates some database information

regarding these two users, and then sends a confirmation message to the JXTA Peer. The JXTA

Peer receives the message and sends it to the GUI Controller component.

Page 11: Voicenger - Software Architecture Document

Voicenger - Software Architecture Document

Page 9 of 15

3.5 Delete a Friend

When a user deletes a friend from his friends list, an informational message is sent to the server. It

passes from the GUI component through the String Processing component to the Queue Interface

component inside the JXTA Peer entity. From here, the message is sent over the network to the

JXTA Server entity. Once the server gets the message, it updates the Database, and then sends an

acknowledgement message back to the JXTA Peer.

3.6 Ignore a Friend

When a user ignores a friend from his friends list, an informational message is sent to the server. It

passes from the GUI component through the String Processing component to the Queue Interface

component inside the JXTA Peer entity. From here, the message is sent over the network to the

JXTA Server entity. Once the server gets the message, it updates the Database, and then sends an

acknowledgement message back to the JXTA Peer.

3.7 Edit Profile

When a user edits its profile information, several messages are sent the server announcing the

changes. The messages pass from several Textboxes inside the GUI component through the String

Processing component to the Queue Interface component inside the JXTA Peer entity. From

here, the messages are sent over the network to the JXTA Server entity. Once the server gets the

messages, it updates the Database, and then sends an acknowledgement message back to the JXTA

Peer.

3.8 One-on-One Chat

When a user initiates a one-on-one chat with another user, an action is initiated from inside the GUI

component that passes through the String Processing and goes to the Queue Interface. From here,

a message is sent to the other JXTA Peer entity. The other JXTA Peer entity receives the message

through JXTA and passes the message to the GUI Controller component. If everything is ok, and

the chat session can be initiated, an acknowledgement message is sent back to the initial JXTA

Peer. The initial JXTA Peer receives the message, and starts a conversation tab inside the GUI

component.

Every message a users writes in the Textbox and sent to the other user, passes from the GUI

component, through the String Processing component and then to the Queue Interface. From the

Queue Interface, the message passes over the network to the other JXTA Peer entity. The other

JXTA Peer entity receives the message and sends it to its GUI Controller component. This

process is bidirectional.

Page 12: Voicenger - Software Architecture Document

Voicenger - Software Architecture Document

Page 10 of 15

3.9 Call a Friend

When a user calls a friend, an initial message is sent to the other user. If everything is ok, the other

peer replies with an acknowledgement message and the connection is established. After this, all the

sound that is recorded from the microphone in peer A, is send to the FileProcesor component. This

component splits the sound data in chunks, and then sends those chunks to the Queue Interface.

From the Queue Interface, the chunks are sent through the network, to the other JXTA Peer. The

other peer receives those chunks of sound, and sends them to its GUI Controller component. From

the GUI Controller, the chunks are sent to the Sound component, which plays the received sound.

This process is bidirectional.

3.10 Initiate a Conference Chat

When a user initiates a conference chat with several other users, an action is initiated from inside

the GUI component that passes through the String Processing and goes to the Queue Interface.

From here, a message is sent to the all other JXTA Peer entities. The other JXTA Peer entities

receive the message through JXTA and pass the message to their respective GUI Controller

component. If everything is ok, and the chat session can be initiated, an acknowledgement message

is sent back to the initial JXTA Peer. The initial JXTA Peer receives the message, and starts a

conversation tab inside the GUI component.

Every message a users writes in the Textbox and sent to all other user, passes from the GUI

component, through the String Processing component and then to the Queue Interface. From the

Queue Interface, the message passes over the network to all other JXTA Peer entities. The other

JXTA Peer entities receive the message and send it to their respective GUI Controller component.

This process is bidirectional.

3.11 Set a Discussion Topic

When a sets a discussion topic inside a chat tab, an action is initiated from inside the GUI

component that passes through the String Processing and goes to the Queue Interface. From here,

a message with the new discussion topic is sent to the other JXTA Peer entity. The other JXTA

Peer entity receives the message through JXTA and passes the message to the GUI Controller

component. If everything is ok, an acknowledgement message is sent back to the initial JXTA

Peer.

3.12 Create a Poll inside a Conference

When a user initiates a poll inside a conference chat with several other users, an action is initiated

from inside the GUI component that passes through the String Processing and goes to the Queue

Interface. From here, a message with the poll options is sent to the all other JXTA Peer entities.

The other JXTA Peer entities receive the message through JXTA and pass the message to their

respective GUI Controller component. If everything is ok, an acknowledgement message is sent

back to the initial JXTA Peer.

Page 13: Voicenger - Software Architecture Document

Voicenger - Software Architecture Document

Page 11 of 15

3.13 Send a File

When a user sends a file to a friend, the file is sent from the GUI component to the FileProcessor

component that splits the file in chunks. These chunks are then sent to the Queue Interface. From

the Queue Interface, the chunks are sent through the network, to the other JXTA Peer. The other

peer receives those chunks, and sends them to its GUI Controller component. From the GUI

Controller, the chunks are sent to the FilePackager component, which saves the received file. This

process is bidirectional.

3.14 Add a Textual Image

When a user adds a textual image to a conference chat, the image is sent from the GUI component

to the FileProcessor component that splits the file in chunks. These chunks are then sent to the

Queue Interface. From the Queue Interface, the chunks are sent through the network, to the all

others JXTA Peer entities. The other peers receive those chunks, and send them to their respective

GUI Controller component. From the GUI Controller, the chunks are sent to the FilePackager

component, and then are displayed in the chat window.

3.15 Tagging while in Conference

When a user uses tags inside a conference chat with several other users, an action is initiated from

inside the GUI component that passes through the String Processing and goes to the Queue

Interface. From here, a message regarding the tag is sent to the all other JXTA Peer entities. The

other JXTA Peer entities receive the message through JXTA and pass the message to their

respective GUI Controller component. If everything is ok, an acknowledgement message is sent

back to the initial JXTA Peer.

3.16 Update Facebook Status

Each JXTA Peer can call the Facebook API over the internet, if the user has correctly inputted a

username and a password, and wants to update his Facebook status account. The API calling is

actually a HTTP POST message.

3.17 Update Twitter Status

Each JXTA Peer can call the Twitter API over the internet, if the user has correctly inputted a

username and a password, and wants to update his Twitter status account. The API calling is

actually a HTTP POST message.

Page 14: Voicenger - Software Architecture Document

Voicenger - Software Architecture Document

Page 12 of 15

4 Appendices

4.1 Data Send

Page 15: Voicenger - Software Architecture Document

Voicenger - Software Architecture Document

Page 13 of 15

4.2 Data Receive

Page 16: Voicenger - Software Architecture Document

Voicenger - Software Architecture Document

Page 14 of 15

4.3 Server Communication

Page 17: Voicenger - Software Architecture Document

Voicenger - Software Architecture Document

Page 15 of 15

4.4 Message Renderer