|
4 | 4 | * Anyplace is a first-of-a-kind indoor information service offering GPS-less
|
5 | 5 | * localization, navigation and search inside buildings using ordinary smartphones.
|
6 | 6 | *
|
7 |
| - * Author(s): Constantinos Costa, Kyriakos Georgiou, Lambros Petrou, Loukas Solea |
| 7 | + * Author(s): Constantinos Costa, Kyriakos Georgiou, Lambros Petrou, Loukas Solea, Paschalis Mpeis |
8 | 8 | *
|
9 | 9 | * Supervisor: Demetrios Zeinalipour-Yazti
|
10 | 10 | *
|
@@ -37,7 +37,6 @@ package controllers
|
37 | 37 |
|
38 | 38 | import java.io._
|
39 | 39 | import java.net.{HttpURLConnection, URL}
|
40 |
| -import java.nio.file.attribute.FileTime |
41 | 40 | import java.text.{NumberFormat, ParseException}
|
42 | 41 | import java.util
|
43 | 42 | import java.util.Locale
|
@@ -69,30 +68,24 @@ import scala.collection.mutable.ListBuffer
|
69 | 68 | import scala.io.Source
|
70 | 69 | import java.nio.file.{Files, Paths}
|
71 | 70 | import java.time.Instant
|
72 |
| -import java.nio.file._ |
73 |
| -import java.time._ |
74 | 71 | import java.time.temporal.{ChronoUnit, TemporalUnit}
|
75 | 72 |
|
76 | 73 | object AnyplaceMapping extends play.api.mvc.Controller {
|
77 | 74 |
|
| 75 | + // CHECK Why is this hardcoded here? |
78 | 76 | private val ADMIN_ID = "112997031510415584062_google"
|
79 |
| - val ACCES_RETRY_AMOUNT = 10 |
80 |
| - val ACCES_RETRY_UNIT: TemporalUnit = ChronoUnit.SECONDS |
| 77 | + val ACCES_RETRY_AMOUNT = 2 |
| 78 | + val ACCES_RETRY_UNIT: TemporalUnit = ChronoUnit.HOURS |
81 | 79 |
|
82 | 80 | // returns a json in a string format, and strips out unnecessary fields for logging, like:
|
83 | 81 | // access_token (which is huge), username, and password
|
84 | 82 | def stripJson(jsVal: JsValue) = {
|
85 |
| - // This replaces: |
86 |
| - // val json = jsVal.as[JsObject] ++ Json.obj("access_token" -> "") |
87 |
| -// val date_format = "dd/MM/YY HH:mm:ss"; |
88 |
| -// new SimpleDateFormat(date_format).format(new Date) |
89 |
| - (jsVal.as[JsObject] - "access_token" - "password").toString() |
| 83 | + // if username is needed, then restore it |
| 84 | + (jsVal.as[JsObject] - "access_token" - "password" - "username").toString() |
90 | 85 | }
|
91 | 86 |
|
92 |
| - |
93 |
| - |
94 | 87 | private def verifyOwnerId(authToken: String): String = {
|
95 |
| - //remove the double string qoutes due to json processing |
| 88 | + //remove the double string quotes due to json processing |
96 | 89 | val gURL = "https://www.googleapis.com/oauth2/v3/tokeninfo?id_token=" + authToken
|
97 | 90 | var res = ""
|
98 | 91 | try
|
@@ -2997,7 +2990,7 @@ object AnyplaceMapping extends play.api.mvc.Controller {
|
2997 | 2990 | if(requestExpired) {
|
2998 | 2991 | // This is to give user some feedback too..
|
2999 | 2992 | LPLogger.info("getAccesMap: Previous request failed and expired." +
|
3000 |
| - "Will retry on next request. File: " + crlb_filename) |
| 2993 | + "Will retry on next request.\nFile: " + crlb_filename) |
3001 | 2994 | // lock will be deleted at the callsite of this method
|
3002 | 2995 | } else {
|
3003 | 2996 | LPLogger.debug("getAccesMap: Ignoring request. Another process is already building: " + crlb_filename)
|
|
0 commit comments