Académique Documents
Professionnel Documents
Culture Documents
INTRODUCTION
1
2. SYSTEM ANALYSIS
2
2.2 PROPOSED SYSTEM
2.2.1. ADVANTAGES:
• Easy to access
• Provide information as fast
• Keep the user information confidentially
3
3. SYSTEM REQUIREMENTS
• Java1.6 or More
• J2ME
• Wireless toolkit 2.5.1
• Windows XP
• MS-SQL Server
• Hard disk : 40 GB
• RAM : 128mb
• Processor : Pentium
4
3.3 TECHNOLOGIES USED
3.3.1. JAVA
▪ A platform
• Simple
• Object oriented
• Distributed
• Interpreted
• Robust
5
• Secure
• Architecture-neutral
• Portable
• High-performance
• Multithreaded
• Dynamic
6
interpreter, whether it's a Java development tool or a Web browser
that can run Java applets, is an implementation of the Java VM. The
Java VM can also be implemented in hardware.
Java byte codes help make "write once, run anywhere" possible.
The Java program can be compiled into byte codes on any platform
that has a Java compiler. The byte codes can then be run on any
implementation of the Java VM. For example, the same Java program
can run on Windows NT, Solaris, and Macintosh.
7
The Java platform has two components:
8
Accessibility from any location in the world: Java is an internet
programming language The web provides accessibility to a computer
from anywhere in the world Virus free System:
1.)Java is secure
2.)That is any changes made to the computer are tagged as
errors and the program will not execute
Platform Independent Language:
1.)java compiler compiles java code to an intermediate byte
code that is understood by JVM(java virtual machine)
2.) To execute the byte codes the system should have java
interpreter or java enabled internet browser
Speed:
1.) Java is a High performance language.
2.) Faster than programs written in other interpreter languages,
such as BASIC.
3.) Faster than C, C++.
Development time:
1.) Java is simple.
2.) In java programmers do not need to manipulate memory.
GARBAGE COLLECTION
9
How Will Java Technology Change My Life?
We can't promise you fame, fortune, or even a job if you learn
the Java programming language. Still, it is likely to make your
programs better and requires less effort than other languages. We
believe that Java technology will help you do the following:
Get started quickly: Although the Java programming language
is a powerful object-oriented language, it's easy to learn, especially for
programmers already familiar with C or C++.
Write less code: Comparisons of program metrics (class counts,
method counts, and so on) suggest that a program written in the Java
programming language can be four times smaller than the same
program written in C++.
Write better code: The Java programming language encourages
good coding practices, and automatic garbage collection helps you
avoid memory leaks. Its object orientation, its JavaBeansTM
component architecture, and its wide-ranging, easily extendible API
let you reuse existing, tested code and introduce fewer bugs.
Develop programs more quickly: The Java programming
language is simpler than C++, and as such, your development time
could be up to twice as fast when writing in it. Your programs will
also require fewer lines of code.
Avoid platform dependencies: You can keep your program
portable by avoiding the use of libraries written in other languages.
Write once, run anywhere: Because applications written in the
Java programming language are compiled into machine-independent
bytecodes, they run consistently on any Java platform.
10
Distribute software more easily: With Java Web Start software,
users will be able to launch your applications with a single click of the
mouse. An automatic version check at startup ensures that users are
always up to date with the latest version of your software. If an update
is available, the Java Web Start software will automatically update
their installation.
How does the Java API support all of these kinds of programs?
With packages of software components that provide a wide range of
functionality. The core API is the API included in every full
implementation of the Java platform. The core API gives you the
following features:
11
• The Essentials: Objects, strings, threads, numbers, input and output,
data structures, system properties, date and time, and so on.
• Applets: The set of conventions used by Java applets.
• Networking: URLs, TCP and UDP sockets, and IP addresses.
• Internationalization: Help for writing programs that can be localized
for users worldwide. Programs can automatically adapt to specific
locales and be displayed in the appropriate language.
• Security: Both low-level and high-level, including electronic
signatures, public/private key management, access control, and
certificates.
• Software components: Known as JavaBeans, can plug into existing
component architectures such as Microsoft's OLE/COM/Active-X
architecture, OpenDoc, and Netscape's Live Connect.
• Object serialization: Allows lightweight persistence and
communication via Remote Method Invocation (RMI).
• Java Database Connectivity (JDBC): Provides uniform access to a
wide range of relational databases.
12
J2ME, Sun has adapted the Java platform for consumer products that
incorporate or are based on small computing devices.
13
3.4. DATABASE
The JDBC API lets you invoke SQL commands from Java
programming language methods. You use the JDBC API in an
enterprise bean when you override the default container-managed
persistence or have a session bean access the database. With
container-managed persistence, database access operations are
handled by the container, and your enterprise bean implementation
contains no JDBC code or SQL commands. You can also use the
JDBC API from a servlet or JSP page to access the database directly
without going through an enterprise bean.
14
▪ ODBC API was completely written in C language and
it makes an extensive use of pointers. Calls from Java to
native C code have a number of drawbacks in the security,
implementation, robustness and automatic portability of
applications.
Driver Manager:
15
vice-versa. A JDBC Driver is responsible for ensuring that an
application has consistent and uniform m access to any database.
When a request received by the application, the JDBC driver
passes the request to the ODBC driver, the ODBC driver
communicates with the database and sends the request and gets the
results. The results will be passed to the JDBC driver and in turn to
the application. So, the JDBC driver has no knowledge about the
actual database, it knows how to pass the application request o the
ODBC and get the results from the ODBC.
The JDBC and ODBC interact with each other, how? The
reason is both the JDBC API and ODBC are built on an interface
called “Call Level Interface” (CLI). Because of this reason the JDBC
driver translates the request to an ODBC call. The ODBC then
converts the request again and presents it to the database. The results
of the request are then fed back through the same channel in reverse.
16
The most common SQL commands include commands is
the SELECT command, which allows you to retrieve data from the
database.
In addition to SQL commands, the oracle server has a
procedural language called PL/SQL. PL/SQL enables the programmer
to program SQL statement. It allows you to control the flow of a SQL
program, to use variables, and to write error-handling procedures.
17
4. SYSTEM DESIGN
Location
based
queries
18
FIG 4.1
User
Type Query
Send Query
Stop
FIG 4.2
19
Level 0- login and registration module
FIG 4.2.1
Send response
LBS Server Location cloaking agent
FIG4.2.2
20
4.3. UML DIAGRAMS
4.3.1. USE CASE DIAGRAM:
Login
Cloaking Server
User
Location Server
21
4.3.2. SEQUENCE DIAGRAM:
1: Login
22
4.3.3. COLLABORATION DIAGRAM:
User
1: Login
2: Query with Gps value
Cloaking
Server
Location
Server
23
4.3.4. ACTIVITY DIAGRAM:
Login
24
5. SYSTEM IMPLEMENTATION
5.1. MODULES
1. User Registration
2. User Authentication & Query Process
3. User Location Identification
4. Safe Region Manipulation
5. Query Request to the Data Location Server
6. Retrieve of results in according to safe region
7. Find the nearest location
25
5.2. MODULE DESCRIPTION
1. USER REGISTRATION
In the Location base query system we have to register the user for his
future query search. Without registering a user can’t access the
clocking agent. For register the user should give his details such as his
name, address, age, sex, ext., once a user register his details he can get
useful information from the clocking server. Each user will identify
by a unique username and password. REF[1].
The clocking agent will get user location and then it will find the user
is moving towards the location or moving outwards the location. The
current location is obtained using GPS from the mobile user. The
mobile user will carry with the GPS for getting the longitude &
latitude values. These values are obtained via satellite communication.
So once the user sends the query to the Cloaking Agent, the Cloaking
26
agent will get the exact location of the user via GPS values of the
user. REF[3]&[4].
The Clocking agent Manipulate the Safe region for the client and the
send the query to the Location server. The location server checks the
Query and Retrieve the results according to the safe region and then
27
send the result to the clocking agent. If the user is requested for ATM
Bank from Habibullah Road, first the query is sent to the Cloaking
Agent. Cloaking agent will manipulate the safe region as T.Nagar,
then the query is forwarded to the Data Location Server. REF[6]&[7].
Clocking agent will send the query to the Location server. The
Location server manipulates the user query and it will send the results
to the clocking server. The main data server will retrieve the nearest
results that are fit into the safe region area calculation. If the query for
ATM Bank from the T,nagar as safe Region, then the Location server
will find the nearest ATM bank with respect to T.nagar. The location
based is retrieved and the results are given back to the Cloaking agent.
REF[8].
After getting the query result from the Location server, the clocking
server will filter the results in accordance to the user exact location.
The Location server will retrieve the ATM bank information in
accordance to T. Nagar to the cloaking agent. But the cloaking agent
knows user is in Habibullah Road. So the cloaking agent will apply
KNN Query Algorithm to fetch the nearest ATM bank in accordance
to Habibullah Road. So user will be receving the exact information, as
28
requested but then the user’s Location Privacy is still maintained,
because the Location server will update in its table as the query is
from T.anagr not from Habibullah Road. By this way we ensure
Privacy in the user’s location. REF[9].
29
6. TESTING
Unit testing:
Unit testing involves the design of test cases that validate that
the internal program logic is functioning properly, and that program
input produces valid outputs. All decision branches and internal code
flow should be validated. It is the testing of individual software units
of the application .it is done after the completion of an individual unit
before integration. This is a structural testing, that relies on knowledge
of its construction and is invasive. Unit tests perform basic tests at
30
component level and test a specific business process, application,
and/or system configuration. Unit tests ensure that each unique path of
a business process performs accurately to the documented
specifications and contains clearly defined inputs and expected
results.
Integration testing:
Integration tests are designed to test integrated software
components to determine if they actually run as one program. Testing
is event driven and is more concerned with the basic outcome of
screens or fields. Integration tests demonstrate that although the
components were individually satisfaction, as shown by successfully
unit testing, the combination of components is correct and consistent.
Integration testing is specifically aimed at exposing the problems
that arise from the combination of components.
Functional test:
31
Output : identified classes of application outputs must
be exercised.
Systems/Procedures: interfacing systems or procedures must be
invoked.
System Test:
System testing ensures that the entire integrated software
system meets requirements. It tests a configuration to ensure known
and predictable results. An example of system testing is the
configuration oriented system integration test. System testing is based
on process descriptions and flows, emphasizing pre-driven process
links and integration points.
32
Black Box Testing:
Black Box Testing is testing the software without any
knowledge of the inner workings, structure or language of the module
being tested. Black box tests, as most other kinds of tests, must be
written from a definitive source document, such as specification or
requirements document, such as specification or requirements
document. It is a testing in which the software under test is treated, as
a black box .you cannot “see” into it. The test provides inputs and
responds to outputs without considering how the software works.
Unit Testing:
33
Integration Testing
Test Results:
All the test cases mentioned above passed successfully. No defects
encountered.
34
7. CONCLUSION
35
8. APPENDIX
Login:
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import javax.microedition.io.*;
import java.io.*;
TextField txtUser,txtPwd,txtIPAddress;
Display disp;
Command cmdSubmit,cmdBack;
Form welScreen;
String userpassword;
super(strTitle);
this.disp = disp1;
this.welScreen = welScreen;
36
cmdSubmit = new Command("Submit",Command.OK,1);
this.append(txtUser);
this.append(txtPwd);
this.append(txtIPAddress);
this.addCommand(cmdSubmit);
this.addCommand(cmdBack);
this.setCommandListener(this);
if(com==cmdSubmit){
userpassword = "LI$"+txtUser.getString().trim()+"$"+txtPwd.getString();
ServerIPAddress.setServerIPAddress(txtIPAddress.getString());
else if(com==cmdBack)
disp.setCurrent(welScreen); }}
37
DIRECTION:
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import javax.microedition.io.*;
import java.io.*;
import java.lang.*;
Display disp;
Command cmdSubmit,cmdBack;
socketexam clsoc;
super(strTitle);
this.disp=disp;
this.direction = direction;
38
cmdBack = new Command("BACK",Command.BACK,1);
this.append(userInput);
this.addCommand(cmdSubmit);
this.addCommand(cmdBack);
this.setCommandListener(this);
// This method is used to generate the event ie, If You click the Forward
button Client will move the forward direction
if(com==cmdSubmit){
System.out.println("Submit");
finalString = "direction,"+userInput.getString()+","+direction;
if(com==cmdBack){
System.out.println("Back");
39
CHOKING SERVER:
import java.lang.*;
import java.util.*;
import java.sql.*;
import java.io.*;
import java.net.*;
Thread t;
PrintWriter clientOutput;
StringTokenizer st = null;
float intLan,intLat;
String uname,pass=null,direction,category;
40
private double a[]=new double[50];
String rname=null,rpass=null,raddress=null,rno=null,rmail=null;
public ChokingServer(){
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
connection=DriverManager.getConnection("jdbc:odbc:Driver={SQL Server};
Server=.;Database=location;UId=sa");
statement = connection.createStatement();
catch(Exception ex)
ex.printStackTrace();
System.out.println(ex);
try
41
{
statement.executeUpdate("insertinto
userlogin(name,password,address,phoneno,mailid)
values('"+rname+"','"+rpass+"','"+raddress+"','"+rno+"','"+rmail+"')"
);
System.out.println(ex10);
ex10.printStackTrace();
try{
clientOutput=new PrintWriter(ss.getOutputStream());
String str=HttpTunnel.undoHttpTunneling(ss.getInputStream());
str = str.substring(1);
System.out.println("royal test"+str);
if(str.startsWith("LI"))
st = new StringTokenizer(str,"$");
st.nextToken();
42
uname = st.nextToken();
pass = st.nextToken();
if(resultSet.next()){
else{
status = "InValid";
HttpTunnel.doHttpTunneling(clientOutput,status);
}else if(str.startsWith("Add")){
System.out.println("ssfdfds"+str);
st = new StringTokenizer(str,"$");
st.nextToken();
rname=st.nextToken();
rpass=st.nextToken();
raddress=st.nextToken();
rno=st.nextToken();
rmail=st.nextToken();
System.out.println(rname+"\n"+rpass+"\n"+raddress+"\n"+rno+"\n"+rmail);
database(); HttpTunnel.doHttpTunneling(clientOutput,"register");
}else if(str.startsWith("direction"))
43
{
st = new StringTokenizer(str,",");
st.nextToken();
lat =Float.parseFloat(st.nextToken());
lan = Float.parseFloat(st.nextToken());
category = st.nextToken();
direction = st.nextToken();
System.out.println("Direction "+direction);
intLan = lan+0.20f;
intLat = lat+0.20f;
intLan = lan-0.20f;
intLat = lat-0.20f;
System.out.println("Message"+msg);
connectToCentralServer(msg,lat,lan,category);
System.out.println("connect To server");
44
e.printStackTrace();
System.out.println(e);
try{
System.out.println("socket is created");
ous.writeObject(str+","+category);
System.out.println("Location List"+locationList);
float d2 = strLat;
float d1 = strLan;
System.out.println("float value:"+f2);
System.out.println("double value:"+df2);
45
double df1 = f1.doubleValue();
System.out.println("float value:"+f1);
System.out.println("double value:"+df1);
computedistance(df2,df1);
computeshortest(df2,df1);
catch(Exception ex){
ex.printStackTrace();
System.out.println(ex);
int i=1;
double x=0,x2=0,y2=0;
Iterator it=locationList.iterator();
while(it.hasNext()){
//System.out.println(it.next());
String str=it.next().toString();
System.out.println("String"+str);
46
StringTokenizer st=new StringTokenizer(str,"&");
st.nextToken();
st.nextToken();
String location=st.nextToken();
String strLat=st.nextToken();
String strLan=st.nextToken();
x2=Double.parseDouble(strLat);
y2=Double.parseDouble(strLan);
a[i]=Math.sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
System.out.println(a[i]);
locationArrayList.add(location+"&"+a[i]);
System.out.println("Location ArrayList"+locationArrayList);
i++;
try{
String message=null;
int i=1;
for( i=1;i<=locationArrayList.size();i++)
47
{
for(int j=1+i;j<=locationArrayList.size();j++)
if(a[i]>a[j])
double temp=a[i];
a[i]=a[j];
a[j]=temp;
for( i=1;i<=locationArrayList.size();i++){
System.out.println("Shortest Route"+a[i]);
Iterator it=locationArrayList.iterator();
while(it.hasNext()){
String str=it.next().toString();
System.out.println(str);
String location=st.nextToken();
String val=st.nextToken();
double value=Double.parseDouble(val);
System.out.println("***"+val+"A[1] Value"+a[1]);
48
if(value==a[1]){
System.out.println("Location Is"+location);
HttpTunnel.doHttpTunneling(clientOutput,location);
break;
catch(Exception ex)
ex.printStackTrace();
System.out.println(ex);
try{
sock=new ServerSocket(7000);
while(true){
ss=sock.accept();
cs.start();
49
}
catch(Exception ex){
System.out.println(ex);
SIGN IN:
50
FIG 8.2.1
REGISTRATION FORM:
51
FIG 8.2.2
52
DIRECTION FORM:
FIG 8.2.3
53
LOCATION INFORMATION:
FIG 8.2.4
9. References
54
[1] B. Bamba,L. Liu, P. Pesti, and T. Wang, “Supporting Anonymous Location Queries
in Mobile Environments with Privacygrid,” Proc. Int’l World Wide Web Conf. (WWW),
2008.
[2] C. Bettini, S.Mascetti, X.S. Wang, and S.Jajodia, “Anonymity in Location-Based
Services: Towards a General Framework,” Proc. Eighth Int’l Conf. Mobile Data
Management (MDM), May 2007.
[3] S.Berchtold, C Bo¨hm, D.A. Keim, F. Krebs, and H.-P. Kriegel,“On Optimizing
Nearest Neighbor Queries in High-Dimensional Data Spaces,” Proc. Int’l Conf. Database
Theory (ICDT), 2001.
[4] A.R. Beresford and F. Stajano,“Location Privacy in Pervasive Computing,” IEEE
Pervasive Computing, vol. 2, no. 1, pp. 46-55, Jan.-Mar. 2003.
[5] R. Cheng, Y. Zhang, E. Bertino, and S. Prabhakar,“Preserving User Location Privacy
in Mobile Data Management Infrastructures,” Proc. Privacy Enhancing Technology
Workshop, June 2006.
[6] C.-Y. Chow, M.F. Mokbel,and X. Liu, “A Peer-to-Peer Spatial Cloaking Algorithm
for Anonymous Location-Based Services,” Proc. ACM Int’l Symp.Advances in
Geographic Information Systems (GIS), 2006.
[7] J. Du, J. Xu, X. Tang, and H. Hu, “iPDA: Supporting Privacy- Preserving Location-
Based Mobile Services (Demonstration),” Proc. Eighth Int’l Conf. Mobile Data
Management (MDM), May 2007.
[8] G. Myles, A. Friday, and N. Davies, “Preserving Privacy in Environments with
Location-Based Applications,” IEEE Pervasive Computing, vol. 2, no. 1, pp. 56-64, Jan.-
Mar. 2003.
55