David J. Kim (djkim@mit.edu)

UROP Final Documentation, IAP-FALL 2001

Supervisor: Christopher M. Schmandt

Project: IMPROMPTU – Audio Applications for Mobile IP

 

 

INTRODUCTION

 

IMPROMPTU can be seen as a combination of the functionalities of the PC, Internet and the mobile phone. IMPROMPTU is an Internet Protocol (IP) based mobile audio platform for audio communication and mobile audio applications. It consists of a wireless client device and distributed services that support multiple audio applications. Specifically, the project will explore different kinds of audio applications that would be interesting for mobile users when high bandwidth wireless connectivity is available. By looking into the requirements imposed on the user interface by these applications, the project will attempt to address the limitations of current mobile telephony, providing guidelines for research in future broadband mobile communication systems.

 

 

INITIAL RESPONSIBILITIES – IMPROMPTU Service Management System

 

My initial role was the design and implementation of the Service Management System (SMS). The Impromptu SMS is basically a system for the control and monitor of the different services (for both a regular user and the administrator) via a simple web interface.

 

Users needed to be able to log into their service manager from any web browser, with their own password. After logging onto the web client, the user was to have the ability to manage their user profile, “friends list”, and personal preferences on the applications (chat, newsgroups, baby monitor, messaging, etc.).

 

The administrator was to have control over the whole network of IMPROMPTU, and have the ability to manage and oversee the status and stability of the network.

 


IMPROMPTU SMS ARCHITECTURE – OVERVIEW

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


Database: InstantDB

·          An all Java, Relational Database Management System (RDBMS).

·          Features include joins, transactions, triggers, sub-selects, table aliasing, etc.

·          Uses standard SQL and Sun's JDBC API.

 

 

 

Java JDBC – Java Database API

·          JDBC (Java Database Connectivity) – API that lets you access virtually any tabular data source from the Java programming language, provides cross-DBMS connectivity to a wide range of SQL databases. More information can be found at http://java.sun.com/j2se/1.3/docs/guide/jdbc/

·          Database Java API (Database Layer) – API used to access the database, used by the Service Management System as well as the Application Manager. Uses Java JDBC to access InstantDB.

 

Java RMI – Application Manager

·       Java RMI (Remote Method Invocation) - enables the programmer to create distributed JavaTM technology-based to Java technology-based applications, in which the methods of remote Java objects can be invoked from other Java virtual machines, possibly on different hosts. More information can be found at http://java.sun.com/products/jdk/rmi/

·       Application manager uses Java RMI to connect to the Database API via the network from a different client.

 

Apache Tomcat Servlet Engine (Servlets)

·          Tomcat Servlet Engine - free, open-source implementation of Java Servlet and JavaServer Pages technologies developed under the Jakarta project at the Apache Software Foundation. More information at http://java.sun.com/products/jsp/tomcat/

·          Java Servlets - simple, consistent mechanism for extending the functionality of a web server and for accessing existing business systems. Servlets provide a component-based, platform-independent method for building web-based applications, without the performance limitations of CGI programs. More information can be found at http://java.sun.com/products/servlet/index.html

·          Web client and the database layer (DBLayer) is connected via the Java Servlets.

 

Web Client (JSP, HTML)

·       Java Server Pages (JSP) - enables rapid development of web-based applications that are platform independent. Java Server Pages technology separates the. user interface from content generation enabling designers to change the overall page layout without altering the underlying dynamic content. JSP uses XML-like tags and scriptlets (written in the Java programming language) within the HTML to encapsulate the logic that generates the content for the page. More information at http://java.sun.com/products/jsp/

·       HTML – any other pages that are not JSPs.

·       Web client is a combination of the JSP and HTML (JSP are essentially HTML pages with Java scripts), used to access the database from the web.

 

 

ACHIEVEMENTS

 

·          Users can log into the service manager from any web browser with a password. Administrator has a separate password to access a different page. If the user is a new user, he/she can add herself to the Impromptu system at the Impromptu SMS homepage.

·          Users can change personal information: first name, last name, password, settings, service URLs.

·          Users can change buddy list – add and remove other Impromptu users to and from the personal buddy list. Also has a trust level feature where users can give different trust levels for different users. If a user newly adds another user, the trust level is set to OUTPENDING on the user who added the other user, and IMPENDING on the user that has just been added.

·          Users can change application list – works in the same way as the buddy list, but with applications.

·          Users can view the automatic user profiling settings.

·          Uses can view a log of their past connections to other users or applications on a LOG page, much like a phone bill – includes time/date, duration, user/application name.

 

·          Administrator can add, modify and remove global settings and values of Impromptu.

·          Administrator can add or remove Impromptu applications.

·          Administrator can modify application settings: name, URL, type, connection, alertURL, vocabURL.

·          Administrator can also modify trust levels given to the subscribed users of a certain application, or remove the subscribed user altogether.

 


DATABASE

 

Here are the database tables. The function headers for the database layer are at the end of this document.

 

UserInfo

userID

password

firstname

lastname

speechURL

presenceURL

profilerURL

alertURL

string

string

not null

string

string

string

string

string

string

unique key = userID

 

ApplicationList

appID

appName

appURL

appType

conType

alertURL

vocabURL

string

string

string

int

int

string

string

unique key = appID

 

appType 0 = NORM

                1 = SRTTS

                2 = RECO

                3 = TTS

conType 0 = datagram

                1 = stream

                2 = both

 

 

UserToUserSubscription

userID

buddy

trustlevel

string

string

int

unique key = userID + buddy

 

trustlevel 100 = SUPERUSER               104 = UNTRUSTED

                101 = VIP                               105 = IMPENDING

                102 = TRUSTED                   106 = OUTPENDING

                103 = NORMAL

 

 

UserToAppSubscription

userID

appID

trustlevel

string

string

int

unique key = userID + appID

 

AppToUserSubscription

appID

userID

trustlevel

string

string

int

unique key = appID + userID

 



AdminInfo

GlobalSettings

userID

password

 

settingID

settingValue

 

string

string

 

string

int

 


unique key = userID

unique key = settingID

 

BuddyProfiling

userID

buddy

hits

lastStart

lastFinish

lastDuration

string

string

int

long

long

int

unique key = userID + buddy

 

NB. lastStart, lastFinish, lastAccess retrieved as Date – Date.toString(long)

 

AppProfiling

userID

appID

hits

lastStart

lastFinish

lastDuration

string

string

int

long

long

int

unique key = userID + appID

 

BuddyLog

userID

buddy

lastAccess

lastDuration

string

string

long

int

unique key = userID + buddy + lastAccess

 

AppLog

userID

appID

lastAccess

lastDuration

string

string

long

int

unique key = userID + appID + lastAccess

 

 


Web Client: HTML and Java Server Pages

 

Here are the HTML and JSP files and their functions. The JSP files have embedded java codes to access and retrieve information from the database (via the Database API).

 

index.html                     The Impromptu SMS entrance page. Users enter their user ID and the password to log-in. New users can fill out the new user details (user ID, password, first name, last name, alert URL, speech URL, presence URL, profiler URL) to become part of the Impromptu community.

 

loginAgain.html             The page shown when the user ID and/or the password entered are incorrect. Users can enter their user ID and the password again to log-in.

 

admin.jsp                      If the user ID “Administrator” and the password “impromptu” is entered in the log-in page, the user is redirected to the Administrator Home page. The administrator can add, modify, or remove global settings and their values. Administrator can also add new setting with corresponding details (application ID, application name, type, connection, alert URL, vocab URL) or remove an application. If the Administrator wants to modify a certain application, he/she can choose the appropriate application and click on modify where the Administrator will be redirected to the application page (app.jsp).

 

app.jsp                         Administrator can modify the details of the selected application (application ID, application name, type, connection, alert URL, vocab URL). Administrator can also change subscriptions – change the trustlevel given to subscribed users, or remove subscribed users.

 

home.jsp                      User home page. A user is directed to this page upon log-in. User can modify and update his/her personal information and settings. Also, user can change buddy list or the application list– add and remove other Impromptu users or Impromptu applications to and from the personal buddy list. User can also set trustlevels for buddies and applications If a user newly adds another user, the trust level is set to OUTPENDING on the user who added the other user, and IMPENDING on the user that has just been added (works same for application).

 

log.jsp                          User log page. User can view his/her past connections to other users or applications, much like a phone bill – includes time/date, duration, user/application name

 

profile.jsp                     User profiler page. User can view automatic profiling status. Not functional yet.

 


SERVLETS

 

Here are the Servlets and their functions. Like the jsp pages, the servlets access the database (retrieve information as well as store and modify database entries) via the Database API, DBLayer.java and SDBLayer.java.

 

LoginServlet.java          Called from index.html or loginAgain.html. The servlet checks the user ID and the password and redirects the user accordingly. If “Administrator”, the servlet takes the user to admin.jsp, otherwise to home.jsp (with the session logged in with the user ID). If user ID or password is incorrect, then the user is taken back to the loginAgain.html page.

LogoutServlet.java        Called whenever the “LOGOUT” button is pressed. Invalidates the current session and redirects the user to the Impromptu SMS entry page.

ServletUtilities.java       Contains static functions that convert trustlevel integers to corresponding string (and vice versa) and appType integers to corresponding string (and vice versa).

 

User Servlets

NewUserServlet.java    Called from index.html when a new user inputs the necessary details (user ID, password, first name, last name, alert URL, speech URL, presence URL, profiler URL) and clicks on the register button. The information of the new user is inserted into the database, and the user is redirected back to the impromptu home.

ModifySettingsServlet.java

Called from home.jsp when the user inputs personal information to modify, and then clicks on the update/modify button. The information in the database is updated accordingly.

ModifyBuddiesServlet.java

Called from home.jsp when the user selects another Impromptu user to add, remove or modify the trustlevel of, and then clicks on the corresponding button (add, modify, remove). The information in the database is updated accordingly. When a new buddy is added, the trustlevel of that user is set to OUTPENDING until the other user authorizes him (by changing the trustlevel from INPENDING to a different trustlevel). When a buddy is removed, the user is also removed simultaneously from the other user’s buddy list.

ModifyApplicationsServlet.java

Works in the same way as the ModifyBuddiesServlet.java but with the user’s application list.

 

Administrator Servlets

ModifyGlobalsServlet.java

Called from admin.jsp when the administrator adds, modifies or removes a global settting and its value. The information in the database is updated accordingly.

ModifyGlobalAppsServlet.java

Called from admin.jsp when the administrator adds, modifies or removes a global application. When a new application is added (with corresponding information), it is inserted into the database. When an application is removed, it is removed from the database, as well as from all the subscribed users’ application lists. Finally, if the administrator selects an application and clicks on “modify”, then he/she is redirected to the app.jsp page where that application information and subscribed users can be viewed and modified.

ModifyApplicationServlet.java

Called from app.jsp when the administrator decides to modify settings and information of a certain application. Also, the same servlet is called when the administrator decides to modify the trustlevel of, or remove a subscribed user. The database is updated accordingly.

 

 

Here is a diagram showing the interaction between the web client, servlets, and the database.

 

JAVA SERVLET

Tomcat Servlet Engine

 

WEB CLIENT

HTML

JSP

 

DB JAVA API

DBLayer

 
 

 

 



IMPROMPTU SMS DIRECTORY STRUCTURE

 


CVS Repository

 

This is the directory structure of the Impromptu SMS in the CVS Repository.

 

/impromptu

            /database

impromptu.prp

create_tables.sql

fill_tables.sql

drop_tables.sql

RmiJdbc.jar

java.policy

DB_README.txt

IDB_README.txt

/java

            /src

                        /impromptu

                                    /data

                                                DBLayer.java

                                                                SDBLayer.java

                                                                DBUtilities.java

                                                                etc…

                etc…

            /web

build.xml

java.policy

setup.sh

SERVLET_README.txt

TOMCAT_README.txt   

                        /impromptu

                                    /html

                                    index.html

loginAgain.html

home.jsp

profile.jsp

log.jsp

admin.jsp

app.jsp

/images

heading.gif

button_home.gif

button_home2.gif

button_log.gif        

button_log2.gif

button_profile.gif

button_profile2.gif

button_adminhome.gif

button_adminhome2.gif

button_logout.gif

button_logout2.gif

                                    /servlets

LoginServlet.java

LogoutServlet.java

ServletUtilities.java

                                                        /user

ModifyApplicationsServlet.java

ModifyBuddiesServlet.java

ModifySettingsServlet.java

NewUserServlet.java

                                                /admin

ModifyGlobalsServlet.java

ModifyGlobalAppsServlet.java

ModifyApplicationServlet.java

 

Deployment

 

The directory structure after deploying.

 

/impromptu_home (currently luz:/var/impromptu)

setup.sh

/database

impromptu.prp

create_tables.sql

drop_tables.sql

fill_tables.sql

java.policy

/indexes

/system

/tables

/tmp

/web

index.html

loginAgain.html

home.jsp

log.jsp

profile.jsp

admin.jsp

app.jsp

/images

heading.gif

button_home.gif

button_home2.gif

                                button_log.gif                                        

button_log2.gif

button_profile.gif

button_profile2.gif

button_adminhome.gif

button_adminhome2.gif

button_logout.gif

button_logout2.gif

 

/WEB-INF

            /classes

                        /impromptu

                                    /common

Common.class

Cond.class

EntityType.class

State.class

                                    /data

DBLayer.class

SDBLayer.class

SDBLayer$AppProfile.class

SDBLayer$LogApp.class

SDBLayer$BuddyProfile.class

SDBLayer$LogBuddy.class

DBUtilities.class

AppInfo.class

ConnectionInfo.class

IEntityInfo.class

PresenceInfo.class

UserServices.class

                                    /servlets

LoginServlet.class

LogoutServlet.class

ServletUtilities.class

                                                /user

NewUserServlet.class

ModifySettingsServlet.class

ModifyBuddiesServlet.class

ModifyApplicationsServlet.class

/admin

ModifyGlobalsServlet.class

ModifyGlobalAppsServlet.class 

ModifyApplicationServlet.class

 

 

SETTING UP IMPROMPTU SMS

 

. setup.sh Script file to set the classpaths and aliases for the setup of impromptu

 

#CLASSPATHS

JAVA_HOME=/usr/java/jdk1.3

TOMCAT_HOME=/usr/local/jakarta-tomcat-3.2.1

export JAVA_HOME;

export TOMCAT_HOME;

export PATH=${JAVA_HOME}/bin:${PATH}

export CLASSPATH=/usr/local/idb/Classes/RmiJdbc.jar:.

export CLASSPATH=${CLASSPATH}:/usr/local/idb/Classes/idb.jar

export CLASSPATH=${CLASSPATH}:/usr/local/idb/Classes/idbexmpl.jar

export CLASSPATH=${CLASSPATH}:/usr/local/idb/Classes/jta-spec1_0_1.jar

export CLASSPATH=${CLASSPATH}:${JAVA_HOME}/lib/tools.jar

export CLASSPATH=${CLASSPATH}:${TOMCAT_HOME}/lib/servlet.jar

export CLASSPATH=${CLASSPATH}:/usr/local/xml/jdom-b6/build/jdom.jar

 

#ALIASES

alias scriptTool='java org.enhydra.instantdb.ScriptTool'

alias dbb='java -Djava.security.policy=java.policy org.enhydra.instantdb.DBBrowser'

alias apache='/etc/rc.d/init.d/httpd restart'

alias tc_start='/usr/local/jakarta-tomcat-3.2.1/bin/startup.sh'

alias tc_stop='/usr/local/jakarta-tomcat-3.2.1/bin/shutdown.sh'

alias rmijdbc='java -Djava.security.policy=java.policy -Djava.rmi.server.codebase=http://www.media.mit.edu/~kwan/classes/RmiJdbc.jar

 RmiJdbc.RJJdbcServer -noreg org.enhydra.instantdb.jdbc.idbDriver'

 

dbb (Database Browser) Browser to view the contents of the database. Click on ”browse” to choose the database setup file – impromptu.prp (under /impromptu/database). Can also input SQL commands to update database.

 

scriptTool – Tool for compiling (?) sql script files. Tool used to create the database tables, till the tables, and drop the tables (create_tables.sql, fill_tables.sql, drop_tables.sql).

 

apache – Restarts the apache server.

 

tc_start, tc_stop – Aliases which start and stop the Tomcat Servlet Engine. Must be started in root for the Impromptu SMS to run. After running tc_start, the impromptu SMS is located at http://luz.media.mit.edu:8080/impromptu

 

Installing InstantDB Ver 3.26

1. Create a new directory on your machine, the idb_home (preferably /usr/local/idb).

2. Download the idb installation file (idb.tar.gz)

        http://instantdb.enhydra.org/software/downloads/index.html

        to the idb