GeoTrack Servlet – Build a Java Servlet that provides a web service that tracks the locations of users who are roaming around with their mobile devices. Users can update the system with their current location.

In today’s fast-paced academic environment, students often find themselves juggling multiple responsibilities, from attending classes and working part-time jobs to participating in extracurricular activities. The demands of modern education can be overwhelming, leaving students in search of effective solutions to manage their academic workload efficiently. One such solution is the use of Nursingpapertutors.com academic writing website. Nursingpapertutors.com academic writing website employ a cadre of experienced and knowledgeable writers who are well-versed in various academic subjects and writing styles. Nursingpapertutors.com professionals bring a wealth of expertise to the table, enabling them to produce well-researched and well-structured papers that meet the academic standards and expectations of students. Their familiarity with diverse subjects ensures that students can receive assistance across a wide spectrum of disciplines, from mathematics to literature, and from nursing to engineering.

 

Cont. of the question: They can also query the system to find people within a given distance of their location.

 

Description: Overview. Each user in the system is uniquely identified by a string ID (e.g. a MAC address or cell phone ID). Only the user themselves knows their unique ID, the rest of the world only sees a friendly name that users get to choose themselves. You are building a Java servlet that provides the following functions:

  • Update – Allows a user to update their current position. The user must supply their unique ID, their friendly name, and their current position.
  • Delete – Allows a user to remove themselves from the tracking servlet. The user must supply their unique ID.
  • Query – Allows a user to find the name, position and distance to all users within a given distance of the user. The user must supply their unique ID and the radius of interest (in meters).

Coordinate system. Mobile devices report their position in UTM coordinates. UTM coordinates consist of two float-point numbers, an easting and a northing. The easting specifies how many meters the device is to the east of a fixed grid reference location. Similarly the northing is how far the device is north of the grid reference. To calculate the distance between two positions in UTM coordinates, use the Pythagorean theorem. 

Web service input. You are building a servlet that provides a RESTful web service. The following GET parameters are accepted by the web service:

  • command – Specifies the desired function, parameters is a string: updatedelete, or query. Required by all requests.
  • id – Unique string specifying the user making the request. Required by all requests.
  • name – Friendly name the user wants to be displayed as. Required by the update command.
  • northing – The northing coordinate of the device. Required by the update command.
  • easting – The easting coordinate of the device. Required by the update command.
  • distance – The radius in meters the user wants to search for users. Required by the query command.

Web service output. The web service returns results in JSON format. Every response always contains a string field status. The status contains the string “OK” if the request was successful. If their was an error, the string contains a human-readable description of what went wrong (e.g. “ERROR: unable to parse distance as a floating-point value!”). Your servlet should be robust to bad requests and always return a well-formed JSON result with a status field. 

The only command with an additional result field is the query command. This command returns a field near containing an array with 0 or more elements. Each element in the array contains information about a user within the queried radius. The fields returned in each element are:

  • name – friendly name of the nearby user
  • northing – northing coordinate of the nearby user
  • easting – easting coordinate of the nearby user
  • distance – the distance calculated between the user who made the request and the nearby user
  • timestamp – when the nearby user last update their position, expressed as the number of seconds since Jan 1, 1970

Here is an example result from a query request:

{
    "status": "OK",
    "near": [
        {
            "name": "carol",
            "northing": 50,
            "easting": 150,
            "distance": 70.710678,
            "timestamp": 1362722508
        },
        {
            "name": "bob",
            "northing": 150,
            "easting": 150,
            "distance": 70.710678,
            "timestamp": 1362722494
        }
    ]
}

Pruning data. Users may disappear from the network without deleting themselves from the tracker. You need to implement a pruning mechanism. If more than 1 minute has elapsed since a user’s last update command, then you should delete that user from the tracker. This pruning should happen in a timely manner (i.e. within a few seconds of being over 1 minute stale, the user is deleted). 

Concurrency. Remember that only one instance of your servlet object will exist. This object may get called by multiple threads in parallel. This will almost certainly happen when I test your submission. Thus you should ensure that all access to non-thread safe variables is appropriately protected. You can test your program with the Apache benchmark utility ab with a concurrency > 1. 

Example implementation. The course schedule page has links to a working servlet implementation. You can experiment by directly typing in URLs with GET parameters to the servlet. There is also a HTML test client. The HTML client uses a PHP proxy page to avoid the cross-origin restriction of the AJAX requests (due to the different port numbers of the servlet and web server). 

Servlet details. You should build a Java servlet as an embedded Jetty application (see the Java Servlets lecture/links for example code). You will need to download a copy of Jetty v9. You can develop your servlet in Eclipse if you like or work on the command line. The schedule page has example unix scripts showing the JAR files you need on your CLASSPATH to compile and run an embedded Jetty servlet. You can obtain the handyjetty-all JAR file from /home/staff/vertanen/jetty/lib on katie

Your application should take a single command-line argument specifying the port to start the server on. You can assume any HTTP request to the server is for the servlet (i.e. the server does nothing but provide the web service).

 

P.S.: I will need the URL (and port) and the source files (codes).

 

More information: https://katie.mtech.edu/classes/csci470/assign/geotrack/

 

One of the significant challenges students face is time management. The demands of coursework, assignments, and exams can create immense pressure, leading to stress and a potential drop in academic performance. Nursingpapertutors.com academic writing website can be a valuable resource for students seeking to balance their responsibilities effectively. By outsourcing some of their academic tasks, students can free up time to focus on studying, participating in meaningful extracurricular activities, or even addressing personal obligations. This improved time management can alleviate the stress associated with academic overload. The ultimate goal of education is to enhance one’s knowledge and skills. Nursingpapertutors.com academic writing websites can play a vital role in achieving this goal by providing students with well-crafted papers that serve as models for their own work. These papers can offer valuable insights into effective research, organization, and writing, thereby empowering students to improve their academic performance over time.

 
Do you need a similar assignment done for you from scratch? We have qualified writers to help you. We assure you an A+ quality paper that is free from plagiarism. Order now for an Amazing Discount!
Use Discount Code "Newclient" for a 15% Discount!

NB: We do not resell papers. Upon ordering, we do an original paper exclusively for you.