import idl "aquarium-anyvalue.avdl";
record ResourceEventMsg {
- string @aliases(["originalID", "ID"]) id;
- string @aliases(["_id", "inStoreID"]) idInStore;
+ string @aliases(["id"]) originalID; // From message creator
+ union {string, null} @aliases(["_id", "idInStore"]) inStoreID; // From Aquarium (message recipient)
long occurredMillis;
long receivedMillis = 0;
string userID;
}
record IMEventMsg {
- string @aliases(["originalID", "ID"]) id;
- string @aliases(["_id", "inStoreID"]) idInStore;
+ string @aliases(["id"]) originalID; // From message creator
+ union {string, null} @aliases(["_id", "idInStore"]) inStoreID; // From Aquarium (message recipient)
long occurredMillis;
long receivedMillis = 0;
string userID;
}
record PolicyMsg {
- string @aliases(["id, _id, idInStore, inStoreID"]) ID;
+ string @aliases(["id"]) originalID; // From message creator (e.g. this is present for the default policy.json)
+ union {string, null} @aliases(["_id", "idInStore"]) inStoreID; // From Aquarium (message recipient)
union {string, null} parentID;
long validFromMillis;
long validToMillis;
@SuppressWarnings("all")
public interface AquariumEvents {
- public static final org.apache.avro.Protocol PROTOCOL = org.apache.avro.Protocol.parse("{\"protocol\":\"AquariumEvents\",\"namespace\":\"gr.grnet.aquarium.message.avro.gen\",\"types\":[{\"type\":\"record\",\"name\":\"AnyValueMsg\",\"fields\":[{\"name\":\"anyValue\",\"type\":[\"null\",\"int\",\"long\",\"boolean\",\"double\",\"bytes\",\"string\"]}]},{\"type\":\"record\",\"name\":\"ResourceEventMsg\",\"fields\":[{\"name\":\"id\",\"type\":\"string\",\"aliases\":[\"originalID\",\"ID\"]},{\"name\":\"idInStore\",\"type\":\"string\"},{\"name\":\"occurredMillis\",\"type\":\"long\"},{\"name\":\"receivedMillis\",\"type\":\"long\",\"default\":0},{\"name\":\"userID\",\"type\":\"string\"},{\"name\":\"clientID\",\"type\":\"string\"},{\"name\":\"eventVersion\",\"type\":\"string\",\"default\":\"1.0\"},{\"name\":\"resource\",\"type\":\"string\",\"aliases\":[\"resourceType\"]},{\"name\":\"instanceID\",\"type\":\"string\"},{\"name\":\"value\",\"type\":\"string\"},{\"name\":\"details\",\"type\":{\"type\":\"map\",\"values\":\"AnyValueMsg\"}}]},{\"type\":\"record\",\"name\":\"IMEventMsg\",\"fields\":[{\"name\":\"id\",\"type\":\"string\",\"aliases\":[\"originalID\",\"ID\"]},{\"name\":\"idInStore\",\"type\":\"string\"},{\"name\":\"occurredMillis\",\"type\":\"long\"},{\"name\":\"receivedMillis\",\"type\":\"long\",\"default\":0},{\"name\":\"userID\",\"type\":\"string\"},{\"name\":\"clientID\",\"type\":\"string\"},{\"name\":\"eventVersion\",\"type\":\"string\",\"default\":\"1.0\"},{\"name\":\"isActive\",\"type\":\"boolean\"},{\"name\":\"role\",\"type\":\"string\"},{\"name\":\"details\",\"type\":{\"type\":\"map\",\"values\":\"AnyValueMsg\"}}]}],\"messages\":{}}");
+ public static final org.apache.avro.Protocol PROTOCOL = org.apache.avro.Protocol.parse("{\"protocol\":\"AquariumEvents\",\"namespace\":\"gr.grnet.aquarium.message.avro.gen\",\"types\":[{\"type\":\"record\",\"name\":\"AnyValueMsg\",\"fields\":[{\"name\":\"anyValue\",\"type\":[\"null\",\"int\",\"long\",\"boolean\",\"double\",\"bytes\",\"string\"]}]},{\"type\":\"record\",\"name\":\"ResourceEventMsg\",\"fields\":[{\"name\":\"originalID\",\"type\":\"string\",\"aliases\":[\"id\"]},{\"name\":\"inStoreID\",\"type\":[\"string\",\"null\"],\"aliases\":[\"_id\",\"idInStore\"]},{\"name\":\"occurredMillis\",\"type\":\"long\"},{\"name\":\"receivedMillis\",\"type\":\"long\",\"default\":0},{\"name\":\"userID\",\"type\":\"string\"},{\"name\":\"clientID\",\"type\":\"string\"},{\"name\":\"eventVersion\",\"type\":\"string\",\"default\":\"1.0\"},{\"name\":\"resource\",\"type\":\"string\",\"aliases\":[\"resourceType\"]},{\"name\":\"instanceID\",\"type\":\"string\"},{\"name\":\"value\",\"type\":\"string\"},{\"name\":\"details\",\"type\":{\"type\":\"map\",\"values\":\"AnyValueMsg\"}}]},{\"type\":\"record\",\"name\":\"IMEventMsg\",\"fields\":[{\"name\":\"originalID\",\"type\":\"string\",\"aliases\":[\"id\"]},{\"name\":\"inStoreID\",\"type\":[\"string\",\"null\"],\"aliases\":[\"_id\",\"idInStore\"]},{\"name\":\"occurredMillis\",\"type\":\"long\"},{\"name\":\"receivedMillis\",\"type\":\"long\",\"default\":0},{\"name\":\"userID\",\"type\":\"string\"},{\"name\":\"clientID\",\"type\":\"string\"},{\"name\":\"eventVersion\",\"type\":\"string\",\"default\":\"1.0\"},{\"name\":\"isActive\",\"type\":\"boolean\"},{\"name\":\"role\",\"type\":\"string\"},{\"name\":\"details\",\"type\":{\"type\":\"map\",\"values\":\"AnyValueMsg\"}}]}],\"messages\":{}}");
@SuppressWarnings("all")
public interface Callback extends AquariumEvents {
@SuppressWarnings("all")
public interface AquariumPolicy {
- public static final org.apache.avro.Protocol PROTOCOL = org.apache.avro.Protocol.parse("{\"protocol\":\"AquariumPolicy\",\"namespace\":\"gr.grnet.aquarium.message.avro.gen\",\"types\":[{\"type\":\"record\",\"name\":\"ResourceTypeMsg\",\"fields\":[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"unit\",\"type\":\"string\"},{\"name\":\"chargingBehaviorClass\",\"type\":\"string\"}]},{\"type\":\"record\",\"name\":\"CronSpecTupleMsg\",\"fields\":[{\"name\":\"a\",\"type\":\"string\"},{\"name\":\"b\",\"type\":\"string\"}]},{\"type\":\"record\",\"name\":\"EffectiveUnitPriceMsg\",\"fields\":[{\"name\":\"unitPrice\",\"type\":\"double\"},{\"name\":\"when\",\"type\":[\"CronSpecTupleMsg\",\"null\"]}]},{\"type\":\"record\",\"name\":\"EffectivePriceTableMsg\",\"fields\":[{\"name\":\"priceOverrides\",\"type\":{\"type\":\"array\",\"items\":\"EffectiveUnitPriceMsg\"}}]},{\"type\":\"record\",\"name\":\"SelectorValueMsg\",\"fields\":[{\"name\":\"selectorValue\",\"type\":[\"EffectivePriceTableMsg\",{\"type\":\"map\",\"values\":\"SelectorValueMsg\"}]}]},{\"type\":\"record\",\"name\":\"FullPriceTableMsg\",\"fields\":[{\"name\":\"perResource\",\"type\":{\"type\":\"map\",\"values\":{\"type\":\"map\",\"values\":\"SelectorValueMsg\"}}}]},{\"type\":\"record\",\"name\":\"PolicyMsg\",\"fields\":[{\"name\":\"ID\",\"type\":\"string\",\"aliases\":[\"id, _id, idInStore, inStoreID\"]},{\"name\":\"parentID\",\"type\":[\"string\",\"null\"]},{\"name\":\"validFromMillis\",\"type\":\"long\"},{\"name\":\"validToMillis\",\"type\":\"long\"},{\"name\":\"resourceTypes\",\"type\":{\"type\":\"array\",\"items\":\"ResourceTypeMsg\"}},{\"name\":\"chargingBehaviors\",\"type\":{\"type\":\"array\",\"items\":\"string\"}},{\"name\":\"roleMapping\",\"type\":{\"type\":\"map\",\"values\":\"FullPriceTableMsg\"}}]}],\"messages\":{}}");
+ public static final org.apache.avro.Protocol PROTOCOL = org.apache.avro.Protocol.parse("{\"protocol\":\"AquariumPolicy\",\"namespace\":\"gr.grnet.aquarium.message.avro.gen\",\"types\":[{\"type\":\"record\",\"name\":\"ResourceTypeMsg\",\"fields\":[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"unit\",\"type\":\"string\"},{\"name\":\"chargingBehaviorClass\",\"type\":\"string\"}]},{\"type\":\"record\",\"name\":\"CronSpecTupleMsg\",\"fields\":[{\"name\":\"a\",\"type\":\"string\"},{\"name\":\"b\",\"type\":\"string\"}]},{\"type\":\"record\",\"name\":\"EffectiveUnitPriceMsg\",\"fields\":[{\"name\":\"unitPrice\",\"type\":\"double\"},{\"name\":\"when\",\"type\":[\"CronSpecTupleMsg\",\"null\"]}]},{\"type\":\"record\",\"name\":\"EffectivePriceTableMsg\",\"fields\":[{\"name\":\"priceOverrides\",\"type\":{\"type\":\"array\",\"items\":\"EffectiveUnitPriceMsg\"}}]},{\"type\":\"record\",\"name\":\"SelectorValueMsg\",\"fields\":[{\"name\":\"selectorValue\",\"type\":[\"EffectivePriceTableMsg\",{\"type\":\"map\",\"values\":\"SelectorValueMsg\"}]}]},{\"type\":\"record\",\"name\":\"FullPriceTableMsg\",\"fields\":[{\"name\":\"perResource\",\"type\":{\"type\":\"map\",\"values\":{\"type\":\"map\",\"values\":\"SelectorValueMsg\"}}}]},{\"type\":\"record\",\"name\":\"PolicyMsg\",\"fields\":[{\"name\":\"originalID\",\"type\":\"string\",\"aliases\":[\"id\"]},{\"name\":\"inStoreID\",\"type\":[\"string\",\"null\"],\"aliases\":[\"_id\",\"idInStore\"]},{\"name\":\"parentID\",\"type\":[\"string\",\"null\"]},{\"name\":\"validFromMillis\",\"type\":\"long\"},{\"name\":\"validToMillis\",\"type\":\"long\"},{\"name\":\"resourceTypes\",\"type\":{\"type\":\"array\",\"items\":\"ResourceTypeMsg\"}},{\"name\":\"chargingBehaviors\",\"type\":{\"type\":\"array\",\"items\":\"string\"}},{\"name\":\"roleMapping\",\"type\":{\"type\":\"map\",\"values\":\"FullPriceTableMsg\"}}]}],\"messages\":{}}");
@SuppressWarnings("all")
public interface Callback extends AquariumPolicy {
@SuppressWarnings("all")
public interface AquariumUserState {
- public static final org.apache.avro.Protocol PROTOCOL = org.apache.avro.Protocol.parse("{\"protocol\":\"AquariumUserState\",\"namespace\":\"gr.grnet.aquarium.message.avro.gen\",\"types\":[{\"type\":\"record\",\"name\":\"ResourceTypeMsg\",\"fields\":[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"unit\",\"type\":\"string\"},{\"name\":\"chargingBehaviorClass\",\"type\":\"string\"}]},{\"type\":\"record\",\"name\":\"CronSpecTupleMsg\",\"fields\":[{\"name\":\"a\",\"type\":\"string\"},{\"name\":\"b\",\"type\":\"string\"}]},{\"type\":\"record\",\"name\":\"EffectiveUnitPriceMsg\",\"fields\":[{\"name\":\"unitPrice\",\"type\":\"double\"},{\"name\":\"when\",\"type\":[\"CronSpecTupleMsg\",\"null\"]}]},{\"type\":\"record\",\"name\":\"EffectivePriceTableMsg\",\"fields\":[{\"name\":\"priceOverrides\",\"type\":{\"type\":\"array\",\"items\":\"EffectiveUnitPriceMsg\"}}]},{\"type\":\"record\",\"name\":\"SelectorValueMsg\",\"fields\":[{\"name\":\"selectorValue\",\"type\":[\"EffectivePriceTableMsg\",{\"type\":\"map\",\"values\":\"SelectorValueMsg\"}]}]},{\"type\":\"record\",\"name\":\"FullPriceTableMsg\",\"fields\":[{\"name\":\"perResource\",\"type\":{\"type\":\"map\",\"values\":{\"type\":\"map\",\"values\":\"SelectorValueMsg\"}}}]},{\"type\":\"record\",\"name\":\"PolicyMsg\",\"fields\":[{\"name\":\"ID\",\"type\":\"string\",\"aliases\":[\"id, _id, idInStore, inStoreID\"]},{\"name\":\"parentID\",\"type\":[\"string\",\"null\"]},{\"name\":\"validFromMillis\",\"type\":\"long\"},{\"name\":\"validToMillis\",\"type\":\"long\"},{\"name\":\"resourceTypes\",\"type\":{\"type\":\"array\",\"items\":\"ResourceTypeMsg\"}},{\"name\":\"chargingBehaviors\",\"type\":{\"type\":\"array\",\"items\":\"string\"}},{\"name\":\"roleMapping\",\"type\":{\"type\":\"map\",\"values\":\"FullPriceTableMsg\"}}]},{\"type\":\"record\",\"name\":\"AnyValueMsg\",\"fields\":[{\"name\":\"anyValue\",\"type\":[\"null\",\"int\",\"long\",\"boolean\",\"double\",\"bytes\",\"string\"]}]},{\"type\":\"record\",\"name\":\"ResourceEventMsg\",\"fields\":[{\"name\":\"id\",\"type\":\"string\",\"aliases\":[\"originalID\",\"ID\"]},{\"name\":\"idInStore\",\"type\":\"string\"},{\"name\":\"occurredMillis\",\"type\":\"long\"},{\"name\":\"receivedMillis\",\"type\":\"long\",\"default\":0},{\"name\":\"userID\",\"type\":\"string\"},{\"name\":\"clientID\",\"type\":\"string\"},{\"name\":\"eventVersion\",\"type\":\"string\",\"default\":\"1.0\"},{\"name\":\"resource\",\"type\":\"string\",\"aliases\":[\"resourceType\"]},{\"name\":\"instanceID\",\"type\":\"string\"},{\"name\":\"value\",\"type\":\"string\"},{\"name\":\"details\",\"type\":{\"type\":\"map\",\"values\":\"AnyValueMsg\"}}]},{\"type\":\"record\",\"name\":\"IMEventMsg\",\"fields\":[{\"name\":\"id\",\"type\":\"string\",\"aliases\":[\"originalID\",\"ID\"]},{\"name\":\"idInStore\",\"type\":\"string\"},{\"name\":\"occurredMillis\",\"type\":\"long\"},{\"name\":\"receivedMillis\",\"type\":\"long\",\"default\":0},{\"name\":\"userID\",\"type\":\"string\"},{\"name\":\"clientID\",\"type\":\"string\"},{\"name\":\"eventVersion\",\"type\":\"string\",\"default\":\"1.0\"},{\"name\":\"isActive\",\"type\":\"boolean\"},{\"name\":\"role\",\"type\":\"string\"},{\"name\":\"details\",\"type\":{\"type\":\"map\",\"values\":\"AnyValueMsg\"}}]},{\"type\":\"record\",\"name\":\"UserAgreementMsg\",\"fields\":[{\"name\":\"id\",\"type\":\"string\"},{\"name\":\"relatedIMEventID\",\"type\":[\"string\",\"null\"]},{\"name\":\"validFromMillis\",\"type\":\"long\"},{\"name\":\"validToMillis\",\"type\":\"long\"},{\"name\":\"role\",\"type\":\"string\"},{\"name\":\"fullPriceTableRef\",\"type\":[\"FullPriceTableMsg\",\"null\"]}]},{\"type\":\"record\",\"name\":\"WorkingResourceInstanceChargingStateMsg\",\"fields\":[{\"name\":\"details\",\"type\":{\"type\":\"map\",\"values\":\"AnyValueMsg\"}},{\"name\":\"previousEvents\",\"type\":{\"type\":\"array\",\"items\":\"ResourceEventMsg\"}},{\"name\":\"implicitlyIssuedStartEvents\",\"type\":{\"type\":\"array\",\"items\":\"ResourceEventMsg\"}},{\"name\":\"accumulatingAmount\",\"type\":\"double\"},{\"name\":\"oldAccumulatingAmount\",\"type\":\"double\"},{\"name\":\"previousValue\",\"type\":\"double\"},{\"name\":\"currentValue\",\"type\":\"double\"}]},{\"type\":\"record\",\"name\":\"WorkingResourcesChargingStateMsg\",\"fields\":[{\"name\":\"details\",\"type\":{\"type\":\"map\",\"values\":\"AnyValueMsg\"}},{\"name\":\"stateOfResourceInstance\",\"type\":{\"type\":\"map\",\"values\":\"WorkingResourceInstanceChargingStateMsg\"}}]},{\"type\":\"record\",\"name\":\"WorkingAgreementHistoryMsg\",\"fields\":[{\"name\":\"agreements\",\"type\":{\"type\":\"array\",\"items\":\"UserAgreementMsg\"}}]},{\"type\":\"record\",\"name\":\"ChargeslotMsg\",\"fields\":[{\"name\":\"startMillis\",\"type\":\"long\"},{\"name\":\"stopMillis\",\"type\":\"long\"},{\"name\":\"unitPrice\",\"type\":\"double\"},{\"name\":\"explanation\",\"type\":\"string\",\"default\":\"\"},{\"name\":\"creditsToSubtract\",\"type\":\"double\"}]},{\"type\":\"record\",\"name\":\"WalletEntryMsg\",\"fields\":[{\"name\":\"userID\",\"type\":\"string\"},{\"name\":\"sumOfCreditsToSubtract\",\"type\":\"double\"},{\"name\":\"oldTotalCredits\",\"type\":\"double\"},{\"name\":\"newTotalCredits\",\"type\":\"double\"},{\"name\":\"whenComputedMillis\",\"type\":\"long\"},{\"name\":\"referenceStartMillis\",\"type\":\"long\"},{\"name\":\"referenceStopMillis\",\"type\":\"long\"},{\"name\":\"billingYear\",\"type\":\"int\"},{\"name\":\"billingMonth\",\"type\":\"int\"},{\"name\":\"billingDay\",\"type\":\"int\"},{\"name\":\"chargeslots\",\"type\":{\"type\":\"array\",\"items\":\"ChargeslotMsg\"}},{\"name\":\"resourceEvents\",\"type\":{\"type\":\"array\",\"items\":\"ResourceEventMsg\"}},{\"name\":\"resourceType\",\"type\":\"ResourceTypeMsg\"},{\"name\":\"isSynthetic\",\"type\":\"boolean\",\"default\":false}]},{\"type\":\"record\",\"name\":\"WorkingUserStateMsg\",\"fields\":[{\"name\":\"userID\",\"type\":\"string\"},{\"name\":\"parentUserStateIDInStore\",\"type\":[\"string\",\"null\"]},{\"name\":\"resourceTypesMap\",\"type\":{\"type\":\"map\",\"values\":\"ResourceTypeMsg\"}},{\"name\":\"workingStateOfResources\",\"type\":{\"type\":\"map\",\"values\":\"WorkingResourcesChargingStateMsg\"}},{\"name\":\"totalCredits\",\"type\":\"double\"},{\"name\":\"workingAgreementHistory\",\"type\":\"WorkingAgreementHistoryMsg\"},{\"name\":\"latestUpdateMillis\",\"type\":\"long\"},{\"name\":\"latestResourceEventOccurredMillis\",\"type\":\"long\"},{\"name\":\"billingPeriodOutOfSyncResourceEventsCounter\",\"type\":\"long\"},{\"name\":\"walletEntries\",\"type\":{\"type\":\"array\",\"items\":\"WalletEntryMsg\"}}]}],\"messages\":{}}");
+ public static final org.apache.avro.Protocol PROTOCOL = org.apache.avro.Protocol.parse("{\"protocol\":\"AquariumUserState\",\"namespace\":\"gr.grnet.aquarium.message.avro.gen\",\"types\":[{\"type\":\"record\",\"name\":\"ResourceTypeMsg\",\"fields\":[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"unit\",\"type\":\"string\"},{\"name\":\"chargingBehaviorClass\",\"type\":\"string\"}]},{\"type\":\"record\",\"name\":\"CronSpecTupleMsg\",\"fields\":[{\"name\":\"a\",\"type\":\"string\"},{\"name\":\"b\",\"type\":\"string\"}]},{\"type\":\"record\",\"name\":\"EffectiveUnitPriceMsg\",\"fields\":[{\"name\":\"unitPrice\",\"type\":\"double\"},{\"name\":\"when\",\"type\":[\"CronSpecTupleMsg\",\"null\"]}]},{\"type\":\"record\",\"name\":\"EffectivePriceTableMsg\",\"fields\":[{\"name\":\"priceOverrides\",\"type\":{\"type\":\"array\",\"items\":\"EffectiveUnitPriceMsg\"}}]},{\"type\":\"record\",\"name\":\"SelectorValueMsg\",\"fields\":[{\"name\":\"selectorValue\",\"type\":[\"EffectivePriceTableMsg\",{\"type\":\"map\",\"values\":\"SelectorValueMsg\"}]}]},{\"type\":\"record\",\"name\":\"FullPriceTableMsg\",\"fields\":[{\"name\":\"perResource\",\"type\":{\"type\":\"map\",\"values\":{\"type\":\"map\",\"values\":\"SelectorValueMsg\"}}}]},{\"type\":\"record\",\"name\":\"PolicyMsg\",\"fields\":[{\"name\":\"originalID\",\"type\":\"string\",\"aliases\":[\"id\"]},{\"name\":\"inStoreID\",\"type\":[\"string\",\"null\"],\"aliases\":[\"_id\",\"idInStore\"]},{\"name\":\"parentID\",\"type\":[\"string\",\"null\"]},{\"name\":\"validFromMillis\",\"type\":\"long\"},{\"name\":\"validToMillis\",\"type\":\"long\"},{\"name\":\"resourceTypes\",\"type\":{\"type\":\"array\",\"items\":\"ResourceTypeMsg\"}},{\"name\":\"chargingBehaviors\",\"type\":{\"type\":\"array\",\"items\":\"string\"}},{\"name\":\"roleMapping\",\"type\":{\"type\":\"map\",\"values\":\"FullPriceTableMsg\"}}]},{\"type\":\"record\",\"name\":\"AnyValueMsg\",\"fields\":[{\"name\":\"anyValue\",\"type\":[\"null\",\"int\",\"long\",\"boolean\",\"double\",\"bytes\",\"string\"]}]},{\"type\":\"record\",\"name\":\"ResourceEventMsg\",\"fields\":[{\"name\":\"originalID\",\"type\":\"string\",\"aliases\":[\"id\"]},{\"name\":\"inStoreID\",\"type\":[\"string\",\"null\"],\"aliases\":[\"_id\",\"idInStore\"]},{\"name\":\"occurredMillis\",\"type\":\"long\"},{\"name\":\"receivedMillis\",\"type\":\"long\",\"default\":0},{\"name\":\"userID\",\"type\":\"string\"},{\"name\":\"clientID\",\"type\":\"string\"},{\"name\":\"eventVersion\",\"type\":\"string\",\"default\":\"1.0\"},{\"name\":\"resource\",\"type\":\"string\",\"aliases\":[\"resourceType\"]},{\"name\":\"instanceID\",\"type\":\"string\"},{\"name\":\"value\",\"type\":\"string\"},{\"name\":\"details\",\"type\":{\"type\":\"map\",\"values\":\"AnyValueMsg\"}}]},{\"type\":\"record\",\"name\":\"IMEventMsg\",\"fields\":[{\"name\":\"originalID\",\"type\":\"string\",\"aliases\":[\"id\"]},{\"name\":\"inStoreID\",\"type\":[\"string\",\"null\"],\"aliases\":[\"_id\",\"idInStore\"]},{\"name\":\"occurredMillis\",\"type\":\"long\"},{\"name\":\"receivedMillis\",\"type\":\"long\",\"default\":0},{\"name\":\"userID\",\"type\":\"string\"},{\"name\":\"clientID\",\"type\":\"string\"},{\"name\":\"eventVersion\",\"type\":\"string\",\"default\":\"1.0\"},{\"name\":\"isActive\",\"type\":\"boolean\"},{\"name\":\"role\",\"type\":\"string\"},{\"name\":\"details\",\"type\":{\"type\":\"map\",\"values\":\"AnyValueMsg\"}}]},{\"type\":\"record\",\"name\":\"UserAgreementMsg\",\"fields\":[{\"name\":\"id\",\"type\":\"string\"},{\"name\":\"relatedIMEventID\",\"type\":[\"string\",\"null\"]},{\"name\":\"validFromMillis\",\"type\":\"long\"},{\"name\":\"validToMillis\",\"type\":\"long\"},{\"name\":\"role\",\"type\":\"string\"},{\"name\":\"fullPriceTableRef\",\"type\":[\"FullPriceTableMsg\",\"null\"]}]},{\"type\":\"record\",\"name\":\"WorkingResourceInstanceChargingStateMsg\",\"fields\":[{\"name\":\"details\",\"type\":{\"type\":\"map\",\"values\":\"AnyValueMsg\"}},{\"name\":\"previousEvents\",\"type\":{\"type\":\"array\",\"items\":\"ResourceEventMsg\"}},{\"name\":\"implicitlyIssuedStartEvents\",\"type\":{\"type\":\"array\",\"items\":\"ResourceEventMsg\"}},{\"name\":\"accumulatingAmount\",\"type\":\"double\"},{\"name\":\"oldAccumulatingAmount\",\"type\":\"double\"},{\"name\":\"previousValue\",\"type\":\"double\"},{\"name\":\"currentValue\",\"type\":\"double\"}]},{\"type\":\"record\",\"name\":\"WorkingResourcesChargingStateMsg\",\"fields\":[{\"name\":\"details\",\"type\":{\"type\":\"map\",\"values\":\"AnyValueMsg\"}},{\"name\":\"stateOfResourceInstance\",\"type\":{\"type\":\"map\",\"values\":\"WorkingResourceInstanceChargingStateMsg\"}}]},{\"type\":\"record\",\"name\":\"WorkingAgreementHistoryMsg\",\"fields\":[{\"name\":\"agreements\",\"type\":{\"type\":\"array\",\"items\":\"UserAgreementMsg\"}}]},{\"type\":\"record\",\"name\":\"ChargeslotMsg\",\"fields\":[{\"name\":\"startMillis\",\"type\":\"long\"},{\"name\":\"stopMillis\",\"type\":\"long\"},{\"name\":\"unitPrice\",\"type\":\"double\"},{\"name\":\"explanation\",\"type\":\"string\",\"default\":\"\"},{\"name\":\"creditsToSubtract\",\"type\":\"double\"}]},{\"type\":\"record\",\"name\":\"WalletEntryMsg\",\"fields\":[{\"name\":\"userID\",\"type\":\"string\"},{\"name\":\"sumOfCreditsToSubtract\",\"type\":\"double\"},{\"name\":\"oldTotalCredits\",\"type\":\"double\"},{\"name\":\"newTotalCredits\",\"type\":\"double\"},{\"name\":\"whenComputedMillis\",\"type\":\"long\"},{\"name\":\"referenceStartMillis\",\"type\":\"long\"},{\"name\":\"referenceStopMillis\",\"type\":\"long\"},{\"name\":\"billingYear\",\"type\":\"int\"},{\"name\":\"billingMonth\",\"type\":\"int\"},{\"name\":\"billingDay\",\"type\":\"int\"},{\"name\":\"chargeslots\",\"type\":{\"type\":\"array\",\"items\":\"ChargeslotMsg\"}},{\"name\":\"resourceEvents\",\"type\":{\"type\":\"array\",\"items\":\"ResourceEventMsg\"}},{\"name\":\"resourceType\",\"type\":\"ResourceTypeMsg\"},{\"name\":\"isSynthetic\",\"type\":\"boolean\",\"default\":false}]},{\"type\":\"record\",\"name\":\"WorkingUserStateMsg\",\"fields\":[{\"name\":\"userID\",\"type\":\"string\"},{\"name\":\"parentUserStateIDInStore\",\"type\":[\"string\",\"null\"]},{\"name\":\"resourceTypesMap\",\"type\":{\"type\":\"map\",\"values\":\"ResourceTypeMsg\"}},{\"name\":\"workingStateOfResources\",\"type\":{\"type\":\"map\",\"values\":\"WorkingResourcesChargingStateMsg\"}},{\"name\":\"totalCredits\",\"type\":\"double\"},{\"name\":\"workingAgreementHistory\",\"type\":\"WorkingAgreementHistoryMsg\"},{\"name\":\"latestUpdateMillis\",\"type\":\"long\"},{\"name\":\"latestResourceEventOccurredMillis\",\"type\":\"long\"},{\"name\":\"billingPeriodOutOfSyncResourceEventsCounter\",\"type\":\"long\"},{\"name\":\"walletEntries\",\"type\":{\"type\":\"array\",\"items\":\"WalletEntryMsg\"}}]}],\"messages\":{}}");
@SuppressWarnings("all")
public interface Callback extends AquariumUserState {
package gr.grnet.aquarium.message.avro.gen;
@SuppressWarnings("all")
public class IMEventMsg extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
- public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"IMEventMsg\",\"namespace\":\"gr.grnet.aquarium.message.avro.gen\",\"fields\":[{\"name\":\"id\",\"type\":\"string\",\"aliases\":[\"originalID\",\"ID\"]},{\"name\":\"idInStore\",\"type\":\"string\"},{\"name\":\"occurredMillis\",\"type\":\"long\"},{\"name\":\"receivedMillis\",\"type\":\"long\",\"default\":0},{\"name\":\"userID\",\"type\":\"string\"},{\"name\":\"clientID\",\"type\":\"string\"},{\"name\":\"eventVersion\",\"type\":\"string\",\"default\":\"1.0\"},{\"name\":\"isActive\",\"type\":\"boolean\"},{\"name\":\"role\",\"type\":\"string\"},{\"name\":\"details\",\"type\":{\"type\":\"map\",\"values\":{\"type\":\"record\",\"name\":\"AnyValueMsg\",\"fields\":[{\"name\":\"anyValue\",\"type\":[\"null\",\"int\",\"long\",\"boolean\",\"double\",\"bytes\",\"string\"]}]}}}]}");
- @Deprecated public java.lang.CharSequence id;
- @Deprecated public java.lang.CharSequence idInStore;
+ public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"IMEventMsg\",\"namespace\":\"gr.grnet.aquarium.message.avro.gen\",\"fields\":[{\"name\":\"originalID\",\"type\":\"string\",\"aliases\":[\"id\"]},{\"name\":\"inStoreID\",\"type\":[\"string\",\"null\"],\"aliases\":[\"_id\",\"idInStore\"]},{\"name\":\"occurredMillis\",\"type\":\"long\"},{\"name\":\"receivedMillis\",\"type\":\"long\",\"default\":0},{\"name\":\"userID\",\"type\":\"string\"},{\"name\":\"clientID\",\"type\":\"string\"},{\"name\":\"eventVersion\",\"type\":\"string\",\"default\":\"1.0\"},{\"name\":\"isActive\",\"type\":\"boolean\"},{\"name\":\"role\",\"type\":\"string\"},{\"name\":\"details\",\"type\":{\"type\":\"map\",\"values\":{\"type\":\"record\",\"name\":\"AnyValueMsg\",\"fields\":[{\"name\":\"anyValue\",\"type\":[\"null\",\"int\",\"long\",\"boolean\",\"double\",\"bytes\",\"string\"]}]}}}]}");
+ @Deprecated public java.lang.CharSequence originalID;
+ @Deprecated public java.lang.CharSequence inStoreID;
@Deprecated public long occurredMillis;
@Deprecated public long receivedMillis;
@Deprecated public java.lang.CharSequence userID;
// Used by DatumWriter. Applications should not call.
public java.lang.Object get(int field$) {
switch (field$) {
- case 0: return id;
- case 1: return idInStore;
+ case 0: return originalID;
+ case 1: return inStoreID;
case 2: return occurredMillis;
case 3: return receivedMillis;
case 4: return userID;
@SuppressWarnings(value="unchecked")
public void put(int field$, java.lang.Object value$) {
switch (field$) {
- case 0: id = (java.lang.CharSequence)value$; break;
- case 1: idInStore = (java.lang.CharSequence)value$; break;
+ case 0: originalID = (java.lang.CharSequence)value$; break;
+ case 1: inStoreID = (java.lang.CharSequence)value$; break;
case 2: occurredMillis = (java.lang.Long)value$; break;
case 3: receivedMillis = (java.lang.Long)value$; break;
case 4: userID = (java.lang.CharSequence)value$; break;
}
/**
- * Gets the value of the 'id' field.
+ * Gets the value of the 'originalID' field.
*/
- public java.lang.CharSequence getId() {
- return id;
+ public java.lang.CharSequence getOriginalID() {
+ return originalID;
}
/**
- * Sets the value of the 'id' field.
+ * Sets the value of the 'originalID' field.
* @param value the value to set.
*/
- public void setId(java.lang.CharSequence value) {
- this.id = value;
+ public void setOriginalID(java.lang.CharSequence value) {
+ this.originalID = value;
}
/**
- * Gets the value of the 'idInStore' field.
+ * Gets the value of the 'inStoreID' field.
*/
- public java.lang.CharSequence getIdInStore() {
- return idInStore;
+ public java.lang.CharSequence getInStoreID() {
+ return inStoreID;
}
/**
- * Sets the value of the 'idInStore' field.
+ * Sets the value of the 'inStoreID' field.
* @param value the value to set.
*/
- public void setIdInStore(java.lang.CharSequence value) {
- this.idInStore = value;
+ public void setInStoreID(java.lang.CharSequence value) {
+ this.inStoreID = value;
}
/**
public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<IMEventMsg>
implements org.apache.avro.data.RecordBuilder<IMEventMsg> {
- private java.lang.CharSequence id;
- private java.lang.CharSequence idInStore;
+ private java.lang.CharSequence originalID;
+ private java.lang.CharSequence inStoreID;
private long occurredMillis;
private long receivedMillis;
private java.lang.CharSequence userID;
/** Creates a Builder by copying an existing IMEventMsg instance */
private Builder(gr.grnet.aquarium.message.avro.gen.IMEventMsg other) {
super(gr.grnet.aquarium.message.avro.gen.IMEventMsg.SCHEMA$);
- if (isValidValue(fields()[0], other.id)) {
- this.id = (java.lang.CharSequence) data().deepCopy(fields()[0].schema(), other.id);
+ if (isValidValue(fields()[0], other.originalID)) {
+ this.originalID = (java.lang.CharSequence) data().deepCopy(fields()[0].schema(), other.originalID);
fieldSetFlags()[0] = true;
}
- if (isValidValue(fields()[1], other.idInStore)) {
- this.idInStore = (java.lang.CharSequence) data().deepCopy(fields()[1].schema(), other.idInStore);
+ if (isValidValue(fields()[1], other.inStoreID)) {
+ this.inStoreID = (java.lang.CharSequence) data().deepCopy(fields()[1].schema(), other.inStoreID);
fieldSetFlags()[1] = true;
}
if (isValidValue(fields()[2], other.occurredMillis)) {
}
}
- /** Gets the value of the 'id' field */
- public java.lang.CharSequence getId() {
- return id;
+ /** Gets the value of the 'originalID' field */
+ public java.lang.CharSequence getOriginalID() {
+ return originalID;
}
- /** Sets the value of the 'id' field */
- public gr.grnet.aquarium.message.avro.gen.IMEventMsg.Builder setId(java.lang.CharSequence value) {
+ /** Sets the value of the 'originalID' field */
+ public gr.grnet.aquarium.message.avro.gen.IMEventMsg.Builder setOriginalID(java.lang.CharSequence value) {
validate(fields()[0], value);
- this.id = value;
+ this.originalID = value;
fieldSetFlags()[0] = true;
return this;
}
- /** Checks whether the 'id' field has been set */
- public boolean hasId() {
+ /** Checks whether the 'originalID' field has been set */
+ public boolean hasOriginalID() {
return fieldSetFlags()[0];
}
- /** Clears the value of the 'id' field */
- public gr.grnet.aquarium.message.avro.gen.IMEventMsg.Builder clearId() {
- id = null;
+ /** Clears the value of the 'originalID' field */
+ public gr.grnet.aquarium.message.avro.gen.IMEventMsg.Builder clearOriginalID() {
+ originalID = null;
fieldSetFlags()[0] = false;
return this;
}
- /** Gets the value of the 'idInStore' field */
- public java.lang.CharSequence getIdInStore() {
- return idInStore;
+ /** Gets the value of the 'inStoreID' field */
+ public java.lang.CharSequence getInStoreID() {
+ return inStoreID;
}
- /** Sets the value of the 'idInStore' field */
- public gr.grnet.aquarium.message.avro.gen.IMEventMsg.Builder setIdInStore(java.lang.CharSequence value) {
+ /** Sets the value of the 'inStoreID' field */
+ public gr.grnet.aquarium.message.avro.gen.IMEventMsg.Builder setInStoreID(java.lang.CharSequence value) {
validate(fields()[1], value);
- this.idInStore = value;
+ this.inStoreID = value;
fieldSetFlags()[1] = true;
return this;
}
- /** Checks whether the 'idInStore' field has been set */
- public boolean hasIdInStore() {
+ /** Checks whether the 'inStoreID' field has been set */
+ public boolean hasInStoreID() {
return fieldSetFlags()[1];
}
- /** Clears the value of the 'idInStore' field */
- public gr.grnet.aquarium.message.avro.gen.IMEventMsg.Builder clearIdInStore() {
- idInStore = null;
+ /** Clears the value of the 'inStoreID' field */
+ public gr.grnet.aquarium.message.avro.gen.IMEventMsg.Builder clearInStoreID() {
+ inStoreID = null;
fieldSetFlags()[1] = false;
return this;
}
public IMEventMsg build() {
try {
IMEventMsg record = new IMEventMsg();
- record.id = fieldSetFlags()[0] ? this.id : (java.lang.CharSequence) defaultValue(fields()[0]);
- record.idInStore = fieldSetFlags()[1] ? this.idInStore : (java.lang.CharSequence) defaultValue(fields()[1]);
+ record.originalID = fieldSetFlags()[0] ? this.originalID : (java.lang.CharSequence) defaultValue(fields()[0]);
+ record.inStoreID = fieldSetFlags()[1] ? this.inStoreID : (java.lang.CharSequence) defaultValue(fields()[1]);
record.occurredMillis = fieldSetFlags()[2] ? this.occurredMillis : (java.lang.Long) defaultValue(fields()[2]);
record.receivedMillis = fieldSetFlags()[3] ? this.receivedMillis : (java.lang.Long) defaultValue(fields()[3]);
record.userID = fieldSetFlags()[4] ? this.userID : (java.lang.CharSequence) defaultValue(fields()[4]);
package gr.grnet.aquarium.message.avro.gen;
@SuppressWarnings("all")
public class PolicyMsg extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
- public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"PolicyMsg\",\"namespace\":\"gr.grnet.aquarium.message.avro.gen\",\"fields\":[{\"name\":\"ID\",\"type\":\"string\",\"aliases\":[\"id, _id, idInStore, inStoreID\"]},{\"name\":\"parentID\",\"type\":[\"string\",\"null\"]},{\"name\":\"validFromMillis\",\"type\":\"long\"},{\"name\":\"validToMillis\",\"type\":\"long\"},{\"name\":\"resourceTypes\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"ResourceTypeMsg\",\"fields\":[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"unit\",\"type\":\"string\"},{\"name\":\"chargingBehaviorClass\",\"type\":\"string\"}]}}},{\"name\":\"chargingBehaviors\",\"type\":{\"type\":\"array\",\"items\":\"string\"}},{\"name\":\"roleMapping\",\"type\":{\"type\":\"map\",\"values\":{\"type\":\"record\",\"name\":\"FullPriceTableMsg\",\"fields\":[{\"name\":\"perResource\",\"type\":{\"type\":\"map\",\"values\":{\"type\":\"map\",\"values\":{\"type\":\"record\",\"name\":\"SelectorValueMsg\",\"fields\":[{\"name\":\"selectorValue\",\"type\":[{\"type\":\"record\",\"name\":\"EffectivePriceTableMsg\",\"fields\":[{\"name\":\"priceOverrides\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"EffectiveUnitPriceMsg\",\"fields\":[{\"name\":\"unitPrice\",\"type\":\"double\"},{\"name\":\"when\",\"type\":[{\"type\":\"record\",\"name\":\"CronSpecTupleMsg\",\"fields\":[{\"name\":\"a\",\"type\":\"string\"},{\"name\":\"b\",\"type\":\"string\"}]},\"null\"]}]}}}]},{\"type\":\"map\",\"values\":\"SelectorValueMsg\"}]}]}}}}]}}}]}");
- @Deprecated public java.lang.CharSequence ID;
+ public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"PolicyMsg\",\"namespace\":\"gr.grnet.aquarium.message.avro.gen\",\"fields\":[{\"name\":\"originalID\",\"type\":\"string\",\"aliases\":[\"id\"]},{\"name\":\"inStoreID\",\"type\":[\"string\",\"null\"],\"aliases\":[\"_id\",\"idInStore\"]},{\"name\":\"parentID\",\"type\":[\"string\",\"null\"]},{\"name\":\"validFromMillis\",\"type\":\"long\"},{\"name\":\"validToMillis\",\"type\":\"long\"},{\"name\":\"resourceTypes\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"ResourceTypeMsg\",\"fields\":[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"unit\",\"type\":\"string\"},{\"name\":\"chargingBehaviorClass\",\"type\":\"string\"}]}}},{\"name\":\"chargingBehaviors\",\"type\":{\"type\":\"array\",\"items\":\"string\"}},{\"name\":\"roleMapping\",\"type\":{\"type\":\"map\",\"values\":{\"type\":\"record\",\"name\":\"FullPriceTableMsg\",\"fields\":[{\"name\":\"perResource\",\"type\":{\"type\":\"map\",\"values\":{\"type\":\"map\",\"values\":{\"type\":\"record\",\"name\":\"SelectorValueMsg\",\"fields\":[{\"name\":\"selectorValue\",\"type\":[{\"type\":\"record\",\"name\":\"EffectivePriceTableMsg\",\"fields\":[{\"name\":\"priceOverrides\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"EffectiveUnitPriceMsg\",\"fields\":[{\"name\":\"unitPrice\",\"type\":\"double\"},{\"name\":\"when\",\"type\":[{\"type\":\"record\",\"name\":\"CronSpecTupleMsg\",\"fields\":[{\"name\":\"a\",\"type\":\"string\"},{\"name\":\"b\",\"type\":\"string\"}]},\"null\"]}]}}}]},{\"type\":\"map\",\"values\":\"SelectorValueMsg\"}]}]}}}}]}}}]}");
+ @Deprecated public java.lang.CharSequence originalID;
+ @Deprecated public java.lang.CharSequence inStoreID;
@Deprecated public java.lang.CharSequence parentID;
@Deprecated public long validFromMillis;
@Deprecated public long validToMillis;
// Used by DatumWriter. Applications should not call.
public java.lang.Object get(int field$) {
switch (field$) {
- case 0: return ID;
- case 1: return parentID;
- case 2: return validFromMillis;
- case 3: return validToMillis;
- case 4: return resourceTypes;
- case 5: return chargingBehaviors;
- case 6: return roleMapping;
+ case 0: return originalID;
+ case 1: return inStoreID;
+ case 2: return parentID;
+ case 3: return validFromMillis;
+ case 4: return validToMillis;
+ case 5: return resourceTypes;
+ case 6: return chargingBehaviors;
+ case 7: return roleMapping;
default: throw new org.apache.avro.AvroRuntimeException("Bad index");
}
}
@SuppressWarnings(value="unchecked")
public void put(int field$, java.lang.Object value$) {
switch (field$) {
- case 0: ID = (java.lang.CharSequence)value$; break;
- case 1: parentID = (java.lang.CharSequence)value$; break;
- case 2: validFromMillis = (java.lang.Long)value$; break;
- case 3: validToMillis = (java.lang.Long)value$; break;
- case 4: resourceTypes = (java.util.List<gr.grnet.aquarium.message.avro.gen.ResourceTypeMsg>)value$; break;
- case 5: chargingBehaviors = (java.util.List<java.lang.CharSequence>)value$; break;
- case 6: roleMapping = (java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.FullPriceTableMsg>)value$; break;
+ case 0: originalID = (java.lang.CharSequence)value$; break;
+ case 1: inStoreID = (java.lang.CharSequence)value$; break;
+ case 2: parentID = (java.lang.CharSequence)value$; break;
+ case 3: validFromMillis = (java.lang.Long)value$; break;
+ case 4: validToMillis = (java.lang.Long)value$; break;
+ case 5: resourceTypes = (java.util.List<gr.grnet.aquarium.message.avro.gen.ResourceTypeMsg>)value$; break;
+ case 6: chargingBehaviors = (java.util.List<java.lang.CharSequence>)value$; break;
+ case 7: roleMapping = (java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.FullPriceTableMsg>)value$; break;
default: throw new org.apache.avro.AvroRuntimeException("Bad index");
}
}
/**
- * Gets the value of the 'ID' field.
+ * Gets the value of the 'originalID' field.
*/
- public java.lang.CharSequence getID() {
- return ID;
+ public java.lang.CharSequence getOriginalID() {
+ return originalID;
}
/**
- * Sets the value of the 'ID' field.
+ * Sets the value of the 'originalID' field.
* @param value the value to set.
*/
- public void setID(java.lang.CharSequence value) {
- this.ID = value;
+ public void setOriginalID(java.lang.CharSequence value) {
+ this.originalID = value;
+ }
+
+ /**
+ * Gets the value of the 'inStoreID' field.
+ */
+ public java.lang.CharSequence getInStoreID() {
+ return inStoreID;
+ }
+
+ /**
+ * Sets the value of the 'inStoreID' field.
+ * @param value the value to set.
+ */
+ public void setInStoreID(java.lang.CharSequence value) {
+ this.inStoreID = value;
}
/**
public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<PolicyMsg>
implements org.apache.avro.data.RecordBuilder<PolicyMsg> {
- private java.lang.CharSequence ID;
+ private java.lang.CharSequence originalID;
+ private java.lang.CharSequence inStoreID;
private java.lang.CharSequence parentID;
private long validFromMillis;
private long validToMillis;
/** Creates a Builder by copying an existing PolicyMsg instance */
private Builder(gr.grnet.aquarium.message.avro.gen.PolicyMsg other) {
super(gr.grnet.aquarium.message.avro.gen.PolicyMsg.SCHEMA$);
- if (isValidValue(fields()[0], other.ID)) {
- this.ID = (java.lang.CharSequence) data().deepCopy(fields()[0].schema(), other.ID);
+ if (isValidValue(fields()[0], other.originalID)) {
+ this.originalID = (java.lang.CharSequence) data().deepCopy(fields()[0].schema(), other.originalID);
fieldSetFlags()[0] = true;
}
- if (isValidValue(fields()[1], other.parentID)) {
- this.parentID = (java.lang.CharSequence) data().deepCopy(fields()[1].schema(), other.parentID);
+ if (isValidValue(fields()[1], other.inStoreID)) {
+ this.inStoreID = (java.lang.CharSequence) data().deepCopy(fields()[1].schema(), other.inStoreID);
fieldSetFlags()[1] = true;
}
- if (isValidValue(fields()[2], other.validFromMillis)) {
- this.validFromMillis = (java.lang.Long) data().deepCopy(fields()[2].schema(), other.validFromMillis);
+ if (isValidValue(fields()[2], other.parentID)) {
+ this.parentID = (java.lang.CharSequence) data().deepCopy(fields()[2].schema(), other.parentID);
fieldSetFlags()[2] = true;
}
- if (isValidValue(fields()[3], other.validToMillis)) {
- this.validToMillis = (java.lang.Long) data().deepCopy(fields()[3].schema(), other.validToMillis);
+ if (isValidValue(fields()[3], other.validFromMillis)) {
+ this.validFromMillis = (java.lang.Long) data().deepCopy(fields()[3].schema(), other.validFromMillis);
fieldSetFlags()[3] = true;
}
- if (isValidValue(fields()[4], other.resourceTypes)) {
- this.resourceTypes = (java.util.List<gr.grnet.aquarium.message.avro.gen.ResourceTypeMsg>) data().deepCopy(fields()[4].schema(), other.resourceTypes);
+ if (isValidValue(fields()[4], other.validToMillis)) {
+ this.validToMillis = (java.lang.Long) data().deepCopy(fields()[4].schema(), other.validToMillis);
fieldSetFlags()[4] = true;
}
- if (isValidValue(fields()[5], other.chargingBehaviors)) {
- this.chargingBehaviors = (java.util.List<java.lang.CharSequence>) data().deepCopy(fields()[5].schema(), other.chargingBehaviors);
+ if (isValidValue(fields()[5], other.resourceTypes)) {
+ this.resourceTypes = (java.util.List<gr.grnet.aquarium.message.avro.gen.ResourceTypeMsg>) data().deepCopy(fields()[5].schema(), other.resourceTypes);
fieldSetFlags()[5] = true;
}
- if (isValidValue(fields()[6], other.roleMapping)) {
- this.roleMapping = (java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.FullPriceTableMsg>) data().deepCopy(fields()[6].schema(), other.roleMapping);
+ if (isValidValue(fields()[6], other.chargingBehaviors)) {
+ this.chargingBehaviors = (java.util.List<java.lang.CharSequence>) data().deepCopy(fields()[6].schema(), other.chargingBehaviors);
fieldSetFlags()[6] = true;
}
+ if (isValidValue(fields()[7], other.roleMapping)) {
+ this.roleMapping = (java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.FullPriceTableMsg>) data().deepCopy(fields()[7].schema(), other.roleMapping);
+ fieldSetFlags()[7] = true;
+ }
}
- /** Gets the value of the 'ID' field */
- public java.lang.CharSequence getID() {
- return ID;
+ /** Gets the value of the 'originalID' field */
+ public java.lang.CharSequence getOriginalID() {
+ return originalID;
}
- /** Sets the value of the 'ID' field */
- public gr.grnet.aquarium.message.avro.gen.PolicyMsg.Builder setID(java.lang.CharSequence value) {
+ /** Sets the value of the 'originalID' field */
+ public gr.grnet.aquarium.message.avro.gen.PolicyMsg.Builder setOriginalID(java.lang.CharSequence value) {
validate(fields()[0], value);
- this.ID = value;
+ this.originalID = value;
fieldSetFlags()[0] = true;
return this;
}
- /** Checks whether the 'ID' field has been set */
- public boolean hasID() {
+ /** Checks whether the 'originalID' field has been set */
+ public boolean hasOriginalID() {
return fieldSetFlags()[0];
}
- /** Clears the value of the 'ID' field */
- public gr.grnet.aquarium.message.avro.gen.PolicyMsg.Builder clearID() {
- ID = null;
+ /** Clears the value of the 'originalID' field */
+ public gr.grnet.aquarium.message.avro.gen.PolicyMsg.Builder clearOriginalID() {
+ originalID = null;
fieldSetFlags()[0] = false;
return this;
}
+ /** Gets the value of the 'inStoreID' field */
+ public java.lang.CharSequence getInStoreID() {
+ return inStoreID;
+ }
+
+ /** Sets the value of the 'inStoreID' field */
+ public gr.grnet.aquarium.message.avro.gen.PolicyMsg.Builder setInStoreID(java.lang.CharSequence value) {
+ validate(fields()[1], value);
+ this.inStoreID = value;
+ fieldSetFlags()[1] = true;
+ return this;
+ }
+
+ /** Checks whether the 'inStoreID' field has been set */
+ public boolean hasInStoreID() {
+ return fieldSetFlags()[1];
+ }
+
+ /** Clears the value of the 'inStoreID' field */
+ public gr.grnet.aquarium.message.avro.gen.PolicyMsg.Builder clearInStoreID() {
+ inStoreID = null;
+ fieldSetFlags()[1] = false;
+ return this;
+ }
+
/** Gets the value of the 'parentID' field */
public java.lang.CharSequence getParentID() {
return parentID;
/** Sets the value of the 'parentID' field */
public gr.grnet.aquarium.message.avro.gen.PolicyMsg.Builder setParentID(java.lang.CharSequence value) {
- validate(fields()[1], value);
+ validate(fields()[2], value);
this.parentID = value;
- fieldSetFlags()[1] = true;
+ fieldSetFlags()[2] = true;
return this;
}
/** Checks whether the 'parentID' field has been set */
public boolean hasParentID() {
- return fieldSetFlags()[1];
+ return fieldSetFlags()[2];
}
/** Clears the value of the 'parentID' field */
public gr.grnet.aquarium.message.avro.gen.PolicyMsg.Builder clearParentID() {
parentID = null;
- fieldSetFlags()[1] = false;
+ fieldSetFlags()[2] = false;
return this;
}
/** Sets the value of the 'validFromMillis' field */
public gr.grnet.aquarium.message.avro.gen.PolicyMsg.Builder setValidFromMillis(long value) {
- validate(fields()[2], value);
+ validate(fields()[3], value);
this.validFromMillis = value;
- fieldSetFlags()[2] = true;
+ fieldSetFlags()[3] = true;
return this;
}
/** Checks whether the 'validFromMillis' field has been set */
public boolean hasValidFromMillis() {
- return fieldSetFlags()[2];
+ return fieldSetFlags()[3];
}
/** Clears the value of the 'validFromMillis' field */
public gr.grnet.aquarium.message.avro.gen.PolicyMsg.Builder clearValidFromMillis() {
- fieldSetFlags()[2] = false;
+ fieldSetFlags()[3] = false;
return this;
}
/** Sets the value of the 'validToMillis' field */
public gr.grnet.aquarium.message.avro.gen.PolicyMsg.Builder setValidToMillis(long value) {
- validate(fields()[3], value);
+ validate(fields()[4], value);
this.validToMillis = value;
- fieldSetFlags()[3] = true;
+ fieldSetFlags()[4] = true;
return this;
}
/** Checks whether the 'validToMillis' field has been set */
public boolean hasValidToMillis() {
- return fieldSetFlags()[3];
+ return fieldSetFlags()[4];
}
/** Clears the value of the 'validToMillis' field */
public gr.grnet.aquarium.message.avro.gen.PolicyMsg.Builder clearValidToMillis() {
- fieldSetFlags()[3] = false;
+ fieldSetFlags()[4] = false;
return this;
}
/** Sets the value of the 'resourceTypes' field */
public gr.grnet.aquarium.message.avro.gen.PolicyMsg.Builder setResourceTypes(java.util.List<gr.grnet.aquarium.message.avro.gen.ResourceTypeMsg> value) {
- validate(fields()[4], value);
+ validate(fields()[5], value);
this.resourceTypes = value;
- fieldSetFlags()[4] = true;
+ fieldSetFlags()[5] = true;
return this;
}
/** Checks whether the 'resourceTypes' field has been set */
public boolean hasResourceTypes() {
- return fieldSetFlags()[4];
+ return fieldSetFlags()[5];
}
/** Clears the value of the 'resourceTypes' field */
public gr.grnet.aquarium.message.avro.gen.PolicyMsg.Builder clearResourceTypes() {
resourceTypes = null;
- fieldSetFlags()[4] = false;
+ fieldSetFlags()[5] = false;
return this;
}
/** Sets the value of the 'chargingBehaviors' field */
public gr.grnet.aquarium.message.avro.gen.PolicyMsg.Builder setChargingBehaviors(java.util.List<java.lang.CharSequence> value) {
- validate(fields()[5], value);
+ validate(fields()[6], value);
this.chargingBehaviors = value;
- fieldSetFlags()[5] = true;
+ fieldSetFlags()[6] = true;
return this;
}
/** Checks whether the 'chargingBehaviors' field has been set */
public boolean hasChargingBehaviors() {
- return fieldSetFlags()[5];
+ return fieldSetFlags()[6];
}
/** Clears the value of the 'chargingBehaviors' field */
public gr.grnet.aquarium.message.avro.gen.PolicyMsg.Builder clearChargingBehaviors() {
chargingBehaviors = null;
- fieldSetFlags()[5] = false;
+ fieldSetFlags()[6] = false;
return this;
}
/** Sets the value of the 'roleMapping' field */
public gr.grnet.aquarium.message.avro.gen.PolicyMsg.Builder setRoleMapping(java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.FullPriceTableMsg> value) {
- validate(fields()[6], value);
+ validate(fields()[7], value);
this.roleMapping = value;
- fieldSetFlags()[6] = true;
+ fieldSetFlags()[7] = true;
return this;
}
/** Checks whether the 'roleMapping' field has been set */
public boolean hasRoleMapping() {
- return fieldSetFlags()[6];
+ return fieldSetFlags()[7];
}
/** Clears the value of the 'roleMapping' field */
public gr.grnet.aquarium.message.avro.gen.PolicyMsg.Builder clearRoleMapping() {
roleMapping = null;
- fieldSetFlags()[6] = false;
+ fieldSetFlags()[7] = false;
return this;
}
public PolicyMsg build() {
try {
PolicyMsg record = new PolicyMsg();
- record.ID = fieldSetFlags()[0] ? this.ID : (java.lang.CharSequence) defaultValue(fields()[0]);
- record.parentID = fieldSetFlags()[1] ? this.parentID : (java.lang.CharSequence) defaultValue(fields()[1]);
- record.validFromMillis = fieldSetFlags()[2] ? this.validFromMillis : (java.lang.Long) defaultValue(fields()[2]);
- record.validToMillis = fieldSetFlags()[3] ? this.validToMillis : (java.lang.Long) defaultValue(fields()[3]);
- record.resourceTypes = fieldSetFlags()[4] ? this.resourceTypes : (java.util.List<gr.grnet.aquarium.message.avro.gen.ResourceTypeMsg>) defaultValue(fields()[4]);
- record.chargingBehaviors = fieldSetFlags()[5] ? this.chargingBehaviors : (java.util.List<java.lang.CharSequence>) defaultValue(fields()[5]);
- record.roleMapping = fieldSetFlags()[6] ? this.roleMapping : (java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.FullPriceTableMsg>) defaultValue(fields()[6]);
+ record.originalID = fieldSetFlags()[0] ? this.originalID : (java.lang.CharSequence) defaultValue(fields()[0]);
+ record.inStoreID = fieldSetFlags()[1] ? this.inStoreID : (java.lang.CharSequence) defaultValue(fields()[1]);
+ record.parentID = fieldSetFlags()[2] ? this.parentID : (java.lang.CharSequence) defaultValue(fields()[2]);
+ record.validFromMillis = fieldSetFlags()[3] ? this.validFromMillis : (java.lang.Long) defaultValue(fields()[3]);
+ record.validToMillis = fieldSetFlags()[4] ? this.validToMillis : (java.lang.Long) defaultValue(fields()[4]);
+ record.resourceTypes = fieldSetFlags()[5] ? this.resourceTypes : (java.util.List<gr.grnet.aquarium.message.avro.gen.ResourceTypeMsg>) defaultValue(fields()[5]);
+ record.chargingBehaviors = fieldSetFlags()[6] ? this.chargingBehaviors : (java.util.List<java.lang.CharSequence>) defaultValue(fields()[6]);
+ record.roleMapping = fieldSetFlags()[7] ? this.roleMapping : (java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.FullPriceTableMsg>) defaultValue(fields()[7]);
return record;
} catch (Exception e) {
throw new org.apache.avro.AvroRuntimeException(e);
package gr.grnet.aquarium.message.avro.gen;
@SuppressWarnings("all")
public class ResourceEventMsg extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
- public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"ResourceEventMsg\",\"namespace\":\"gr.grnet.aquarium.message.avro.gen\",\"fields\":[{\"name\":\"id\",\"type\":\"string\",\"aliases\":[\"originalID\",\"ID\"]},{\"name\":\"idInStore\",\"type\":\"string\"},{\"name\":\"occurredMillis\",\"type\":\"long\"},{\"name\":\"receivedMillis\",\"type\":\"long\",\"default\":0},{\"name\":\"userID\",\"type\":\"string\"},{\"name\":\"clientID\",\"type\":\"string\"},{\"name\":\"eventVersion\",\"type\":\"string\",\"default\":\"1.0\"},{\"name\":\"resource\",\"type\":\"string\",\"aliases\":[\"resourceType\"]},{\"name\":\"instanceID\",\"type\":\"string\"},{\"name\":\"value\",\"type\":\"string\"},{\"name\":\"details\",\"type\":{\"type\":\"map\",\"values\":{\"type\":\"record\",\"name\":\"AnyValueMsg\",\"fields\":[{\"name\":\"anyValue\",\"type\":[\"null\",\"int\",\"long\",\"boolean\",\"double\",\"bytes\",\"string\"]}]}}}]}");
- @Deprecated public java.lang.CharSequence id;
- @Deprecated public java.lang.CharSequence idInStore;
+ public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"ResourceEventMsg\",\"namespace\":\"gr.grnet.aquarium.message.avro.gen\",\"fields\":[{\"name\":\"originalID\",\"type\":\"string\",\"aliases\":[\"id\"]},{\"name\":\"inStoreID\",\"type\":[\"string\",\"null\"],\"aliases\":[\"_id\",\"idInStore\"]},{\"name\":\"occurredMillis\",\"type\":\"long\"},{\"name\":\"receivedMillis\",\"type\":\"long\",\"default\":0},{\"name\":\"userID\",\"type\":\"string\"},{\"name\":\"clientID\",\"type\":\"string\"},{\"name\":\"eventVersion\",\"type\":\"string\",\"default\":\"1.0\"},{\"name\":\"resource\",\"type\":\"string\",\"aliases\":[\"resourceType\"]},{\"name\":\"instanceID\",\"type\":\"string\"},{\"name\":\"value\",\"type\":\"string\"},{\"name\":\"details\",\"type\":{\"type\":\"map\",\"values\":{\"type\":\"record\",\"name\":\"AnyValueMsg\",\"fields\":[{\"name\":\"anyValue\",\"type\":[\"null\",\"int\",\"long\",\"boolean\",\"double\",\"bytes\",\"string\"]}]}}}]}");
+ @Deprecated public java.lang.CharSequence originalID;
+ @Deprecated public java.lang.CharSequence inStoreID;
@Deprecated public long occurredMillis;
@Deprecated public long receivedMillis;
@Deprecated public java.lang.CharSequence userID;
// Used by DatumWriter. Applications should not call.
public java.lang.Object get(int field$) {
switch (field$) {
- case 0: return id;
- case 1: return idInStore;
+ case 0: return originalID;
+ case 1: return inStoreID;
case 2: return occurredMillis;
case 3: return receivedMillis;
case 4: return userID;
@SuppressWarnings(value="unchecked")
public void put(int field$, java.lang.Object value$) {
switch (field$) {
- case 0: id = (java.lang.CharSequence)value$; break;
- case 1: idInStore = (java.lang.CharSequence)value$; break;
+ case 0: originalID = (java.lang.CharSequence)value$; break;
+ case 1: inStoreID = (java.lang.CharSequence)value$; break;
case 2: occurredMillis = (java.lang.Long)value$; break;
case 3: receivedMillis = (java.lang.Long)value$; break;
case 4: userID = (java.lang.CharSequence)value$; break;
}
/**
- * Gets the value of the 'id' field.
+ * Gets the value of the 'originalID' field.
*/
- public java.lang.CharSequence getId() {
- return id;
+ public java.lang.CharSequence getOriginalID() {
+ return originalID;
}
/**
- * Sets the value of the 'id' field.
+ * Sets the value of the 'originalID' field.
* @param value the value to set.
*/
- public void setId(java.lang.CharSequence value) {
- this.id = value;
+ public void setOriginalID(java.lang.CharSequence value) {
+ this.originalID = value;
}
/**
- * Gets the value of the 'idInStore' field.
+ * Gets the value of the 'inStoreID' field.
*/
- public java.lang.CharSequence getIdInStore() {
- return idInStore;
+ public java.lang.CharSequence getInStoreID() {
+ return inStoreID;
}
/**
- * Sets the value of the 'idInStore' field.
+ * Sets the value of the 'inStoreID' field.
* @param value the value to set.
*/
- public void setIdInStore(java.lang.CharSequence value) {
- this.idInStore = value;
+ public void setInStoreID(java.lang.CharSequence value) {
+ this.inStoreID = value;
}
/**
public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<ResourceEventMsg>
implements org.apache.avro.data.RecordBuilder<ResourceEventMsg> {
- private java.lang.CharSequence id;
- private java.lang.CharSequence idInStore;
+ private java.lang.CharSequence originalID;
+ private java.lang.CharSequence inStoreID;
private long occurredMillis;
private long receivedMillis;
private java.lang.CharSequence userID;
/** Creates a Builder by copying an existing ResourceEventMsg instance */
private Builder(gr.grnet.aquarium.message.avro.gen.ResourceEventMsg other) {
super(gr.grnet.aquarium.message.avro.gen.ResourceEventMsg.SCHEMA$);
- if (isValidValue(fields()[0], other.id)) {
- this.id = (java.lang.CharSequence) data().deepCopy(fields()[0].schema(), other.id);
+ if (isValidValue(fields()[0], other.originalID)) {
+ this.originalID = (java.lang.CharSequence) data().deepCopy(fields()[0].schema(), other.originalID);
fieldSetFlags()[0] = true;
}
- if (isValidValue(fields()[1], other.idInStore)) {
- this.idInStore = (java.lang.CharSequence) data().deepCopy(fields()[1].schema(), other.idInStore);
+ if (isValidValue(fields()[1], other.inStoreID)) {
+ this.inStoreID = (java.lang.CharSequence) data().deepCopy(fields()[1].schema(), other.inStoreID);
fieldSetFlags()[1] = true;
}
if (isValidValue(fields()[2], other.occurredMillis)) {
}
}
- /** Gets the value of the 'id' field */
- public java.lang.CharSequence getId() {
- return id;
+ /** Gets the value of the 'originalID' field */
+ public java.lang.CharSequence getOriginalID() {
+ return originalID;
}
- /** Sets the value of the 'id' field */
- public gr.grnet.aquarium.message.avro.gen.ResourceEventMsg.Builder setId(java.lang.CharSequence value) {
+ /** Sets the value of the 'originalID' field */
+ public gr.grnet.aquarium.message.avro.gen.ResourceEventMsg.Builder setOriginalID(java.lang.CharSequence value) {
validate(fields()[0], value);
- this.id = value;
+ this.originalID = value;
fieldSetFlags()[0] = true;
return this;
}
- /** Checks whether the 'id' field has been set */
- public boolean hasId() {
+ /** Checks whether the 'originalID' field has been set */
+ public boolean hasOriginalID() {
return fieldSetFlags()[0];
}
- /** Clears the value of the 'id' field */
- public gr.grnet.aquarium.message.avro.gen.ResourceEventMsg.Builder clearId() {
- id = null;
+ /** Clears the value of the 'originalID' field */
+ public gr.grnet.aquarium.message.avro.gen.ResourceEventMsg.Builder clearOriginalID() {
+ originalID = null;
fieldSetFlags()[0] = false;
return this;
}
- /** Gets the value of the 'idInStore' field */
- public java.lang.CharSequence getIdInStore() {
- return idInStore;
+ /** Gets the value of the 'inStoreID' field */
+ public java.lang.CharSequence getInStoreID() {
+ return inStoreID;
}
- /** Sets the value of the 'idInStore' field */
- public gr.grnet.aquarium.message.avro.gen.ResourceEventMsg.Builder setIdInStore(java.lang.CharSequence value) {
+ /** Sets the value of the 'inStoreID' field */
+ public gr.grnet.aquarium.message.avro.gen.ResourceEventMsg.Builder setInStoreID(java.lang.CharSequence value) {
validate(fields()[1], value);
- this.idInStore = value;
+ this.inStoreID = value;
fieldSetFlags()[1] = true;
return this;
}
- /** Checks whether the 'idInStore' field has been set */
- public boolean hasIdInStore() {
+ /** Checks whether the 'inStoreID' field has been set */
+ public boolean hasInStoreID() {
return fieldSetFlags()[1];
}
- /** Clears the value of the 'idInStore' field */
- public gr.grnet.aquarium.message.avro.gen.ResourceEventMsg.Builder clearIdInStore() {
- idInStore = null;
+ /** Clears the value of the 'inStoreID' field */
+ public gr.grnet.aquarium.message.avro.gen.ResourceEventMsg.Builder clearInStoreID() {
+ inStoreID = null;
fieldSetFlags()[1] = false;
return this;
}
public ResourceEventMsg build() {
try {
ResourceEventMsg record = new ResourceEventMsg();
- record.id = fieldSetFlags()[0] ? this.id : (java.lang.CharSequence) defaultValue(fields()[0]);
- record.idInStore = fieldSetFlags()[1] ? this.idInStore : (java.lang.CharSequence) defaultValue(fields()[1]);
+ record.originalID = fieldSetFlags()[0] ? this.originalID : (java.lang.CharSequence) defaultValue(fields()[0]);
+ record.inStoreID = fieldSetFlags()[1] ? this.inStoreID : (java.lang.CharSequence) defaultValue(fields()[1]);
record.occurredMillis = fieldSetFlags()[2] ? this.occurredMillis : (java.lang.Long) defaultValue(fields()[2]);
record.receivedMillis = fieldSetFlags()[3] ? this.receivedMillis : (java.lang.Long) defaultValue(fields()[3]);
record.userID = fieldSetFlags()[4] ? this.userID : (java.lang.CharSequence) defaultValue(fields()[4]);
package gr.grnet.aquarium.message.avro.gen;
@SuppressWarnings("all")
public class WalletEntryMsg extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
- public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"WalletEntryMsg\",\"namespace\":\"gr.grnet.aquarium.message.avro.gen\",\"fields\":[{\"name\":\"userID\",\"type\":\"string\"},{\"name\":\"sumOfCreditsToSubtract\",\"type\":\"double\"},{\"name\":\"oldTotalCredits\",\"type\":\"double\"},{\"name\":\"newTotalCredits\",\"type\":\"double\"},{\"name\":\"whenComputedMillis\",\"type\":\"long\"},{\"name\":\"referenceStartMillis\",\"type\":\"long\"},{\"name\":\"referenceStopMillis\",\"type\":\"long\"},{\"name\":\"billingYear\",\"type\":\"int\"},{\"name\":\"billingMonth\",\"type\":\"int\"},{\"name\":\"billingDay\",\"type\":\"int\"},{\"name\":\"chargeslots\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"ChargeslotMsg\",\"fields\":[{\"name\":\"startMillis\",\"type\":\"long\"},{\"name\":\"stopMillis\",\"type\":\"long\"},{\"name\":\"unitPrice\",\"type\":\"double\"},{\"name\":\"explanation\",\"type\":\"string\",\"default\":\"\"},{\"name\":\"creditsToSubtract\",\"type\":\"double\"}]}}},{\"name\":\"resourceEvents\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"ResourceEventMsg\",\"fields\":[{\"name\":\"id\",\"type\":\"string\",\"aliases\":[\"originalID\",\"ID\"]},{\"name\":\"idInStore\",\"type\":\"string\"},{\"name\":\"occurredMillis\",\"type\":\"long\"},{\"name\":\"receivedMillis\",\"type\":\"long\",\"default\":0},{\"name\":\"userID\",\"type\":\"string\"},{\"name\":\"clientID\",\"type\":\"string\"},{\"name\":\"eventVersion\",\"type\":\"string\",\"default\":\"1.0\"},{\"name\":\"resource\",\"type\":\"string\",\"aliases\":[\"resourceType\"]},{\"name\":\"instanceID\",\"type\":\"string\"},{\"name\":\"value\",\"type\":\"string\"},{\"name\":\"details\",\"type\":{\"type\":\"map\",\"values\":{\"type\":\"record\",\"name\":\"AnyValueMsg\",\"fields\":[{\"name\":\"anyValue\",\"type\":[\"null\",\"int\",\"long\",\"boolean\",\"double\",\"bytes\",\"string\"]}]}}}]}}},{\"name\":\"resourceType\",\"type\":{\"type\":\"record\",\"name\":\"ResourceTypeMsg\",\"fields\":[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"unit\",\"type\":\"string\"},{\"name\":\"chargingBehaviorClass\",\"type\":\"string\"}]}},{\"name\":\"isSynthetic\",\"type\":\"boolean\",\"default\":false}]}");
+ public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"WalletEntryMsg\",\"namespace\":\"gr.grnet.aquarium.message.avro.gen\",\"fields\":[{\"name\":\"userID\",\"type\":\"string\"},{\"name\":\"sumOfCreditsToSubtract\",\"type\":\"double\"},{\"name\":\"oldTotalCredits\",\"type\":\"double\"},{\"name\":\"newTotalCredits\",\"type\":\"double\"},{\"name\":\"whenComputedMillis\",\"type\":\"long\"},{\"name\":\"referenceStartMillis\",\"type\":\"long\"},{\"name\":\"referenceStopMillis\",\"type\":\"long\"},{\"name\":\"billingYear\",\"type\":\"int\"},{\"name\":\"billingMonth\",\"type\":\"int\"},{\"name\":\"billingDay\",\"type\":\"int\"},{\"name\":\"chargeslots\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"ChargeslotMsg\",\"fields\":[{\"name\":\"startMillis\",\"type\":\"long\"},{\"name\":\"stopMillis\",\"type\":\"long\"},{\"name\":\"unitPrice\",\"type\":\"double\"},{\"name\":\"explanation\",\"type\":\"string\",\"default\":\"\"},{\"name\":\"creditsToSubtract\",\"type\":\"double\"}]}}},{\"name\":\"resourceEvents\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"ResourceEventMsg\",\"fields\":[{\"name\":\"originalID\",\"type\":\"string\",\"aliases\":[\"id\"]},{\"name\":\"inStoreID\",\"type\":[\"string\",\"null\"],\"aliases\":[\"_id\",\"idInStore\"]},{\"name\":\"occurredMillis\",\"type\":\"long\"},{\"name\":\"receivedMillis\",\"type\":\"long\",\"default\":0},{\"name\":\"userID\",\"type\":\"string\"},{\"name\":\"clientID\",\"type\":\"string\"},{\"name\":\"eventVersion\",\"type\":\"string\",\"default\":\"1.0\"},{\"name\":\"resource\",\"type\":\"string\",\"aliases\":[\"resourceType\"]},{\"name\":\"instanceID\",\"type\":\"string\"},{\"name\":\"value\",\"type\":\"string\"},{\"name\":\"details\",\"type\":{\"type\":\"map\",\"values\":{\"type\":\"record\",\"name\":\"AnyValueMsg\",\"fields\":[{\"name\":\"anyValue\",\"type\":[\"null\",\"int\",\"long\",\"boolean\",\"double\",\"bytes\",\"string\"]}]}}}]}}},{\"name\":\"resourceType\",\"type\":{\"type\":\"record\",\"name\":\"ResourceTypeMsg\",\"fields\":[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"unit\",\"type\":\"string\"},{\"name\":\"chargingBehaviorClass\",\"type\":\"string\"}]}},{\"name\":\"isSynthetic\",\"type\":\"boolean\",\"default\":false}]}");
@Deprecated public java.lang.CharSequence userID;
@Deprecated public double sumOfCreditsToSubtract;
@Deprecated public double oldTotalCredits;
package gr.grnet.aquarium.message.avro.gen;
@SuppressWarnings("all")
public class WorkingResourceInstanceChargingStateMsg extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
- public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"WorkingResourceInstanceChargingStateMsg\",\"namespace\":\"gr.grnet.aquarium.message.avro.gen\",\"fields\":[{\"name\":\"details\",\"type\":{\"type\":\"map\",\"values\":{\"type\":\"record\",\"name\":\"AnyValueMsg\",\"fields\":[{\"name\":\"anyValue\",\"type\":[\"null\",\"int\",\"long\",\"boolean\",\"double\",\"bytes\",\"string\"]}]}}},{\"name\":\"previousEvents\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"ResourceEventMsg\",\"fields\":[{\"name\":\"id\",\"type\":\"string\",\"aliases\":[\"originalID\",\"ID\"]},{\"name\":\"idInStore\",\"type\":\"string\"},{\"name\":\"occurredMillis\",\"type\":\"long\"},{\"name\":\"receivedMillis\",\"type\":\"long\",\"default\":0},{\"name\":\"userID\",\"type\":\"string\"},{\"name\":\"clientID\",\"type\":\"string\"},{\"name\":\"eventVersion\",\"type\":\"string\",\"default\":\"1.0\"},{\"name\":\"resource\",\"type\":\"string\",\"aliases\":[\"resourceType\"]},{\"name\":\"instanceID\",\"type\":\"string\"},{\"name\":\"value\",\"type\":\"string\"},{\"name\":\"details\",\"type\":{\"type\":\"map\",\"values\":\"AnyValueMsg\"}}]}}},{\"name\":\"implicitlyIssuedStartEvents\",\"type\":{\"type\":\"array\",\"items\":\"ResourceEventMsg\"}},{\"name\":\"accumulatingAmount\",\"type\":\"double\"},{\"name\":\"oldAccumulatingAmount\",\"type\":\"double\"},{\"name\":\"previousValue\",\"type\":\"double\"},{\"name\":\"currentValue\",\"type\":\"double\"}]}");
+ public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"WorkingResourceInstanceChargingStateMsg\",\"namespace\":\"gr.grnet.aquarium.message.avro.gen\",\"fields\":[{\"name\":\"details\",\"type\":{\"type\":\"map\",\"values\":{\"type\":\"record\",\"name\":\"AnyValueMsg\",\"fields\":[{\"name\":\"anyValue\",\"type\":[\"null\",\"int\",\"long\",\"boolean\",\"double\",\"bytes\",\"string\"]}]}}},{\"name\":\"previousEvents\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"ResourceEventMsg\",\"fields\":[{\"name\":\"originalID\",\"type\":\"string\",\"aliases\":[\"id\"]},{\"name\":\"inStoreID\",\"type\":[\"string\",\"null\"],\"aliases\":[\"_id\",\"idInStore\"]},{\"name\":\"occurredMillis\",\"type\":\"long\"},{\"name\":\"receivedMillis\",\"type\":\"long\",\"default\":0},{\"name\":\"userID\",\"type\":\"string\"},{\"name\":\"clientID\",\"type\":\"string\"},{\"name\":\"eventVersion\",\"type\":\"string\",\"default\":\"1.0\"},{\"name\":\"resource\",\"type\":\"string\",\"aliases\":[\"resourceType\"]},{\"name\":\"instanceID\",\"type\":\"string\"},{\"name\":\"value\",\"type\":\"string\"},{\"name\":\"details\",\"type\":{\"type\":\"map\",\"values\":\"AnyValueMsg\"}}]}}},{\"name\":\"implicitlyIssuedStartEvents\",\"type\":{\"type\":\"array\",\"items\":\"ResourceEventMsg\"}},{\"name\":\"accumulatingAmount\",\"type\":\"double\"},{\"name\":\"oldAccumulatingAmount\",\"type\":\"double\"},{\"name\":\"previousValue\",\"type\":\"double\"},{\"name\":\"currentValue\",\"type\":\"double\"}]}");
@Deprecated public java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.AnyValueMsg> details;
@Deprecated public java.util.List<gr.grnet.aquarium.message.avro.gen.ResourceEventMsg> previousEvents;
@Deprecated public java.util.List<gr.grnet.aquarium.message.avro.gen.ResourceEventMsg> implicitlyIssuedStartEvents;
package gr.grnet.aquarium.message.avro.gen;
@SuppressWarnings("all")
public class WorkingResourcesChargingStateMsg extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
- public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"WorkingResourcesChargingStateMsg\",\"namespace\":\"gr.grnet.aquarium.message.avro.gen\",\"fields\":[{\"name\":\"details\",\"type\":{\"type\":\"map\",\"values\":{\"type\":\"record\",\"name\":\"AnyValueMsg\",\"fields\":[{\"name\":\"anyValue\",\"type\":[\"null\",\"int\",\"long\",\"boolean\",\"double\",\"bytes\",\"string\"]}]}}},{\"name\":\"stateOfResourceInstance\",\"type\":{\"type\":\"map\",\"values\":{\"type\":\"record\",\"name\":\"WorkingResourceInstanceChargingStateMsg\",\"fields\":[{\"name\":\"details\",\"type\":{\"type\":\"map\",\"values\":\"AnyValueMsg\"}},{\"name\":\"previousEvents\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"ResourceEventMsg\",\"fields\":[{\"name\":\"id\",\"type\":\"string\",\"aliases\":[\"originalID\",\"ID\"]},{\"name\":\"idInStore\",\"type\":\"string\"},{\"name\":\"occurredMillis\",\"type\":\"long\"},{\"name\":\"receivedMillis\",\"type\":\"long\",\"default\":0},{\"name\":\"userID\",\"type\":\"string\"},{\"name\":\"clientID\",\"type\":\"string\"},{\"name\":\"eventVersion\",\"type\":\"string\",\"default\":\"1.0\"},{\"name\":\"resource\",\"type\":\"string\",\"aliases\":[\"resourceType\"]},{\"name\":\"instanceID\",\"type\":\"string\"},{\"name\":\"value\",\"type\":\"string\"},{\"name\":\"details\",\"type\":{\"type\":\"map\",\"values\":\"AnyValueMsg\"}}]}}},{\"name\":\"implicitlyIssuedStartEvents\",\"type\":{\"type\":\"array\",\"items\":\"ResourceEventMsg\"}},{\"name\":\"accumulatingAmount\",\"type\":\"double\"},{\"name\":\"oldAccumulatingAmount\",\"type\":\"double\"},{\"name\":\"previousValue\",\"type\":\"double\"},{\"name\":\"currentValue\",\"type\":\"double\"}]}}}]}");
+ public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"WorkingResourcesChargingStateMsg\",\"namespace\":\"gr.grnet.aquarium.message.avro.gen\",\"fields\":[{\"name\":\"details\",\"type\":{\"type\":\"map\",\"values\":{\"type\":\"record\",\"name\":\"AnyValueMsg\",\"fields\":[{\"name\":\"anyValue\",\"type\":[\"null\",\"int\",\"long\",\"boolean\",\"double\",\"bytes\",\"string\"]}]}}},{\"name\":\"stateOfResourceInstance\",\"type\":{\"type\":\"map\",\"values\":{\"type\":\"record\",\"name\":\"WorkingResourceInstanceChargingStateMsg\",\"fields\":[{\"name\":\"details\",\"type\":{\"type\":\"map\",\"values\":\"AnyValueMsg\"}},{\"name\":\"previousEvents\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"ResourceEventMsg\",\"fields\":[{\"name\":\"originalID\",\"type\":\"string\",\"aliases\":[\"id\"]},{\"name\":\"inStoreID\",\"type\":[\"string\",\"null\"],\"aliases\":[\"_id\",\"idInStore\"]},{\"name\":\"occurredMillis\",\"type\":\"long\"},{\"name\":\"receivedMillis\",\"type\":\"long\",\"default\":0},{\"name\":\"userID\",\"type\":\"string\"},{\"name\":\"clientID\",\"type\":\"string\"},{\"name\":\"eventVersion\",\"type\":\"string\",\"default\":\"1.0\"},{\"name\":\"resource\",\"type\":\"string\",\"aliases\":[\"resourceType\"]},{\"name\":\"instanceID\",\"type\":\"string\"},{\"name\":\"value\",\"type\":\"string\"},{\"name\":\"details\",\"type\":{\"type\":\"map\",\"values\":\"AnyValueMsg\"}}]}}},{\"name\":\"implicitlyIssuedStartEvents\",\"type\":{\"type\":\"array\",\"items\":\"ResourceEventMsg\"}},{\"name\":\"accumulatingAmount\",\"type\":\"double\"},{\"name\":\"oldAccumulatingAmount\",\"type\":\"double\"},{\"name\":\"previousValue\",\"type\":\"double\"},{\"name\":\"currentValue\",\"type\":\"double\"}]}}}]}");
@Deprecated public java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.AnyValueMsg> details;
@Deprecated public java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.WorkingResourceInstanceChargingStateMsg> stateOfResourceInstance;
public org.apache.avro.Schema getSchema() { return SCHEMA$; }
package gr.grnet.aquarium.message.avro.gen;
@SuppressWarnings("all")
public class WorkingUserStateMsg extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
- public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"WorkingUserStateMsg\",\"namespace\":\"gr.grnet.aquarium.message.avro.gen\",\"fields\":[{\"name\":\"userID\",\"type\":\"string\"},{\"name\":\"parentUserStateIDInStore\",\"type\":[\"string\",\"null\"]},{\"name\":\"resourceTypesMap\",\"type\":{\"type\":\"map\",\"values\":{\"type\":\"record\",\"name\":\"ResourceTypeMsg\",\"fields\":[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"unit\",\"type\":\"string\"},{\"name\":\"chargingBehaviorClass\",\"type\":\"string\"}]}}},{\"name\":\"workingStateOfResources\",\"type\":{\"type\":\"map\",\"values\":{\"type\":\"record\",\"name\":\"WorkingResourcesChargingStateMsg\",\"fields\":[{\"name\":\"details\",\"type\":{\"type\":\"map\",\"values\":{\"type\":\"record\",\"name\":\"AnyValueMsg\",\"fields\":[{\"name\":\"anyValue\",\"type\":[\"null\",\"int\",\"long\",\"boolean\",\"double\",\"bytes\",\"string\"]}]}}},{\"name\":\"stateOfResourceInstance\",\"type\":{\"type\":\"map\",\"values\":{\"type\":\"record\",\"name\":\"WorkingResourceInstanceChargingStateMsg\",\"fields\":[{\"name\":\"details\",\"type\":{\"type\":\"map\",\"values\":\"AnyValueMsg\"}},{\"name\":\"previousEvents\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"ResourceEventMsg\",\"fields\":[{\"name\":\"id\",\"type\":\"string\",\"aliases\":[\"originalID\",\"ID\"]},{\"name\":\"idInStore\",\"type\":\"string\"},{\"name\":\"occurredMillis\",\"type\":\"long\"},{\"name\":\"receivedMillis\",\"type\":\"long\",\"default\":0},{\"name\":\"userID\",\"type\":\"string\"},{\"name\":\"clientID\",\"type\":\"string\"},{\"name\":\"eventVersion\",\"type\":\"string\",\"default\":\"1.0\"},{\"name\":\"resource\",\"type\":\"string\",\"aliases\":[\"resourceType\"]},{\"name\":\"instanceID\",\"type\":\"string\"},{\"name\":\"value\",\"type\":\"string\"},{\"name\":\"details\",\"type\":{\"type\":\"map\",\"values\":\"AnyValueMsg\"}}]}}},{\"name\":\"implicitlyIssuedStartEvents\",\"type\":{\"type\":\"array\",\"items\":\"ResourceEventMsg\"}},{\"name\":\"accumulatingAmount\",\"type\":\"double\"},{\"name\":\"oldAccumulatingAmount\",\"type\":\"double\"},{\"name\":\"previousValue\",\"type\":\"double\"},{\"name\":\"currentValue\",\"type\":\"double\"}]}}}]}}},{\"name\":\"totalCredits\",\"type\":\"double\"},{\"name\":\"workingAgreementHistory\",\"type\":{\"type\":\"record\",\"name\":\"WorkingAgreementHistoryMsg\",\"fields\":[{\"name\":\"agreements\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"UserAgreementMsg\",\"fields\":[{\"name\":\"id\",\"type\":\"string\"},{\"name\":\"relatedIMEventID\",\"type\":[\"string\",\"null\"]},{\"name\":\"validFromMillis\",\"type\":\"long\"},{\"name\":\"validToMillis\",\"type\":\"long\"},{\"name\":\"role\",\"type\":\"string\"},{\"name\":\"fullPriceTableRef\",\"type\":[{\"type\":\"record\",\"name\":\"FullPriceTableMsg\",\"fields\":[{\"name\":\"perResource\",\"type\":{\"type\":\"map\",\"values\":{\"type\":\"map\",\"values\":{\"type\":\"record\",\"name\":\"SelectorValueMsg\",\"fields\":[{\"name\":\"selectorValue\",\"type\":[{\"type\":\"record\",\"name\":\"EffectivePriceTableMsg\",\"fields\":[{\"name\":\"priceOverrides\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"EffectiveUnitPriceMsg\",\"fields\":[{\"name\":\"unitPrice\",\"type\":\"double\"},{\"name\":\"when\",\"type\":[{\"type\":\"record\",\"name\":\"CronSpecTupleMsg\",\"fields\":[{\"name\":\"a\",\"type\":\"string\"},{\"name\":\"b\",\"type\":\"string\"}]},\"null\"]}]}}}]},{\"type\":\"map\",\"values\":\"SelectorValueMsg\"}]}]}}}}]},\"null\"]}]}}}]}},{\"name\":\"latestUpdateMillis\",\"type\":\"long\"},{\"name\":\"latestResourceEventOccurredMillis\",\"type\":\"long\"},{\"name\":\"billingPeriodOutOfSyncResourceEventsCounter\",\"type\":\"long\"},{\"name\":\"walletEntries\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"WalletEntryMsg\",\"fields\":[{\"name\":\"userID\",\"type\":\"string\"},{\"name\":\"sumOfCreditsToSubtract\",\"type\":\"double\"},{\"name\":\"oldTotalCredits\",\"type\":\"double\"},{\"name\":\"newTotalCredits\",\"type\":\"double\"},{\"name\":\"whenComputedMillis\",\"type\":\"long\"},{\"name\":\"referenceStartMillis\",\"type\":\"long\"},{\"name\":\"referenceStopMillis\",\"type\":\"long\"},{\"name\":\"billingYear\",\"type\":\"int\"},{\"name\":\"billingMonth\",\"type\":\"int\"},{\"name\":\"billingDay\",\"type\":\"int\"},{\"name\":\"chargeslots\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"ChargeslotMsg\",\"fields\":[{\"name\":\"startMillis\",\"type\":\"long\"},{\"name\":\"stopMillis\",\"type\":\"long\"},{\"name\":\"unitPrice\",\"type\":\"double\"},{\"name\":\"explanation\",\"type\":\"string\",\"default\":\"\"},{\"name\":\"creditsToSubtract\",\"type\":\"double\"}]}}},{\"name\":\"resourceEvents\",\"type\":{\"type\":\"array\",\"items\":\"ResourceEventMsg\"}},{\"name\":\"resourceType\",\"type\":\"ResourceTypeMsg\"},{\"name\":\"isSynthetic\",\"type\":\"boolean\",\"default\":false}]}}}]}");
+ public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"WorkingUserStateMsg\",\"namespace\":\"gr.grnet.aquarium.message.avro.gen\",\"fields\":[{\"name\":\"userID\",\"type\":\"string\"},{\"name\":\"parentUserStateIDInStore\",\"type\":[\"string\",\"null\"]},{\"name\":\"resourceTypesMap\",\"type\":{\"type\":\"map\",\"values\":{\"type\":\"record\",\"name\":\"ResourceTypeMsg\",\"fields\":[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"unit\",\"type\":\"string\"},{\"name\":\"chargingBehaviorClass\",\"type\":\"string\"}]}}},{\"name\":\"workingStateOfResources\",\"type\":{\"type\":\"map\",\"values\":{\"type\":\"record\",\"name\":\"WorkingResourcesChargingStateMsg\",\"fields\":[{\"name\":\"details\",\"type\":{\"type\":\"map\",\"values\":{\"type\":\"record\",\"name\":\"AnyValueMsg\",\"fields\":[{\"name\":\"anyValue\",\"type\":[\"null\",\"int\",\"long\",\"boolean\",\"double\",\"bytes\",\"string\"]}]}}},{\"name\":\"stateOfResourceInstance\",\"type\":{\"type\":\"map\",\"values\":{\"type\":\"record\",\"name\":\"WorkingResourceInstanceChargingStateMsg\",\"fields\":[{\"name\":\"details\",\"type\":{\"type\":\"map\",\"values\":\"AnyValueMsg\"}},{\"name\":\"previousEvents\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"ResourceEventMsg\",\"fields\":[{\"name\":\"originalID\",\"type\":\"string\",\"aliases\":[\"id\"]},{\"name\":\"inStoreID\",\"type\":[\"string\",\"null\"],\"aliases\":[\"_id\",\"idInStore\"]},{\"name\":\"occurredMillis\",\"type\":\"long\"},{\"name\":\"receivedMillis\",\"type\":\"long\",\"default\":0},{\"name\":\"userID\",\"type\":\"string\"},{\"name\":\"clientID\",\"type\":\"string\"},{\"name\":\"eventVersion\",\"type\":\"string\",\"default\":\"1.0\"},{\"name\":\"resource\",\"type\":\"string\",\"aliases\":[\"resourceType\"]},{\"name\":\"instanceID\",\"type\":\"string\"},{\"name\":\"value\",\"type\":\"string\"},{\"name\":\"details\",\"type\":{\"type\":\"map\",\"values\":\"AnyValueMsg\"}}]}}},{\"name\":\"implicitlyIssuedStartEvents\",\"type\":{\"type\":\"array\",\"items\":\"ResourceEventMsg\"}},{\"name\":\"accumulatingAmount\",\"type\":\"double\"},{\"name\":\"oldAccumulatingAmount\",\"type\":\"double\"},{\"name\":\"previousValue\",\"type\":\"double\"},{\"name\":\"currentValue\",\"type\":\"double\"}]}}}]}}},{\"name\":\"totalCredits\",\"type\":\"double\"},{\"name\":\"workingAgreementHistory\",\"type\":{\"type\":\"record\",\"name\":\"WorkingAgreementHistoryMsg\",\"fields\":[{\"name\":\"agreements\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"UserAgreementMsg\",\"fields\":[{\"name\":\"id\",\"type\":\"string\"},{\"name\":\"relatedIMEventID\",\"type\":[\"string\",\"null\"]},{\"name\":\"validFromMillis\",\"type\":\"long\"},{\"name\":\"validToMillis\",\"type\":\"long\"},{\"name\":\"role\",\"type\":\"string\"},{\"name\":\"fullPriceTableRef\",\"type\":[{\"type\":\"record\",\"name\":\"FullPriceTableMsg\",\"fields\":[{\"name\":\"perResource\",\"type\":{\"type\":\"map\",\"values\":{\"type\":\"map\",\"values\":{\"type\":\"record\",\"name\":\"SelectorValueMsg\",\"fields\":[{\"name\":\"selectorValue\",\"type\":[{\"type\":\"record\",\"name\":\"EffectivePriceTableMsg\",\"fields\":[{\"name\":\"priceOverrides\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"EffectiveUnitPriceMsg\",\"fields\":[{\"name\":\"unitPrice\",\"type\":\"double\"},{\"name\":\"when\",\"type\":[{\"type\":\"record\",\"name\":\"CronSpecTupleMsg\",\"fields\":[{\"name\":\"a\",\"type\":\"string\"},{\"name\":\"b\",\"type\":\"string\"}]},\"null\"]}]}}}]},{\"type\":\"map\",\"values\":\"SelectorValueMsg\"}]}]}}}}]},\"null\"]}]}}}]}},{\"name\":\"latestUpdateMillis\",\"type\":\"long\"},{\"name\":\"latestResourceEventOccurredMillis\",\"type\":\"long\"},{\"name\":\"billingPeriodOutOfSyncResourceEventsCounter\",\"type\":\"long\"},{\"name\":\"walletEntries\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"WalletEntryMsg\",\"fields\":[{\"name\":\"userID\",\"type\":\"string\"},{\"name\":\"sumOfCreditsToSubtract\",\"type\":\"double\"},{\"name\":\"oldTotalCredits\",\"type\":\"double\"},{\"name\":\"newTotalCredits\",\"type\":\"double\"},{\"name\":\"whenComputedMillis\",\"type\":\"long\"},{\"name\":\"referenceStartMillis\",\"type\":\"long\"},{\"name\":\"referenceStopMillis\",\"type\":\"long\"},{\"name\":\"billingYear\",\"type\":\"int\"},{\"name\":\"billingMonth\",\"type\":\"int\"},{\"name\":\"billingDay\",\"type\":\"int\"},{\"name\":\"chargeslots\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"ChargeslotMsg\",\"fields\":[{\"name\":\"startMillis\",\"type\":\"long\"},{\"name\":\"stopMillis\",\"type\":\"long\"},{\"name\":\"unitPrice\",\"type\":\"double\"},{\"name\":\"explanation\",\"type\":\"string\",\"default\":\"\"},{\"name\":\"creditsToSubtract\",\"type\":\"double\"}]}}},{\"name\":\"resourceEvents\",\"type\":{\"type\":\"array\",\"items\":\"ResourceEventMsg\"}},{\"name\":\"resourceType\",\"type\":\"ResourceTypeMsg\"},{\"name\":\"isSynthetic\",\"type\":\"boolean\",\"default\":false}]}}}]}");
@Deprecated public java.lang.CharSequence userID;
@Deprecated public java.lang.CharSequence parentUserStateIDInStore;
@Deprecated public java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.ResourceTypeMsg> resourceTypesMap;
-{ "jsonClass":"gr.grnet.aquarium.policy.StdPolicy",
+{
+ "originalID":"default-policy",
+ "inStoreID":null,
+ "parentID":null,
+ "validFromMillis":"0",
+ "validToMillis":"9223372036854775807",
- "id":"default-policy",
-
- "validityTimespan":{
- "fromMillis":0,
- "toMillis":9223372036854775807
- },
-
- "resourceTypes":[{
- "jsonClass":"gr.grnet.aquarium.policy.ResourceType",
- "name":"diskspace",
- "unit":"MB/Hr",
- "chargingBehavior":"gr.grnet.aquarium.charging.ContinuousChargingBehavior"
- },{
- "jsonClass":"gr.grnet.aquarium.policy.ResourceType",
- "name":"vmtime",
- "unit":"Hr",
- "chargingBehavior":"gr.grnet.aquarium.charging.VMChargingBehavior"
- },{
- "jsonClass":"gr.grnet.aquarium.policy.ResourceType",
- "name":"addcredits",
- "unit":"Credits",
- "chargingBehavior":"gr.grnet.aquarium.charging.OnceChargingBehavior"
- }],
+ "resourceTypes":[
+ {
+ "name":"diskspace",
+ "unit":"MB/Hr",
+ "chargingBehaviorClass":"gr.grnet.aquarium.charging.ContinuousChargingBehavior"
+ },
+ {
+ "name":"vmtime",
+ "unit":"Hr",
+ "chargingBehaviorClass":"gr.grnet.aquarium.charging.VMChargingBehavior"
+ },
+ {
+ "name":"addcredits",
+ "unit":"Credits",
+ "chargingBehaviorClass":"gr.grnet.aquarium.charging.OnceChargingBehavior"
+ }
+ ],
"chargingBehaviors":[
"gr.grnet.aquarium.charging.VMChargingBehavior",
"gr.grnet.aquarium.charging.ContinuousChargingBehavior",
- "gr.grnet.aquarium.charging.OnceChargingBehavior"
- ],
+ "gr.grnet.aquarium.charging.OnceChargingBehavior" ],
"roleMapping":{
"default":{
- "jsonClass":"gr.grnet.aquarium.policy.FullPriceTable",
-
"perResource":{
"diskspace":{
- "default":{ "jsonClass":"gr.grnet.aquarium.policy.EffectivePriceTable",
- "priceOverrides":[{ "jsonClass":"gr.grnet.aquarium.policy.EffectiveUnitPrice",
- "unitPrice":0.01
- }]
+ "default":{
+ "selectorValue":{
+ "gr.grnet.aquarium.message.avro.gen.EffectivePriceTableMsg":{
+ "priceOverrides":[
+ {
+ "unitPrice":"0.01",
+ "when":null
+ }
+ ]
+ }
+ }
}
},
"vmtime":{
- "powerOn":{ "jsonClass":"gr.grnet.aquarium.policy.EffectivePriceTable",
- "priceOverrides":[{ "jsonClass":"gr.grnet.aquarium.policy.EffectiveUnitPrice",
- "unitPrice":0.01
- }]
+ "powerOff":{
+ "selectorValue":{
+ "gr.grnet.aquarium.message.avro.gen.EffectivePriceTableMsg":{
+ "priceOverrides":[
+ {
+ "unitPrice":"0.0010",
+ "when":null
+ }
+ ]
+ }
+ }
},
- "powerOff":{ "jsonClass":"gr.grnet.aquarium.policy.EffectivePriceTable",
- "priceOverrides":[{ "jsonClass":"gr.grnet.aquarium.policy.EffectiveUnitPrice",
- "unitPrice":0.0010
- }]
+ "powerOn":{
+ "selectorValue":{
+ "gr.grnet.aquarium.message.avro.gen.EffectivePriceTableMsg":{
+ "priceOverrides":[
+ {
+ "unitPrice":"0.01",
+ "when":null
+ }
+ ]
+ }
+ }
}
},
"addcredits":{
- "default":{ "jsonClass":"gr.grnet.aquarium.policy.EffectivePriceTable",
- "priceOverrides":[{ "jsonClass":"gr.grnet.aquarium.policy.EffectiveUnitPrice",
- "unitPrice":-1.0
- }]
+ "default":{
+ "selectorValue":{
+ "gr.grnet.aquarium.message.avro.gen.EffectivePriceTableMsg":{
+ "priceOverrides":[
+ {
+ "unitPrice":"-1.0",
+ "when":null
+ }
+ ]
+ }
+ }
}
}
}
+++ /dev/null
-import gr.grnet.aquarium.charging.VMChargingBehavior.Selectors.Power
-import gr.grnet.aquarium.charging.{OnceChargingBehavior, ContinuousChargingBehavior, VMChargingBehavior}
-import gr.grnet.aquarium.policy.FullPriceTable._
-import gr.grnet.aquarium.policy.{EffectiveUnitPrice, EffectivePriceTable, FullPriceTable, ResourceType, StdPolicy}
-import gr.grnet.aquarium.Timespan
-import gr.grnet.aquarium.util.nameOfClass
-
-// Definition of our standard policy in plain Scala
-
-StdPolicy(
- id = "750E6309-AB60-41B4-8D4B-9FFEA6EF843C",
- parentID = None,
-
- validityTimespan = Timespan(0),
-
- resourceTypes = Set(
- ResourceType("vmtime", "Hr", nameOfClass[VMChargingBehavior]),
- ResourceType("diskspace", "MB/Hr", nameOfClass[ContinuousChargingBehavior])
- ),
-
- chargingBehaviors = Set(
- nameOfClass[VMChargingBehavior],
- nameOfClass[ContinuousChargingBehavior],
- nameOfClass[OnceChargingBehavior]
- ),
-
- roleMapping = Map(
- "default" -> FullPriceTable(Map(
- "diskspace" -> Map(
- DefaultSelectorKey -> EffectivePriceTable(EffectiveUnitPrice(0.01) :: Nil)
- ),
- "vmtime" -> Map(
- Power.powerOn -> EffectivePriceTable(EffectiveUnitPrice(0.01) :: Nil),
- Power.powerOff -> EffectivePriceTable(EffectiveUnitPrice(0.001) :: Nil) // cheaper when the VM is OFF
- )
- ))
- )
-)
\ No newline at end of file
import gr.grnet.aquarium.policy.{FullPriceTable, PolicyModel, CachingPolicyStore, PolicyDefinedFullPriceTableRef, StdUserAgreement, UserAgreementModel, ResourceType}
import gr.grnet.aquarium.charging.{ChargingService, ChargingBehavior}
import gr.grnet.aquarium.util.date.TimeHelpers
+import gr.grnet.aquarium.message.avro.gen.PolicyMsg
+import gr.grnet.aquarium.message.avro.{ModelFactory, AvroHelpers}
/**
*
@volatile private[this] var _chargingBehaviorMap = Map[String, ChargingBehavior]()
private[this] lazy val cachingPolicyStore = new CachingPolicyStore(
- apply(EnvKeys.defaultPolicyModel),
+ apply(EnvKeys.defaultPolicyMsg),
apply(EnvKeys.storeProvider).policyStore
)
}
this.eventsStoreFolder.throwMe // on error
- logger.info("default policy = {}", defaultPolicyModel.toJsonString)
+ logger.info("default policy = {}", AvroHelpers.jsonStringOfSpecificRecord(defaultPolicyMsg))
}
private[this] def addShutdownHooks(): Unit = {
}
def currentResourceTypesMap: Map[String, ResourceType] = {
- val policyOpt = policyStore.loadValidPolicyAt(TimeHelpers.nowMillis())
- if(policyOpt.isEmpty) {
+ val policyMspOpt = policyStore.loadPolicyAt(TimeHelpers.nowMillis())
+ if(policyMspOpt.isEmpty) {
throw new AquariumInternalError("Not even the default policy found")
}
- policyOpt.get.resourceTypesMap
+ val policyMsg = policyMspOpt.get
+ // TODO optimize
+ ModelFactory.newPolicyModel(policyMsg).resourceTypesMap
}
def unsafeValidPolicyAt(referenceTimeMillis: Long): PolicyModel = {
- policyStore.loadValidPolicyAt(referenceTimeMillis) match {
+ policyStore.loadPolicyAt(referenceTimeMillis) match {
case None ⇒
throw new AquariumInternalError(
"No policy found at %s".format(TimeHelpers.toYYYYMMDDHHMMSSSSS(referenceTimeMillis))
)
- case Some(policy) ⇒
- policy
+ case Some(policyMsg) ⇒
+ ModelFactory.newPolicyModel(policyMsg)
}
}
}
}
- def defaultPolicyModel = apply(EnvKeys.defaultPolicyModel)
+ def defaultPolicyMsg = apply(EnvKeys.defaultPolicyMsg)
def defaultClassLoader = apply(EnvKeys.defaultClassLoader)
final val defaultClassLoader: TypedKey[ClassLoader] =
new AquariumEnvKey[ClassLoader]("default.class.loader")
- final val defaultPolicyModel: TypedKey[PolicyModel] =
- new AquariumEnvKey[PolicyModel]("default.policy.model")
+ final val defaultPolicyMsg: TypedKey[PolicyMsg] =
+ new AquariumEnvKey[PolicyMsg]("default.policy.msg")
}
}
package gr.grnet.aquarium
-import com.ckkloverdos.key.{BooleanKey, TypedKey}
import com.ckkloverdos.env.Env
-import com.ckkloverdos.props.Props
+import com.ckkloverdos.key.{BooleanKey, TypedKey}
import com.ckkloverdos.maybe.{Failed, MaybeEither, Just, NoVal}
-import gr.grnet.aquarium.util.Loggable
-import java.io.File
-import gr.grnet.aquarium.service.EventBusService
+import com.ckkloverdos.props.Props
import gr.grnet.aquarium.converter.StdConverters
+import gr.grnet.aquarium.message.avro.gen.PolicyMsg
+import gr.grnet.aquarium.service.EventBusService
import gr.grnet.aquarium.service.event.AquariumCreatedEvent
-import gr.grnet.aquarium.policy.PolicyModel
+import gr.grnet.aquarium.util.Loggable
+import java.io.File
/**
* Create a tailored Aquarium.
final class AquariumBuilder(
val originalProps: Props,
- val defaultPolicyModel: PolicyModel
+ val defaultPolicyMsg: PolicyMsg
) extends Loggable {
if(originalProps eq null) {
Some(propValue)
}
- update(EnvKeys.defaultPolicyModel, defaultPolicyModel)
+ update(EnvKeys.defaultPolicyMsg, defaultPolicyMsg)
this._aquarium = new Aquarium(_env)
try {
val aquarium = new AquariumBuilder(
ResourceLocator.AquariumProperties,
- ResourceLocator.DefaultPolicyModel
+ ResourceLocator.DefaultPolicyMsg
).build()
aquarium.start()
import com.ckkloverdos.convert.Converters
import gr.grnet.aquarium.converter.{JsonTextFormat, StdConverters}
import gr.grnet.aquarium.policy.StdPolicy
+import gr.grnet.aquarium.message.avro.AvroHelpers
+import gr.grnet.aquarium.message.avro.gen.PolicyMsg
/**
* Locates resources.
}
}
- final lazy val DefaultPolicyModel = {
+ final lazy val DefaultPolicyMsg = {
val maybePolicyJSON = Resources.PolicyJSONResource.stringContent
maybePolicyJSON match {
case NoVal ⇒
Resources.PolicyJSONResource))
case Just(jsonString) ⇒
- StdConverters.AllConverters.convertEx[StdPolicy](JsonTextFormat(jsonString))
+ AvroHelpers.specificRecordOfJsonString(jsonString, new PolicyMsg)
}
}
// It will also update the old one inside the data structure.
workingResourceInstanceChargingState.setNewAccumulatingAmount(_newAccumulatingAmount)
- val policyByTimeslot = policyStore.loadAndSortPoliciesWithin(
+ val policyByTimeslot = policyStore.loadSortedPolicyModelsWithin(
referenceTimeslot.from.getTime,
referenceTimeslot.to.getTime
)
//Console.err.println("JSON: " + (new BillEntry).toJsonString)
val propsfile = new FileStreamResource(new File("aquarium.properties"))
var _props: Props = Props(propsfile)(StdConverters.AllConverters).getOr(Props()(StdConverters.AllConverters))
- val aquarium = new AquariumBuilder(_props, ResourceLocator.DefaultPolicyModel).
+ val aquarium = new AquariumBuilder(_props, ResourceLocator.DefaultPolicyMsg).
update(Aquarium.EnvKeys.storeProvider, new MemStoreProvider).
update(Aquarium.EnvKeys.eventsStoreFolder,Some(new File(".."))).
build()
def main(args: Array[String]) = {
val propsfile = new FileStreamResource(new File("aquarium.properties"))
var _props: Props = Props(propsfile)(StdConverters.AllConverters).getOr(Props()(StdConverters.AllConverters))
- val aquarium = new AquariumBuilder(_props, ResourceLocator.DefaultPolicyModel).
+ val aquarium = new AquariumBuilder(_props, ResourceLocator.DefaultPolicyMsg).
update(Aquarium.EnvKeys.storeProvider, new MemStoreProvider).
update(Aquarium.EnvKeys.eventsStoreFolder, Some(new File(".."))).
build()
import java.io.{OutputStream, ByteArrayOutputStream}
import org.apache.avro.Schema
import org.apache.avro.generic.{GenericRecord, GenericDatumWriter}
-import org.apache.avro.io.{JsonEncoder, EncoderFactory}
-import org.apache.avro.specific.{SpecificDatumWriter, SpecificRecord}
+import org.apache.avro.io.{JsonDecoder, DecoderFactory, JsonEncoder, EncoderFactory}
+import org.apache.avro.specific.{SpecificDatumReader, SpecificDatumWriter, SpecificRecord}
/**
* @author Christos KK Loverdos <loverdos@gmail.com>
*/
object AvroHelpers {
+ private[this] final val DefaultEncoderFactory = EncoderFactory.get()
+ private[this] final val DefaultDecoderFactory = DecoderFactory.get()
+
def getJsonEncoder(schema: Schema, out: OutputStream): JsonEncoder = {
- val encoder = EncoderFactory.get().jsonEncoder(schema, out)
+ val encoder = DefaultEncoderFactory.jsonEncoder(schema, out)
val jsonGenerator = JsonHelpers.getJsonGenerator(out)
encoder.configure(jsonGenerator)
}
+ def getJsonDecoder(schema: Schema, in: String): JsonDecoder = {
+ DefaultDecoderFactory.jsonDecoder(schema, in)
+ }
+
+ def specificRecordOfJsonString[R <: SpecificRecord](json: String, fresh: R): R = {
+ val schema = fresh.getSchema
+ val decoder = getJsonDecoder(schema, json)
+ val reader = new SpecificDatumReader[R](schema)
+ reader.read(fresh, decoder)
+ }
+
def jsonStringOfSpecificRecord[T <: SpecificRecord](t: T): String = {
val schema = t.getSchema()
val out = new ByteArrayOutputStream()
encoder.flush()
out.toString
}
+
+ def bytesOfSpecificRecord[R <: SpecificRecord](r: R): Array[Byte] = {
+ val schema = r.getSchema
+ val out = new ByteArrayOutputStream()
+ val encoder = EncoderFactory.get().binaryEncoder(out, null)
+ val writer = new SpecificDatumWriter[R](schema)
+
+ writer.write(r, encoder)
+ encoder.flush()
+ out.toByteArray
+ }
+
+ def specificRecordOfBytes[R <: SpecificRecord](bytes: Array[Byte], fresh: R): R = {
+ val decoder = DefaultDecoderFactory.binaryDecoder(bytes, null)
+ val reader = new SpecificDatumReader[R](fresh.getSchema)
+ reader.read(fresh, decoder)
+ }
}
--- /dev/null
+/*
+ * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and
+ * documentation are those of the authors and should not be
+ * interpreted as representing official policies, either expressed
+ * or implied, of GRNET S.A.
+ */
+
+package gr.grnet.aquarium.message.avro
+
+import gr.grnet.aquarium.message.avro.gen.{FullPriceTableMsg, ResourceTypeMsg, PolicyMsg}
+import java.{util ⇒ ju}
+
+/**
+ *
+ * @author Christos KK Loverdos <loverdos@gmail.com>
+ */
+object DummyHelpers {
+ def dummyPolicyMsgAt(millis: Long) : PolicyMsg = {
+ PolicyMsg.newBuilder().
+ setOriginalID("").
+ setInStoreID(null).
+ setParentID(null).
+ setValidFromMillis(millis).
+ setValidToMillis(Long.MaxValue).
+ setChargingBehaviors(new ju.ArrayList[CharSequence]()).
+ setResourceTypes(new ju.ArrayList[ResourceTypeMsg]()).
+ setRoleMapping(new ju.HashMap[CharSequence, FullPriceTableMsg]()).
+ build()
+ }
+}
import scala.collection.JavaConverters.seqAsJavaListConverter
/**
+ * Provides helper methods that construct avro messages.
*
* @author Christos KK Loverdos <loverdos@gmail.com>
*/
}
def newChargingBehaviorMsgs(cbs: CharSequence*) = {
- cbs.asJava
+ val ret = cbs.asJava
+ println(cbs.toList)
+ println("========")
+ var i = 0
+ while(i < ret.size()) {
+ println(ret.get(i))
+ i += 1
+ }
+
+ ret
}
}
--- /dev/null
+/*
+ * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and
+ * documentation are those of the authors and should not be
+ * interpreted as representing official policies, either expressed
+ * or implied, of GRNET S.A.
+ */
+
+package gr.grnet.aquarium.message.avro
+
+import gr.grnet.aquarium.message.avro.gen.{EffectiveUnitPriceMsg, SelectorValueMsg, EffectivePriceTableMsg, FullPriceTableMsg, ResourceTypeMsg, PolicyMsg}
+import gr.grnet.aquarium.policy.{CronSpec, EffectiveUnitPrice, EffectivePriceTable, FullPriceTable, ResourceType, PolicyModel}
+import scala.collection.JavaConverters.asScalaBufferConverter
+import scala.collection.JavaConverters.mapAsScalaMapConverter
+import scala.collection.mutable
+
+/**
+ * Provides helper methods that construct model objects, usually from their avro message counterparts.
+ *
+ * @author Christos KK Loverdos <loverdos@gmail.com>
+ */
+object ModelFactory {
+ def newOptionString(in: CharSequence): Option[String] = {
+ in match {
+ case null ⇒ None
+ case some ⇒ Some(in.toString)
+ }
+ }
+
+ def newResourceType(msg: ResourceTypeMsg) = {
+ ResourceType(
+ msg.getName().toString,
+ msg.getUnit().toString,
+ msg.getChargingBehaviorClass().toString
+ )
+ }
+
+ def newEffectiveUnitPrice(msg: EffectiveUnitPriceMsg) = {
+ EffectiveUnitPrice(
+ unitPrice = msg.getUnitPrice(),
+ when = msg.getWhen() match {
+ case null ⇒
+ None
+
+ case cronSpecTupleMsg ⇒
+ Some(
+ CronSpec(cronSpecTupleMsg.getA.toString),
+ CronSpec(cronSpecTupleMsg.getB.toString)
+ )
+ }
+ )
+ }
+
+ def newEffectivePriceTable(msg: EffectivePriceTableMsg) = {
+ EffectivePriceTable(
+ priceOverrides = msg.getPriceOverrides.asScala.map(newEffectiveUnitPrice).toList
+ )
+ }
+
+ def newSelectorValue(v: SelectorValueMsg): Any /* either a selector (String) or a map */ = {
+ v match {
+ case effectivePriceTableMsg: EffectivePriceTableMsg ⇒
+ newEffectivePriceTable(effectivePriceTableMsg)
+
+ case mapOfSelectorValueMsg: java.util.Map[_, _] ⇒
+ mapOfSelectorValueMsg.asScala.map { case (k, v) ⇒
+ (k.toString, newSelectorValue(v.asInstanceOf[SelectorValueMsg]))
+ }.toMap // make immutable map
+ }
+ }
+
+ def newFullPriceTable(msg: FullPriceTableMsg) = {
+ FullPriceTable(
+ perResource = Map(msg.getPerResource().asScala.map { case (k, v) ⇒
+ val k2 = k.toString
+ val v2 = v.asInstanceOf[java.util.Map[CharSequence, SelectorValueMsg]].asScala.map { case (k, v) ⇒
+ (k.toString, newSelectorValue(v))
+ }.toMap // make immutable map
+
+ (k2, v2)
+ }.toSeq: _*)
+ )
+ }
+
+ def newRoleMapping(
+ roleMapping: java.util.Map[CharSequence, FullPriceTableMsg]
+ ): mutable.Map[String, FullPriceTable] = {
+
+ roleMapping.asScala.map { case (k, v) ⇒
+ val k2 = k.toString
+ val v2 = newFullPriceTable(v)
+
+ (k2, v2)
+ }
+ }
+
+ def newPolicyModel(msg: PolicyMsg) = {
+ PolicyModel(
+ originalID = msg.getOriginalID().toString,
+ inStoreID = newOptionString(msg.getInStoreID()),
+ parentID = newOptionString(msg.getParentID()),
+ validFromMillis = msg.getValidFromMillis(),
+ validToMillis = msg.getValidToMillis(),
+ resourceTypes = Set(msg.getResourceTypes().asScala.map(newResourceType).toSeq: _*),
+ chargingBehaviors = Set(msg.getChargingBehaviors().asScala.map(_.toString).toSeq: _*),
+ roleMapping = newRoleMapping(msg.getRoleMapping).toMap
+ )
+ }
+}
* or implied, of GRNET S.A.
*/
-package gr.grnet.aquarium.store.mongodb
+package gr.grnet.aquarium.message.avro
-import gr.grnet.aquarium.Timespan
-import gr.grnet.aquarium.policy.{PolicyModel, FullPriceTable, ResourceType}
+import gr.grnet.aquarium.message.avro.gen.PolicyMsg
/**
*
* @author Christos KK Loverdos <loverdos@gmail.com>
*/
-
-case class MongoDBPolicy(
- _id: String,
- parentID: Option[String],
- validityTimespan: Timespan,
- resourceTypes: Set[ResourceType],
- chargingBehaviors: Set[String],
- roleMapping: Map[String/*Role*/, FullPriceTable]
-) extends PolicyModel {
-
- def id = _id
- def idInStore = Some(_id)
-}
-
-object MongoDBPolicy {
- final def fromOther(policy: PolicyModel, _id: String): MongoDBPolicy = {
- MongoDBPolicy(
- _id,
- policy.parentID,
- policy.validityTimespan,
- policy.resourceTypes,
- policy.chargingBehaviors,
- policy.roleMapping
- )
+object OrderingHelpers {
+ final val DefaultPolicyMsgOrdering = new Ordering[PolicyMsg] {
+ def compare(x: PolicyMsg, y: PolicyMsg): Int = {
+ if(x.getValidFromMillis < y.getValidFromMillis) {
+ -1
+ }
+ else if (x.getValidFromMillis == y.getValidFromMillis) {
+ 0
+ } else {
+ 1
+ }
+ }
}
}
package gr.grnet.aquarium.policy
-import gr.grnet.aquarium.Timespan
-import gr.grnet.aquarium.util.Lock
-import gr.grnet.aquarium.store.PolicyStore
import gr.grnet.aquarium.logic.accounting.dsl.Timeslot
-import collection.immutable
+import gr.grnet.aquarium.message.avro.gen.PolicyMsg
+import gr.grnet.aquarium.message.avro.{DummyHelpers, OrderingHelpers}
+import gr.grnet.aquarium.store.PolicyStore
+import gr.grnet.aquarium.util.Lock
+import scala.collection.immutable
/**
* A caching [[gr.grnet.aquarium.store.PolicyStore]].
* @author Prodromos Gerakios <pgerakios@grnet.gr>
*/
-class CachingPolicyStore(defaultPolicy: PolicyModel, policyStore: PolicyStore) extends PolicyStore {
+class CachingPolicyStore(defaultPolicy: PolicyMsg, policyStore: PolicyStore) extends PolicyStore {
private[this] final val lock = new Lock()
- private[this] final val EmptyPolicyByTimeslotMap = immutable.SortedMap[Timeslot, PolicyModel]()
- private[this] var _policies = immutable.TreeSet[PolicyModel]()
+ private[this] var _policies = immutable.TreeSet[PolicyMsg]()(OrderingHelpers.DefaultPolicyMsgOrdering)
+
+ def foreachPolicy[U](f: (PolicyMsg) ⇒ U) {
+ ensureLoaded {
+ _policies.foreach(f)
+ }
+ }
private[this] def ensureLoaded[A](andThen: ⇒ A): A = {
this.lock.withLock {
if(_policies.isEmpty) {
- _policies ++= policyStore.loadAllPolicies
+ policyStore.foreachPolicy(_policies += _)
if(_policies.isEmpty) {
_policies += defaultPolicy
}
}
- private[this] def policyAt(s:Long) : PolicyModel =
- new StdPolicy("", None, Timespan(s), Set(), Set(), Map())
-
- def loadAndSortPoliciesWithin(fromMillis: Long, toMillis: Long): immutable.SortedMap[Timeslot, PolicyModel] =
- ensureLoaded {
- val range = Timeslot(fromMillis,toMillis)
- /* ``to'' method: return the subset of all policies.from <= range.to */
- _policies.to(policyAt(range.to.getTime)).foldLeft (EmptyPolicyByTimeslotMap) { (map,p) =>
- if(p.validityTimespan.toTimeslot.to.getTime >= range.from.getTime)
- map + ((p.validityTimespan.toTimeslot,p))
- else
- map
- }
- }
-
+ def loadSortedPoliciesWithin(fromMillis: Long, toMillis: Long): immutable.SortedMap[Timeslot, PolicyMsg] = {
+ immutable.SortedMap(_policies.
+ from(DummyHelpers.dummyPolicyMsgAt(fromMillis)).
+ to(DummyHelpers.dummyPolicyMsgAt(toMillis)).toSeq.
+ map(p ⇒ (Timeslot(p.getValidFromMillis, p.getValidToMillis), p)): _*
+ )
+ }
/**
* Return the last (ordered) policy that starts before timeMillis
* @param atMillis
* @return
*/
- def loadValidPolicyAt(atMillis: Long): Option[PolicyModel] =
+ def loadPolicyAt(atMillis: Long): Option[PolicyMsg] =
ensureLoaded {
// Take the subset of all ordered policies up to the one with less than or equal start time
// and then return the last item. This should be the policy right before the given time.
// TODO: optimize the creation of the fake StdPolicy
- _policies.to(policyAt(atMillis)).lastOption
+ _policies.to(DummyHelpers.dummyPolicyMsgAt(atMillis)).lastOption
}
/**
* Store an accounting policy.
*/
- def insertPolicy(policy: PolicyModel): PolicyModel = {
+ def insertPolicy(policy: PolicyMsg): PolicyMsg = {
ensureLoaded {
this._policies += policy
policyStore.insertPolicy(policy)
trait PolicyModel extends Ordered[PolicyModel] with JsonSupport {
final def compare(that: PolicyModel): Int = {
- if(this.validFrom < that.validFrom) {
+ if(this.validFromMillis < that.validFromMillis) {
-1
- } else if(this.validFrom == that.validFrom) {
+ } else if(this.validFromMillis == that.validFromMillis) {
0
} else {
1
}
}
- def id: String
+ def originalID: String
def parentID: Option[String]
- def idInStore: Option[Any]
+ def inStoreID: Option[String]
+ def validFromMillis: Long
+ def validToMillis: Long
/**
* The time period within which this policy is valid.
*/
- def validityTimespan: Timespan
-
- final def validFrom: Long = validityTimespan.fromMillis
-
- final def validTo: Long = validityTimespan.toMillis
+ def validityTimespan: Timespan = Timespan(validFromMillis, validToMillis)
/**
* All known resource types for the policy's validity period.
}
object PolicyModel {
- trait NamesT {
- final val id = "id"
- final val parentID = "parentID"
- final val idInStore = "idInStore"
+ def fromJsonString(json: String): StdPolicy = {
+ StdConverters.AllConverters.convertEx[StdPolicy](JsonTextFormat(json))
}
- final object Names extends NamesT
+ def apply(
+ originalID: String,
+ inStoreID: Option[String],
+ parentID: Option[String],
+ validFromMillis: Long,
+ validToMillis: Long,
+ resourceTypes: Set[ResourceType],
+ chargingBehaviors: Set[String],
+ roleMapping: Map[String /* role name */, FullPriceTable]
+ ): PolicyModel = {
+
+ StdPolicy(
+ originalID,
+ inStoreID,
+ parentID,
+ validFromMillis,
+ validToMillis,
+ resourceTypes,
+ chargingBehaviors,
+ roleMapping
+ )
+ }
}
package gr.grnet.aquarium.policy
-import gr.grnet.aquarium.Timespan
-import gr.grnet.aquarium.converter.{JsonTextFormat, StdConverters}
/**
* Standard implementation of Aquarium policy model.
*/
case class StdPolicy(
- id: String,
+ originalID: String,
+ inStoreID: Option[String],
parentID: Option[String],
- validityTimespan: Timespan,
+ validFromMillis: Long,
+ validToMillis: Long,
resourceTypes: Set[ResourceType],
chargingBehaviors: Set[String],
- roleMapping: Map[String/*Role*/, FullPriceTable]
-) extends PolicyModel {
-
- def idInStore = Some(id)
-}
-
-object StdPolicy {
- def fromJsonString(json: String): StdPolicy = {
- StdConverters.AllConverters.convertEx[StdPolicy](JsonTextFormat(json))
- }
-}
+ roleMapping: Map[String/* role name */, FullPriceTable]
+) extends PolicyModel
package gr.grnet.aquarium.store
-import collection.immutable.SortedMap
-import collection.immutable.SortedSet
+import collection.immutable
import gr.grnet.aquarium.logic.accounting.dsl.Timeslot
+import gr.grnet.aquarium.message.avro.gen.PolicyMsg
import gr.grnet.aquarium.policy.PolicyModel
+import gr.grnet.aquarium.message.avro.ModelFactory
/**
* A store for serialized policy models.
* @author Christos KK Loverdos <loverdos@gmail.com>
*/
trait PolicyStore {
- def loadAllPolicies: SortedSet[PolicyModel] = {
- val all = loadAndSortPoliciesWithin(0, Long.MaxValue)
- val set = SortedSet[PolicyModel]()
- set ++ all.valuesIterator
- }
+ def foreachPolicy[U](f: PolicyMsg ⇒ U): Unit
+
+ def loadSortedPoliciesWithin(fromMillis: Long, toMillis: Long): immutable.SortedMap[Timeslot, PolicyMsg]
- def loadAndSortPoliciesWithin(fromMillis: Long, toMillis: Long): SortedMap[Timeslot, PolicyModel]
+ def loadSortedPolicyModelsWithin(fromMillis: Long, toMillis: Long): immutable.SortedMap[Timeslot, PolicyModel] = {
+ loadSortedPoliciesWithin(fromMillis, toMillis).map { case (timeslot, msg) ⇒
+ (timeslot, ModelFactory.newPolicyModel(msg))
+ }
+ }
- def loadValidPolicyAt(atMillis: Long): Option[PolicyModel]
+ def loadPolicyAt(atMillis: Long): Option[PolicyMsg]
/**
* Store an accounting policy.
*/
- def insertPolicy(policy: PolicyModel): PolicyModel
-
+ def insertPolicy(policy: PolicyMsg): PolicyMsg
}
\ No newline at end of file
* or implied, of GRNET S.A.
*/
-package gr.grnet.aquarium.policy
+package gr.grnet.aquarium.store
-import org.junit.Test
-import gr.grnet.aquarium.Timespan
-import gr.grnet.aquarium.charging.{OnceChargingBehavior, ContinuousChargingBehavior, VMChargingBehavior}
-import gr.grnet.aquarium.charging.VMChargingBehavior.Selectors.Power
-import gr.grnet.aquarium.util.nameOfClass
-import FullPriceTable.DefaultSelectorKey
+import gr.grnet.aquarium.logic.accounting.dsl.Timeslot
+import gr.grnet.aquarium.message.avro.ModelFactory
+import gr.grnet.aquarium.policy.PolicyModel
+import scala.collection.immutable.{SortedMap, SortedSet}
/**
+ * Provides helper methods for the policy store.
*
* @author Christos KK Loverdos <loverdos@gmail.com>
*/
+object PolicyStoreHelpers {
+ def loadAllPoliciesToSortedModels(store: PolicyStore): SortedSet[PolicyModel] = {
+ var set = SortedSet[PolicyModel]()
+ store.foreachPolicy { msg ⇒
+ val policyModel = ModelFactory.newPolicyModel(msg)
+ set += policyModel
+ }
-class StdPolicyTest {
- final lazy val policy = StdPolicy(
- id = "default-policy",
- parentID = None,
-
- validityTimespan = Timespan(0),
-
- resourceTypes = Set(
- ResourceType("diskspace", "MB/Hr", nameOfClass[ContinuousChargingBehavior]),
- ResourceType("vmtime", "Hr", nameOfClass[VMChargingBehavior])
- ),
-
- chargingBehaviors = Set(
- nameOfClass[VMChargingBehavior],
- nameOfClass[ContinuousChargingBehavior],
- nameOfClass[OnceChargingBehavior]
- ),
-
- roleMapping = Map(
- "default" -> FullPriceTable(Map(
- "diskspace" -> Map(
- DefaultSelectorKey -> EffectivePriceTable(EffectiveUnitPrice(0.01) :: Nil)
- ),
- "vmtime" -> Map(
- Power.powerOn -> EffectivePriceTable(EffectiveUnitPrice(0.01) :: Nil),
- Power.powerOff -> EffectivePriceTable(EffectiveUnitPrice(0.001) :: Nil) // cheaper when the VM is OFF
- )
- ))
- )
- )
-
- @Test
- def testJson(): Unit = {
- val json = policy.toJsonString
- val obj = StdPolicy.fromJsonString(json)
+ set
+ }
- assert(policy == obj)
+ def loadSortedPolicyModelsWithin(
+ store: PolicyStore,
+ fromMillis: Long,
+ toMillis: Long
+ ): SortedMap[Timeslot, PolicyModel] = {
+ store.loadSortedPoliciesWithin(fromMillis, toMillis).map { case (timeslot, policy) ⇒
+ (timeslot, ModelFactory.newPolicyModel(policy))
+ }
}
}
import collection.immutable
import java.util.Date
import gr.grnet.aquarium.charging.state.{UserStateModel, StdUserState}
+import gr.grnet.aquarium.message.avro.gen.PolicyMsg
+import gr.grnet.aquarium.message.avro.{DummyHelpers, OrderingHelpers}
/**
* An implementation of various stores that persists parts in memory.
with Loggable {
private[this] var _userStates = List[UserStateModel]()
- private[this] var _policies = List[PolicyModel]()
+ private[this] var _policies = immutable.TreeSet[PolicyMsg]()(OrderingHelpers.DefaultPolicyMsgOrdering)
private[this] var _resourceEvents = List[ResourceEventModel]()
private[this] val imEventById: ConcurrentMap[String, MemIMEvent] = new ConcurrentHashMap[String, MemIMEvent]()
}
//- IMEventStore
- /**
- * Store an accounting policy.
- */
- def insertPolicy(policy: PolicyModel): PolicyModel = {
- val localPolicy = StdPolicy(
- id = policy.id,
- parentID = policy.parentID,
- validityTimespan = policy.validityTimespan,
- resourceTypes = policy.resourceTypes,
- chargingBehaviors = policy.chargingBehaviors,
- roleMapping = policy.roleMapping
- )
- _policies = localPolicy :: _policies
+ //+ PolicyStore
+ def insertPolicy(policy: PolicyMsg): PolicyMsg = synchronized {
+ _policies += policy
- localPolicy
+ policy
}
- def loadValidPolicyAt(atMillis: Long): Option[PolicyModel] = {
- var d = new Date(atMillis)
- /* sort in reverse order and return the first that includes this date*/
- _policies.sortWith({(x,y)=> y.validFrom < x.validFrom}).collectFirst({
- case t if(t.validityTimespan.toTimeslot.includes(d)) => t
- })
+ def loadPolicyAt(atMillis: Long): Option[PolicyMsg] = synchronized {
+ _policies.to(DummyHelpers.dummyPolicyMsgAt(atMillis)).lastOption
}
- private def emptyMap = immutable.SortedMap[Timeslot, PolicyModel]()
+ def loadSortedPoliciesWithin(fromMillis: Long, toMillis: Long): SortedMap[Timeslot, PolicyMsg] = {
+ immutable.SortedMap(_policies.
+ from(DummyHelpers.dummyPolicyMsgAt(fromMillis)).
+ to(DummyHelpers.dummyPolicyMsgAt(toMillis)).toSeq.
+ map(p ⇒ (Timeslot(p.getValidFromMillis, p.getValidToMillis), p)): _*
+ )
+ }
- def loadAndSortPoliciesWithin(fromMillis: Long, toMillis: Long): SortedMap[Timeslot, PolicyModel] = {
- val range = Timeslot(fromMillis,toMillis)
- _policies.foldLeft (emptyMap) { (map,p) =>
- if(range.overlaps(p.validityTimespan.toTimeslot))
- map + ((p.validityTimespan.toTimeslot,p))
- else
- map
- }
+ def foreachPolicy[U](f: (PolicyMsg) ⇒ U) {
+ _policies.foreach(f)
}
+ //- PolicyStore
}
object MemStoreProvider {
import gr.grnet.aquarium.logic.accounting.dsl.Timeslot
import collection.immutable
import gr.grnet.aquarium.charging.state.UserStateModel
+import gr.grnet.aquarium.message.avro.gen.PolicyMsg
+import gr.grnet.aquarium.message.avro.{DummyHelpers, OrderingHelpers, AvroHelpers}
/**
* Mongodb implementation of the various aquarium stores.
//+PolicyStore
- /**
- * Store an accounting policy.
- */
- def insertPolicy(policy: PolicyModel): PolicyModel = {
- val dbPolicy = MongoDBPolicy.fromOther(policy, new ObjectId().toStringMongod)
- MongoDBStore.insertObject(dbPolicy, policies, MongoDBStore.jsonSupportToDBObject)
+ def foreachPolicy[U](f: PolicyMsg ⇒ U) {
+ val cursor = policies.find()
+ withCloseable(cursor) { cursor ⇒
+ val dbObject = cursor.next()
+ val payload = dbObject.get(MongoDBStore.JsonNames.payload).asInstanceOf[Array[Byte]]
+ val policy = AvroHelpers.specificRecordOfBytes(payload, new PolicyMsg)
+ f(policy)
+ }
}
- private def emptyMap = immutable.SortedMap[Timeslot,PolicyModel]()
+ def insertPolicy(policy: PolicyMsg): PolicyMsg = {
+ val mongoID = new ObjectId()
+ policy.setInStoreID(mongoID.toStringMongod)
+ val dbObject = new BasicDBObjectBuilder().
+ add(MongoDBStore.JsonNames._id, mongoID).
+ add(MongoDBStore.JsonNames.validFromMillis, policy.getValidFromMillis).
+ add(MongoDBStore.JsonNames.validToMillis, policy.getValidToMillis).
+ add(MongoDBStore.JsonNames.payload, AvroHelpers.bytesOfSpecificRecord(policy)).
+ get()
- def loadValidPolicyAt(atMillis: Long): Option[PolicyModel] = {
- /*var d = new Date(atMillis)
- /* sort in reverse order and return the first that includes this date*/
- policies.sortWith({(x,y)=> y.validFrom < x.validFrom}).collectFirst({
- case t if(t.validityTimespan.toTimeslot.includes(d)) => t
- })*/
- None
+ MongoDBStore.insertDBObject(dbObject, policies)
+ policy
}
- def loadAndSortPoliciesWithin(fromMillis: Long, toMillis: Long): SortedMap[Timeslot, PolicyModel] = {
- TreeMap[Timeslot, PolicyModel]()
+ def loadPolicyAt(atMillis: Long): Option[PolicyMsg] = {
+ // FIXME Inefficient
+ var _policies = immutable.TreeSet[PolicyMsg]()(OrderingHelpers.DefaultPolicyMsgOrdering)
+ foreachPolicy(_policies += _)
+ _policies.to(DummyHelpers.dummyPolicyMsgAt(atMillis)).lastOption
+ }
+
+ def loadSortedPoliciesWithin(fromMillis: Long, toMillis: Long): immutable.SortedMap[Timeslot, PolicyMsg] = {
+ // FIXME Inefficient
+ var _policies = immutable.TreeSet[PolicyMsg]()(OrderingHelpers.DefaultPolicyMsgOrdering)
+ foreachPolicy(_policies += _)
+
+ immutable.SortedMap(_policies.
+ from(DummyHelpers.dummyPolicyMsgAt(fromMillis)).
+ to(DummyHelpers.dummyPolicyMsgAt(toMillis)).toSeq.
+ map(p ⇒ (Timeslot(p.getValidFromMillis, p.getValidToMillis), p)): _*
+ )
}
//-PolicyStore
}
object MongoDBStore {
object JsonNames {
+ final val payload = "payload"
final val _id = "_id"
+ final val occuredMillis = "occuredMillis"
+ final val receivedMillis = "receivedMillis"
+ final val validFromMillis = "validFromMillis"
+ final val validToMillis = "validToMillis"
}
/**
obj
}
+ def insertDBObject(dbObj: DBObject, collection: DBCollection) {
+ collection.insert(dbObj, WriteConcern.JOURNAL_SAFE)
+ }
+
def jsonSupportToDBObject(jsonSupport: JsonSupport) = {
StdConverters.AllConverters.convertEx[DBObject](jsonSupport)
}
object JsonHelpers {
final val DefaultObjectCodec = new ObjectMapper()
final val DefaultJsonFactory = {
- new JsonFactory(DefaultObjectCodec).
+ new JsonFactory(DefaultObjectCodec)/*.
enable(JsonGenerator.Feature.ESCAPE_NON_ASCII).
enable(JsonGenerator.Feature.QUOTE_FIELD_NAMES).
enable(JsonGenerator.Feature.QUOTE_NON_NUMERIC_NUMBERS).
enable(JsonGenerator.Feature.WRITE_NUMBERS_AS_STRINGS).
enable(JsonParser.Feature.CANONICALIZE_FIELD_NAMES).
enable(JsonParser.Feature.ALLOW_COMMENTS).
- enable(JsonParser.Feature.ALLOW_SINGLE_QUOTES)
+ enable(JsonParser.Feature.ALLOW_SINGLE_QUOTES)*/
}
def getJsonGenerator(out: OutputStream): JsonGenerator = {
-{ "jsonClass":"gr.grnet.aquarium.policy.StdPolicy",
+{
+ "originalID":"default-policy",
+ "inStoreID":null,
+ "parentID":null,
+ "validFromMillis":"0",
+ "validToMillis":"9223372036854775807",
- "id":"test-default-policy",
-
- "validityTimespan":{
- "fromMillis":0,
- "toMillis":9223372036854775807
- },
-
- "resourceTypes":[{
- "jsonClass":"gr.grnet.aquarium.policy.ResourceType",
- "name":"diskspace",
- "unit":"MB/Hr",
- "chargingBehavior":"gr.grnet.aquarium.charging.ContinuousChargingBehavior"
- },{
- "jsonClass":"gr.grnet.aquarium.policy.ResourceType",
- "name":"vmtime",
- "unit":"Hr",
- "chargingBehavior":"gr.grnet.aquarium.charging.VMChargingBehavior"
- },{
- "jsonClass":"gr.grnet.aquarium.policy.ResourceType",
- "name":"addcredits",
- "unit":"credits",
- "chargingBehavior":"gr.grnet.aquarium.charging.OnceChargingBehavior"
- }],
+ "resourceTypes":[
+ {
+ "name":"diskspace",
+ "unit":"MB/Hr",
+ "chargingBehaviorClass":"gr.grnet.aquarium.charging.ContinuousChargingBehavior"
+ },
+ {
+ "name":"vmtime",
+ "unit":"Hr",
+ "chargingBehaviorClass":"gr.grnet.aquarium.charging.VMChargingBehavior"
+ },
+ {
+ "name":"addcredits",
+ "unit":"Credits",
+ "chargingBehaviorClass":"gr.grnet.aquarium.charging.OnceChargingBehavior"
+ }
+ ],
"chargingBehaviors":[
"gr.grnet.aquarium.charging.VMChargingBehavior",
"gr.grnet.aquarium.charging.ContinuousChargingBehavior",
- "gr.grnet.aquarium.charging.OnceChargingBehavior"
- ],
+ "gr.grnet.aquarium.charging.OnceChargingBehavior" ],
"roleMapping":{
"default":{
- "jsonClass":"gr.grnet.aquarium.policy.FullPriceTable",
-
"perResource":{
"diskspace":{
- "default":{ "jsonClass":"gr.grnet.aquarium.policy.EffectivePriceTable",
- "priceOverrides":[{ "jsonClass":"gr.grnet.aquarium.policy.EffectiveUnitPrice",
- "unitPrice":0.01
- }]
+ "default":{
+ "selectorValue":{
+ "gr.grnet.aquarium.message.avro.gen.EffectivePriceTableMsg":{
+ "priceOverrides":[
+ {
+ "unitPrice":"0.01",
+ "when":null
+ }
+ ]
+ }
+ }
}
},
"vmtime":{
- "powerOn":{ "jsonClass":"gr.grnet.aquarium.policy.EffectivePriceTable",
- "priceOverrides":[{ "jsonClass":"gr.grnet.aquarium.policy.EffectiveUnitPrice",
- "unitPrice":0.01
- }]
+ "powerOff":{
+ "selectorValue":{
+ "gr.grnet.aquarium.message.avro.gen.EffectivePriceTableMsg":{
+ "priceOverrides":[
+ {
+ "unitPrice":"0.0010",
+ "when":null
+ }
+ ]
+ }
+ }
},
- "powerOff":{ "jsonClass":"gr.grnet.aquarium.policy.EffectivePriceTable",
- "priceOverrides":[{ "jsonClass":"gr.grnet.aquarium.policy.EffectiveUnitPrice",
- "unitPrice":0.0010
- }]
+ "powerOn":{
+ "selectorValue":{
+ "gr.grnet.aquarium.message.avro.gen.EffectivePriceTableMsg":{
+ "priceOverrides":[
+ {
+ "unitPrice":"0.01",
+ "when":null
+ }
+ ]
+ }
+ }
}
},
"addcredits":{
- "default":{ "jsonClass":"gr.grnet.aquarium.policy.EffectivePriceTable",
- "priceOverrides":[{ "jsonClass":"gr.grnet.aquarium.policy.EffectiveUnitPrice",
- "unitPrice":-1.0
- }]
+ "default":{
+ "selectorValue":{
+ "gr.grnet.aquarium.message.avro.gen.EffectivePriceTableMsg":{
+ "priceOverrides":[
+ {
+ "unitPrice":"-1.0",
+ "when":null
+ }
+ ]
+ }
+ }
}
}
}
val aquarium = {
exec("mongo aquarium --eval db.resevents.remove();db.imevents.remove();db.policies.remove();db.userstates.remove()",
Console.err.println(_))
- new AquariumBuilder(props, ResourceLocator.DefaultPolicyModel).
+ new AquariumBuilder(props, ResourceLocator.DefaultPolicyMsg).
//update(Aquarium.EnvKeys.storeProvider, new MemStoreProvider).
update(Aquarium.EnvKeys.eventsStoreFolder,Some(new File(".."))).
build()
@Test
def testOne() {
val policyConf = PolicyMsg.newBuilder().
- setChargingBehaviors(newChargingBehaviorMsgs(
- nameOfClass[gr.grnet.aquarium.charging.VMChargingBehavior],
- nameOfClass[gr.grnet.aquarium.charging.ContinuousChargingBehavior],
- nameOfClass[gr.grnet.aquarium.charging.OnceChargingBehavior])
- ).
- setID("default-policy").
- setParentID("").
+ setOriginalID("default-policy").
+ setInStoreID(null).
+ setParentID(null).
setValidFromMillis(0L).
setValidToMillis(Long.MaxValue).
setResourceTypes(newResourceTypeMsgs(
- newResourceTypeMsg("diskspace", "MB/Hr", nameOfClass[gr.grnet.aquarium.charging.ContinuousChargingBehavior]),
- newResourceTypeMsg("vmtime", "Hr", nameOfClass[gr.grnet.aquarium.charging.VMChargingBehavior]),
- newResourceTypeMsg("addcredits", "Credits", nameOfClass[gr.grnet.aquarium.charging.OnceChargingBehavior]))
- ).
+ newResourceTypeMsg("diskspace", "MB/Hr", nameOfClass[gr.grnet.aquarium.charging.ContinuousChargingBehavior]),
+ newResourceTypeMsg("vmtime", "Hr", nameOfClass[gr.grnet.aquarium.charging.VMChargingBehavior]),
+ newResourceTypeMsg("addcredits", "Credits", nameOfClass[gr.grnet.aquarium.charging.OnceChargingBehavior]))
+ ).
+ setChargingBehaviors(newChargingBehaviorMsgs(
+ nameOfClass[gr.grnet.aquarium.charging.VMChargingBehavior],
+ nameOfClass[gr.grnet.aquarium.charging.ContinuousChargingBehavior],
+ nameOfClass[gr.grnet.aquarium.charging.OnceChargingBehavior])
+ ).
setRoleMapping(newRoleMappingMsg(
"default" -> newFullPriceTableMsg(
"diskspace" -> Map(
@Test
def testJSONObjectOutput() {
val rcEvent = ResourceEventMsg.newBuilder().
- setId("id-1").
+ setOriginalID("id-1").
setClientID("client-1").
setResource("diskspace").
setInstanceID("1").
- setIdInStore("").
setOccurredMillis(1000L).
setUserID("foouser").
setValue("123.32").