+ props.get(Keys.wallet_entry_store_class) map {
+ className ⇒
+ val instance = newInstance[WalletEntryStore](className)
+ logger.info("Overriding WalletEntryStore provisioning. Implementation given by: %s".format(instance.getClass))
+ instance
+ }
+ }
+
+ private[this] lazy val _policyStoreM: Maybe[PolicyStore] = {
+ props.get(Keys.policy_store_class) map {
+ className ⇒
+ val instance = newInstance[PolicyStore](className)
+ logger.info("Overriding PolicyStore provisioning. Implementation given by: %s".format(instance.getClass))
+ instance
+ }
+ }
+
+ private[this] lazy val _eventsStoreFolder: Maybe[File] = {
+ props.get(Keys.events_store_folder) map {
+ folderName ⇒
+ val canonicalFolder = {
+ val folder = new File(folderName)
+ if(folder.isAbsolute) {
+ folder.getCanonicalFile
+ } else {
+ logger.info("{} is not absolute, making it relative to AQUARIUM_HOME", Keys.events_store_folder)
+ new File(ResourceLocator.AQUARIUM_HOME_FOLDER, folderName).getCanonicalFile
+ }
+ }
+
+ val canonicalPath = canonicalFolder.getCanonicalPath
+
+ logger.info("{} = {}", Keys.events_store_folder, canonicalPath)
+
+ if(canonicalFolder.exists() && !canonicalFolder.isDirectory) {
+ throw new AquariumException("%s = %s is not a folder".format(Keys.events_store_folder, canonicalFolder))
+ }
+
+ // Now, events folder must be outside AQUARIUM_HOME, since AQUARIUM_HOME can be wiped out for an upgrade but
+ // we still want to keep the events.
+ val ahCanonicalPath = ResourceLocator.AQUARIUM_HOME_FOLDER.getCanonicalPath
+ if(canonicalPath.startsWith(ahCanonicalPath)) {
+ throw new AquariumException(
+ "%s = %s is under %s = %s".format(
+ Keys.events_store_folder, canonicalFolder,
+ ResourceLocator.AQUARIUM_HOME.name, ahCanonicalPath
+ ))
+ }
+
+ canonicalFolder.mkdirs()
+
+ canonicalFolder