The University of QueenslandSchool of Information Technology and Electrical EngineeringSemester 1, 2019CSSE7014 - Assignment 1Issued: 04/03/2019Due: 4pm on Monday 15/04/2019Weighting: 25%IntroductionIn this assignment, students will be required to develop an application, namely Enviro Smart, which makesuse of sensed environmental and weather information to provide users with suggestions and warnings ontheir potential risk from the current environmental conditions. This sensed environmental information isalso referred to as “context information”. Applications that adjust to changes in context information areconsidered to be context-aware and fall under the research field of pervasive computing.Using the context-aware Enviro Smart application, users will be able to receive warnings when variousenvironmental conditions such as incoming heavy rain or the air pollution level is above a predefinedthreshold as well as receive suggestions for activities/places that will minimise the exposure. Thesesuggestions are based on user-specified preferences.The Enviro Smart application will make use of the both Remote Method Invocation (RMI) andPublish/Subscribe architecture for communication between its components.Ice Distributed Computing PlatformThe Ice distributed computing platform (http://www.zeroc.com) is a reasonably new computingplatform but already used by many companies for software development in which speed (performance)and reliability are key factors. You will find a listing of such companies on the Ice website. Ice providestwo communication paradigms: RMI and notifications (publish/subscribe). You should use both inthe assignment and for this you need to evaluate which communication should be of the type RMI andwhich one is more suitable for publish/subscribe.A short screencast that shows how to create an Ice client and server with Java and Eclipse taken fromhttp://www.zeroc.com/download/screencasts/IceIn20Minutes.mov has been put on Blackboard fordownloading.Publish/subscribe is provided in Ice by IceStorm (www.zeroc.com/icestorm/index.html). IceStorm actsas a mediator between message publishers and message subscribers. IceStorm messages areunidirectional notifications. A component/process indicates its interest in receiving messages bysubscribing to a topic. A topic is essentially equivalent to an application-defined Slice interface (Slice isthe specification language (IDL) for Ice): the operations of the interface define the types of messages supported by the topic. A publisher uses a proxy for the topic interface to send its messages, and asubscriber implements the topic interface (or an interface derived from the topic interface) in order toreceive the messages. The demos can be downloaded from here: https://github.com/zeroc-ice/icedemos/tree/3.7.For more information, please refer to https://doc.zeroc.com/display/Ice37/IceStorm.Part A (22%) Context-aware applicationAssignment componentsWe assume for the scenario used in this assignment that each person will have the latest smart watch. Thesmart watch has several sensors or sensor-like devices (accelerometer, GPS, light, microphone, camera).However, for the purpose of this assignment we assume that our smart watches not only have an improvedlocation sensor that can work indoor and outdoor (not only outdoor as GPS does), but also include an AirPollution (AP) sensor that can measure Air Quality Index (AQI), a temperature sensor, and also a weatheralarm.The readings from the sensors are gathered by a Context Manager as described in the following sections.The location information produced by the location sensor is pre-processed by a Location Server before itis sent to the Context Manager. The Context Manager evaluates the context (such as the currenttemperature, AQI, and location) and issues warnings to the user if an AP overexposure (APO) thresholdor a temperature threshold is reached, or a weather alarm is triggered. The Context Manager also providessuggestions on alternative places/activities based on user preferences. The application has a user interfacethat allows multiple users to query the application on items of interest.The application, Enviro Smart, has the following components: Sensors (Location sensor, Air Pollution (AP) sensor and a Temperature sensor). AllSensors.java Weather alarm provides alarms on extreme weather conditions such as heavy rain, hail storm,strong wind. WeatherAlarm.java A Location Server provides Indoor/Outdoor mapping of location coordinates to Context Manager.LocationServer.java A Context Manager evaluates extreme weather warnings, current temperature and APO thresholdsso as to make appropriate suggestions to users based on user preferences captured in the PreferenceRepository. ContextManager.java A Preference Repository responds to queries issued by the Context Manager regarding preferenceson how the application should make recommendations to users. PreferenceRepository.java User Interfaces for users to manage the Enviro Smart application. EnviroAppUI.javaStudents are asked to figure out the order in which the components should start, the order in which theyexit, and which communication paradigm (RMI or Publish/Subscribe) to use when communicatingbetween each component.1. Sensors and alarmThe context-awareness of the Enviro Smart application is based on context information collected by threetypes of sensors and alarm. These are: A temperature sensor that produces integer readings in the range 0 to 50 A location sensor that monitors the user’s location. An AP sensor that shows the current level of air pollution in the unit of AQI (Air Quality Index)from 0 to 200. A global weather alarm that returns monitoring of extreme weather. The value is one of theseintegers:o 0 - normal weather condition – no alarm is triggered and no weather warning is deliveredo 1 - heavy raino 2 - hail stormo 3 - strong windAll sensors produce readings every second. The information sent by sensors is in the format: username,sensor type, sensor reading.The alarm produces a signal every 60 seconds.1.1 Starting the sensors and the weather alarmThe temperature sensor, the AP sensor and the location sensor are all started in Eclipse together at thesame time in one java file, AllSensors.java, accepting the following argument:[username]where [username] is the name of a user logged into a user Interface, and every user has his/her ownsensors.AllSensors reads in three different predefined files at start-up. The three files contain readings of the threesensors for each person. The name of each predefined files are “Temperature”,“AQI” and “Location”.Each line of the predefined files is in the format:value, number of secondsvalue is the value that should be in the update notification.number of seconds is the number of seconds that value should be used.The sensors produce the “value” every second for “number of seconds”.An example content for the predefined file of the location sensor for Alice (i.e., AliceLocation) are asfollows:A,20C,10B,20D,10This can be interpreted that the location sensor will report the user to have the location A for the first 20readings (seconds), then the location B for the next 10 seconds then the location C for the 20 seconds afterthat. The location of the user will then be D for 10 seconds.Once the end of the file is reached, the sensor will return to the beginning i.e. after sending D for 10seconds, the location tracker will send A for 20 seconds and so on until the application exits.1.2 Shutting down the Sensors and weather alarmThe sensors and weather alarm shut down (and stop sending information) when the user exit the UserInterface.2. Location Server (LS)The Location Server receives location coordinates from the location sensor, determines the currentindoor/outdoor status of the user, and forwards these context information to the Context Manager. Themapping of the status to location coordinates is specified in the server’s configuration file using thefollowing structure:Status : Location CoordinatesIndoor : A, B,Outdoor : C, D,The server notifies the Context Manager about the current location coordinate of the user and itsindoor/outdoor status. The server also is responsible for returning a list of indoor locations to the ContextManager upon request.The Location Server is started in Eclipse, taking the following argument:[configuration-file]where [configuration-file] is a file containing the mapping of the indoor/outdoor status to locationcoordinates.3. Context Manager (CM)The Context Manager:? gathers information about Air Quality Index (0-200), weather alarm, and user location fromsensors. gathers personal information about temperature threshold and air pollution tolerance threshold ofa user from the Preference Manager.? calculates a threshold for AP overexposure, and sends a warning together with suggestions of itemsof interest when the APO threshold of the user is reached. The suggestions are based on userpreferences and they must be located indoor. evaluates temperature and sends a warning together with suggestions of items of interest when thetemperature threshold for a user is reached. The suggestions are based on user preferences. responds to queries from the User Interface.3.1 Evaluating AP Overexposure (APO)The AQ Index (AQI) gives an indication of the level of air pollution and the potential danger of exposureto air pollutants. The Context Manager uses AQI, personal medical type and duration of AP exposure tocalculate an AP Overexposure (APO) threshold. The following AQI exposure recommendations is usedby the context manager in the evaluation of a user’s APO threshold.AQI Air Quality Recommendation Base time0 to 50 Good You can safely enjoy being outside! 30seconds51 to 100 Moderate People with medical conditions should considerreducing prolonged or heavy exertion.15seconds101 to 150 Unhealthy forSensitive GroupsPeople with heart or lung disease, older adults, andchildren should reduce prolonged or heavy exertion.10seconds150 to 200 UnhealthyPeople with heart or lung disease, older adults, andchildren should avoid all physical activity outdoors.Everyone should avoid prolonged or heavy exertion5 secondsTable 1. AQI exposure recommendationsA AP Overexposure Threshold of a user is calculated by multiplying a Base Time of the current AQI(according to Table 1) and the user personal reference to air pollution level (i.e., APO Threshold = BaseTime * Medical Condition Type).Skin types are categorised as follows:Medical Condition Type 1: People with heart and lung disease, and asthmaDefinition: People with heart or lung such as coronary artery disease, congestive heart failure, andasthma or chronic obstructive pulmonary disease.Medical Condition Type 2: Children and old adultsDefinition: Children age between 0-17 and old adults age above 45.Medical Condition Type 3: Healthy adultsDefinition: Adults age between 18-45 without medical history relevant to lung and heart diseasesThe medical condition type of particular users is stored in the Preference Repository. The context managerqueries the Preference Repository for the medical condition type when the user first login tothe User Interface.A user is considered to be overexposed when the AP Overexposure Threshold is said to be reached. Thatis, when the amount of time a user has been located outdoor is greater or equal to the current APO thresholdof the user (i.e. APO Threshold reached = outdoor time ≥ APO threshold).For example, for user with Medical Condition Type 2 exposed under an AQI of 90, the APO Threshold is30 (2*15 seconds). The threshold will be reached when the user spent 30 seconds or more in outdoorlocations.When a user is overexposed (or the APO threshold is reached) the Context Manager will send an APOverexposure Warning to the particular user, and make suggestions for items of interest base on his/herpreferences, providing the items of interest are located indoor. The Context Manager is required to querythe location server regarding a list of indoor location, so as to make appropriate suggestions to users.NOTE: The timer (for counting the outdoor duration of a user) starts counting from zero when: (1) the usermoves from an indoor to an outdoor location, or (2) there is a change to current AQ Index (theAPO threshold of the user is also re-evaluated). The timer continues to count when the user moves from an outdoor to an outdoor location,providing the AQ Index stays constant and the APO threshold for the user has not been reached. The timer stops counting when: (1) the user is located indoor, or (2) the APO threshold is reached.3.2 Evaluating weather alarmThe weather alarm takes the highest priority in suggesting users to stay outdoor or to move indoor. Thealarm events are stored in a predefined weather_alarm.txt file. The context manager queries the nextweather alarm every 60 seconds.When a weather alarm is triggered (i.e., warning of incoming heavy rain or strong wind), the ContextManager will send a Weather Warning event to the user and make suggestions for items of interest baseon user’s preferences in any location. In addition, because the alarm has the highest priority in suggestingusers to stay outdoor/indoor, the Context Manager will only give suggestions which are located indooruntil the weather condition has changed to ‘normal’.3.3 Evaluating temperatureThe temperature threshold for a particular user is stored in the Preference Repository. The context managerqueries the Preference Repository for the temperature threshold when the user first login tothe User Interface.When the threshold is reached (i.e., the current temperature is equal to the threshold predefined in the userpreference), the Context Manager will send a Temperature Warning to the user and make suggestions foritems of interest base on user’s preferences in any location.NOTE: When a temperature threshold is reached, the temperature is not evaluated again until there is achange of temperature.3.4 Storing information about the cityThe Context Manager maintains a knowledge base which it populates using a city information file read atstart-up. This file contains a number of entries corresponding to items of interest within the city. Eachentry has: a unique name for an item of interest, indicated with name a location coordinate exists in the accepted by the Location Server (such as A, B,C, D). a short paragraph of information about the item of interest a list of services offered at the item of interestAn example of an item of interest entry in the file is:name: Indooroopilly Shopping Centrelocation: Ainformation: Indooroopilly Shopping Centre is a major regional shopping centre in the western suburbof Indooroopilly, Brisbane, Queensland, Australia. It is the largest shopping centre in the western suburbsof Brisbane, by gross area, and contains the only Myer store in that region.services: cinema, restaurants, pool, shopsname: Garden Citylocation: Binformation: Garden City Shopping Centre is located 10km South of the Brisbane central business district(CBD) and includes Myer, David Jones, Hoyts Cinema, Freedom and over 230 specialty stores.services: cinema, restaurants, pool, shopsname: South Bank Parklandslocation: Cinformation: The South Bank Parklands area was created as part of the rejuvenationof the industrial water front undertaken for World Expo 1988. The Parklands area contains many shops, acinema complex, and a large number of restaurants as well as a man-made beach. A river promenadestretches the length of South Bank Parklands.services: restaurants, pool, shops, Ferris wheelname: Brisbane Citylocation: Dinformation: The Brisbane central business district (CBD), or the City is located on a point on thenorthern bank of the Brisbane River. The triangular shaped area is bounded by the Brisbane River to theeast, south and west. The point, known at its tip as Gardens Point, slopes upward to the north-west wherethe city is bounded by parkland and the inner city suburb of Spring Hill to the north. The City is boundedto the north-east by the suburb of Fortitude Valley.services: restaurants, shops, market, bowling3.5 Making suggestions to usersThe Context Manager makes suggestions of item of interest when either a weather alarm is triggered, orthe AQI or temperature thresholds of a particular user is reached. In order to take into account the userpreferences, the Context Manager must indicate to the Preference Manager which threshold has beenreached in the following format:[Username], weather warning in the case when a weather alarm has been triggered, or[Username], APO in the case when the APO threshold has been reached, or[Username], [Temperature Threshold] in the case when the temperature threshold has been reached.where:[Username] is the name of the user,[Temperature Threshold] is the threshold of the temperature that has been reached.The Preference Repository returns a list of services the Context Manager should suggest to the user. Theweather alarm, which is updated every 60 seconds, has the highest priority. Should both temperature andAPO threshold are reached at the same time, the APO threshold take higher precedence, and the ContextManager should only request a list of services corresponding to the APO preference. Upon the return ofthe list of services from the Preference Repository, the Context Manager sends a list of items of interestthat provide those services to the User Interface of the Enviro Smart Application, but ensures these itemsof interest are located indoor if the user’s AP threshold is reached.To determine whether a list of items of interest is located indoor, the CM queries the Location Serverregarding the indoor/outdoor mapping of the location of the list of items. Such query should be made tothe Location Server for every suggestion3.6 Responding to queries from User InterfaceThe Context Manager is also required to respond to queries issued by the User Interface.Two queries are supported: Search for items of interest in the current location Search for information about a specific item of interestSearch for item of interest in the current locationThe Context Manager responds with an item of interest in the user’s current location.Search for information about a specific item of interestThe Context Manager searches for the specified item of interest in its knowledge base and returns theinformation associated with that item of interest.More detailed information regarding how the queries are generated is specified in the User Interfacesection 6.1.3.7 Starting the Context ManagerThe Context Manager is started from Eclipse, accepting the following argument:[city-information-file]where [city-information-file] is the name of the text file containing the information about the city.3.8 Shutting down the Context ManagerThe Context Manager shuts down automatically when all User Interfaces have exited. The shutdownprocess of the Context Manager involves deregistering its subscriptions with Ice Storm and exits. The exitwill also trigger shutdown of other components.4. Preference Repository (PM)The Preference Repository stores user preferences and evaluates these preferences when requested by theContext Manager.4.1 Preference formatA weather alarm preference is in the following format:when weather warning suggest [service]An APO preference is in the following format:when APO suggest [service]A temperature preference is in the following format:when [temperature value] suggest [service][temperature value] is one of the readings that the temperature sensors can produce.[service] is the name of a service (e.g., shops) provided by item of interestsAPO is just a word indicating the user is being overexposed to air pollution.Preferences are loaded from a preference file when the Preference Repository starts up.The preference file contains at least one and at most three user.For each user in the file contains at least one temperature preference, exactly one weather alarmpreference, and exactly one APO preference.The preference file is formatted as follows: Each entry has the name of the preference owner Each field in the entry is terminated with a new line character Each entry is separated from other entries by an empty lineAn example entry in the preference file is:name: BryanMedical Condition Type: 2pref-1: when 30 suggest pool //temp. threshold examplepref-2: when APO suggest cinema //APO threshold examplepref-3: when weather suggest cinema //weather alarm example4.2 Preference EvaluationPreference evaluation is initiated by a request from the Context Manager when a weather alarm is triggeredor either one of the APO or Temperature threshold is reached.This request contains: the name of the user whose preferences should be checked the triggered weather alarm the current temperature readings or the word “APO” depending on which threshold is reachedThe Preference Repository checks the preferences for the specified user to see if the context values in thepreferences match with any of the sensor readings. The services suggested by any matching preferencesare then returned to the Context Manager as the result of the request.For example, a user Alice has defined the preference:when 25 suggest pool //temp. threshold exampleIf a request from the Context Manager contains “Alice, normal, 25”, the Preference Repository will return“pool” to the Context Manager, which will then return “Indooroopilly”, “Garden City” and “South BankParkland” to the User Interface.Another example, a user Alice has defined the preference:when 30 suggest pool //temp. threshold examplewhen APO suggest shops //APO threshold exampleIf a request from the Context Manager contains “Alice, normal, APO”, the Preference Repository willreturn “shops” to the Context Manager, which will only return “Indooroopilly” and “Garden City” to theUser Interface without “South Bank Parkland”.4.3 Starting the Preference RepositoryThe Preference Repository is started from Eclipse, accepting the following argument:[preference-file]where: [preference-file] is the name of the file containing the user preferences.4.4 Shutting down the Preference RepositoryThe Preference Repository shuts down when it receives a notification from the Context Managerinstructing it to do so. The Preference Repository deregisters its subscription with Ice Storm before exiting.5. The User Interface (UI)The Enviro Smart Application provides an interface through which users can issue queries for informationabout the city, and also receive warnings and suggestions based on predefined preferences when user’sAPO threshold is reached.Users interact with the Enviro Smart Application using a text-based menu. User menu choices are readoff standard in. All spec-related Enviro Smart Application output is printed to standard out. All non-specEnviro Smart Application output must be printed to standard error.5.1 Initialisation and queriesThe Enviro Smart Application initially asks for a name of the user:Context-aware Enviro Smart ApplicationPlease enter your user name:Then a main menu will initially appear as:Context-aware Enviro Smart Application Main MenuPlease select an option:1. Search for information on a specific item of interest2. Search for items of interest in current locationE. ExitThe user then has the option of selecting 1, 2 or E.Option 1: Search for a specific item of interestThe user is presented with a prompt requesting the name of an item of interest.Please enter name of item of interest:The user enters the name of an item of interest. A request is then made to the Context Manager queryingfor information on the item of interest.The information returned by the Context Manager is then displayed on the screen in the format:Information about If a user searched for South Bank Parklands the following would be printed:Information about South Bank Parklands:The South Bank Parklands area was created as part of the rejuvenation of theindustrial water front undertaken for World Expo 1988. The Parklands area containsmany shops, a cinema complex, and a large number of restaurants as well as a manmadebeach. A river promenade stretches the length of South Bank Parklands.If the item of interest is not recognised (not in the city information file) the Enviro Smart Applicationprints the following:No match found for item of interestIrrespective of whether the query succeeds or fails, pressing the Enter key should return the user to theMain Menu.Option 2: Search for items of interest in current locationA request is made to the Context Manager querying for the names of items of interest in the user’s currentlocation. For example, the current location of the user is A and A has two items of interest (South BankParklands and The IMAX cinema), the Context Manager will respond with a list of names of items ofinterest in the user’s current location (printed one per line) as below:The following items of interest are in your location:South Bank ParklandsThe IMAX cinemaIf there are no items of interest in the user’s current location, the following message is printed to thescreen:There are no items of interest in your current location.Irrespective of whether the query succeeds or fails, pressing the Enter key returns to the Main Menu.Option E: ExitA message is sent to the Context Manager informing it that the Enviro Smart Application is exiting. TheEnviro Smart Application then deregisters with the Ice Storm and exits.5.2 Receiving warnings and suggestionsIf a weather alarm is triggered, the Enviro Smart Application will issue a warning of the following format:Context-aware Enviro Smart Application Main MenuWarning, extreme weather is detected, the current weather event is alarm>Suggestion - please go to , .Please select an option:1. Search for information on a specific item of interest2. Search for items of interest in current locationE. ExitIf user’s APO threshold is reached, the Enviro Smart Application will issue a warning of the followingformat:Context-aware Enviro Smart Application Main MenuWarning, significant air pollution level detected, the current AQI is AQI>Suggestion - please go to , .Please select an option:1. Search for information on a specific item of interest2. Search for items of interest in current locationE. ExitIf user’s predefined temperature is reached, the Enviro Smart application will issue a warning with themenu appear as:Context-aware Enviro Smart Application Main MenuWarning, Temperature is now Suggestion - please go to , .Please select an option:1. Search for information on a specific item of interest2. Search for items of interest in current locationE. ExitSuggestions are printed out as soon as they are received. It may happen that a suggestion is printed to thescreen while a user is typing information for one of the other menu options. This is acceptable behaviourfor the Enviro Smart Application.5.3 Starting the Interface of the Enviro Smart ApplicationThe Enviro Smart Application is started in Eclipse, taking no arguments.6. Designing the start and exit of the application and choosingappropriate communication paradigmsIt is necessary to design the order in which the components start and exit, as well as determine thecommunication paradigm (i.e., RMI and/or Publish/Subscribe Notification) employed between eachcomponent. The final electronic submission should include a file called “Design details” that describesthis design, and annotates Figure 1 below with appropriate arrows to show all the communications thatoccurs between components. Each annotated arrow must have a number associated with it foridentification purpose when completing Table 2 below the figure. There can be more than one arrowbetween two components, and each arrow should occupy at least one row in the table.Figure 1.ArrowNum.SendingComponentReceivingComponentCommunicationparadigmBrief description of thecommunication taking placee.g., 1 Sensor 1 Server A Publish/Subscribe Sensor 1 sends sensor readingsto Server A… … … …Table 2.7. AssessmentThe students will have to provide a demonstration of how the application works for the assessmentpurposes. Students have the options of demonstrating their applications on their own laptops or the labmachines. To maintain academic integrity, the applications used for demonstration must be same as theone that students have submitted. That is, if the java files students used to demonstrate their applicationsare different to the ones they submitted, they will be subjected to investigation.Marks are allocated for the different components of the assignment as follows:Assessment item Marks allocatedAppropriate design of the start and exit of the application and choseof communication paradigms between each component5Context Manager- correctly responds to Enviro Smart Application queries- correctly evaluate APO and temperature threshold- correctly deliver extreme weather warnings5- correctly makes suggestions and warnings- request to shutdown supported as per specification (i.e., shutdownwhen all UIs have exited)Preference Repository- responds to queries as per specification- correctly evaluates user preferences3Sensors- all types of sensor supported- sensors provide appropriate readings- deregistration of subscription on IceStorm and exiting whenreceiving shutdown notification3Location Server- location mapping supported- forward location and indoor/outdoor status to context manager asper specification- deregistration of subscription on IceStorm and exiting whenreceiving shutdown notification2Enviro Smart Application- user interface as per specification- queries sent to Context Manager- correctly output suggestions and warning- support multiple users- issues shutdown request, deregister subscription on IceStorm andexits3General- Ice Version 3.7.0, coding style and documentations (codecommented, neat layout, minimal spelling and grammar mistakes)1TOTAL 22Partial marks will be awarded for assignments that are missing components, do not compile, or onlypartially fulfil the stated specifications. Assignments will be returned to students no later than 3 weeksafter the assignment submission deadline. Assignment marks will be emailed to each student’s UQ emailaccount and will also be accessible on the course website.Part B (3%) – publish/subscribeFor this part of the assignment find two papers on the publish/subscribe communication paradigm (contentbased routing is another ter本团队核心人员组成主要包括硅谷工程师、BAT一线工程师,精通德英语!我们主要业务范围是代做编程大作业、课程设计等等。我们的方向领域:window编程 数值算法 AI人工智能 金融统计 计量分析 大数据 网络编程 WEB编程 通讯编程 游戏编程多媒体linux 外挂编程 程序API图像处理 嵌入式/单片机 数据库编程 控制台 进程与线程 网络安全 汇编语言 硬件编程 软件设计 工程标准规等。其中代写编程、代写程序、代写留学生程序作业语言或工具包括但不限于以下范围:C/C++/C#代写Java代写IT代写Python代写辅导编程作业Matlab代写Haskell代写Processing代写Linux环境搭建Rust代写Data Structure Assginment 数据结构代写MIPS代写Machine Learning 作业 代写Oracle/SQL/PostgreSQL/Pig 数据库代写/代做/辅导Web开发、网站开发、网站作业ASP.NET网站开发Finance Insurace Statistics统计、回归、迭代Prolog代写Computer Computational method代做因为专业,所以值得信赖。如有需要,请加QQ:99515681 或邮箱:[email protected] 微信:codehelp