import gr.grnet.aquarium.computation.UserState.{JsonNames ⇒ UserStateJsonNames}
import gr.grnet.aquarium.util.json.JsonSupport
import collection.mutable.ListBuffer
-import gr.grnet.aquarium.event._
-import gr.grnet.aquarium.event.im.IMEventModel
-import gr.grnet.aquarium.event.im.IMEventModel.{Names ⇒ IMEventNames}
-import gr.grnet.aquarium.event.resource.ResourceEventModel
-import gr.grnet.aquarium.event.resource.ResourceEventModel.{Names ⇒ ResourceEventNames}
+import gr.grnet.aquarium.event.model.im.IMEventModel
+import gr.grnet.aquarium.event.model.im.IMEventModel.{Names ⇒ IMEventNames}
+import gr.grnet.aquarium.event.model.resource.ResourceEventModel
+import gr.grnet.aquarium.event.model.resource.ResourceEventModel.{Names ⇒ ResourceEventNames}
import gr.grnet.aquarium.store._
-import gr.grnet.aquarium.event.WalletEntry.{JsonNames ⇒ WalletJsonNames}
-import gr.grnet.aquarium.event.PolicyEntry.{JsonNames ⇒ PolicyJsonNames}
+import gr.grnet.aquarium.event.model.WalletEntry.{JsonNames ⇒ WalletJsonNames}
+import gr.grnet.aquarium.event.model.PolicyEntry.{JsonNames ⇒ PolicyJsonNames}
import java.util.Date
import gr.grnet.aquarium.logic.accounting.Policy
import com.mongodb._
import gr.grnet.aquarium.util._
import gr.grnet.aquarium.converter.Conversions
import gr.grnet.aquarium.computation.UserState
+import gr.grnet.aquarium.event.model.{ExternalEventModel, WalletEntry, PolicyEntry}
/**
* Mongodb implementation of the various aquarium stores.
MongoDBResourceEvent.fromOther(event, null)
}
+ def pingResourceEventStore(): Unit = {
+ MongoDBStore.ping(mongo)
+ }
+
def insertResourceEvent(event: ResourceEventModel) = {
val localEvent = MongoDBResourceEvent.fromOther(event, new ObjectId().toStringMongod)
MongoDBStore.insertObject(localEvent, resourceEvents, MongoDBStore.jsonSupportToDBObject)
MongoDBStore.createIMEventFromOther(event)
}
+ def pingIMEventStore(): Unit = {
+ MongoDBStore.ping(mongo)
+ }
+
def insertIMEvent(event: IMEventModel): IMEvent = {
val localEvent = MongoDBIMEvent.fromOther(event, new ObjectId().toStringMongod)
MongoDBStore.insertObject(localEvent, imEvents, MongoDBStore.jsonSupportToDBObject)
}
/**
- * Collection holding the [[gr.grnet.aquarium.event.resource.ResourceEventModel]]s.
+ * Collection holding the [[gr.grnet.aquarium.event.model.resource.ResourceEventModel]]s.
*
* Resource events are coming from all systems handling billable resources.
*/
final val USER_STATES_COLLECTION = "userstates"
/**
- * Collection holding [[gr.grnet.aquarium.event.im.IMEventModel]]s.
+ * Collection holding [[gr.grnet.aquarium.event.model.im.IMEventModel]]s.
*
* User events are coming from the IM module (external).
*/
final val IM_EVENTS_COLLECTION = "imevents"
/**
- * Collection holding [[gr.grnet.aquarium.event.im.IMEventModel]]s that could not be parsed to normal objects.
+ * Collection holding [[gr.grnet.aquarium.event.model.im.IMEventModel]]s that could not be parsed to normal objects.
*
* We of course assume at least a valid JSON representation.
*
final val UNPARSED_IM_EVENTS_COLLECTION = "unparsed_imevents"
/**
- * Collection holding [[gr.grnet.aquarium.event.WalletEntry]].
+ * Collection holding [[gr.grnet.aquarium.event.model.WalletEntry]].
*
* Wallet entries are generated internally in Aquarium.
*/
// final val POLICIES_COLLECTION = "policies"
/**
- * Collection holding [[gr.grnet.aquarium.event.PolicyEntry]].
+ * Collection holding [[gr.grnet.aquarium.event.model.PolicyEntry]].
*/
final val POLICY_ENTRIES_COLLECTION = "policyEntries"
PolicyEntry.fromJson(JSON.serialize(dbObj))
}
+ def ping(mongo: Mongo): Unit = {
+ // This requires a network roundtrip
+ mongo.isLocked
+ }
+
def findBy[A >: Null <: AnyRef](name: String,
value: String,
collection: DBCollection,