Advertisement
Guest User

Untitled

a guest
Apr 29th, 2016
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.02 KB | None | 0 0
  1. val logConfigurationFile = System.getenv("PETCLINIC_HOME") + "/logback.xml"
  2. val context: LoggerContext = LoggerFactory.getILoggerFactory.asInstanceOf[LoggerContext]
  3. val jc: JoranConfigurator = new JoranConfigurator()
  4. context.reset()
  5. context.putProperty("application-name", "PetClinic")
  6. jc.setContext(context)
  7. jc.doConfigure(logConfigurationFile)
  8.  
  9. lazy val appPropertyFilePath = System.getenv("PETCLINIC_HOME") + "/app.properties"
  10. lazy val properties: Properties = {
  11. val properties = new Properties()
  12. properties.load(new FileInputStream(appPropertyFilePath))
  13. properties
  14. }
  15.  
  16. lazy val projectUrl: String = properties.getProperty("project.url")
  17. lazy val projectEmail: String = properties.getProperty("project.email")
  18. lazy val appUrl: String = properties.getProperty("app.url")
  19. lazy val mysqlUsername: String = properties.getProperty("mysql.username")
  20. lazy val mysqlPassword: String = properties.getProperty("mysql.password")
  21. lazy val mysqlDatabaseName: String = properties.getProperty("mysql.database.name")
  22. lazy val mysqlServerName: String = properties.getProperty("mysql.server.name")
  23. lazy val mysqlCachePrepStmts: Boolean = properties.getProperty("mysql.cachePrepStmts").toBoolean
  24. lazy val mysqlPrepStmtCacheSize: Int = properties.getProperty("mysql.prepStmtCacheSize").toInt
  25. lazy val mysqlPrepStmtCacheSqlLimit: Int = properties.getProperty("mysql.prepStmtCacheSqlLimit").toInt
  26. lazy val mysqlUseServerPrepStmts: Boolean = properties.getProperty("mysql.useServerPrepStmts").toBoolean
  27. lazy val casUrl: String = properties.getProperty("cas.url")
  28. lazy val casPort: Int = properties.getProperty("cas.port").toInt
  29. lazy val casKeyspace: String = properties.getProperty("cas.keyspace")
  30. lazy val hazelcastGroupName: String = properties.getProperty("hazelcast.group.name")
  31. lazy val hazelcastGroupPassword: String = properties.getProperty("hazelcast.group.password")
  32. lazy val hazelcastLoggingType: String = properties.getProperty("hazelcast.logging.type")
  33. lazy val smtpUrl: String = properties.getProperty("smtp.url")
  34. lazy val smtpPort: Int = properties.getProperty("smtp.port").toInt
  35. lazy val smtpUserName: String = properties.getProperty("smtp.username")
  36. lazy val smtpPassword: String = properties.getProperty("smtp.password")
  37. lazy val smtpSslOnConnect: Boolean = properties.getProperty("smtp.sslonconnect").toBoolean
  38. lazy val googleWebClientId: String = properties.getProperty("google.webclient.id")
  39. lazy val googleWebClientSecret: String = properties.getProperty("google.clientweb.secret")
  40. lazy val appEmail: String = properties.getProperty("app.email")
  41. lazy val appName: String = properties.getProperty("app.name")
  42.  
  43. def initialize():Unit = {
  44. //TODO do initialization
  45. }
  46.  
  47. def cleanup():Unit = {
  48. //TODO do cleanup
  49. }
  50.  
  51. lazy val restApi = new RestApi(cassandraSession, eventBus, userApi, ownerApi, petApi, authenticationApi)
  52. lazy val swaggerApiDocServlet = new SwaggerApiDocServlet(projectUrl, projectEmail)
  53.  
  54. override def init(context: ServletContext) {
  55.  
  56. context.mount(restApi, "/api/*") // mount servlets
  57. context.mount(swaggerApiDocServlet, "/api-doc/*") // mount servlets
  58. initialize()
  59. }
  60.  
  61. ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement