Skip to content

Commit 9300901

Browse files
Added .editorconf, changed tiler script, added logging configuration.o
Some tiler script fixes for docker image compatibility. Logging is now configured using: server/conf/logger.xml
1 parent e55d1ab commit 9300901

File tree

4 files changed

+15
-17
lines changed

4 files changed

+15
-17
lines changed

.editorconf

+5
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ insert_final_newline = true
1111
max_line_length = 100
1212
trim_trailing_whitespace = true
1313

14+
[*.js]
15+
charset = utf-8
16+
indent_style = space
17+
indent_size = 2
18+
1419
[*.py]
1520
indent_style = space
1621
indent_size = 4

server/anyplace_tiler/start-anyplace-tiler.sh

100644100755
File mode changed.

server/app/controllers/AnyplaceMapping.scala

+8-15
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Anyplace is a first-of-a-kind indoor information service offering GPS-less
55
* localization, navigation and search inside buildings using ordinary smartphones.
66
*
7-
* Author(s): Constantinos Costa, Kyriakos Georgiou, Lambros Petrou, Loukas Solea
7+
* Author(s): Constantinos Costa, Kyriakos Georgiou, Lambros Petrou, Loukas Solea, Paschalis Mpeis
88
*
99
* Supervisor: Demetrios Zeinalipour-Yazti
1010
*
@@ -37,7 +37,6 @@ package controllers
3737

3838
import java.io._
3939
import java.net.{HttpURLConnection, URL}
40-
import java.nio.file.attribute.FileTime
4140
import java.text.{NumberFormat, ParseException}
4241
import java.util
4342
import java.util.Locale
@@ -69,30 +68,24 @@ import scala.collection.mutable.ListBuffer
6968
import scala.io.Source
7069
import java.nio.file.{Files, Paths}
7170
import java.time.Instant
72-
import java.nio.file._
73-
import java.time._
7471
import java.time.temporal.{ChronoUnit, TemporalUnit}
7572

7673
object AnyplaceMapping extends play.api.mvc.Controller {
7774

75+
// CHECK Why is this hardcoded here?
7876
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
8179

8280
// returns a json in a string format, and strips out unnecessary fields for logging, like:
8381
// access_token (which is huge), username, and password
8482
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()
9085
}
9186

92-
93-
9487
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
9689
val gURL = "https://www.googleapis.com/oauth2/v3/tokeninfo?id_token=" + authToken
9790
var res = ""
9891
try
@@ -2997,7 +2990,7 @@ object AnyplaceMapping extends play.api.mvc.Controller {
29972990
if(requestExpired) {
29982991
// This is to give user some feedback too..
29992992
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)
30012994
// lock will be deleted at the callsite of this method
30022995
} else {
30032996
LPLogger.debug("getAccesMap: Ignoring request. Another process is already building: " + crlb_filename)

server/conf/logger.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
55
<file>${application.home}/logs/application.log</file>
66
<encoder>
7-
<pattern>%%d{HH:mm:ss.SS} | %-5level | %logger | %n%message%n%xException%n</pattern>
7+
<pattern>%20.-20logger{20} | %d{"dd/MM/YY HH:mm:ss"} | %5Level | %message%n%xException{5}</pattern>
88
</encoder>
99
</appender>
1010

1111
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
1212
<encoder>
1313
<!-- FORMAT: APP | DATE | [LEVEL] LOG_MESSAGE -->
14-
<pattern>%20.-20logger{20} | %d{"dd/MM/YY HH:mm:ss"} | %7coloredLevel %message%n%xException{5}</pattern>
14+
<pattern>%cyan(%20.-20logger{20}) | %d{"dd/MM/YY HH:mm:ss"} | %highlight(%-5level) | %message%n%xException{5}</pattern>
1515
</encoder>
1616
</appender>
1717

0 commit comments

Comments
 (0)