package gr.grnet.aquarium
-import actor.ActorProvider
-import com.ckkloverdos.props.Props
-import com.ckkloverdos.convert.Converters.{DefaultConverters => TheDefaultConverters}
-import processor.actor.{UserEventProcessorService, ResourceEventProcessorService}
-import store._
-import util.{Lifecycle, Loggable}
+import events.im.IMEventModel
import java.io.File
+
import com.ckkloverdos.maybe._
+import com.ckkloverdos.props.Props
+import com.ckkloverdos.convert.Converters.{DefaultConverters => TheDefaultConverters}
+
+import gr.grnet.aquarium.service._
+import gr.grnet.aquarium.util.{Lifecycle, Loggable}
+import gr.grnet.aquarium.store._
/**
* The master configurator. Responsible to load all of application configuration and provide the relevant services.
}
- private[this] lazy val _actorProvider: ActorProvider = {
- val instance = newInstance[ActorProvider](props.getEx(Keys.actor_provider_class))
- logger.info("Loaded ActorProvider: %s".format(instance.getClass))
+ private[this] lazy val _actorProvider: ActorProviderService = {
+ val instance = newInstance[ActorProviderService](props.getEx(Keys.actor_provider_class))
+ logger.info("Loaded ActorProviderService: %s".format(instance.getClass))
instance
}
}
}
- private[this] lazy val _userEventStoreM: Maybe[UserEventStore] = {
+ private[this] lazy val _imEventStoreM: Maybe[IMEventStore] = {
props.get(Keys.user_event_store_class) map { className ⇒
- val instance = newInstance[UserEventStore](className)
- logger.info("Overriding UserEventStore provisioning. Implementation given by: %s".format(instance.getClass))
+ val instance = newInstance[IMEventStore](className)
+ logger.info("Overriding IMEventStore provisioning. Implementation given by: %s".format(instance.getClass))
instance
}
}
}
}
- private[this] lazy val _resEventProc: ResourceEventProcessorService = new ResourceEventProcessorService
+ private[this] lazy val _resEventProc = new ResourceEventProcessorService
- private[this] lazy val _imEventProc: UserEventProcessorService = new UserEventProcessorService
+ private[this] lazy val _imEventProc = new IMEventProcessorService
+
+ private[this] lazy val _lifecycleServices = List(AkkaService, _restService, _actorProvider, _resEventProc, _imEventProc)
def get(key: String, default: String = ""): String = props.getOr(key, default)
}
def startServices(): Unit = {
- _restService.start()
- _actorProvider.start()
- _resEventProc.start()
- _imEventProc.start()
+ _lifecycleServices.foreach(_.start())
}
def stopServices(): Unit = {
- _imEventProc.stop()
- _resEventProc.stop()
- _restService.stop()
- _actorProvider.stop()
-
+ _lifecycleServices.reverse.foreach(_.stop())
// akka.actor.Actor.registry.shutdownAll()
}
}
}
- def userEventStore = {
- _userEventStoreM match {
+ def imEventStore = {
+ _imEventStoreM match {
case Just(es) ⇒ es
- case _ ⇒ storeProvider.userEventStore
+ case _ ⇒ storeProvider.imEventStore
}
}
new Configurator(newProps)
}
- // FIXME: This is instead of props.getInt which currently contains a bug.
- // FIXME: Fix the original bug and delete this method
- def getInt(name: String): Maybe[Int] = {
- props.get(name).map(_.toInt)
- }
-
def eventsStoreFolder = _eventsStoreFolder
def adminCookie: MaybeOption[String] = props.get(Configurator.Keys.admin_cookie) match {
final val version = "version"
/**
- * The fully qualified name of the class that implements the `ActorProvider`.
+ * The fully qualified name of the class that implements the `ActorProviderService`.
* Will be instantiated reflectively and should have a public default constructor.
*/
final val actor_provider_class = "actor.provider.class"
final val events_store_folder = "events.store.folder"
/**
- * If set to `true`, then an IM event that cannot be parsed to [[gr.grnet.aquarium.logic.events.UserEvent]] is
- * saved to the [[gr.grnet.aquarium.store.UserEventStore]].
+ * If set to `true`, then an IM event that cannot be parsed to [[gr.grnet.aquarium.events.im.IMEventModel]] is
+ * saved to the [[gr.grnet.aquarium.store.IMEventStore]].
*/
final val save_unparsed_event_im = "save.unparsed.event.im"
*/
final val admin_cookie = "admin.cookie"
}
+
+ object HTTP {
+ final val RESTAdminHeaderName = "X-Aquarium-Admin-Cookie"
+ final val RESTAdminHeaderNameLowerCase = RESTAdminHeaderName.toLowerCase
+ }
}