Você está na página 1de 109

Java Chat Room

[eFrontDesk]
(for Liberian Government Ministries Inquiry)

by Chrichtian A. Neal

A dissertation submitted in partial fulfillment of the requirements of Bachelor of Science in Information Technology at the Amity Center for E-learning Amity University, Noida June 2013

June 24, 2013

CERTIFICATE

This is to certify that this a bona fide record to the project work done satifactorily at Uttar Pradesh by Chrichtian A. Neal (BSc IT015420102013027) of the BSCIT10 program.

This report or the similar report on this topic has not been submitted for any other examination and does not form part of any othe course undergone by the candidate.

Date: June 24, 2013

Signature of Project Guide:________________________________

Sanjay Kumar Dubey

ABSTRACT

A government enacted the Freedom of information law but limited its people to information due to the uncongenial layer that exists between the government and its people regarding the availability to information. It is the rights of the people to have unfiltered information. This project was done to depict the existing problems experienced at governments front desk and the hassle faced by the people in getting to these front desks where time and cost is involved. Findings backed the development of a web application called the eFrontDesk (chat system), an effective way through which of technology solved these problems. A Java software development kit was used for implementation after analysis of qualitative data collection was applied that brought out useful findings. The results supported this project development to bring the government and its citizen closer - using chat technology, but also keeping the traditional front desk system. The cost analysis showed an average 62% cost feasibility considering information access through Internet, and where cost is not a factor, time was of the greatest essence. The entire project design phase focused on creating a server end application and a client side with full GUI environment for text only. This project is applicable to governments wanting to delivery information to its people in a timely and cost effective way. It will help governments and people to reduce time and cost to access information with similar scenario.

ii

ACKNOLEWDGEMENT

It has taken me some considerate amount to time and effort to complete this project but at the same time have to take out time to extend thanks to those special persons who have made the complete process very possible. I am highly indebted to Mr. Florian Kammermann for being my study guidance during this project. He was very instrumental and resourceful even during his bus schedules. Very special thanks and gratitude goes to my dearest friend, Tori, who have helped and inspired me to carry out this project in the manner as I did. Another big thank you to the entire staff of Winrock-LESSP for affording me the peace I needed on Earth to complete this project. Had it not been for their understanding and reduced job requests, I wouldnt have been able to come to a reasonable finish.

iii

TABLE OF CONTENT Table of Contents


1. Introduction .................................................................................................................................... 1 1.1 1.2 1.3 Background ............................................................................................................................. 3 Objectives................................................................................................................................ 6 Purpose, Scope, and Applicability ........................................................................................... 7 Purpose ........................................................................................................................... 7 Scope ............................................................................................................................... 7 Applicability..................................................................................................................... 8

1.3.1 1.3.2 1.3.3 1.4 1.5 2. 3.

Achievements.......................................................................................................................... 9 Organization of Report............................................................................................................ 9

Survey of Technologies ................................................................................................................. 11 Methodology................................................................................................................................. 13 3.1 3.2 3.3 3.4 Problem definition ................................................................................................................ 16 Requirement Specification .................................................................................................... 17 Planning and scheduling ....................................................................................................... 18 Software and hardware requirement ................................................................................... 19 Hardware specification:- .............................................................................................. 19 Software specifications:- ............................................................................................... 19 Development:................................................................................................................ 19

3.4.1 3.4.2 3.4.3 3.5 3.6

Preliminary Product Description ........................................................................................... 20 Conceptual Models: .............................................................................................................. 21 System Flow diagram .................................................................................................... 22 Abstract Use Cases ........................................................................................................ 23

3.6.1 3.6.2 4.

System Design ............................................................................................................................... 29 4.1 Prototype .............................................................................................................................. 29 Web Site ........................................................................................................................ 32 User interface................................................................................................................ 36

4.1.1 4.1.2 4.2

Security issues ....................................................................................................................... 37 Secure enhancement: ................................................................................................... 38

4.2.1 5.

Implementation and Testing ......................................................................................................... 39 5.1 Server-client implementation ............................................................................................... 40 Server-side implementation ......................................................................................... 41 iv

5.1.1

5.1.2 5.1.3 5.1.4 5.2

Client-side implementation .......................................................................................... 47 Code efficiency: ............................................................................................................. 50 Storage Efficiency .......................................................................................................... 51

Testing Approach .................................................................................................................. 53 Unit testing:................................................................................................................... 53 Integrated testing: ........................................................................................................ 54

5.2.1 5.2.2 5.3 6.

Modifications and Improvements:........................................................................................ 55

Results and Discussion .................................................................................................................. 56 6.1 Results overview ................................................................................................................... 56 Cost indicator ................................................................................................................ 59

6.1.1 6.2 6.3 6.4 7.

Results discussion ................................................................................................................. 60 Technical result and discussion............................................................................................. 61 User Documentation: ............................................................................................................ 62

Conclusion ..................................................................................................................................... 71 7.1 7.2 Limitations of the System: .................................................................................................... 72 Future Scope of the Project .................................................................................................. 73

Bibliography .......................................................................................................................................... 74 Glossary ................................................................................................................................................. 75 Appendix A ............................................................................................................................................ 77 Appendix B ............................................................................................................................................ 80 Appendix C ............................................................................................................................................ 89

1. Introduction

The clich the world is a global village has had no profound meaning until recent few years when the proliferation of social media chat rooms. It is important to note that the unhindered and unlimited free flow of information amongst people across continents through the Internet as a result of chat room platforms (applets and applications) by which text, voice, video, and other types of files are exchanged has led to another unnoticed phenomenon. This paper looked at the development of a chat room system. There has been an increase in the number of chat room applications over the years, so much that many web sites cutting across all fields of studies have incorporated a chat applet on their web page. There are number of reasons for embedding these chat rooms into their websites, but what they all have in common is the real-time interaction amongst people of diverse interest coming together without geographic limitations to share information. The eFrontDesk application is no exception to this great venture, but it goes beyond boundaries of social media into making a government equally liable to providing free, available, and accessible information as it regards to the operations of a particular government (The Liberian Government). Governments MDG lacks the will in the absence of technology as a tool; and where there is availability of resource, the government owes accountability and transparency to its people in the form of good governance. The mixture of structure and process that brings together all forms of electronic communication that exists between any government and its citizenry should be encourage by proving a means by which inquiries are asked, and responses are given. This project investigation provided valuable resource which supports the creation of an eFrontDesk for each government ministrys webpage, -which will foster the free flow of information by bridging the gap between the government and people, and promote accountability, and transparency.

The paper provided in details a model for developing a web chat application. The project discussed lengthy on the processes of embedding the developed application into a web page to create a server-client chat system that would aid prospective users cut down on travel cost and reduce time constraints in obtaining needed information. As a result of inter-operational functions of governments offices, private businesses, non-governmental organization, private individuals, are often faced with hassle wherein business processes might require more than a single government ministry or office to complete. This process is cumbersome, costly in terms of distance which spans over ministries. The project will seek to address the information gap between the government and its people. The development of an electronic front desk will
1

relieve the burden, time constraint, transportation cost factor in getting needed information as required by users. It will also remove the centralization of information distribution from the Capital of ministry offices to limitless boundaries. And all this would be made possible by technology. Identified were problems faced by the Liberian people in an age where information is abundant, but has limited or scarce access to information. Finding presents a clear perspective that problem is political and the solution to adopt neutrality is technology. Technology was a resounding yes from findings to encourage good governance, foster cordiality between government and people, improve transparency and accountability, minimize cost on people by reaching out to the with technology. As was amplified by the studys report, it was shown the technology was the hope for an improvement to governments relationship with citizen.

A lot of effort was put in finding a unique development toolkit to sprout out a prototype for the application to solve the aforementioned problem of reaching the doorsteps a people with information. Newer ideas introduced another type of program functionality enhancement the eRejoinder. The rejoinder module and database functionality to capture governments indicators was touched upon especially as to why they formed part of the limitations of the project. The report brought together two types of methodologies. A data collection methodology which was qualitative in nature and imbued questionnaire, interviews, and direct observations to have come up with the analysis supporting the implementation of the projects development, and another methodology which was more technical in nature. The technical methodology of the SDLC (Software Development Life Circle) was a V-shaped model to enhance an RAD (Rapid Application Development) due to minimal planning. The data collection tool had a remarkable influence on spotting out new areas on which future studies could be made. These findings in turn showed light on some unnoticeable misconception on the part of computer users of what the good intention of technology is about. The user module of the computer system was emphasized to mean that the computer system is not efficient without uses.

1.1 Background

The beginning of online chat was from in the mid-1970s when Doug Brown and David R. Woolley of the University of Illionois created the Talkomatic. From then on, newer ideas on the development of modern chat systems was initiated for global usage and it was made available to many other people from different parts of the world thanks to the creation of the Internet. The Internet is the platform on which multiplatform computers are interconnected to make chatting possible. Right after that, Jarkko Oikarinen came up with the first IRC client and server application in 1988, at the University of Oulu in Finland. Since then, online chatting has grown from a tool of a few researchers and technologists to a wider public, and even inter-personal Internet activity, which provides a platform amongst users of specific interest group the sharing of information and knowledge.

In recent years, many free email web hosting sites have included a chat feature on their services. We see the same with eCommerce, eGovernance, health and medical practitioners, military services, hotel and tourism, banking institution, eLearning (of which the Amity University is proud), and very prominently the social era of relationship seeking through chatting and online dating services, customer support, plus more. Internet chat not only being the transmission of text but also incorporating video chat for conferencing, and VOIP has revolutionize the way people once perceived the Internet and this has changed the way people interact with one another locally and globally forever. Marshall McLuhans the world is a global village is strongly supported by this trend and consciousness has been extended.

On the backdrop of electronic globalization, it is binding on governments to bridge the gap between its people and the flow of information it has. For the most part, information in Liberia still seem to be scarcely managed but by a few. There should be a very free flow of information between any and every government and its people regardless of the negative impacts. The Government of Liberia signed The Freedom of Information Act in October in 2010, making the country the fourth country in Africa and the first country within the West African to have signed such a document. The law allows both the media and individual citizens to demand information from any public authority or any private authority that carries out government functions.

Within the framework of practicing efficiency and effectiveness in governance, it must be noted that good governance initiates opportunities that allows governments to recreate means which promote higher level of efficiency in terms of eGovernance. EGovernance when practice well helps the government get closer to the citizenry and
3

this leads to a rather closer coalition and relationship with diverse communities of expertise, interest, and practice within the context of national development agendas with is wholly reliant on proper distribution and sharing of vital information. EGovernance being an emerging concept or practice seeks to substantiate processes and social structure for harnessing the capabilities of information and communication technologies (ICT) at many diverse levels of government and the public sector.

As was previously mentioned, the central of the Global Information Infrastructure is important to effectuate the concept of flexible regulation, decentralization, and dissimilation of information, which is the right of each and every citizen (as enshrined by law) living in Liberia to have free unrestricted access public information. The road to eGovernance seems more like an emerging revolution, as governments and citizens the world over invest more into the experimental phase and exploits deeper into the concept with newer media and information technologies. E-Governance has evolved to be a new styles of leadership, bringing newer ways of considering and deciding strategies, newer means of accessing services, newer ways of doing business, newer ways of accessing education, newer ways of listening to citizens, newer ways of organizing and delivering information.

Amongst the many ways eGovernance promotes eDemocracy (which is referred to as the mixture of structure and process that brings together all forms of electronic communication that exists between any government and the citizenry) is by making information available and accessible to its people and those in search. A better way to do this is what this project has researched an online chat room which serves as an information front desk made available to the people once Internet is available.

The eFrontDesk is an application coded to run as an applet in a web browser. This program enables users to login and interact with help desk representative and request relevant information without having to in person visit the government office for needed information. This project unlike many other projects is incomparable due to its government-to-citizen forecast on availing information. Much similar to this project is the inclusion by many universities the world over incorporate web chat on their pages. Except that eFrontDesk is limited to just text-based chat, eLearning encompasses textbased, video-based, audio-based, and the wholeness of multimedia interactions.

Evidently in recent times, a lot more educational institutions have added a chat roombased teaching environment. This environment permits virtual teaching which occurs at different times and locations much more convenient to the students and faculties. Due to this improvement, the teaching field is moved to utilizing the best out of this technological tool to improve the quality of social and psychological lives of the students and forecast their learning abilities. There are some universities which created chat rooms supported by Internet that allow students to socialize and share their emotions as well as relevant information with other students and faculties. Some universities engaging this chat technology are: The University of Delaware in the United States did establish a series of online chat rooms for incoming freshmen, while the New York University and Kwangwoon University (in South Korea) also did create their own chat rooms for students who are single which allowed them to socialize with each other and share their photos online to get to know each other better. This project comes handy in aiding the Government of Liberia in allowing a framework for the people to know their government in what they do, how they do, and why they do what they do. It brings to the doorsteps of the people the answers they have been waiting for. And this put the government in the position of making fulfillment of some of the promises made to the people by reaching out technologically with information.

1.2 Objectives

This projects objective is to create a chat room for the government ministries in Liberia written in Java , designed to ease the burden off the citizenry which includes: NGOs, businesses, and private individuals (home and abroad), and span over non-Liberians when it comes to acquiring firsthand information from each of the various government ministries. Research was conducted in Liberia, but the product would be relevant to people outside the country as well.

The project will also developed to help alleviate cost and time factor of citizens in getting relevant and timely information for effective decision making. Most times, it is very difficult on the part of citizens to get to relevant government offices and it takes hours to get a small piece of information, which sometimes in either misleading or uncompleted.

Primary objective:
To create a single chat server and multiple client connections using sockets allowing user s to make inquiry to online desk offices. To help Ministries become more interactive, and bridging the information gap between it and its people.

Secondary objective:
To study the various classes responsible for socket connections across the Internet and how a client side application connects to a server, like the Listener class, while-loop, etc. To understand the authentication and communication protocol involved before a session. To study Javas greatest strength when it comes to multithreading and networking by providing vivid analysis of this characteristic in the project. To study how information is send to database that will store log in session activities and chats. To study the cleanup and maintenance after a chat session. If possible, attach a rejoinder app to forward findings to phone numbers and email addresses of visitors.

1.3 Purpose, Scope, and Applicability

1.3.1

Purpose

The aim of this paper is to provide a model for the developing and implementation a web-based user-friendly (GUI) and easy-to-use online web application, which will enhance interaction between government and citizen (we shall use clients or users for this scenario), and those seeking information from relevant Liberian Government Ministries by means of devices capable of connecting to the Internet via a web browser.

The application will act as a web application and link the government to the people. It will make available a platform which the citizenry could use to request information within a fraction of time without having to spend extra on transportation. The long waits and hurdle faced by people will be minimized, if not abolished, just by a few clicks. For the greater good of the country (Liberia), this project finding brings the government closer to its people in a very assessable fashion, wherein through eGovenance, eDemocracy is practiced and the people partake of the right to information regardless of their geographic location, financial status, ethnicity, beliefs and political affiliations.

Accepting that the eFrontDesk system is capable of tracking all data from uses which includes the location, professional, age group, gender, inquires of each user, amongst other information that are determining factors to enable the government underline meaningful indicators to meet its eGovernance information objective. A visual can be seen on the who, where, when and why elements of information reach-out.

1.3.2

Scope

As was researched, there was need for a viable solution amongst government ministries overlap of office functions, but there was also a need for a one-timeinquiry center which is not limited in terms of location for citizens or users to get as much information as possible. The research will provide a medium to reduce and saturation of information between government offices but providing users with a means of eTraveling to get those desired information. This project is in itself feasible for fact that Java applications are less of a problem when looking at dependency of
7

platforms and it comes across efficient to connectivity. The creation of the Java chat room might find itself useful by undergoing a sequence of program development methods and procedures which are applicable in the modeling of Java development for the purpose of information inquiry. It will leave enormous room for integration into web sites. It will further grow its functionality when considering enormous integrated interworking of offices as far as information exchange is concerned.

Careful thoughts would be put in to other aspects of the applications data reservation (data mining) to enhance a system of monitoring and evaluation, but this feature was a limitation due to time and left for future growth. This project is unlike many others with full functional voice, video and file sharing capabilities. A very relevant feature which would particularly support the purpose of the project is the file sharing. The government and people could use this to further cut down on the problems by sharing various types of forms, journal, new letter, bills, and so on. In the same way form could be submitted to bureau electronically. Functionally,

1.3.3

Applicability

This paper implementation, that which is the outcome, would be used at the front-desk of Government Ministries in Liberia to address many forwarded inquiries from users. This project is going to contribute meaningfully to the users (who mostly would be Liberians) by reducing the time put in to travel from one office to another to make queries. It was developed to also reduce the cost of travel for users. The project is scoped for Liberians near and for wanting to get information prior to seeing governments office. It does not limit non-Liberians from also get similar information or making inquiries. It would be very important for all business people, NGOs, and private individuals. Since it is going to be Internet supported; this broadens the usage to a more global audience. On a global spectrum, this project is pilot project to many governments that would want to practice eGovernance where transparency and access to information to its people would be paramount. It will add value to many governments web page inducing a friendly but human interaction which is more flexible and not limiting.

1.4 Achievements

A significant achievement has been made as a result of an on-hands initiation and implementation of this project. More notable is the importance of the Java as a widely used application; much was achieved in terms of developing a messaging protocol using socket and how to integrate that into a full application in to a web page this which was a new lesson learned. Much time was spent on remodeling the user interface which was created with Java AWT package coding and this turned out very phenomenal. The experience was new, difficult, but paid off. Other important issues learned was that of the governmental operation and functions in the Liberian political setting. It was discovered through this research that Liberia was the fourth nation in African to enact the Freedom of Information Bill and it was also the first nation in West Africa to do same. The researcher found it very useful through gathering information that despite the literacy margin with is almost the same as the illiteracy rate, many look at technology as a means of improvement. Be it personal improvement, or a national collective improvement. It is established that technology is the new trend by which any government should build its millennium development goal upon for a rapid and inclusive growth. This project is achieved remarkable success for implementation to those governments wanting to reduce time, cost, and hurdle of its people, and allow a cordial free flow of information through its authorities (ministries) by a few clicks.

1.5 Organization of Report

This project provides a stimulus recipe of an investigative summary researching the productivity afforded by employing the use of technology in helping make the most out of our day to day situations. It goes further to dissect the SDLC in putting a solution to the problem found with an intention to alleviate the fear relating to cost, and time consumption that incur trying to obtain information for a particular setting. The rest of the chapters will elaborate more detailed findings and methods taken to resolve the problems found. The best tool as was analyzed in chapter 2 was laid out and selection done. Chapter 3 spells out clearly the problems and how the problems would be solved in a time cautious way -with all of the necessary and relevant materials (software and hardware) needed from design to implementation. It focuses more on the method of data collection and analysis which was supportive of the
9

project. It gives a step-by-step detail for further replication or improvement of similar project. In chapter 4 is where explicit discussion and elaboration was done, which included the planning, diagram, flow chat, pseudo coding, plus other issues that had to do with security were made mention. This chapter is in total the design phase of the entire project for developing a complete prototype. The test-try-and-use phase is chapter 5. This chapter implements a platform which enables whatever that was developed as a prototype into coding for prompt workable application for a test and try. If test-and-try meets specifications, then the prototype is moved into implementation or changeover mode. Chapter 6 discusses the result from the test cases. Much deliberation is carried out here relating to the combine methods used. An insightful peak into the analysis of the data collection procedure is explained, and those methods where qualitative, questionnaire, open-ended interviews, and general observation. It discusses more on the ability of the application to withstand the reality of endurance in a real world scenario. In this chapter user documentation is found. The conclusion is the finally chapter (chapter 7), and it brings to together a lot of point in a mesmerizing way. It presents a full summary of what the project report is all about. What the findings where, and how they were solved, and things which were unsolvable, and those that are up for future study or solution based on limitation of various sorts.

10

2. Survey of Technologies

The implementation of a chat room which cuts across multi-platform with not much hurdle, despite other issue arising from growth and data storage Java stands tall. Java's write-once-run-everywhere capability along with its easy accessibility have driven the software and Internet communities to embrace it as the de facto standard for writing applications for complex networks, and perhaps many other devices. In similar manner, we cannot pay a blind eye to other contending tools like C#. Quite recently, there have been many controversies when it comes to the strengths and weaknesses of the two (Java and C#) devkits. More developers are finding C# highly interoperable, portable, and cross platform. Diving deep into which of the two app has all it takes to run a project like a chat room, it could be simple and easy to choose Java over C# because of the scope of this study, but eradicating the politics centering Sun MicroSystem and the .Net/Mono project, many would want unlimited restriction or OpenSource privileges. PHP (server side) combined with JavaScript (client side) comes across as one perfect solution for a chat room application. When combined, Ajax integrates suitable techniques for server/client side messaging protocols. The truth of the matter is that these languages have interesting features lagging by the other, but for now Java seems to have an urge over the rest due to its popularity, portability, robustness, maintainability, abstraction, and its politicized write once run everywhere campaign. Even though, many programmers would chose C#Mono over Java due to its Language Integrated Query (LINQ) feature, the major factor is not which programming language is the hallmark of excellence, but which protocol (IRC, PSYC, HTTP, or XMPP) serves best the purpose for chat messaging or conferencing.

Available technologies: Java C# PHP JavaScript SunMicroSystem Microsoft The PHP Group Netscape

11

Table 1: Chat programming language comparison


Memory usage Using VM Programming Web services IDEs Native interoperability Functional programing

Java

High

Faster

Difficult

Yes

Cross platform Microsoft

No

No

C# PHP JavaScript

Low High High

Slower

Easier

No Yes Yes

Yes

Yes

The above survey (table 1) provided available platforms to undertake this project, and the best language as per the requirements provided to undertake this project was Java. There were a few constraints that led to the selection of Java and time was one of those restraints. Another key feature with Java is that it is encourages multi-threading - an important feature relating to enhancing a real-time login process with multiple users demanding access at the same time.

12

3. Methodology

To develop an application, it is important to apply the right methodology to make the development process effective and efficient. As per the requirement and analysis of the system, the V-Shaped module was used for its simplistic nature. This model is also one of the SDLC models with a high change of success as compare to other modules and each phase has a specific deliverable.

The project specifics modeled around the below listed: To use technology to allow freedom to access information for government To mitigate the cost and time put in to obtain the require information, either by transport or phone calls. To allow the people and government foster a cordial interrelationship by eradicating the limitations geographic location has on its people along with the negative effects. To alleviate public misconception and misinformation through direct one-onone means with the help of technology. To improve technological skills of front desk personnel on ICT. Hence, a Rapid software Prototyping process (or Rapid Prototype Model) was applied. This process describes a practice in software development process or application development process and is sometimes referred to as rapid application development (RAD). Rapid Application Development (RAD) is also referred to as a type of software development methodology, which uses minimal planning in favor of rapid prototyping. The planning stage of the software development uses RAD to interleave with the writing of the software. The projects beginning had a minimal plan and all the following works were strictly based on the plan, even though there were some changes during the development process. This project was supervised by the Mr. Florian Kemmermann (a software engineer), and periodic reviews on the progress of this project were held intermittently during the development of the project. With focus set on the purpose of the project, identified were problems faced by a people (the Liberian people) and found ways through the use of technology to solve the problems. It sought to mitigate the cost and times factor faced by many people wanting information in a feasible way, and in so doing relieved them of stress. More importantly was the emphasis made on the commitment of a government wanting to bridge the gap with its people by disseminating unhindered information with the help of technology. Good governance intertwined with technology produced efficiency in eGovernance and forecasts eDemocracy. The study provided a set of problems through a qualitative method, since this method did not just investigate the what, where, and when of the decision making, but
13

also the why and how. Qualitative data collection also drifts away from the scientific demand unto a rather natural understanding of a problem which was less scientific driven. The investigation looked at output from a series of data collection processes which included questionnaires and a couple of interviews that were openended. A cross section sampling was done out of a focus group of eight. Questionnaires were handed out 13 respondents, and a series (five IT professionals and five front desk personnel from various ministries) at of open-ended interviews with diverse professional groups was held. The respondents were from a cross section of gender, age groups, professions, with much knowledge on the information criteria as made available by the Liberian government ministries. There were series of direct observation made at various front desks as to their inner working of front desk practices and procedure in handling the dissemination of information to visitors. The observation method proved helpful in determining key variables to the projects implementation. The interview, questionnaire, and direct observation aimed at obtaining information on the current front desk system, the effectiveness of it, room for improvement, using technology for improvement, and the decentralization of information. The questions asked also gave respondents the freedom to reject the validity to undergo this project, but fortunately the results proved otherwise. As shown in the appendix (appendix A1), each respondent of the 13 were provided, through cluster sampling, a questionnaire with two section which collected personal data (which included: age group, sex, occupational category, and IT literacy), and the other section presented 15 questions that yielded insightful outcome. The other 10 responded went through the interview and were presented 10 open-ended questions each (see appendix A-2). The sampling was judgmental. Responses from the respondents were recorded and later analyzed. All analysis arising from the questionnaires was done using Microsoft Excel 2010, while interviews were narratologically analyzed. The duration for the data collection is a little over the one week stipulated in the time schedule. The process has been ongoing but within a week, all the recorded interviews were done along with the collection of questionnaire from respondents. Respondents were engaged mostly at the mid-day at seven of the 19 ministries which included the Ministry of Foreign Affairs, Ministry of Planning and Economic Affairs, Ministry of Lands, Mines and Energy, Ministry of Health and Social Welfare, Ministry of Education, Ministry of Information, Cultural and Tourism, and the Ministry of Finance and Budget Bureau. A cross sampling interview was also done at some local government agencies which included the Rural Renewable Energy Agency, Liberia Business Registry, Liberia Bureau of Customs, and Liberia Maritime Bureau. All of these ministries and agencies are all located within the vicinity of Monrovia and Paynesville cities, Monsterrado County, Liberia.

14

Some important factors to make mention of which could have hampered the outcome of this project are as follow: The literacy rate in Liberia is battling out the illiteracy but with a minute margin. In 2010, the literacy rate stood at 60% wherein that figure in a population of approximately 4 Million inhabitants, 56% are females. Balancing the ratio could have led to variance had computer literacy not been a determining variable. The demography of the country is shifted largely to a few bigger cities, making it difficult to obtain proportional data sampling from all parts of the country. Political factor: some respondents felt that the process was to discredit the present government of which they are closely linked or partisans. This could have put a damper on the quality of responses. To avoid the above mentioned anticipated problems, a prescreening was also initiated in form of a conversation which was more or less an open-ended interview to get hold of the respondents utterance. This inclusion criterion was used to determine the level of education of the respondent. As for reaching throughout the countrys demography representatively, this was in a sense very difficult. The reason is that the countrys (Liberia) political setting is centralized to the capital (Monrovia). This had a negative bearing when it came to representative data collection. All government ministries are in Monrovia with no or non-functional sub branches. A careful introduction to respondents was done in order to ensure that they actually understood the intension of the exercise. To eradicate the political atmosphere during the data collection process, the problem statement was presented in a manner that shifted the political ideology to a communicational gap and a technological enhancement.

15

3.1 Problem definition

One of the great disadvantages faced by people in the Information Age is information overcharge. So much information out there and one might not know from which to select. This also applies to the many government offices, agencies, and ministries, where occasionally, their functions interlaced with each other. Businesses, nongovernmental organization, private individuals, are often faced with hassle wherein business processes might require (unknowingly) more than a single government ministry or office to complete. This is cumbersome enough, time consuming, costly in terms of distance -spanning over ministries, offers delay in business transactions. During the close of the year, especially holidays seasons, this could be very irritating since transportation means is difficult, and government offices close-down far too early. It is frustrating to know that many government ministries do not have websites. Some do have websites but they are not regularly updated. Front Desk offices are either not available or without the information needed. Many others in a hurry to get information are impatient. This unavailability of relevant information at front desk is viewed by many citizens in Liberia as a way the government chose to hide information from them. Inasmuch as the Freedom of Information Law was enacted into law, and yet many still feel disenfranchised to information. Information should be free and available at all times to those in need. The government has a duty to its people to provide the information they need if they should make the right decisions. To summarize, the project found the following problems which it will seek to address: 1. Information gap between the government and its people 2. Burdensome, time consuming, phone communication and or transportation cost factor in getting needed information 3. Information retrieval is geographically centralized because governance is also centralized.

This project did identify the above listed problems faced by the Liberian people and found a way by using technology to solve the said problems. It sought to mitigate the cost and times factor faced by people wanting information in a feasible and cost effective way, and in doing so -relieve them of stress.

16

3.2 Requirement Specification

The eFrontDesk is a web-based chat room application coded in Java using socket which runs on a WAN architecture. The finished product runs in two folds. 1. Server-side application (listens for clients connection). 2. Client-side application (access chat room through web page to make queries). Server-side The server-side module contains the UserObject class which handles users socket, chatnames and others. The chatserver when executed opens a server socket at port 1436 (is set as default but can be changed) and waits on trigger from a clients connection. The connection between a client and server provides a medium for the exchange of chats between other available concurrent chat users by invoking the ChatCommunication class. Client-side The client-side is accessed via a web browser. On the menu, a login pane pops up a login windows for user to connect to server. Upon login, an HELO RFC is transmitted to the server to establish connection. The user can now send out chat message to anyone in the Administrator or Help Desk Personal for inquiry, and also other logged on users as well. The application runs on Internet connection, and allows users to choose a nick name. It does not allow for redundant nick names. Successful logged on users are able to communicate with front desk personal who are administrators of various chat rooms. Any users can make general inquiry (public) or a private inquiry, to the administrator or other users. Response is received in same manner as was asked (public or private). User can avoid communication with other users by blocking specific user(s) and a user can also unblock a particular user(s) by allowing them. Use can exit after obtaining any necessary information or at any given time they choose.

17

3.3 Planning and scheduling

Like every undertaking, planning is the first step. A developer must go through this phase in order to properly organize the many sub-phases of the project, and afford him the relevant documentation on the system he wants to build. It is by this means the system comes under critical studying, the collection of data, design implementation, system coding, series of testing, and finally, implementation of the system is achieved.

Table 2: Simulated Gnatt chart


ID
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 Task Procedures Duration
wk1 wk2 wk3 wk4 wk5 Wk6 Wk7 Wk8

Begin project Phase0 Survey and analysis Phase1 Server module coding Phase2 Client module coding Phase3 Web page creation Phase4 Client module Phase5 Embedding client module in HTML Phase6 Testing validation Phase7 Debugging errors Phase8 Remodeling Phase9- Testing validation Phase10-Final testing and implementation Phase11 Integrated Testing Phase12: Modification to suite spec Phase13: Testing and debugging Finish: implementation

2months 6days 3days 9days 2days 3days 2day 6days 5days 2days 2days 1days 2days 2days 2days

The time duration as displayed by the Gnatt chart is far less than the 3 months period as stipulated by the project schedule. In additional, this depicts an estimated time value, and due to unavoidable circumstances, schedule can incur fluctuation.

18

3.4 Software and hardware requirement Minimum requirements:


3.4.1 Hardware specification:-

Processor Speed Memory Hard drive USB port Keyboard Monitor Compact disk drive Mouse Network card

: Intel Pentium II or higher : 350 MHz processor or higher : 128MB RAM or higher : 10GB or higher : 1 port or multiple : Standard keyboard : 15 color CRT (Cathode Ray Tube) : Combo Drive : Scroll Mouse : 10/100 mbps

In addition to the above mentioned hardware specification, it should be noted that the requirement for implementation is not limited to mobile users.

3.4.2

Software specifications:

JVM (Java Virtual Machine) Internet web browser (Internet Explorer, Mozilla Firefox, Google Chrome, Safari, Opera,..) TCP/IP, Socket OS [cross platform]

3.4.3

Development:

Java IDE (NetBeans 7.0.1) EditPad Lite 7 JDK 1.3.1 or above Microsoft Office 2003 or above
19

3.5 Preliminary Product Description

The significance of this project is to provide a decentralized, inexpensive, less time consuming alternative to users wanting information from any of the governments ministries in Liberia with the help of technology. This new web enabled chat application will be used by those in Liberia as well as Liberians and non-Liberians outside the country. This will help them to make resourceful inquiries from government offices near and far by a few clicks. The application will allow users to login with a user name or chatter handle or nickname and will each user will be validated to chat with front desk personnel. The eFrontDesk system should be able to meet the following requirements:

The system should be able to have an attentive server listening to connections. The application should allow multiple users to logon to the server through a web application. Redundant nicknames should be discouraged. Chat users should be able to provide a username to be validated. Users must be able to communicate with front desk personnel and get instant feedback through chat. The system must be easy to use. System should allow user tranquility or abstention from unnecessary chatter(s). It should allow user to terminate connection if they so desire. The system should be able to keep track of logged in users.

20

3.6 Conceptual Models:

The eFrontDesk system will mediate between people seeking information and those at the various ministries front desks representing the voice of the government by providing such information:

Figure 1: A simple illustration of the chat logic from concept

21

3.6.1

System Flow diagram

Figure 2: A message flow diagram between a server and two clients

I. II. III. IV. V. VI. VII. VIII.

Client 1 connects to the server. Validation takes place to avoid duplicate nick names. The server sends a USERLIST_MESSAGE message to Client 1 (The user list window is populated with all online users and all available public chat rooms) Client 2 connects to the server. The server sends a USERLIST_MESSAGE message to Client 2 (The user list window is populated with all online users and all available public chat rooms) Client 1 sends a CHATINVITE_MESSAGE for Client 2 to the server The server sends an OPENCHAT_MESSAGE to Client 2 (A private chat window is opened on Client 2) Client 2 sends a BROADCAST_MESSAGE to the server for the private chat room that Client 1 and 2 are now in The server sends a BROADCAST_MESSAGE to all clients in the specified chat room. (The message is printed in the chat window on both clients) 22

IX. X.

Client 1 sends a LEAVEROOM_MESSAGE to the server. (The server removes Client 1 from the chat room) Client 2 sends a LEAVEROOM_MESSAGE to the server. (The server removes Client 2 from the chat room. Since there are no longer any clients in the chat room, the server closes the room and makes the chat room ID available for future use) Client 1 sends an EXIT_MESSAGE to the server. (The clients connection is terminated and the client is removed from the online users.) The server sends a USERLIST_MESSAGE to Client 2 (This message will no longer contain Client 1)

XI. XII.

3.6.2

Abstract Use Cases

The abstracting use case is a makeup of the requirements specifications. The area covers the most important functionalities and requirements. The abstraction of the client-side consists of the following use cases:
1. Use Case 1: Login 2. Use Case 3: Chat in one room 3. Use Case 4: Logout

eFrontDesk System USE CASE 1

Login

USE CASE 2

Chat in room

User/chatter **

USE CASE 3

Logout

Figure 3: Use Case diagram [user login]

In this use case diagram, the pane with the label eFrontDesk System indicated the boundary of this system, and the three ellipses showed the use cases inside this boundary and occupied some part of system resources, but not all of them. Except those use cases, the remaining part indicated some other resources of this system, such
23

as web page part. On leftside of system boundary, the symbols represented users part of this system, and ** means the user quantity can be ranged from zero to infinite. The following use cases were not fully dressed, only successful system operations were recorded and the failed operations were ignored: :: Use case 1: Login 1. The system displays a login menu. The use click the Login menu button and a dialog box appears, asking user to enter a nickname that used for chatting, a server name, and port number. The server name is not important and it could be null. The port is defaulted to 1436. 2. The user enters a nickname and then presses Connect button. 3. The system displays a card-layout GUI chat room window to user.

:: Use case 2: Chatting in room 1. User can type in General Message! text box and press Send Message! to send general message to all users in chat room. 2. A user can also send private message to specific user in chat room by double click users name, or by selecting specific user and clicking the Send Direct Message button. A private chat window will display for personal chatting. 3. User can also select a particular user and ignore conversation or chat from selected or highlighted user. 4. User can send/broadcast message to all logged on users or engage Admin/front desk personnel for inquiry. :: Use case 3: Logout 1. User can click the Exit Chat button to leave chat room. 2. The server stops the active session of the user and closed the user chat window by exiting the system.

eFrontDesk System

Start/Stop Chat Server

Chat Admin

Respond to user queries

Figure 4: Chat Admin [Admin actions]

24

:: Use case for Admin 1. The Chat Admin start the server and or stop server application. 2. The Chat Admin respond to various inquiries made by users. Detailed use case diagram of server/client:

Log Onto ChatServer

<<include>> Respond to chatter query

Quit Chatroom

Chat Admin Send Message to Admin User/Chatter Decode Chatter Message <<include>> <<include>>

Send Control Message

Send Message to ALL

<<include>>

The above diagram is similar to the previous but elaborates more on the actions that could be performed by the user/chatter and the proposed role of the administrator/help desk personnel. 1: Chatter Logon to chat room. Send General message. Send private message. Send message to Admin/help desk person. 2: Admin/Help desk personnel Start/stop server. Respond to chatter inquires.
25

A Chat Message Use Case Sequence Diagram showing groups of objects interworking

aSendMessag eWindow

client

aClientSocket
Message()

* write()

aServerSocket

* recieve()

mssgType := getMssgType()

[validMssg ]
new new

aBroadcastMssg aLogEntry

| | |

| | | | | | | | | | | | | | | | |26 | | | |

| | | |

A Client Create Sequence Diagram asynchronous messaging

new

aChatClient

new

aClientListener

new

aChatClientSender

* listenToServer()
recieve()

* listenToChatter()
mssgRequest()

postToClient ()

sendToServer ()

logout

kill

|
kill

| | | | |

| | | | | | | | 27

A Collaboration Diagram for the Chat Message Use Case

:SendMessag eWindow
1 :clientMessage()

:ClientSocket
1.1 * write() 1.1.1 * recieve()

:ServerSocket

1.1.3: new

: LogEntry

1.1.2 getMssgType() 1.1.4: [validMssg]:new :BroadcastMssg

28

4. System Design

The system design phase turns out to be the most difficult phase in developing an application, maybe not but the most challenging phase within the designing of a system. It is within this phase right after conforming to the various criteria aroused from the system analysis that the development of specification for a candidate was carried out. The designing of software is an integral component of software engineering and it is a technical phase which must be applied to all software modules.

4.1 Prototype

The system is going to be divided into two separate applications running independently of the other but reliant on the other to form a functional system. The client-side and server-side applications: Server-side interface: On the server side, a custom class was created - UserObject class - it will contain the client detail which includes users socket and username or nickname, etc. Initiating the Chat Server opens the Server Socket at port a defaulted port [1436]. This port is changeable to meet users specification. The Server Socket at a desired port listens for the clients connections. When client is connected to the server, it opens another thread to service. This is so because when the client sends a QUIT command, it will therefore close the thread. To get connection from a client, the ChatCommunication object was created. With the ChatCommunication class, a thread is created to watch all the commands coming in from the client and it eventually responds to the client as well.

Internet
ClientObject.1 ClientObject.2 ClientObject.3 run()

Class chatcomm. chatcomm. chatcomm. chatcomm. run() run() sendMessage()

new ChatClient main()

ChatServer main()

Figure 5: Framework of the server chat system

29

The process begins with each new ChatClient making connection to the ChatServer; the chatcommunication creates a socket connect and interface for each new client. An instance of the ClientObject class is created, but it keeps details of the new clients port socket, handle, and existing room. The ChatClient class via the ChatServer sends out messages from the new client to the client object. Within the chatserver class, a list of the current user is maintained; the SendMessageToClient() method uses this list to transmit a message tree to all connected through the ChatClient class.

START SERVER STOP SERVER

Star server button Stop server button

Figure 6: Frame layout of server application window

Client-side interface:

When the Chat Client is initiated through the web page, it will open a socket and connect to ChatServer by shaking hand with a HELO RFC message to Server. When the client gets connected, the socket connection remains open and communication with the server is at the users commands. This interface is made of JPanel from the Abstract Window Toolkit (AWT) standard package to enhance the Grahical User Interface (GUI) of the client side application.

30

Client-side Card Layout:

Login menu Help menu Scroll bars (horizontal and vertical) Users list tab Chat display area Exit chat button

message text bar

Figure 7:

Frame layout of client application window

E x i t

Send message button

With ease-of-use being focused, the canvas has is very simple layout which allows users a very easy way to navigate. Users who are even more familiar without rough chat terrains will even find this layout extremely easy to navigate. The client module is in a way the most intricate part system because of the higher user interaction, and dependence of the server model on the client side. A sluggish design does not help the easy operation of the system as far as the users concerned. The broadest area is the general message display area where conversation between user(s) and administrator is not missed. Periodic notification is display about user(s) login status, logout status, and broadcast messages. The right panel displays information about already logged on or recently logged on users. The bottom part of the chat canvas has the text box where user(s) can make general inquiry or public comments. And if need be, private message can also be sent to the administrator or another user. The send message button and exit button or adjacent each other. Basically, this is the client application layout attribution which is to be made into an actually application.
31

4.1.1

Web Site

The web browser is the first location to initiate the chat process. Due to the fact that the Liberian Government has a web page for the Executive Mansion; it also serves as a central web site for the various ministries. It contains link or pages to the a few ministries that are able to maintain the web service. A valid web address containing the various links to each government ministry is provided: www.emansion.gov.lr

Figure 8:

Executive Mansion web site

The above page is the official web site of the Liberian Government Executive Mansion, and it serves as a hub to information sharing in the country. This page provides in addition to links to other vital resourceful contents like vacancies, RFPs, Bids, Corporate agreements, past speeches, and more. From left to right, tabs [Home : The President : The Vice President : Ministry of State : Speeches : Major Issues : Links : Media Center : Contact Us]. We will focus Link wherein a drop-down menu displays [Ministries : Public Corporations : Autonomous Agencies : PRS Lift Liberia: Partners : Other Links]. Ministries is focused for the purpose of this project.

32

The below (figure 9) page is a subset to the Liberian Executive Mansion web site, and it contains all other available web links to Ministries in Liberia. For the purpose of the project, we shall use Ministry of Information, Cultural Affairs and Tourism as a test case.

Figure 9:

Web page with all Government Ministries

The Information, Cultural and Tourism link redirects to the below (figure 8) web page. The page contains [HOME : MICAT : MEDIA : MICAT SCHOOL]. The HOME menu contains [ About The Ministry : MICAT CONTACT : EGOVERNMENT : ABOUT LIBERIA : MICAT VIDEO GALLERY AND LIVE STREAM].

33

Figure 10:

A home page of the Ministry of Information, Cultural Affairs and Tourism

The implementation of a sixth sub-menu to the Home menu is introduced to incorporate the eFrontDesk menu. This menu shall be incorporated also into other web pages that are of Government Ministries within Liberia. The next snippet is a derived web page illustrating the integration of the new added tab:

Figure 11:

eFrontDesk web menu

34

The eFrontDesk tab is added to the list of menus to complete partial implementation of the system. Web visitors will encounter the eFrontDesk tab at within the Home menu. It is listed as the first sub-menu tab; indicating that front desk is the first stop for information search at any given institution.

Figure 12:

eFrontDesk web page [top view]

The top view of the eFrontDesk page showing the Back button that redirects users to all ministries select home page. It has a user login tab and a help tab. User wanting to login will have to click on Login to join the chat session. The eFrontDesk banner has the flag of Liberia and in the inscription eFrontDesk. Below the banner is the info tab which show the current users name, the room name and the number of users already logged on to the chat server.

Figure 13:

eFrontDesk web page [bottom view]

35

The bottom view of the eFrontDesk page shows the panel of the chat window. The Send Message! is grayed out until a user is logged in to the with a user name. After logging in, a welcome message is displayed.

4.1.2

User interface

The user interface is easy to understand, simple to manipulate, and very flexible.

Login banner

Info bar

Users pane

Chat log area Private message button General chat box Ignore button Exit chat

Figure 14:

chat panel/frame

The user or users is anyone who logs in to the chat room to ascertain information. Each user will have the option to select a particular bureau or government office for which information is needed. All ministries running a web site will have the identical chat room interface. The banner will contain the name of the chat room (eFrontDesk) and the flag of the Country (Liberia). The application will be integrate into all the web pages of each ministry and will have assigned a front desk officer or Administrator or moderator to respond to users queries. Java serves best the purpose for web integration and will run much smoothly.

36

The web page will integrate the .jar file using the following codes:
<object type="application/x-java-applet" height="300" width="500"> <param name="code" value="ChatClient" /> <param name="archive" value="ChatClient.jar" /> Applet failed to run. No Java plug-in was found. </object>

The application is loaded and the ChatClient.class file is located in the archived .jar file and run.

4.2 Security issues

The Java is secure clich is sparking controversy nowadays, since the recent exploit of the Java SE 7. The successful vulnerability attack on the Java platform which opened doors to numerous intrusions on many corporate and private systems has also raised the default setting of the security controls for Java applets to high, preventing Web-based Java applications from executing inside browsers without user confirmation. This situation in brings the ease-of-use and security of Java web-based applets a little bit of concern.

Figure 15:

chat panel/frame

This project runs very minimal on high-level security provision based on the scope of operation by users. User input handles that are not in any way invasive or confidential. Broadcasted information irrelevant to any user at any point in time could be avoided by blocking user. Users flooding the chat room is booted or kicked out of the chat:
if(m_floodFlag) { SendMessageToClient(ClientSocket,"KICK "); messagearraylist.clear(); }

This helps in the reeducation of spammer loggers.


37

Administrator has the authority to boot out users who are using the chat room for the intended purpose of information distribution and sharing.

4.2.1

Secure enhancement:

With the latest Java 7 Update 21, enabled option we has made it impossible for application to forge access to data structures or to access private data in objects that they do not have access to. This closes the door on most activities of viruses. Some web browsers allow applets to read and write date only to the host that server the applet. With the modification, this will let the applet connect only to sockets on the computer from which the applet came. The write restriction prevents applets from planting viruses or altering important files on the local computer. The read restriction does not allow applets to browse files on the local computer for sensitive information, such as credit card numbers, open a socket connection to the applet host, and write the information back

38

5. Implementation and Testing

This is the next phase right after the Design phase. In this section, the presentation of the implementation of this system from client side and server side were separately presented. The remodeling, debugging and testing of codes practically took more time than estimated, and it ran top-down modeling.

With proper planning comes a smooth implementation. For a system that was in place being manually traditional, it is wise to plan, but also get the culture of these offices which would be using the new system. Most often people tend to build an office culture over time in different places. And often it is proven that people in these cases build a kind of resistance towards change. If change should be welcomed by the people operating the system, they have to be educated as to what level of improvement the change will make, how they can become part of the change as agents of change, and how the change will affect their lives forever. An example of a change resistance could be some front desk personnel who are not computer literate. Change would mean joblessness. But planning to training former personnel with necessary skills to enhance the workability of the system would be paramount.

After noting the above points to consider, another factor would be the implementation transition. Already that the workers feel a part of the new system, a healthy changeover would be a parallel running shift. This parallel changeover between the old system and new system would help desk staff take computer classes, and at the same time get them training on the new system. This would also be appropriate for the programmer to consider other issue relating to efficiency of the system, data collection, and resource utilization.

39

5.1 Server-client implementation

The following paragraphs introduced the implementation on server side and client side. It presented an overview of the implementation on client side first, and then described the implementations with emphasis on the main features of this system. It presented the system into disintegrated components, and units for analysis implementation. The server-side is also looked at in similar manner, with snippets (snap shots) of system implantation along with importation codes shots.

The project will be capable of running on any standard Internet web browsers. The interface for the project will provide a login feature through a web interface and administrative capabilities which will be used by front desk a host of personnel. The sole intention is for administrator to provide timely feedback to chatter with inquiry on demand.

Flow Chart: User/chatter


User/chatter

Home Page

eFrontDesk

Login

User visits ministry website.

User navigates to chat room tab in search of information.

User provides a unique nick name to log on to chat system

Other information ces


User might browse other information on web page.

Logout

Chat with other user(s)


User chats with other users for information.

Chat with Admin


User chats with admin for information.

User logs out when necessary

40

Flow Chart: Administrator or Front desk officer


Administrator

Main Page [chat server]


Administrator logs on admin portion of website.

Reports

Admin can see a report of all concurrent users

Chat

Banning

Log out

Admin can respond to chatter inquiry

Admin can ban a user or boot out the user.

Admin can log out of admin section

5.1.1

Server-side implementation

The server-side is implemented with the following classes: Class ChatServer ChatObject ChatCommuniation CommonSettings Main method

1 2 3 4

Table 3

The main method complete coding (chatServer) is found in appendix B.

41

ChatServer codes Only partial view of code was included in this section. Full source code is located in the appendices:
public class ChatServer extends Frame implements Serializable, ActionListener,Runnable,CommonSettings { public ChatServer() { /This intializes all components for the chat server/ this.setTitle("Chat Server"); Image iconImage = Toolkit.getDefaultToolkit().getImage("images/icon.gif"); this.setIconImage(iconImage); this.setResizable(false); this.setBackground(Color.yellow); this.setLayout(new BorderLayout()); //The below snippet shows the outcome of the above coding. The Chat Server is loaded with background color (yellow).

Snippet 1

/ Top Panel Coding / Panel topPanel = new Panel(new BorderLayout()); topPanel.setBackground(Color.black); Label lblTitle = new Label("CHAT SERVER",1); lblTitle.setForeground(Color.white); lblTitle.setFont(new Font("Helvitica",Font.BOLD,20)); topPanel.add("Center",lblTitle); add("North",topPanel); / Center Panel Coding / Panel centerPanel = new Panel(null); cmdStart = new Button("START SERVER"); cmdStart.setBounds(125,10,150,30); cmdStart.addActionListener(this); centerPanel.add(cmdStart); panel.setBackground(Color.green);

42

//The below snippet shows the outcome of the above coding. Starting the server changes the background color (green), and initiates the actionListener. Start Server button is disabled and Stop Server button is enabled.

Snippet 2

cmdStop = new Button("STOP SERVER"); cmdStop.setBounds(125,50,150,30); cmdStop.setEnabled(false); cmdStop.addActionListener(this); centerPanel.add(cmdStop); add("Center",centerPanel); panel.setBackground(Color.red); setSize(400,150); show(); //The below snippet shows the outcome of the above coding. Stopping the server changes the background color (red), and stops the actionListener. Start Server button is then enabled and Stop Server button is disabled.

Snippet 3

/Window Closing Event Section/ addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) {

43

} }); } /Action Listener listening to new connection requests/ public void actionPerformed(ActionEvent evt) { if(evt.getActionCommand().equalsIgnoreCase("Start Server")) { DBProperties = GetDBProperties(); /Initializes the Server Socket / try { serversocket = new ServerSocket(m_portNo); }catch(IOException _IOExc) { } /Initializes the Array List / userarraylist = new ArrayList(); messagearraylist = new ArrayList(); /Initialize the thread/ thread = new Thread(this); thread.start(); } } /Thread Implementation/ public void run() { /Accepting all the client connections and create a separate thread / while(thread != null) { try { /Accepting the Server Connections/ socket = serversocket.accept(); / Create a Seperate Thread for each client or user/ chatcommunication = new ChatCommunication(this,socket); thread.sleep(THREAD_SLEEP_TIME); } } } /Function To Send a Message to Client/ private void SendMessageToClient(Socket clientsocket,String message) { } /Function To Get the Object Of Given User Name/ private ClientObject GetClientObject(String UserName) { ClientObject returnClientObject = null; ClientObject TempClientObject; int m_userListSize = userarraylist.size();

44

for(G_ILoop = 0; G_ILoop < m_userListSize; G_ILoop++) { } return returnClientObject; } / Function To for redundant Username / private boolean IsUserExists(String UserName) { if(GetClientObject(UserName) != null) return true; else return false; } /Function to get the Index of specified User Name/ private int GetIndexOf(String UserName) { int m_userListSize = userarraylist.size(); for(G_ILoop = 0; G_ILoop < m_userListSize; G_ILoop++) { } return -1; } /Function To Add a New Client in to the Server List/ protected void AddUser(Socket ClientSocket,String UserName) { /If User name exists return/ if(IsUserExists(UserName)) { SendMessageToClient(ClientSocket,"EXIS"); return; } } /Function To Send Private Message/ protected void SendPrivateMessage(String Message , String ToUserName) { clientobject = GetClientObject(ToUserName); if(clientobject != null) { SendMessageToClient(clientobject.getSocket(),"PRIV "+Message); } } /main method public static void main(String[] args) { ChatServer mainFrame = new ChatServer(); mainFrame.setVisible(true); }

45

ChatCommunication codes Only partial view of code was included in this section. Full source code is located in the appendices:
public class ChatCommunication implements Runnable,CommonSettings { / Initialize the Socket to the Client / ChatCommunication(ChatServer chatserver,Socket clientsocket) { Parent = chatserver; socket = clientsocket; try { inputstream = new DataInputStream(new BufferedInputStream(socket.getInputStream())); }catch(IOException _IOExc) { } thread = new Thread(this); thread.start(); } / Implement the Thread Interface / public void run() { while(thread != null) { try { } } private void QuitConnection() { thread.stop(); thread = null; try { socket.close(); }catch(IOException _IOExc) { } socket = null; }

46

5.1.2

Client-side implementation

The following paragraphs introduced the implementation on client side. It presented an overview of the implementation on client side first, and then described the implementations with focus on the main features of this system.

The Client-side is implemented with the following classes: Class Border BorderPanel ChatClient CommonSettings CustomPanel InformationDialog ListViewCanvas MessageBox MessageCanvas MessageObject PrivateChat ScrollBar ScrollView SocksSocket SocksSocketConstants SocksSocketImpl SocksSocketImplFactory Main method

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17

Table 4

The main method complete coding (chatClient) is in found in appendix C.

ChatClient codes Only partial view of code was included in this section. Full source code is located in the appendices:
public class ChatClient extends Frame implements Serializable,Runnable,KeyListener,ActionListener,CommonSettings { ChatClient() { } private void ConnectToServer()

47

{ /Initialize the Socket/ messagecanvas.ClearAll(); messagecanvas.AddMessageToMessageObject("Connecting To Server... Please Wait...",MESSAGE_TYPE_ADMIN); try { } } private void LoginToChat() { / Open the Dialog / dialog = new InformationDialog(this); if (dialog.IsConnect == true) { UserName = dialog.TxtUserName.getText(); ServerName = dialog.TxtServerName.getText(); ServerPort = Integer.parseInt(dialog.TxtServerPort.getText()); if(dialog.IsProxyCheckBox.getState() == true) { IsProxy = true; ProxyHost = dialog.TxtProxyHost.getText(); ProxyPort = Integer.parseInt(dialog.TxtProxyPort.getText()); } else { IsProxy = false; } ConnectToServer(); } } } / Key Listener Event / public void keyPressed(KeyEvent evt) { if((evt.getKeyCode() == 10) && (!(TxtMessage.getText().trim().equals("")))) { SendMessage(); } } public void keyTyped(KeyEvent e){} public void keyReleased(KeyEvent e){}

/ If User Name Already Exists / if (ServerData.startsWith("EXIS")) { messagecanvas.AddMessageToMessageObject(" User Name Already Exists... Try Again With Some Other Name!",MESSAGE_TYPE_ADMIN);

48

thread = null; QuitConnection(QUIT_TYPE_NULL); } SplitString = ServerData.substring(5,ServerData.indexOf("~")); tappanel.TxtUserCount.setText("Total Users in "+SplitString+" : "+ServerData.substring(ServerData.indexOf("~")+1)); } / Private Message RFC / if( ServerData.startsWith("PRIV")) { SplitString = ServerData.substring(5,ServerData.indexOf(":")); / Function To Send Private Message To Server / protected void SentPrivateMessageToServer(String Message, String ToUserName) { SendMessageToServer("PRIV "+ToUserName+"~"+UserName+": "+Message); } / Disconnect Chat / private void DisconnectChat() { if(socket != null) { messagecanvas.AddMessageToMessageObject("CONNECTION TO THE SERVER CLOSED",MESSAGE_TYPE_ADMIN); QuitConnection(QUIT_TYPE_DEFAULT); } } public static void main(String args[]) { ChatClient mainFrame = new ChatClient(); }

49

5.1.3

Code efficiency:

Speed The chat room program is not a real-time program but it requires a minimum of latency and swift inter-responses between users and administrator. Speed is not an issue with the eFrontDesk applet due to the high response from the loops incorporated, and the functions calls and objects creation. One other thing about the efficiency of the code is that we applied serialization on the incoming request or connections. Serialization is a useful way to deal with things that are happening simultaneously, except that it can remove parallelism. Serialization does prevent us from saving time by working on multiple things at the same time. In the code bellow, while the program is dealing with one connection, other connections might be piling up.
//Serialization on server// /accept clients connections and create a separate thread / while(thread != null) { try { /Accept the Server Connections/ socket = serversocket.accept(); /Create a separate Thread for each client/ chatcommunication = new ChatCommunication(this,socket); thread.sleep(THREAD_SLEEP_TIME); } catch(InterruptedException _INExc) { ExitServer(); } catch(IOException _IOExc)

To enhance more on efficiency, some methods were declared private().When the method is made final, it allows the compiler to turn any calls to that method into inline calls. When the compiler sees a final method call, it can discretionally skip the normal approach of inserting code to perform the method call mechanism [push arguments on the stack, hop over to the method code and execute it, hop back and clean off the stack arguments, and deal with the return value] and instead replace the method call with a copy of the actual code in the method body. This eliminates the overhead of the method call. If a method is big, the code begins to bloat, and the performance degraded. Therefore, it is best to let the compiler and JVM handle efficiency issues and make a method final only if the need arises to explicitly prevent overriding. Any private methods in a class are implicitly final. Methods declared private are inaccessible method, which cannot be overridden. One can add the final specifier to a

50

private method, but it does not give that method any extra meaning. See sample

from ChatClient:

private void LoginToChat() { / Open the Dialog / dialog = new InformationDialog(this); if (dialog.IsConnect == true) { UserName = dialog.TxtUserName.getText(); ServerName = dialog.TxtServerName.getText(); ServerPort = Integer.parseInt(dialog.TxtServerPort.getText()); if(dialog.IsProxyCheckBox.getState() == true) { IsProxy = true; ProxyHost = dialog.TxtProxyHost.getText(); ProxyPort = Integer.parseInt(dialog.TxtProxyPort.getText()); } else { IsProxy = false; } ConnectToServer(); } }

One the other hand, Java JIT compiler comes with the virtual machine and is used optionally. It compiles the byte-code into platform-specific executable code that is immediately executed. This kind of execution process enhances rapidity in programs during runtime. It is suggested by Sun Microsystems that it's usually faster to select the JIT compiler option, especially if the method executable is repeatedly reused.

5.1.4

Storage Efficiency

The code is embedded with the finally block to ensure that there is no resource leakage. Not only was this block used for resource retrieval, but also to avoid cleanup code being accidentally bypassed by a break, continue or return code block. Adding cleanup code in a finally block does much good as it is always a good practice, even when no exceptions are anticipated. See code below:
Properties DBProperties = new Properties(); try { InputStream inputstream = this.getClass().getClassLoader().getResourceAsStream("server.properties"); DBProperties.load(inputstream);

51

inputstream.close(); } catch (IOException _IOExc){ } finally /the use of the finally block/ { return (DBProperties); } }

The project due to time limitation was not integrated a standard database collection function. The function if introduced would put the project in to a new planning and design phase where new criterion would be made. It will dive deep in to collecting more details from chat users at login with would be time consuming and uneasy to uneasy to maneuver in the fastest way possible. This enhanced database object will promote the ability to create the eRejoinder module of the eFrontDesk application. The eRejoinder module is a conceptual concept which would allow users to be forwarded queries reponses to them through email address and contact numbers collect during new login process.

52

5.2 Testing Approach

The testing procedure verified each components functionality. An internal and external component of the programs is verified, validated for quality and consistency, and to see if the actual outcome of the test is the same as the expected. For the purpose of this project, a grey-box testing was used to help identify the correctness, completeness, security and quality of the eFrontDesk.

According to the project description, the final product is a functional chat room system, embedded in an HTML page for users access. However, a gray box testing method is used to test the functional modules of this system. The aim of testing was to make the system functional as possible, allowing all the specific needs as prescribed to be available. The information in figure 5a provides comments and feedback as a result of such testing.

5.2.1

Unit testing:

Table 5a: Testing result


Test # 1 2 3 4 5 6 Functionalities User login and nickname checking Chatting room display Chatting with user(s)/Admin Blocking users Chat room users info/display Exit chat Grade 5 5 5 5 3 5 Comment Good. The system does not allow duplicate nicknames The chat room display is set to the size as was declared Chatting with users/admin functions as should Blocked/ignored user(s) cannot chat with user who blocked After the 5th user logs in, auto-update of all users is not displayed The chat room closes as anticipated

53

Table 6b: Testing result


5 Chat room users info/display 3 After the 5th user logs in, auto-update of all users is not displayed

The below piece of code is responsible to publish logged on users to the user canvas. But after 5 total user counts, the others users after that are not published to the rest of the user logging. The first five previously logged on uses will have access to info on a much many users there is. This flow was baffling and not rectified.
if(ServerData.startsWith("LIST")) { Tokenizer = new StringTokenizer(ServerData.substring(5),";"); /Update the Information Label/ TotalUserCount = Tokenizer.countTokens(); UpdateInformationLabel(); /Adds a user item into User Canvas/ tappanel.UserCanvas.ClearAll(); while(Tokenizer.hasMoreTokens()) { tappanel.UserCanvas.AddListItemToMessageObject(Tokenizer.nextToken() ); }

5.2.2

Integrated testing:

Table 7: Test result


Test # 1 2 Web interface Server side module Run HTML page in web browser Run server app without connect any client. Server application listens for connection Run client app to check for login functionality workability Initiate both client/server app to check server is listening and accepting connection requests from clients incomplete Run HTML client to connect with server Unit Unit good good Module tested Test done Approach Result

Client side module

unit

Workable

Client/Server communication

Integrated

good

5 6

Data storing module Full system

unit Integrated

bad unsuccessful

54

5.3 Modifications and Improvements:

After testing with not much confusion, the following is noticed: The HTML client page is unable to connect to server. This is because the embedding the application into an HTML file restrict the listening capability of the applet. The embedded code did not include a port and ip address of the host/local host. See code below and modifications:
<object type="application/x-java-applet" height="300" width="500"> <param name="code" value="ChatClient" /> <param name="archive" value="ChatClient.jar" />

This was modified to:


<object type="application/x-java-applet" height="300" width="500"> <param name="code" value="ChatClient" /> <param name =applet VALUE= "telnet"> <!-- applet initialization: address and port --> // Sending the IP address and port number of the server to the telnet applet as a parameter <param name =address VALUE=192.168.1.100> <param name =port VALUE="1436"> </object>

A test was done to ensure that the 1436 was open. See figures below:

Figure 15:

Telnet port listening at 1436

The user pane does not update users information after a 6th users is logged in.
55

The rest of the users will see all users even if there are more than 10 users, but the 6th to X users will see only 5 or 6 users who are logged in. Due to time constrain, not much could be done to rectify the error.
6. Results and Discussion

6.1 Results overview

The development of a Java platform chat room as an online front desk system was supported by sufficient findings during the data collection phase. The study tells us many people did agree that it is actually difficult in getting to various ministries, as was indicated in the problem statement (See figure 16). But ambiguously, report showed that most of the respondents do not go to the any of the various ministries for information. Some of whom are already visiting the ministry and or are employees of the ministries.
Q1: Difficult getting to offices at Ministries
8 7 6 5 4 3 2 1 0 Strongly agree Agree Neutral Disagree Strongly disagree Figure 16:

Number of respondents

Quite significantly, the results from the study concurred that bringing all the information retrieval process to a central hub and using technology to do that would be very significant (See figure 17 and figure 18).

56

Q6: A one-stop-shop info booth will save time and money


7 6 5 4 3 2 1 0 Strongly Agree Neutral Disagree Strongly agree disagree

respondents

Figure 17:

Q10: Those service could be improved by technology


14 12 10 8 6 4 2 0 Strongly Agree agree Neutral Disagree Strongly disagree Figure 18: respondents

The report did show that not one of the respondents disagreed that technology would bring improvement to the already in placed traditional help desk (figure 18). In similar manner, it shows that the traditional front desk system is not very punctual or useful (figure 19).

57

Q7: Ministries' frondesk are running very efficiently


12 10 8 6 4 2 0 Strongly Agree agree Neutral Disagree Strongly disagree Figure 19:

respondents

The respondents had little or completely no knowledge of the implementation phase of a software model but the study shows that, without a sense of importance, they pointed out that a parallel changer over was appropriate (figure 20).
Q13: Making Front Desk online as well as keeping traditional offline desk would be meaningful
8 6 4 respondents 2 0 Strongly agree Agree Neutral Disagree Strongly disagree Figure 20:

The study shows that there was a variation on agreement to the assumption that (see figure 21) that the Government of Liberia makes available to all its citizens unhindered information to all of its citizens.

58

Q9: Relevant information always available at Ministry help desk


6 5 4 3 2 1 0 Strongly agree Agree Neutral Disagree Strongly disagree Figure 21: respondents

The interviews presented much similar findings even though questions asked were much different from that of the questionnaire. Out of the 10 questions posed during the interview, there were variations on the question which does not support not disprove the paper but all recommendation point at a single idea in two different forms. Help desk personnel pointed out: a) Training as a factor but with reference to computer literacy. b) Improvement of existing system by introducing computer (applicable only to offices without computers at front desk). From observation, it was gathered that the effectiveness of front desk was lacking at some ministries. Everyone standing with the vicinity of the front desk seemed to be front desk personnel, will to give out whatever they conceive as information. More worrying was the way security guards were giving front desk personnel role. Private securities employed by the government ministries are often used as front desk personnel.

6.1.1

Cost indicator

The below table provides an average cost based on actual transportation and internet cost based on various location across the county.
Table 8 Cost analysis LOCATION INTERNET COST TRANSPORT COST* ANALYSIS

1 2 3 4

In and around capital 7miles to capital 15miles to capital 200miles to capital

LD$50 per 30min LD$75 per 30min LD$100 per 30min LD$150 per 30min

LD$50 LD$75 LD$150 LD$1,500

0 cost effect only time 0 cost effect only time Internet is 33% cheaper to transport Internet is 90% cheaper to transport 59

*One way to Monrovia (Capital).

The above table clearly states the various cost factors incurred when one is considering transportation means to get information from any government ministry located in the capital and when an alternative web application accessible through Internet. The first two tuples are equally the same in terms of Internet cost and transportation cost. It will not cost an additional cent if either of the factors was consider. The underling variable is time. A person will save time if Internet was a medium to access information from a ministry. On the contrary, the person will also lose time to travel miles to the capital. The third tuple cost analysis indicates that the choice to use Internet to get information would mean that transportation would be 33% costly over Internet. This makes Internet as rather cost effective means of information retrieval. The last tuple shows clearly as huge gap between Internet and transport. A 90% cost difference is quite enormous. Anyone would rather using Internet to access important information before taking the risk to make a travel to the capital city.

6.2 Results discussion

The result in figure 16 shows that people find it difficult getting to ministries is rather something which should not actually be for people living in Monsterrado County. But since this is so, it only leaves more room for those in distant parts of the county and most rural areas to agree more. The part of the study showing that technology is a fulcrum for improvement and a hub for information distribution further supports the thesis statement. The system as torn apart worked flawlessly, but with some reservations. Categorically, the system (excluding the user) comes in three (3) parts: 1. The Web interface 2. The application client interface 3. The server interface. The results on the cost analysis comparing transportation and Internet showed that accessing information from any ministry through Internet is far cheaper. Even in cases where the result showed that cost between transport and Internet was the same, time was the defining factor. It explained how time efficient Internet is as compared to selecting traveling.

60

6.3 Technical result and discussion

Each of the individual components went through testing, and they were validated based on criteria as per analysis. Web Interface: The web interface forms part of an existing web site. The design of the web page is scalable, easy to navigate. Testing ran as expected without integration of the applet. b. Display: -chat room is displayed c. Active: -client(s) can interact with webpage Client Interface: This component of the system which is the most complex, and made out of cardLayout met all specifications. Users are able to chat with administrator and other users for information sharing purpose in a general or public and private manner. Users are able to login with no redundancy, and sign out as well. Users are, along with administrator, capable of blocking unsolicited comments for the other party. a. Login: -client(s) can login b. Chat: -client(s) can chat with Admin and other user(s) c. Block: -client(s) can block unsolicited chat(s) d. Private: -client(s) can initiate private message e. Logout: -client(s) can logout if necessary

Server Interface: The server interface opens up the listening port (1436) and is on a standby without interruption. Login is fast and timely between the server and client application. a. Start: -server can start (listening for connection(s)) b. Listen: -server is attentive on port for connection(s) c. Stop: -server can stop (listening for connection(s)) The whole system put together is very impressive, and leaves room for integration and modifications. It was tested on Windows system and OS X system and without hindrances, it worked flawlessly.

61

6.4 User Documentation:

How to use eFrontDesk:

Table of contents

Page

1. Web site ..................................................................................... 68 2. Login process ............................................................................. 71 3. General chatting ........................................................................ 72 4. Private chatting .......................................................................... 73 5. Ignoring/Blocking user ............................................................... 74 6. Logout ........................................................................................ 75

62

WEB SITE The eFrontDesk is an application ran from a web page. It allows user(s) to interact with front-desk personnel at various Liberian Government ministries to obtain relevant information. A hub web site for all government ministries hosts links users to the appropriate ministry. See below:

Figure 1: Hub website.

1. Go to: www.emansion.gov.lr 2. Click on Links 3. Click on Ministries This brings up another page as shown below. A list of ministries is displayed on this page for which any link is selected.

63

Figure 2: Ministries links web page.

Clicking any of the links as shown brings up the home page of the particular ministry. The Ministry of Information, Cultural and Tourism will be used as test case. Clicking the Ministry of Information link pops up another page as shown below

:
Figure 3: Ministry of Information home page.

Another way to arrive at the home page of any of the ministries web site is to directly type the web address of the page into the web browser.

64

This is also another way to arrive at the desired home page.

Figure 4: eFrontDesk tab on home page.

As shown above on the home page: 1. Click Home tab 2. Click eFrontDesk tab This action pops up the eFrontDesk chatting page which is shown below.

65

Figure 5: eFrontDesk page.

LOGIN PROCESS The eFrontDesk login process is simple. 1. Click Home tab just above eFrontDesk banner. 2. Type nick name of chat name (shown in figure 6). 3. Port number is already set by default 4. Click Connect.

Figure 6: Login window.

66

GENERAL CHATTING A successful login will prompt a Welcome To The General Room! message. At the top right corner, the Administrator is waiting for inquiries. Once a user is logged in, chatting is possible. The Administrators icon is distinct.

Figure 7: General room.

In the General room, a user can ask a question generally or broadcasting (as shown in figure 8) just by typing in the General Message! text box, or initiate a private chat (as shown in figure 9).

Figure 8: Chatting in General room. 67

PRIVATE CHATTING A user can also initiate a private chat by selecting the distinguished user, and then clicking the Send Direct Message, or by simply doubling clicking the particular user. These actions will pop up a private dialogue box for private chatting.

Figure 8: Private chat

A user can clear all chat history in private chat window by clicking Clear button. The Close button completely closes the private chat.

68

IGNORING/BLOCKING USER Users often poke or spam others unwanted messages. The Ignore User button help to avoid the situation. The Ignore User button is exactly below the Send Direct Message button. A user has to be selected from the users panel, and then click the Ignore User button to block selected user. This action could be repetitive if more than one user need be ignored.

Ignore button

Figure 9: Ignore feature

Once a user is ignored, he must be allowed in order have reestablished communication. This is done by clicking the Allow User button as shown below in figure 10.

69

Allow User button

Figure 10: Allow user feature

LOGOUT The Exit Chat button at the bottom right corner allows a user to leave the chat room.

Exit button

Figure 11: Exit chat

70

7. Conclusion

The eFrontDesk chat system is an outcome of the Java programming language. It was designed considering all the simple and necessary needs that were essential for using the system. And those needs are sorely for the sharing and distribution of vital information between a government and its people. It was designed to overcome the drawbacks of the existing system which is a traditionally prudent system, but it lacks the effectiveness of unlimited geographic boundaries. As important as it seemed, the problem face by the people in obtaining information from the government in terms of cost, feasibility, and access, has been eradicated by the implementation of this system. With the aid of this online chatting system, users can sit at home, work, school, or anywhere without further transport cost, and access information for a help desk officer. The system will not only reduce the cost of reaching appropriate government offices, but it will also reduce the amount of time it took anyone to get to these government offices for information. This great disadvantaged of a centralized government and administration will be overcame where information retrieval is concerned. The Java SDK was a handle tool to design and develop the application after qualitative data collection which was analyses with supportive findings. The methodology forecasted two separate views but did not lack the richness of questionnaire, interviews, and direct observation. The project core forecasted onhands knowledge on Java SKD and its various packages, and the Object Oriented Programming (OPP) nature of Java. After prototyping, implementation brought alive the projects objects. The server side application and client side application where were a nest of objects and attributes, function, classes, socket programming, whileloop, but more importantly a keen realization of how distinct Java categories itself into application and applet. A comprehensive clarity of embedding application into applet was something revealed.

This project brought to light some unforeseen realities that were made known as a result of the data collection process. Amongst these new finding were: a) The discovery made about the Liberia government: - that it was the first nation in West Africa and fourth nation in Africa to have signed the Freedom of Information Law. - that front desk has relative lost its significance, wherein security guards are usually left with such a delicate responsibility. - The system is completely manual. Leaving no room for computers or computer trained professional to take on the new system. - That information search incurs cost on the seekers, and most of the respondents who city-bases dwellers do not normally seek information from front desk - That everyone pointed to technology as the basic foundation for innovative improvement and development of the traditional front desk systems. - That front desk services are not effective.
71

b) On a more technical note: - Java has lost, and is doing all to reclaim its credibility with the phrase Java is secure. - That embedding an application developed in Java in to an HTML page as an applet, is a difficult as recreating the problem from scratch.

These finding are timid in saying that a gradual shift in replacing the old system with the new would mean just bridging the government to its people, but a new standard for eGovernace which will demand transparency, and accountability, and change in the way a people interact with a government in information retrieval. On the other hand, government will be able to use whatever available M&E tool to measure the appropriate variable as much as freedom of information is concerned.

7.1

Limitations of the System:

During the testing phase of the project, a couple of system flows were note. Some of these errors where rectified. Listed are persistent errors: Painting of active logged on users (after 5 token counts, uses details were not displayed to sixth and onward users) into the users panel had a flow. The piece of code responsible to publish logged on users to the user canvas just did not after 5 total user counts. Time being a constraint did not allow further rectification. The data storage facility was not integrated to storing purpose. This future puts the project into a new design phase and recreates the freedom of user being anonymous. Yet the feature is shifted for future enhancement

The developed system lacks voice chat feature. It also does not integrate video chat and file sharing. The system lacks the ability to integrate a standard database module. This important feature would be meaningful on the side of a government where monitoring the number of people it has reached in achieving a set of goals in terms of freely distributing information people on work and services the government.

72

7.2

Future Scope of the Project

The investigation carried out during the study gives room for newer investigations to be conducted. From the findings, more areas to further investigate are as follow: Why are front desk not effect (with or without technology)? How can front desk be made effective with technology? Why do people think computer means better or effective work? There are more questions at the end of the findings. Questions which attribute to the positive way technology is looked at but does not contribute meaningfully to technology. An example could be that front desk user without computers thinks that providing them with computer would improve the server, whilst those with computer are equally ineffective and unproductive as those without computers. It would also raise more research than computer usage has ever provided answers.

Due to time limitation, the system defects not rectified included, the error relating to painting user details on use panel, and the integration of a standard database to track users activities like those meaning for to the government in highlighting achievable variables. This would include user professional, location, inquires, gender, sex and other relevant indicator tracking variables.

There is enough room for improvement of the system in enhancing additional capabilities to include voice chat, video chat, and file sharing. These features will further bring the government to the doorsteps of the people and take another step by openly the door of the people. On remarkable concept that sprouted during the findings was a feed-back or rejoinder system. This system is left to be an enhancement to the eFrontDesk system. It will improve the system to be more reliable. This system will work with the eFrontDesk as a separate or integrated module which will (from inputted data like email and telephone number) accept inquiries during non-working periods and responses to queries would be forwarded through texting and or email to various uses when administrators are available. This will be an effective way you reach effectiveness to a wider populace. This system shall be called eRejoinder.

73

Bibliography

References:

1. http://www.javaworld.com 2. http://www.codeproject.com/Articles/2440/Java-Chat-With-Customizable-GUI 3. www.linuxtopia.org/online_books/programming_books/thinking_in_java/TIJ308_013.htm 4. http://en.wikipedia.org/wiki/Online_chat 5. http://tulcingodevalle.gob.mx/work/sites/ELOCAL/resources/LocalContent/1192/9/Okot-Uma.pdf 6. https://www.w3schools.com 7. https://www.cia.gov/library/publications/the-world-factbook/geos/li.html 8. www.emansion.gov.lr 9. en.wikipedia.org/wiki 10. www.google.com

74

Glossary

Term

Definition

eDemocracy

is the use of information and communications technologies and strategies by 'democratic sectors' within the political processes of local communities, states/regions, nations and on the global stage.

eFrontDesk

An electron receptionist system.

eGovernance

is the application of Information and Communication Technology (ICT) for delivering government services, exchange of information communication transactions, integration of various stand-alone systems and services between Government-to-Citizens (G2C), Government-to-Business(G2B),Government-to-Government( G2G) as well as back office processes and interactions within the entire government frame work.

e-Rejoinder

A proposed enhancement to the eFronDesk which will forward information to users email or phone.

e-Traveling

is a term used to refer to the use of technology to accessing experience gained through actual traveling but without actually traveling.

Freedom of Information law

(FOIL) allows access by the general public to data held by national governments. They establish a "right-to-know" legal process by which requests may be made for government-held information, to be received freely or at minimal cost, barring standard exceptions.

Monsterrado County

is the state where the capital, Monrovia, is located

75

ABBREVIATIONS

The following project-specific and general technical abbreviations are used:

AWT CRT GUI HTTP ICT IDE IRC JDK JVM MDG NGO OPP OS X PSYC RAD SDLC VOIP XMPP

Abstract Window Toolkit Cathode Ray Tube Graphical User Interface Hyper Text Transfer Protocol Information and Communication Technology Integrated Development Environment Internet Relay Chat Java Development Kit Java Virtual Machine Millennium Development Goal Non-Governmental Organization Object Oriented Programming Operating System 10 for Macintosh Protocol for Synchronous Conferencing Rapid Application Development Software Development Life Circle Voice Over Internet Protocol Extensible Messaging and Presence Protocol

76

Appendix A
A-1 Questionnaire [page 1]

77

Questionnaire [page 2]

78

A-2 Interview questions

79

Appendix B

Server coding
package com.efrontdesk.chatserver; import import import import import import import import import import import import import import import import import import import import import import java.net.ServerSocket; java.net.Socket; java.io.IOException; java.util.Properties; java.io.DataOutputStream; java.io.Serializable; java.io.InputStream; java.util.ArrayList; java.awt.Button; java.awt.Image; java.awt.Panel; java.awt.Frame; java.awt.Color; java.awt.Label; java.awt.Font; java.awt.Toolkit; java.awt.event.ActionEvent; java.awt.event.WindowEvent; java.awt.event.ActionListener; java.awt.event.WindowAdapter; java.awt.event.WindowListener; java.awt.BorderLayout;

public class ChatServer extends Frame implements Serializable, ActionListener,Runnable,CommonSettings { public ChatServer() { /*******Intialize all components*********/ this.setTitle("Chat Server"); Image iconImage = Toolkit.getDefaultToolkit().getImage("images/icon.gif"); this.setIconImage(iconImage); this.setResizable(false); this.setBackground(Color.yellow); this.setLayout(new BorderLayout()); /********Top Panel Coding*********/ Panel topPanel = new Panel(new BorderLayout()); topPanel.setBackground(Color.black); Label lblTitle = new Label("CHAT SERVER V1.0",1); lblTitle.setForeground(Color.white); lblTitle.setFont(new Font("Helvitica",Font.BOLD,20)); topPanel.add("Center",lblTitle); add("North",topPanel); /********Center Panel Coding*********/ Panel centerPanel = new Panel(null); cmdStart = new Button("START SERVER"); cmdStart.setBounds(125,10,150,30);

80

cmdStart.addActionListener(this); centerPanel.add(cmdStart); panel.setBackground(Color.green); cmdStop = new Button("STOP SERVER"); cmdStop.setBounds(125,50,150,30); cmdStop.setEnabled(false); cmdStop.addActionListener(this); centerPanel.add(cmdStop); add("Center",centerPanel); panel.setBackground(Color.red); setSize(400,150); show(); /*****Window Closing Event Section*******/ addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { ExitServer(); dispose(); System.exit(0); } }); } /*********Action Listener Coding Starts*************/ public void actionPerformed(ActionEvent evt) { if(evt.getActionCommand().equalsIgnoreCase("Start Server")) { DBProperties = GetDBProperties(); /*********Initialize the Server Socket*********/ try { RoomList = ""; if(DBProperties.getProperty("roomlist") != null) { RoomList = DBProperties.getProperty("roomlist"); } int m_portNo = 1436; if(DBProperties.getProperty("portno") != null) m_portNo = Integer.parseInt(DBProperties.getProperty("portno")); serversocket = new ServerSocket(m_portNo); }catch(IOException _IOExc) { } /********Initialize the Array List**********/ userarraylist = new ArrayList(); messagearraylist = new ArrayList(); /********Initialize the thread*************/ thread = new Thread(this); thread.start();

81

cmdStart.setEnabled(false); cmdStop.setEnabled(true); } if(evt.getActionCommand().equalsIgnoreCase("Stop Server")) { ExitServer(); cmdStop.setEnabled(false); cmdStart.setEnabled(true); } } /*************Thread Implementation***************/ public void run() { /*********Accepting all the client connections and create a seperate thread******/ while(thread != null) { try { /********Accepting the Server Connections***********/ socket = serversocket.accept(); /******* Create a Seperate Thread for that each client**************/ chatcommunication = new ChatCommunication(this,socket); thread.sleep(THREAD_SLEEP_TIME); } catch(InterruptedException _INExc) { ExitServer(); } catch(IOException _IOExc) { ExitServer(); } } } /***** Function To Send a Message to Client **********/ private void SendMessageToClient(Socket clientsocket,String message) { try { dataoutputstream = new DataOutputStream(clientsocket.getOutputStream()); dataoutputstream.write(new String(message+"\r\n").getBytes()); }catch(IOException _IOExc) { } } /*********Function To Get the Object Of Given User Name*********/ private ClientObject GetClientObject(String UserName) { ClientObject returnClientObject = null; ClientObject TempClientObject; int m_userListSize = userarraylist.size(); for(G_ILoop = 0; G_ILoop < m_userListSize; G_ILoop++) { TempClientObject = (ClientObject) userarraylist.get(G_ILoop);

82

if(TempClientObject.getUserName().equalsIgnoreCase(UserName)) { returnClientObject = TempClientObject; break; } } return returnClientObject; } /*****Function To Check whether the Username is Already Exists**********/ private boolean IsUserExists(String UserName) { if(GetClientObject(UserName) != null) return true; else return false; } /***********Function to get the Index of specified User Name********/ private int GetIndexOf(String UserName) { int m_userListSize = userarraylist.size(); for(G_ILoop = 0; G_ILoop < m_userListSize; G_ILoop++) { clientobject = (ClientObject) userarraylist.get(G_ILoop); if(clientobject.getUserName().equalsIgnoreCase(UserName)) return G_ILoop; } return -1; } /********Function To Add a New Client in to the Server List**********/ protected void AddUser(Socket ClientSocket,String UserName) { /***If User name Exists return**/ if(IsUserExists(UserName)) { SendMessageToClient(ClientSocket,"EXIS"); return; } /********Send a Room List ********/ SendMessageToClient(ClientSocket,"ROOM "+RoomList); /********Send the New User Detail into All Other Users****/ int m_userListSize = userarraylist.size(); String m_addRFC = "ADD "+UserName; StringBuffer stringbuffer = new StringBuffer("LIST "); for(G_ILoop = 0; G_ILoop < m_userListSize; G_ILoop++) { clientobject = (ClientObject) userarraylist.get(G_ILoop); /***Check the Room Name*****/ if(clientobject.getRoomName().equals(ROOM_NAME)) { SendMessageToClient(clientobject.getSocket(),m_addRFC);

83

stringbuffer.append(clientobject.getUserName()); stringbuffer.append(";"); } } /*****Add a user in to array list***/ clientobject = new ClientObject(ClientSocket,UserName,ROOM_NAME); userarraylist.add(clientobject); /********Sending the Complte User List to the New User***********/ stringbuffer.append(UserName); stringbuffer.append(";"); SendMessageToClient(ClientSocket,stringbuffer.toString()); } /**********Function to Remove User From Server**************/ public void RemoveUser(String UserName, String RoomName, int RemoveType) { ClientObject removeclientobject = GetClientObject(UserName); if(removeclientobject != null) { userarraylist.remove(removeclientobject); userarraylist.trimToSize(); int m_userListSize = userarraylist.size(); String m_RemoveRFC=null; if(RemoveType == REMOVE_USER) m_RemoveRFC = "REMO "+UserName; if(RemoveType == KICK_USER) m_RemoveRFC = "INKI "+UserName; /*****Send a REMO RFC to all other Users****/ for(G_ILoop = 0; G_ILoop < m_userListSize; G_ILoop++) { clientobject = (ClientObject) userarraylist.get(G_ILoop); if(clientobject.getRoomName().equals(RoomName)) SendMessageToClient(clientobject.getSocket(),m_RemoveRFC); } } } /**********Remove User When Exception Occurs **************/ protected void RemoveUserWhenException(Socket clientsocket) { int m_userListSize = userarraylist.size(); ClientObject removeclientobject; for(G_ILoop = 0; G_ILoop < m_userListSize; G_ILoop++) { removeclientobject = (ClientObject) userarraylist.get(G_ILoop); if(removeclientobject.getSocket().equals(clientsocket))

84

{ String m_RemoveUserName = removeclientobject.getUserName(); String m_RemoveRoomName = removeclientobject.getRoomName(); userarraylist.remove(removeclientobject); userarraylist.trimToSize(); m_userListSize = userarraylist.size(); String m_RemoveRFC="REMO "+m_RemoveUserName; /*****Send a REMO RFC to all other Users****/ for(int m_ILoop = 0; m_ILoop < m_userListSize; m_ILoop++) { clientobject = userarraylist.get(m_ILoop); if(clientobject.getRoomName().equals(m_RemoveRoomName)) SendMessageToClient(clientobject.getSocket(),m_RemoveRFC); } return; } } } /****Send all the Users list of that particular room to that client socket****/ int m_userListSize = userarraylist.size(); StringBuffer stringbuffer = new StringBuffer("LIST "); for(G_ILoop = 0; G_ILoop < m_userListSize; G_ILoop++) { clientobject = (ClientObject) userarraylist.get(G_ILoop); /***Check the Room Name*****/ if(clientobject.getRoomName().equals(NewRoomName)) { stringbuffer.append(clientobject.getUserName()); stringbuffer.append(";"); } } SendMessageToClient(ClientSocket,stringbuffer.toString()); (ClientObject)

/********Function to Send General Message ***************/ protected void SendGeneralMessage(Socket ClientSocket, String Message,String UserName,String RoomName) { boolean m_floodFlag = false; messagearraylist.add(UserName); if(messagearraylist.size() > MAX_MESSAGE) {

85

messagearraylist.remove(0); messagearraylist.trimToSize(); /*********Chk Whether the User is flooding the message*********/ String m_firstMessage = (String) messagearraylist.get(0); int m_messageListSize = messagearraylist.size(); for(G_ILoop = 1; G_ILoop < G_ILoop++) { if(messagearraylist.get(G_ILoop).equals(m_firstMessage)) { m_floodFlag = true; } else { m_floodFlag = false; break; } } } /********Sending a General Message to All the Users*******/ int m_userListSize = userarraylist.size(); String m_messageRFC = "MESS "+UserName+":"+Message; for(G_ILoop = 0; G_ILoop < m_userListSize; G_ILoop++) { clientobject = (ClientObject) userarraylist.get(G_ILoop); if((clientobject.getRoomName().equals(RoomName)) && (!(clientobject.getUserName().equals(UserName)))) { SendMessageToClient(clientobject.getSocket(),m_messageRFC); } } /********Kick Off the User If he/she flooding the message********/ if(m_floodFlag) { SendMessageToClient(ClientSocket,"KICK "); messagearraylist.clear(); } } /*************Function To Send Private Message *************/ protected void SendPrivateMessage(String Message , String ToUserName) { clientobject = GetClientObject(ToUserName); if(clientobject != null) { SendMessageToClient(clientobject.getSocket(),"PRIV "+Message); } } m_messageListSize;

86

/***********Function to Get Remote User Address ******************/ protected void GetRemoteUserAddress(Socket ClientSocket,String ToUserName, String FromUserName) { clientobject = GetClientObject(ToUserName); if(clientobject != null) { SendMessageToClient(clientobject.getSocket(),"REIP "+ FromUserName +"~"+ClientSocket.getInetAddress().getHostAddress()); } } /***********Function to Get Remote User Address ******************/ protected void SendRemoteUserAddress(Socket ClientSocket,String ToUserName, String FromUserName) { clientobject = GetClientObject(FromUserName); if(clientobject != null) { SendMessageToClient(clientobject.getSocket(),"AEIP "+ ToUserName +"~"+ClientSocket.getInetAddress().getHostAddress()); } }

/*********Function to get the User Count in the Room***********/ protected void GetUserCount(Socket ClientSocket,String RoomName) { int m_userListSize = userarraylist.size(); int m_userCount = 0; for(G_ILoop = 0; G_ILoop < m_userListSize; G_ILoop++) { clientobject = (ClientObject) userarraylist.get(G_ILoop); if(clientobject.getRoomName().equals(RoomName)) m_userCount++; } SendMessageToClient(ClientSocket,"ROCO "+RoomName+"~"+m_userCount); } /***********Function to Destroy the Objects***********/ private void ExitServer() { if(thread != null) { thread.stop(); thread = null; } try { if(serversocket != null) { serversocket.close(); serversocket = null;

87

} }catch(IOException _IOExc) { } userarraylist = null; messagearraylist = null; cmdStop.setEnabled(false); cmdStart.setEnabled(true); } /*********Loading Properties File*******************/ private Properties GetDBProperties() { /****************** Getting the Property Value From Propeyty File ************************/ Properties DBProperties = new Properties(); try { InputStream inputstream = this.getClass().getClassLoader().getResourceAsStream("server.properties"); DBProperties.load(inputstream); inputstream.close(); } catch (IOException _IOExc){ } finally { return (DBProperties); } } public static void main(String[] args) { ChatServer mainFrame = new ChatServer(); mainFrame.setVisible(true); } /********Global Variable Declarations***********/ Properties DBProperties; Button cmdStart,cmdStop; ServerSocket serversocket; Socket socket; ArrayList userarraylist,messagearraylist; Thread thread; ChatCommunication chatcommunication; DataOutputStream dataoutputstream; int G_ILoop; ClientObject clientobject; String RoomList;

88

Appendix C

Client coding

package com.efrontdesk.chatclient; import java.awt.Panel; import java.awt.Label; import java.awt.Graphics; import java.awt.Image; import java.awt.Window; import java.awt.TextField; import java.awt.TextArea; import java.awt.Frame; import java.awt.Button; import java.awt.Canvas; import java.awt.Color; import java.awt.Font; import java.awt.CardLayout; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.MediaTracker; import java.awt.event.KeyListener; import java.awt.event.KeyEvent; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.net.Socket; import java.util.StringTokenizer; import java.io.Serializable; import java.io.DataInputStream; import java.io.IOException; import java.io.DataOutputStream; import java.net.URL; import java.net.Socket; import java.awt.Toolkit; import java.awt.MenuBar; import java.awt.Menu; import java.awt.MenuItem; import java.awt.MenuShortcut; /**********Chat Client**************/ public class ChatClient extends Frame implements Serializable,Runnable,KeyListener,ActionListener,CommonSettings { ChatClient() { toolkit = Toolkit.getDefaultToolkit(); if(toolkit.getScreenSize().getWidth() > 778) setSize(778, 575); else setSize((int)toolkit.getScreenSize().getWidth(),(int)toolkit.getScree nSize().getHeight() - 20); setResizable(false); dimension = getSize();

89

setLayout(new BorderLayout()); setTitle(PRODUCT_NAME); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent evt) { DisconnectChat();System.exit(0);}}); /*****Loading menubar ***********/ MenuBar menubar = new MenuBar(); Menu loginmenu = new Menu("Login"); loginitem = new MenuItem("Login"); loginitem.addActionListener(this); disconnectitem = new MenuItem("Disconnect"); disconnectitem.addActionListener(this); seperatoritem = new MenuItem("-"); quititem = new MenuItem("Quit"); quititem.addActionListener(this); loginmenu.add(loginitem); loginmenu.add(disconnectitem); loginmenu.add(seperatoritem); loginmenu.add(quititem); Menu aboutmenu = new Menu("Help "); aboutitem = new MenuItem("About "+PRODUCT_NAME); aboutitem.addActionListener(this); aboutmenu.add(aboutitem); menubar.add(loginmenu); menubar.add(aboutmenu); setMenuBar(menubar); /**********Getting all the Parameteres***********/ UserName = ""; UserRoom =""; IconCount = 21; ChatLogo = "images/logo.gif"; BannerName = "images/defaultbanner.gif"; RoomList = ""; IsProxy = false; /*********Assigning Global Colors*************/ ColorMap = new Color[MAX_COLOR]; /*******Backgorund*********/ ColorMap[0] = new Color(224,236,254); /*******Information Panel Background*********/ ColorMap[1] = new Color(255,153,0); /*******Button Foreground*********/ ColorMap[2] = Color.black; /*******Button Background**************/ ColorMap[3] = new Color(224,236,254); /*******sstab button****************/ ColorMap[4] = new Color(255,153,0); /*******message canvas*********/ ColorMap[5] = Color.black; /*******Top Panel Background*********/ ColorMap[6] = Color.yellow; /*******Label Text Colors*********/ ColorMap[7] = Color.white; /**********Loading Images*********/ tracker = new MediaTracker(this); int ImageCount = 0;

90

ImgLogo = toolkit.getImage(ChatLogo); tracker.addImage(ImgLogo,ImageCount); ImageCount++; ImgBanner = toolkit.getImage(BannerName); tracker.addImage(ImgBanner,ImageCount); ImageCount++; /**********Loading Icons....***********/ IconArray = new Image[IconCount]; for(G_ILoop = 0; G_ILoop < IconCount; G_ILoop++) { IconArray[G_ILoop] = toolkit.getImage("icons/photo"+G_ILoop+".gif"); tracker.addImage(IconArray[G_ILoop],ImageCount); ImageCount++; } /*********Initialize Private Window **********/ privatewindow = new PrivateChat[MAX_PRIVATE_WINDOW]; PrivateWindowCount = 0; try{ SetAppletStatus("Loading Images and Icons....."); tracker.waitForAll(); }catch (InterruptedException e){} setIconImage(toolkit.getImage("images/logo.gif")); SetAppletStatus(""); /**********Initializing all the Components*********/ InitializeAppletComponents(); } private void ConnectToServer() { /***********Initialize the Socket*******/ messagecanvas.ClearAll(); messagecanvas.AddMessageToMessageObject("Connecting To Server... Please Wait...",MESSAGE_TYPE_ADMIN); try { if(IsProxy) { /*********Proxy***********/ SocksSocketImplFactory factory=new SocksSocketImplFactory(ProxyHost, ProxyPort); SocksSocket.setSocketImplFactory(factory); socket = new SocksSocket(ServerName,ServerPort); socket.setSoTimeout(0); } else { /*******Not Proxy*********/ socket = new Socket(ServerName,ServerPort); }

91

dataoutputstream = new DataOutputStream(socket.getOutputStream()); SendMessageToServer("HELO "+UserName); datainputstream = new DataInputStream(socket.getInputStream()); /***********Send HELO To Server **********/ StartFlag = true; thread = new Thread(this); thread.start(); EnableAll(); }catch(IOException _IoExc) { QuitConnection(QUIT_TYPE_NULL);} } private void SendMessageToServer(String Message) { try { dataoutputstream.writeBytes(Message+"\r\n"); }catch(IOException _IoExc) { QuitConnection(QUIT_TYPE_DEFAULT);} } /*******Initialize all the Applet Components********/ private void InitializeAppletComponents() { /*******Common Settings***********/ setBackground(ColorMap[0]); Font font = new Font("Dialog",Font.BOLD,11); TextFont = new Font("Dialog",0,11); setFont(font); /***********Top Panel Coding*************/ Panel TopPanel = new Panel(new BorderLayout()); TopPanel.setBackground(ColorMap[6]); Panel LogoPanel = new ImagePanel(this,ImgLogo); TopPanel.add("East",LogoPanel); Panel BannerPanel = new ImagePanel(this,ImgBanner); TopPanel.add("West",BannerPanel); add("North",TopPanel); /*************Information Label Panel Coding*************/ Panel CenterPanel = new Panel(new BorderLayout()); Panel InformationPanel = new Panel(new BorderLayout()); InformationPanel.setBackground(ColorMap[1]); InformationLabel = new Label(); InformationLabel.setAlignment(1); UpdateInformationLabel(); InformationLabel.setForeground(ColorMap[7]); InformationPanel.add("Center",InformationLabel); CenterPanel.add("North",InformationPanel); /*********Message Canvas and SSTAB Coding********/ Panel MessagePanel = new Panel(new BorderLayout()); messagecanvas = new MessageCanvas(this); MessageScrollView = new ScrollView(messagecanvas,true,true,TAPPANEL_CANVAS_WIDTH,TAPPANEL_CANVAS_HE IGHT,SCROLL_BAR_SIZE); messagecanvas.scrollview = MessageScrollView; MessagePanel.add("Center",MessageScrollView); tappanel = new TapPanel(this);

92

MessagePanel.add("East",tappanel); CenterPanel.add("Center",MessagePanel); /*********Input Panel Coding Starts..*********/ Panel InputPanel = new Panel(new BorderLayout()); Panel TextBoxPanel = new Panel(new BorderLayout()); Label LblGeneral = new Label("General Message!"); TxtMessage = new TextField(); TxtMessage.addKeyListener(this); TxtMessage.setFont(TextFont); CmdSend = new CustomButton(this,"Send Message!"); CmdSend.addActionListener(this); TextBoxPanel.add("West",LblGeneral); TextBoxPanel.add("Center",TxtMessage); TextBoxPanel.add("East",CmdSend); InputPanel.add("Center",TextBoxPanel); Panel InputButtonPanel =new Panel(new BorderLayout()); CmdExit = new CustomButton(this,"Exit Chat"); CmdExit.addActionListener(this); InputButtonPanel.add("Center",CmdExit); InputPanel.add("East",InputButtonPanel); Panel EmptyPanel = new Panel(); InputPanel.add("South",EmptyPanel); CenterPanel.add("South",InputPanel); add("Center",CenterPanel); DisableAll(); LoginToChat(); } private void LoginToChat() { /********* Open the Dialog *********/ dialog = new InformationDialog(this); if (dialog.IsConnect == true) { UserName = dialog.TxtUserName.getText(); //UserRoom = dialog.roomchoice.getSelectedItem(); ServerName = dialog.TxtServerName.getText(); ServerPort = Integer.parseInt(dialog.TxtServerPort.getText()); if(dialog.IsProxyCheckBox.getState() == true) { IsProxy = true; ProxyHost = dialog.TxtProxyHost.getText(); ProxyPort = Integer.parseInt(dialog.TxtProxyPort.getText()); } else { IsProxy = false; } ConnectToServer(); } }

93

/*********Button Events *****/ public void actionPerformed(ActionEvent evt) { if(evt.getSource().equals(CmdSend)) { if (!(TxtMessage.getText().trim().equals(""))) SendMessage(); } if ((evt.getSource().equals(CmdExit)) || (evt.getSource().equals(quititem))) { DisconnectChat(); System.exit(0); } if(evt.getSource().equals(loginitem)) { LoginToChat(); } if(evt.getSource().equals(disconnectitem)) { DisconnectChat(); } if(evt.getSource().equals(aboutitem)) { MessageBox messagebox = new MessageBox(this,false); messagebox.AddMessage("~~13 "+PRODUCT_NAME); messagebox.AddMessage("Developed By..."); messagebox.AddMessage(COMPANY_NAME); } } /********* Key Listener Event *************/ public void keyPressed(KeyEvent evt) { if((evt.getKeyCode() == 10) && (!(TxtMessage.getText().trim().equals("")))) { SendMessage(); } } public void keyTyped(KeyEvent e){} public void keyReleased(KeyEvent e){} /******** Function To Send MESS Rfc to Server *************/ private void SendMessage() { /********Sending a Message To Server *********/ SendMessageToServer("MESS "+UserRoom+"~"+UserName+": "+TxtMessage.getText()); messagecanvas.AddMessageToMessageObject(UserName+": "+TxtMessage.getText(),MESSAGE_TYPE_DEFAULT); TxtMessage.setText("");

94

TxtMessage.requestFocus(); } /*********Function To Update the Information Label*****/ private void UpdateInformationLabel() { stringbuffer = new StringBuffer(); stringbuffer.append("User Name: "); stringbuffer.append(UserName); stringbuffer.append(" "); stringbuffer.append("Room Name: "); stringbuffer.append(UserRoom); stringbuffer.append(" "); stringbuffer.append("No. Of Users: "); stringbuffer.append(TotalUserCount); stringbuffer.append(" "); InformationLabel.setText(stringbuffer.toString()); } /********Implements the Thread ****************/ public void run() { while(thread != null) { try { ServerData = datainputstream.readLine(); /********* LIST UserName;UserName; RFC Coding***********/ if(ServerData.startsWith("LIST")) { Tokenizer = new StringTokenizer(ServerData.substring(5),";"); /********Update the Information Label *********/ TotalUserCount = Tokenizer.countTokens(); UpdateInformationLabel(); /**********Add User Item into User Canvas *********/ tappanel.UserCanvas.ClearAll(); while(Tokenizer.hasMoreTokens()) { tappanel.UserCanvas.AddListItemToMessageObject(Tokenizer.nextToken()) ; } messagecanvas.ClearAll(); messagecanvas.AddMessageToMessageObject("Welcome To The "+UserRoom+" Room!",MESSAGE_TYPE_JOIN); } /*********Room Rfc ********/ if( ServerData.startsWith("ROOM")) {

95

/********** Loading Room List in to Room Canvas **************/ Tokenizer = new StringTokenizer(ServerData.substring(5),";"); UserRoom = Tokenizer.nextToken(); UpdateInformationLabel(); /**********Add User Item into User Canvas *********/ tappanel.RoomCanvas.ClearAll(); tappanel.RoomCanvas.AddListItemToMessageObject(UserRoom); while(Tokenizer.hasMoreTokens()) { tappanel.RoomCanvas.AddListItemToMessageObject(Tokenizer.nextToken()) ; } } /********** ADD RFC *********/ if(ServerData.startsWith("ADD")) { /********Update the Information Label *********/ TotalUserCount++; UpdateInformationLabel(); /**********Add User Item into User Canvas *********/ SplitString = ServerData.substring(5); EnablePrivateWindow(SplitString); tappanel.UserCanvas.AddListItemToMessageObject(SplitString); messagecanvas.AddMessageToMessageObject(SplitString + " joins chat...",MESSAGE_TYPE_JOIN); } /*********If User Name Alread Exists **********/ if (ServerData.startsWith("EXIS")) { messagecanvas.AddMessageToMessageObject(" User Name Already Exists... Try Again With Some Other Name!",MESSAGE_TYPE_ADMIN); thread = null; QuitConnection(QUIT_TYPE_NULL); } /******** REMOVE User RFC Coding **********/ if (ServerData.startsWith("REMO")) { SplitString = ServerData.substring(5);

tappanel.UserCanvas.RemoveListItem(SplitString); RemoveUserFromPrivateChat(SplitString);

96

messagecanvas.AddMessageToMessageObject(SplitString+" has been logged Out from Chat!",MESSAGE_TYPE_LEAVE ); /*****Update the Information Label ********/ TotalUserCount--; UpdateInformationLabel(); } /******** MESS RFC Coding Starts **********/ if( ServerData.startsWith("MESS")) { /**** Chk whether ignored user *********/ if(!(tappanel.UserCanvas.IsIgnoredUser(ServerData.substring(5,ServerD ata.indexOf(":"))))) messagecanvas.AddMessageToMessageObject(ServerData.substring(5),MESSA GE_TYPE_DEFAULT); } /***** KICK RFC Starts ***********/ if (ServerData.startsWith("KICK")) { messagecanvas.AddMessageToMessageObject("You are Kicked Out From Chat for flooding the message!",MESSAGE_TYPE_ADMIN); thread = null; QuitConnection(QUIT_TYPE_KICK); } /***** INKI RFC (Information about kicked off User *********/ if( ServerData.startsWith("INKI")) { SplitString = ServerData.substring(5); tappanel.UserCanvas.RemoveListItem(SplitString); RemoveUserFromPrivateChat(SplitString); messagecanvas.AddMessageToMessageObject(SplitString+" has been kicked Out from Chat by the Administrator!",MESSAGE_TYPE_ADMIN ); /*****Update the Information Label ********/ TotalUserCount--; UpdateInformationLabel(); } /***** Change Room RFC **********/ if( ServerData.startsWith("CHRO")) { UserRoom = ServerData.substring(5); } /********** Join Room RFC *************/ if( ServerData.startsWith("JORO"))

97

{ SplitString = ServerData.substring(5); tappanel.UserCanvas.AddListItemToMessageObject(SplitString); /*****Update the Information Label ********/ TotalUserCount++; UpdateInformationLabel(); messagecanvas.AddMessageToMessageObject(SplitString + " joins chat...",MESSAGE_TYPE_JOIN); } /***********Leave Room RFC **********/ if( ServerData.startsWith("LERO")) { SplitString = ServerData.substring(5,ServerData.indexOf("~")); tappanel.UserCanvas.RemoveListItem(SplitString); messagecanvas.AddMessageToMessageObject(SplitString+" has leaves "+UserRoom+" Room and join into "+ServerData.substring(ServerData.indexOf("~")+1)+" Room",MESSAGE_TYPE_ADMIN); /*****Update the Information Label ********/ TotalUserCount--; UpdateInformationLabel(); } /********** Room Count RFC ********/ if( ServerData.startsWith("ROCO")) { SplitString = ServerData.substring(5,ServerData.indexOf("~")); tappanel.TxtUserCount.setText("Total Users in "+SplitString+" : "+ServerData.substring(ServerData.indexOf("~")+1)); } /******* Private Message RFC **********/ if( ServerData.startsWith("PRIV")) { SplitString = ServerData.substring(5,ServerData.indexOf(":")); /**** Chk whether ignored user *********/ if(!(tappanel.UserCanvas.IsIgnoredUser(SplitString))) { boolean PrivateFlag = false; for(G_ILoop = 0; G_ILoop < PrivateWindowCount;G_ILoop++)

98

{ if(privatewindow[G_ILoop].UserName.equals(SplitString)) { privatewindow[G_ILoop].AddMessageToMessageCanvas(ServerData.substring (5)); privatewindow[G_ILoop].show(); privatewindow[G_ILoop].requestFocus(); PrivateFlag = true; break; } } if(!(PrivateFlag)) { if(PrivateWindowCount >= MAX_PRIVATE_WINDOW) { messagecanvas.AddMessageToMessageObject("You are Exceeding private window limit! So you may lose some message from your friends!",MESSAGE_TYPE_ADMIN); } else { privatewindow[PrivateWindowCount++] = new PrivateChat(this,SplitString); privatewindow[PrivateWindowCount1].AddMessageToMessageCanvas(ServerData.substring(5)); privatewindow[PrivateWindowCount-1].show(); privatewindow[PrivateWindowCount-1].requestFocus(); } } } } }catch(Exception _Exc) { messagecanvas.AddMessageToMessageObject(_Exc.getMessage(),MESSAGE_TYPE_ADMI N);QuitConnection(QUIT_TYPE_DEFAULT); } } } /***** Enable the Private Chat when the End User logged out****/ private void EnablePrivateWindow(String ToUserName) { for(G_ILoop = 0; G_ILoop < PrivateWindowCount; G_ILoop++) { if(privatewindow[G_ILoop].UserName.equals(ToUserName)) {

99

privatewindow[G_ILoop].messagecanvas.AddMessageToMessageObject(ToUser Name + " is Currently Online!",MESSAGE_TYPE_ADMIN); privatewindow[G_ILoop].EnableAll(); return; } } } /***** Disable the Private Chat when the End User logged out****/ private void RemoveUserFromPrivateChat(String ToUserName) { for(G_ILoop = 0; G_ILoop < PrivateWindowCount; G_ILoop++) { if(privatewindow[G_ILoop].UserName.equals(ToUserName)) { privatewindow[G_ILoop].messagecanvas.AddMessageToMessageObject(ToUser Name + " is Currently Offline!",MESSAGE_TYPE_ADMIN); privatewindow[G_ILoop].DisableAll(); return; } } } /*******Function To Send Private Message To Server ***********/ protected void SentPrivateMessageToServer(String Message, String ToUserName) { SendMessageToServer("PRIV "+ToUserName+"~"+UserName+": "+Message); } /******* Function To Remove Private Window ***************/ protected void RemovePrivateWindow(String ToUserName) { int m_UserIndex = 0; for(G_ILoop = 0; G_ILoop < PrivateWindowCount; G_ILoop++) { m_UserIndex++; if(privatewindow[G_ILoop].UserName.equals(ToUserName)) break; } for(int m_iLoop = m_UserIndex;m_iLoop < PrivateWindowCount; m_iLoop++) { privatewindow[m_iLoop] = privatewindow[m_iLoop+1]; } PrivateWindowCount--; }

/******* Function to Send a RFC for Get a Room User Count ********/ protected void GetRoomUserCount(String RoomName) { SendMessageToServer("ROCO "+RoomName); }

100

/******** Function to Set the Image Name into Text Field ************/ protected void AddImageToTextField(String ImageName) { if(TxtMessage.getText()==null || TxtMessage.getText().equals("")) TxtMessage.setText("~~"+ImageName+" "); else TxtMessage.setText(TxtMessage.getText()+" "+"~~"+ImageName+" "); } /*********Function to Destroy all the Objects********/ private void QuitConnection(int QuitType) { if(socket != null) { try { if (QuitType == QUIT_TYPE_DEFAULT) SendMessageToServer("QUIT "+UserName+"~"+UserRoom); if (QuitType == QUIT_TYPE_KICK) SendMessageToServer("KICK "+UserName+"~"+UserRoom); socket.close(); socket = null; tappanel.UserCanvas.ClearAll(); }catch(IOException _IoExc) { } } if(thread != null) { thread.stop(); thread = null; } DisableAll(); StartFlag = false; SetAppletStatus("ADMIN: CONNECTION TO THE SERVER CLOSED."); } /***** Function To Disable All Components ********/ private void DisableAll() { TxtMessage.setEnabled(false); CmdSend.setEnabled(false); tappanel.enable(false); disconnectitem.setEnabled(false); loginitem.setEnabled(true); UserName = ""; UserRoom = ""; TotalUserCount = 0; } /***** Function To Enable All Components ********/ private void EnableAll() { TxtMessage.setEnabled(true); CmdSend.setEnabled(true); tappanel.enable(true);

101

disconnectitem.setEnabled(true); loginitem.setEnabled(false); } /*******Diconnect Chat ********/ private void DisconnectChat() { if(socket != null) { messagecanvas.AddMessageToMessageObject("CONNECTION TO THE SERVER CLOSED",MESSAGE_TYPE_ADMIN); QuitConnection(QUIT_TYPE_DEFAULT); } } /*********Setting the AppletStatus********/ private void SetAppletStatus(String Message) { if (messagecanvas != null) messagecanvas.AddMessageToMessageObject(Message,MESSAGE_TYPE_ADMIN); } public static void main(String args[]) { ChatClient mainFrame = new ChatClient(); } /**************Global Variable Declarations*****************/ String UserName,UserRoom,ServerName,AppletStatus,ChatLogo,BannerName,ProxyHost,Ser verData,RoomList,SplitString; Image ImgLogo,ImgBanner; int ServerPort,ProxyPort,IconCount,TotalUserCount,G_ILoop; boolean StartFlag,IsProxy; Socket socket; DataInputStream datainputstream; DataOutputStream dataoutputstream; Color[] ColorMap; Dimension dimension; MediaTracker tracker; Label InformationLabel; StringBuffer stringbuffer; Image[] IconArray; MessageCanvas messagecanvas; ScrollView MessageScrollView; Thread thread; StringTokenizer Tokenizer; TapPanel tappanel; TextField TxtMessage; Button CmdSend,CmdExit; Font TextFont; protected PrivateChat[] privatewindow; protected int PrivateWindowCount; InformationDialog dialog; Toolkit toolkit; MenuItem loginitem; MenuItem disconnectitem; MenuItem seperatoritem; MenuItem quititem,aboutitem; }

102

103

Você também pode gostar