<excludes>
<exclude>**/mapred/tether/**</exclude>
</excludes>
+ <stringType>String</stringType>
<sourceDirectory>${project.basedir}/src/main/avro/</sourceDirectory>
<outputDirectory>${project.basedir}/src/main/java/</outputDirectory>
<!--<outputDirectory>${project.build.directory}/generated-sources/java</outputDirectory>-->
boolean,
double,
bytes,
- string
+ string,
+ array<AnyValueMsg>,
+ map<AnyValueMsg>
} anyValue;
}
}
\ No newline at end of file
protocol AquariumEvents {
import idl "aquarium-anyvalue.avdl";
+ // standalone details message
+ record DetailsMsg {
+ map<AnyValueMsg> details;
+ }
+
record ResourceEventMsg {
string @aliases(["id"]) originalID; // From message creator
union {string, null} @aliases(["_id", "idInStore"]) inStoreID; // From Aquarium (message recipient)
string @aliases(["resourceType"]) resource;
string instanceID;
string value;
+ boolean isSynthetic = false;
map<AnyValueMsg> details;
}
string userID;
string clientID;
string eventVersion = "1.0";
+ string eventType;
boolean isActive;
string role;
+ boolean isSynthetic = false;
map<AnyValueMsg> details;
}
}
\ No newline at end of file
record UserAgreementMsg {
string id;
- union {string, null} relatedIMEventID;
+ union {string, null} relatedIMEventOriginalID;
+ string userID;
long @order("ascending") validFromMillis;
long validToMillis;
string role;
union {FullPriceTableMsg, null} fullPriceTableRef; // If null, then get from aquarium policy
}
- record WorkingResourceInstanceChargingStateMsg {
+ record ResourceInstanceChargingStateMsg {
+ string clientID; // who sent me?
+ string resource; // what kind of resource am I?
+ string instanceID; // who am I?
map<AnyValueMsg> details;
array<ResourceEventMsg> previousEvents;
array<ResourceEventMsg> implicitlyIssuedStartEvents;
double currentValue;
}
- record WorkingResourcesChargingStateMsg {
+ record ResourcesChargingStateMsg {
+ string resource; // who am I?
map<AnyValueMsg> details;
- map<WorkingResourceInstanceChargingStateMsg> stateOfResourceInstance;
+ map<ResourceInstanceChargingStateMsg> stateOfResourceInstance;
}
- record WorkingAgreementHistoryMsg {
+ record UserAgreementHistoryMsg {
array<UserAgreementMsg> agreements;
}
long stopMillis;
double unitPrice;
string explanation = "";
- double creditsToSubtract;
+ double creditsToSubtract = 0.0;
}
+ // The following equation must hold (within a very small error):
+ // `newTotalCredits = oldTotalCredits - sumOfCreditsToSubtract`.
record WalletEntryMsg {
- string userID;
- double sumOfCreditsToSubtract;
+ string userID; // The user ID this wallet entry is related to.
+ double sumOfCreditsToSubtract; // The credit amount generated for this wallet entry.
double oldTotalCredits;
double newTotalCredits;
- long whenComputedMillis;
+ long whenComputedMillis; // When the computation took place
long referenceStartMillis;
long referenceStopMillis;
int billingYear;
int billingMonth;
- int billingDay;
- array<ChargeslotMsg> chargeslots;
+ int billingMonthDay;
+ array<ChargeslotMsg> chargeslots; // The details of the credit computation
array<ResourceEventMsg> resourceEvents; // current is the last one
ResourceTypeMsg resourceType;
boolean isSynthetic = false;
}
- record WorkingUserStateMsg {
+ // convenient wrapper for a list of wallet entries
+ record WalletEntriesMsg {
+ array<WalletEntryMsg> entries;
+ }
+
+ record UserStateMsg {
+ string @aliases(["id"]) originalID; // internal Aquarium ID
+ union {string, null} @aliases(["_id", "idInStore"]) inStoreID; // From Aquarium store
string userID;
- union {string, null} parentUserStateIDInStore;
+ long occurredMillis; // When we created the event
+ union {string, null} parentOriginalID;
+ union {string, null} parentInStoreID;
map<ResourceTypeMsg> resourceTypesMap;
- map<WorkingResourcesChargingStateMsg> workingStateOfResources;
- double totalCredits;
- WorkingAgreementHistoryMsg workingAgreementHistory;
- long latestUpdateMillis;
+ map<ResourcesChargingStateMsg> stateOfResources; // key is resourceType.name
+ double totalCredits = 0.0;
+ UserAgreementHistoryMsg agreementHistory;
+ long latestUpdateMillis; // // last update of this working user state
long latestResourceEventOccurredMillis;
- long billingPeriodOutOfSyncResourceEventsCounter;
+ long billingPeriodOutOfSyncResourceEventsCounter = 0;
+ int billingYear;
+ int billingMonth;
+ int billingMonthDay;
+ boolean isFullBillingMonth = false;
array<WalletEntryMsg> walletEntries;
}
}
\ No newline at end of file
package gr.grnet.aquarium.message.avro.gen;
@SuppressWarnings("all")
public class AnyValueMsg 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\":\"AnyValueMsg\",\"namespace\":\"gr.grnet.aquarium.message.avro.gen\",\"fields\":[{\"name\":\"anyValue\",\"type\":[\"null\",\"int\",\"long\",\"boolean\",\"double\",\"bytes\",\"string\"]}]}");
+ public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"AnyValueMsg\",\"namespace\":\"gr.grnet.aquarium.message.avro.gen\",\"fields\":[{\"name\":\"anyValue\",\"type\":[\"null\",\"int\",\"long\",\"boolean\",\"double\",\"bytes\",{\"type\":\"string\",\"avro.java.string\":\"String\"},{\"type\":\"array\",\"items\":\"AnyValueMsg\"},{\"type\":\"map\",\"values\":\"AnyValueMsg\",\"avro.java.string\":\"String\"}]}]}");
@Deprecated public java.lang.Object anyValue;
public org.apache.avro.Schema getSchema() { return SCHEMA$; }
// Used by DatumWriter. Applications should not call.
@SuppressWarnings("all")
public interface AquariumAny {
- public static final org.apache.avro.Protocol PROTOCOL = org.apache.avro.Protocol.parse("{\"protocol\":\"AquariumAny\",\"namespace\":\"gr.grnet.aquarium.message.avro.gen\",\"types\":[{\"type\":\"record\",\"name\":\"AnyValueMsg\",\"fields\":[{\"name\":\"anyValue\",\"type\":[\"null\",\"int\",\"long\",\"boolean\",\"double\",\"bytes\",\"string\"]}]}],\"messages\":{}}");
+ public static final org.apache.avro.Protocol PROTOCOL = org.apache.avro.Protocol.parse("{\"protocol\":\"AquariumAny\",\"namespace\":\"gr.grnet.aquarium.message.avro.gen\",\"types\":[{\"type\":\"record\",\"name\":\"AnyValueMsg\",\"fields\":[{\"name\":\"anyValue\",\"type\":[\"null\",\"int\",\"long\",\"boolean\",\"double\",\"bytes\",{\"type\":\"string\",\"avro.java.string\":\"String\"},{\"type\":\"array\",\"items\":\"AnyValueMsg\"},{\"type\":\"map\",\"values\":\"AnyValueMsg\",\"avro.java.string\":\"String\"}]}]}],\"messages\":{}}");
@SuppressWarnings("all")
public interface Callback extends AquariumAny {
@SuppressWarnings("all")
public interface AquariumBill {
- public static final org.apache.avro.Protocol PROTOCOL = org.apache.avro.Protocol.parse("{\"protocol\":\"AquariumBill\",\"namespace\":\"gr.grnet.aquarium.message.avro.gen\",\"types\":[{\"type\":\"record\",\"name\":\"ChargeEntryMsg\",\"fields\":[{\"name\":\"id\",\"type\":\"string\"},{\"name\":\"unitPrice\",\"type\":\"string\"},{\"name\":\"startTime\",\"type\":\"string\"},{\"name\":\"endTime\",\"type\":\"string\"},{\"name\":\"ellapsedTime\",\"type\":\"string\"},{\"name\":\"credits\",\"type\":\"string\"}]},{\"type\":\"record\",\"name\":\"EventEntryMsg\",\"fields\":[{\"name\":\"eventType\",\"type\":\"string\"},{\"name\":\"details\",\"type\":{\"type\":\"array\",\"items\":\"ChargeEntryMsg\"}}]},{\"type\":\"record\",\"name\":\"ResourceEntryMsg\",\"fields\":[{\"name\":\"resourceName\",\"type\":\"string\"},{\"name\":\"resourceType\",\"type\":\"string\"},{\"name\":\"unitName\",\"type\":\"string\"},{\"name\":\"totalCredits\",\"type\":\"string\"},{\"name\":\"details\",\"type\":{\"type\":\"array\",\"items\":\"EventEntryMsg\"}}]},{\"type\":\"record\",\"name\":\"BillEntryMsg\",\"fields\":[{\"name\":\"id\",\"type\":\"string\"},{\"name\":\"userID\",\"type\":\"string\"},{\"name\":\"status\",\"type\":\"string\"},{\"name\":\"remainingCredits\",\"type\":\"string\"},{\"name\":\"deductedCredits\",\"type\":\"string\"},{\"name\":\"startTime\",\"type\":\"string\"},{\"name\":\"endTime\",\"type\":\"string\"},{\"name\":\"bill\",\"type\":{\"type\":\"array\",\"items\":\"ResourceEntryMsg\"}}]}],\"messages\":{}}");
+ public static final org.apache.avro.Protocol PROTOCOL = org.apache.avro.Protocol.parse("{\"protocol\":\"AquariumBill\",\"namespace\":\"gr.grnet.aquarium.message.avro.gen\",\"types\":[{\"type\":\"record\",\"name\":\"ChargeEntryMsg\",\"fields\":[{\"name\":\"id\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"unitPrice\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"startTime\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"endTime\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"ellapsedTime\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"credits\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}}]},{\"type\":\"record\",\"name\":\"EventEntryMsg\",\"fields\":[{\"name\":\"eventType\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"details\",\"type\":{\"type\":\"array\",\"items\":\"ChargeEntryMsg\"}}]},{\"type\":\"record\",\"name\":\"ResourceEntryMsg\",\"fields\":[{\"name\":\"resourceName\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"resourceType\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"unitName\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"totalCredits\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"details\",\"type\":{\"type\":\"array\",\"items\":\"EventEntryMsg\"}}]},{\"type\":\"record\",\"name\":\"BillEntryMsg\",\"fields\":[{\"name\":\"id\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"userID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"status\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"remainingCredits\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"deductedCredits\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"startTime\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"endTime\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"bill\",\"type\":{\"type\":\"array\",\"items\":\"ResourceEntryMsg\"}}]}],\"messages\":{}}");
@SuppressWarnings("all")
public interface Callback extends AquariumBill {
@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\":\"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\":{}}");
+ 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\",{\"type\":\"string\",\"avro.java.string\":\"String\"},{\"type\":\"array\",\"items\":\"AnyValueMsg\"},{\"type\":\"map\",\"values\":\"AnyValueMsg\",\"avro.java.string\":\"String\"}]}]},{\"type\":\"record\",\"name\":\"DetailsMsg\",\"fields\":[{\"name\":\"details\",\"type\":{\"type\":\"map\",\"values\":\"AnyValueMsg\",\"avro.java.string\":\"String\"}}]},{\"type\":\"record\",\"name\":\"ResourceEventMsg\",\"fields\":[{\"name\":\"originalID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"inStoreID\",\"type\":[{\"type\":\"string\",\"avro.java.string\":\"String\"},\"null\"]},{\"name\":\"occurredMillis\",\"type\":\"long\"},{\"name\":\"receivedMillis\",\"type\":\"long\",\"default\":0},{\"name\":\"userID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"clientID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"eventVersion\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"default\":\"1.0\"},{\"name\":\"resource\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"instanceID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"value\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"isSynthetic\",\"type\":\"boolean\",\"default\":false},{\"name\":\"details\",\"type\":{\"type\":\"map\",\"values\":\"AnyValueMsg\",\"avro.java.string\":\"String\"}}]},{\"type\":\"record\",\"name\":\"IMEventMsg\",\"fields\":[{\"name\":\"originalID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"inStoreID\",\"type\":[{\"type\":\"string\",\"avro.java.string\":\"String\"},\"null\"]},{\"name\":\"occurredMillis\",\"type\":\"long\"},{\"name\":\"receivedMillis\",\"type\":\"long\",\"default\":0},{\"name\":\"userID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"clientID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"eventVersion\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"default\":\"1.0\"},{\"name\":\"eventType\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"isActive\",\"type\":\"boolean\"},{\"name\":\"role\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"isSynthetic\",\"type\":\"boolean\",\"default\":false},{\"name\":\"details\",\"type\":{\"type\":\"map\",\"values\":\"AnyValueMsg\",\"avro.java.string\":\"String\"}}]}],\"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\":\"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\":{}}");
+ 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\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"unit\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"chargingBehaviorClass\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}}]},{\"type\":\"record\",\"name\":\"CronSpecTupleMsg\",\"fields\":[{\"name\":\"a\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"b\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"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\",\"avro.java.string\":\"String\"}]}]},{\"type\":\"record\",\"name\":\"FullPriceTableMsg\",\"fields\":[{\"name\":\"perResource\",\"type\":{\"type\":\"map\",\"values\":{\"type\":\"map\",\"values\":\"SelectorValueMsg\",\"avro.java.string\":\"String\"},\"avro.java.string\":\"String\"}}]},{\"type\":\"record\",\"name\":\"PolicyMsg\",\"fields\":[{\"name\":\"originalID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"inStoreID\",\"type\":[{\"type\":\"string\",\"avro.java.string\":\"String\"},\"null\"]},{\"name\":\"parentID\",\"type\":[{\"type\":\"string\",\"avro.java.string\":\"String\"},\"null\"]},{\"name\":\"validFromMillis\",\"type\":\"long\"},{\"name\":\"validToMillis\",\"type\":\"long\"},{\"name\":\"resourceTypes\",\"type\":{\"type\":\"array\",\"items\":\"ResourceTypeMsg\"}},{\"name\":\"chargingBehaviors\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"string\",\"avro.java.string\":\"String\"}}},{\"name\":\"roleMapping\",\"type\":{\"type\":\"map\",\"values\":\"FullPriceTableMsg\",\"avro.java.string\":\"String\"}}]}],\"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\":\"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\":{}}");
+ 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\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"unit\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"chargingBehaviorClass\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}}]},{\"type\":\"record\",\"name\":\"CronSpecTupleMsg\",\"fields\":[{\"name\":\"a\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"b\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"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\",\"avro.java.string\":\"String\"}]}]},{\"type\":\"record\",\"name\":\"FullPriceTableMsg\",\"fields\":[{\"name\":\"perResource\",\"type\":{\"type\":\"map\",\"values\":{\"type\":\"map\",\"values\":\"SelectorValueMsg\",\"avro.java.string\":\"String\"},\"avro.java.string\":\"String\"}}]},{\"type\":\"record\",\"name\":\"PolicyMsg\",\"fields\":[{\"name\":\"originalID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"inStoreID\",\"type\":[{\"type\":\"string\",\"avro.java.string\":\"String\"},\"null\"]},{\"name\":\"parentID\",\"type\":[{\"type\":\"string\",\"avro.java.string\":\"String\"},\"null\"]},{\"name\":\"validFromMillis\",\"type\":\"long\"},{\"name\":\"validToMillis\",\"type\":\"long\"},{\"name\":\"resourceTypes\",\"type\":{\"type\":\"array\",\"items\":\"ResourceTypeMsg\"}},{\"name\":\"chargingBehaviors\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"string\",\"avro.java.string\":\"String\"}}},{\"name\":\"roleMapping\",\"type\":{\"type\":\"map\",\"values\":\"FullPriceTableMsg\",\"avro.java.string\":\"String\"}}]},{\"type\":\"record\",\"name\":\"AnyValueMsg\",\"fields\":[{\"name\":\"anyValue\",\"type\":[\"null\",\"int\",\"long\",\"boolean\",\"double\",\"bytes\",{\"type\":\"string\",\"avro.java.string\":\"String\"},{\"type\":\"array\",\"items\":\"AnyValueMsg\"},{\"type\":\"map\",\"values\":\"AnyValueMsg\",\"avro.java.string\":\"String\"}]}]},{\"type\":\"record\",\"name\":\"DetailsMsg\",\"fields\":[{\"name\":\"details\",\"type\":{\"type\":\"map\",\"values\":\"AnyValueMsg\",\"avro.java.string\":\"String\"}}]},{\"type\":\"record\",\"name\":\"ResourceEventMsg\",\"fields\":[{\"name\":\"originalID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"inStoreID\",\"type\":[{\"type\":\"string\",\"avro.java.string\":\"String\"},\"null\"]},{\"name\":\"occurredMillis\",\"type\":\"long\"},{\"name\":\"receivedMillis\",\"type\":\"long\",\"default\":0},{\"name\":\"userID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"clientID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"eventVersion\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"default\":\"1.0\"},{\"name\":\"resource\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"instanceID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"value\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"isSynthetic\",\"type\":\"boolean\",\"default\":false},{\"name\":\"details\",\"type\":{\"type\":\"map\",\"values\":\"AnyValueMsg\",\"avro.java.string\":\"String\"}}]},{\"type\":\"record\",\"name\":\"IMEventMsg\",\"fields\":[{\"name\":\"originalID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"inStoreID\",\"type\":[{\"type\":\"string\",\"avro.java.string\":\"String\"},\"null\"]},{\"name\":\"occurredMillis\",\"type\":\"long\"},{\"name\":\"receivedMillis\",\"type\":\"long\",\"default\":0},{\"name\":\"userID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"clientID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"eventVersion\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"default\":\"1.0\"},{\"name\":\"eventType\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"isActive\",\"type\":\"boolean\"},{\"name\":\"role\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"isSynthetic\",\"type\":\"boolean\",\"default\":false},{\"name\":\"details\",\"type\":{\"type\":\"map\",\"values\":\"AnyValueMsg\",\"avro.java.string\":\"String\"}}]},{\"type\":\"record\",\"name\":\"UserAgreementMsg\",\"fields\":[{\"name\":\"id\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"relatedIMEventOriginalID\",\"type\":[{\"type\":\"string\",\"avro.java.string\":\"String\"},\"null\"]},{\"name\":\"userID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"validFromMillis\",\"type\":\"long\"},{\"name\":\"validToMillis\",\"type\":\"long\"},{\"name\":\"role\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"fullPriceTableRef\",\"type\":[\"FullPriceTableMsg\",\"null\"]}]},{\"type\":\"record\",\"name\":\"ResourceInstanceChargingStateMsg\",\"fields\":[{\"name\":\"clientID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"resource\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"instanceID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"details\",\"type\":{\"type\":\"map\",\"values\":\"AnyValueMsg\",\"avro.java.string\":\"String\"}},{\"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\":\"ResourcesChargingStateMsg\",\"fields\":[{\"name\":\"resource\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"details\",\"type\":{\"type\":\"map\",\"values\":\"AnyValueMsg\",\"avro.java.string\":\"String\"}},{\"name\":\"stateOfResourceInstance\",\"type\":{\"type\":\"map\",\"values\":\"ResourceInstanceChargingStateMsg\",\"avro.java.string\":\"String\"}}]},{\"type\":\"record\",\"name\":\"UserAgreementHistoryMsg\",\"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\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"default\":\"\"},{\"name\":\"creditsToSubtract\",\"type\":\"double\",\"default\":0.0}]},{\"type\":\"record\",\"name\":\"WalletEntryMsg\",\"fields\":[{\"name\":\"userID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"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\":\"billingMonthDay\",\"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\":\"WalletEntriesMsg\",\"fields\":[{\"name\":\"entries\",\"type\":{\"type\":\"array\",\"items\":\"WalletEntryMsg\"}}]},{\"type\":\"record\",\"name\":\"UserStateMsg\",\"fields\":[{\"name\":\"originalID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"inStoreID\",\"type\":[{\"type\":\"string\",\"avro.java.string\":\"String\"},\"null\"]},{\"name\":\"userID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"occurredMillis\",\"type\":\"long\"},{\"name\":\"parentOriginalID\",\"type\":[{\"type\":\"string\",\"avro.java.string\":\"String\"},\"null\"]},{\"name\":\"parentInStoreID\",\"type\":[{\"type\":\"string\",\"avro.java.string\":\"String\"},\"null\"]},{\"name\":\"resourceTypesMap\",\"type\":{\"type\":\"map\",\"values\":\"ResourceTypeMsg\",\"avro.java.string\":\"String\"}},{\"name\":\"stateOfResources\",\"type\":{\"type\":\"map\",\"values\":\"ResourcesChargingStateMsg\",\"avro.java.string\":\"String\"}},{\"name\":\"totalCredits\",\"type\":\"double\",\"default\":0.0},{\"name\":\"agreementHistory\",\"type\":\"UserAgreementHistoryMsg\"},{\"name\":\"latestUpdateMillis\",\"type\":\"long\"},{\"name\":\"latestResourceEventOccurredMillis\",\"type\":\"long\"},{\"name\":\"billingPeriodOutOfSyncResourceEventsCounter\",\"type\":\"long\",\"default\":0},{\"name\":\"billingYear\",\"type\":\"int\"},{\"name\":\"billingMonth\",\"type\":\"int\"},{\"name\":\"billingMonthDay\",\"type\":\"int\"},{\"name\":\"isFullBillingMonth\",\"type\":\"boolean\",\"default\":false},{\"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 BillEntryMsg 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\":\"BillEntryMsg\",\"namespace\":\"gr.grnet.aquarium.message.avro.gen\",\"fields\":[{\"name\":\"id\",\"type\":\"string\"},{\"name\":\"userID\",\"type\":\"string\"},{\"name\":\"status\",\"type\":\"string\"},{\"name\":\"remainingCredits\",\"type\":\"string\"},{\"name\":\"deductedCredits\",\"type\":\"string\"},{\"name\":\"startTime\",\"type\":\"string\"},{\"name\":\"endTime\",\"type\":\"string\"},{\"name\":\"bill\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"ResourceEntryMsg\",\"fields\":[{\"name\":\"resourceName\",\"type\":\"string\"},{\"name\":\"resourceType\",\"type\":\"string\"},{\"name\":\"unitName\",\"type\":\"string\"},{\"name\":\"totalCredits\",\"type\":\"string\"},{\"name\":\"details\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"EventEntryMsg\",\"fields\":[{\"name\":\"eventType\",\"type\":\"string\"},{\"name\":\"details\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"ChargeEntryMsg\",\"fields\":[{\"name\":\"id\",\"type\":\"string\"},{\"name\":\"unitPrice\",\"type\":\"string\"},{\"name\":\"startTime\",\"type\":\"string\"},{\"name\":\"endTime\",\"type\":\"string\"},{\"name\":\"ellapsedTime\",\"type\":\"string\"},{\"name\":\"credits\",\"type\":\"string\"}]}}}]}}}]}}}]}");
- @Deprecated public java.lang.CharSequence id;
- @Deprecated public java.lang.CharSequence userID;
- @Deprecated public java.lang.CharSequence status;
- @Deprecated public java.lang.CharSequence remainingCredits;
- @Deprecated public java.lang.CharSequence deductedCredits;
- @Deprecated public java.lang.CharSequence startTime;
- @Deprecated public java.lang.CharSequence endTime;
+ public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"BillEntryMsg\",\"namespace\":\"gr.grnet.aquarium.message.avro.gen\",\"fields\":[{\"name\":\"id\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"userID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"status\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"remainingCredits\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"deductedCredits\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"startTime\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"endTime\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"bill\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"ResourceEntryMsg\",\"fields\":[{\"name\":\"resourceName\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"resourceType\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"unitName\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"totalCredits\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"details\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"EventEntryMsg\",\"fields\":[{\"name\":\"eventType\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"details\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"ChargeEntryMsg\",\"fields\":[{\"name\":\"id\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"unitPrice\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"startTime\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"endTime\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"ellapsedTime\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"credits\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}}]}}}]}}}]}}}]}");
+ @Deprecated public java.lang.String id;
+ @Deprecated public java.lang.String userID;
+ @Deprecated public java.lang.String status;
+ @Deprecated public java.lang.String remainingCredits;
+ @Deprecated public java.lang.String deductedCredits;
+ @Deprecated public java.lang.String startTime;
+ @Deprecated public java.lang.String endTime;
@Deprecated public java.util.List<gr.grnet.aquarium.message.avro.gen.ResourceEntryMsg> bill;
public org.apache.avro.Schema getSchema() { return SCHEMA$; }
// Used by DatumWriter. Applications should not call.
@SuppressWarnings(value="unchecked")
public void put(int field$, java.lang.Object value$) {
switch (field$) {
- case 0: id = (java.lang.CharSequence)value$; break;
- case 1: userID = (java.lang.CharSequence)value$; break;
- case 2: status = (java.lang.CharSequence)value$; break;
- case 3: remainingCredits = (java.lang.CharSequence)value$; break;
- case 4: deductedCredits = (java.lang.CharSequence)value$; break;
- case 5: startTime = (java.lang.CharSequence)value$; break;
- case 6: endTime = (java.lang.CharSequence)value$; break;
+ case 0: id = (java.lang.String)value$; break;
+ case 1: userID = (java.lang.String)value$; break;
+ case 2: status = (java.lang.String)value$; break;
+ case 3: remainingCredits = (java.lang.String)value$; break;
+ case 4: deductedCredits = (java.lang.String)value$; break;
+ case 5: startTime = (java.lang.String)value$; break;
+ case 6: endTime = (java.lang.String)value$; break;
case 7: bill = (java.util.List<gr.grnet.aquarium.message.avro.gen.ResourceEntryMsg>)value$; break;
default: throw new org.apache.avro.AvroRuntimeException("Bad index");
}
/**
* Gets the value of the 'id' field.
*/
- public java.lang.CharSequence getId() {
+ public java.lang.String getId() {
return id;
}
* Sets the value of the 'id' field.
* @param value the value to set.
*/
- public void setId(java.lang.CharSequence value) {
+ public void setId(java.lang.String value) {
this.id = value;
}
/**
* Gets the value of the 'userID' field.
*/
- public java.lang.CharSequence getUserID() {
+ public java.lang.String getUserID() {
return userID;
}
* Sets the value of the 'userID' field.
* @param value the value to set.
*/
- public void setUserID(java.lang.CharSequence value) {
+ public void setUserID(java.lang.String value) {
this.userID = value;
}
/**
* Gets the value of the 'status' field.
*/
- public java.lang.CharSequence getStatus() {
+ public java.lang.String getStatus() {
return status;
}
* Sets the value of the 'status' field.
* @param value the value to set.
*/
- public void setStatus(java.lang.CharSequence value) {
+ public void setStatus(java.lang.String value) {
this.status = value;
}
/**
* Gets the value of the 'remainingCredits' field.
*/
- public java.lang.CharSequence getRemainingCredits() {
+ public java.lang.String getRemainingCredits() {
return remainingCredits;
}
* Sets the value of the 'remainingCredits' field.
* @param value the value to set.
*/
- public void setRemainingCredits(java.lang.CharSequence value) {
+ public void setRemainingCredits(java.lang.String value) {
this.remainingCredits = value;
}
/**
* Gets the value of the 'deductedCredits' field.
*/
- public java.lang.CharSequence getDeductedCredits() {
+ public java.lang.String getDeductedCredits() {
return deductedCredits;
}
* Sets the value of the 'deductedCredits' field.
* @param value the value to set.
*/
- public void setDeductedCredits(java.lang.CharSequence value) {
+ public void setDeductedCredits(java.lang.String value) {
this.deductedCredits = value;
}
/**
* Gets the value of the 'startTime' field.
*/
- public java.lang.CharSequence getStartTime() {
+ public java.lang.String getStartTime() {
return startTime;
}
* Sets the value of the 'startTime' field.
* @param value the value to set.
*/
- public void setStartTime(java.lang.CharSequence value) {
+ public void setStartTime(java.lang.String value) {
this.startTime = value;
}
/**
* Gets the value of the 'endTime' field.
*/
- public java.lang.CharSequence getEndTime() {
+ public java.lang.String getEndTime() {
return endTime;
}
* Sets the value of the 'endTime' field.
* @param value the value to set.
*/
- public void setEndTime(java.lang.CharSequence value) {
+ public void setEndTime(java.lang.String value) {
this.endTime = value;
}
public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<BillEntryMsg>
implements org.apache.avro.data.RecordBuilder<BillEntryMsg> {
- private java.lang.CharSequence id;
- private java.lang.CharSequence userID;
- private java.lang.CharSequence status;
- private java.lang.CharSequence remainingCredits;
- private java.lang.CharSequence deductedCredits;
- private java.lang.CharSequence startTime;
- private java.lang.CharSequence endTime;
+ private java.lang.String id;
+ private java.lang.String userID;
+ private java.lang.String status;
+ private java.lang.String remainingCredits;
+ private java.lang.String deductedCredits;
+ private java.lang.String startTime;
+ private java.lang.String endTime;
private java.util.List<gr.grnet.aquarium.message.avro.gen.ResourceEntryMsg> bill;
/** Creates a new Builder */
private Builder(gr.grnet.aquarium.message.avro.gen.BillEntryMsg other) {
super(gr.grnet.aquarium.message.avro.gen.BillEntryMsg.SCHEMA$);
if (isValidValue(fields()[0], other.id)) {
- this.id = (java.lang.CharSequence) data().deepCopy(fields()[0].schema(), other.id);
+ this.id = (java.lang.String) data().deepCopy(fields()[0].schema(), other.id);
fieldSetFlags()[0] = true;
}
if (isValidValue(fields()[1], other.userID)) {
- this.userID = (java.lang.CharSequence) data().deepCopy(fields()[1].schema(), other.userID);
+ this.userID = (java.lang.String) data().deepCopy(fields()[1].schema(), other.userID);
fieldSetFlags()[1] = true;
}
if (isValidValue(fields()[2], other.status)) {
- this.status = (java.lang.CharSequence) data().deepCopy(fields()[2].schema(), other.status);
+ this.status = (java.lang.String) data().deepCopy(fields()[2].schema(), other.status);
fieldSetFlags()[2] = true;
}
if (isValidValue(fields()[3], other.remainingCredits)) {
- this.remainingCredits = (java.lang.CharSequence) data().deepCopy(fields()[3].schema(), other.remainingCredits);
+ this.remainingCredits = (java.lang.String) data().deepCopy(fields()[3].schema(), other.remainingCredits);
fieldSetFlags()[3] = true;
}
if (isValidValue(fields()[4], other.deductedCredits)) {
- this.deductedCredits = (java.lang.CharSequence) data().deepCopy(fields()[4].schema(), other.deductedCredits);
+ this.deductedCredits = (java.lang.String) data().deepCopy(fields()[4].schema(), other.deductedCredits);
fieldSetFlags()[4] = true;
}
if (isValidValue(fields()[5], other.startTime)) {
- this.startTime = (java.lang.CharSequence) data().deepCopy(fields()[5].schema(), other.startTime);
+ this.startTime = (java.lang.String) data().deepCopy(fields()[5].schema(), other.startTime);
fieldSetFlags()[5] = true;
}
if (isValidValue(fields()[6], other.endTime)) {
- this.endTime = (java.lang.CharSequence) data().deepCopy(fields()[6].schema(), other.endTime);
+ this.endTime = (java.lang.String) data().deepCopy(fields()[6].schema(), other.endTime);
fieldSetFlags()[6] = true;
}
if (isValidValue(fields()[7], other.bill)) {
}
/** Gets the value of the 'id' field */
- public java.lang.CharSequence getId() {
+ public java.lang.String getId() {
return id;
}
/** Sets the value of the 'id' field */
- public gr.grnet.aquarium.message.avro.gen.BillEntryMsg.Builder setId(java.lang.CharSequence value) {
+ public gr.grnet.aquarium.message.avro.gen.BillEntryMsg.Builder setId(java.lang.String value) {
validate(fields()[0], value);
this.id = value;
fieldSetFlags()[0] = true;
}
/** Gets the value of the 'userID' field */
- public java.lang.CharSequence getUserID() {
+ public java.lang.String getUserID() {
return userID;
}
/** Sets the value of the 'userID' field */
- public gr.grnet.aquarium.message.avro.gen.BillEntryMsg.Builder setUserID(java.lang.CharSequence value) {
+ public gr.grnet.aquarium.message.avro.gen.BillEntryMsg.Builder setUserID(java.lang.String value) {
validate(fields()[1], value);
this.userID = value;
fieldSetFlags()[1] = true;
}
/** Gets the value of the 'status' field */
- public java.lang.CharSequence getStatus() {
+ public java.lang.String getStatus() {
return status;
}
/** Sets the value of the 'status' field */
- public gr.grnet.aquarium.message.avro.gen.BillEntryMsg.Builder setStatus(java.lang.CharSequence value) {
+ public gr.grnet.aquarium.message.avro.gen.BillEntryMsg.Builder setStatus(java.lang.String value) {
validate(fields()[2], value);
this.status = value;
fieldSetFlags()[2] = true;
}
/** Gets the value of the 'remainingCredits' field */
- public java.lang.CharSequence getRemainingCredits() {
+ public java.lang.String getRemainingCredits() {
return remainingCredits;
}
/** Sets the value of the 'remainingCredits' field */
- public gr.grnet.aquarium.message.avro.gen.BillEntryMsg.Builder setRemainingCredits(java.lang.CharSequence value) {
+ public gr.grnet.aquarium.message.avro.gen.BillEntryMsg.Builder setRemainingCredits(java.lang.String value) {
validate(fields()[3], value);
this.remainingCredits = value;
fieldSetFlags()[3] = true;
}
/** Gets the value of the 'deductedCredits' field */
- public java.lang.CharSequence getDeductedCredits() {
+ public java.lang.String getDeductedCredits() {
return deductedCredits;
}
/** Sets the value of the 'deductedCredits' field */
- public gr.grnet.aquarium.message.avro.gen.BillEntryMsg.Builder setDeductedCredits(java.lang.CharSequence value) {
+ public gr.grnet.aquarium.message.avro.gen.BillEntryMsg.Builder setDeductedCredits(java.lang.String value) {
validate(fields()[4], value);
this.deductedCredits = value;
fieldSetFlags()[4] = true;
}
/** Gets the value of the 'startTime' field */
- public java.lang.CharSequence getStartTime() {
+ public java.lang.String getStartTime() {
return startTime;
}
/** Sets the value of the 'startTime' field */
- public gr.grnet.aquarium.message.avro.gen.BillEntryMsg.Builder setStartTime(java.lang.CharSequence value) {
+ public gr.grnet.aquarium.message.avro.gen.BillEntryMsg.Builder setStartTime(java.lang.String value) {
validate(fields()[5], value);
this.startTime = value;
fieldSetFlags()[5] = true;
}
/** Gets the value of the 'endTime' field */
- public java.lang.CharSequence getEndTime() {
+ public java.lang.String getEndTime() {
return endTime;
}
/** Sets the value of the 'endTime' field */
- public gr.grnet.aquarium.message.avro.gen.BillEntryMsg.Builder setEndTime(java.lang.CharSequence value) {
+ public gr.grnet.aquarium.message.avro.gen.BillEntryMsg.Builder setEndTime(java.lang.String value) {
validate(fields()[6], value);
this.endTime = value;
fieldSetFlags()[6] = true;
public BillEntryMsg build() {
try {
BillEntryMsg record = new BillEntryMsg();
- record.id = fieldSetFlags()[0] ? this.id : (java.lang.CharSequence) defaultValue(fields()[0]);
- record.userID = fieldSetFlags()[1] ? this.userID : (java.lang.CharSequence) defaultValue(fields()[1]);
- record.status = fieldSetFlags()[2] ? this.status : (java.lang.CharSequence) defaultValue(fields()[2]);
- record.remainingCredits = fieldSetFlags()[3] ? this.remainingCredits : (java.lang.CharSequence) defaultValue(fields()[3]);
- record.deductedCredits = fieldSetFlags()[4] ? this.deductedCredits : (java.lang.CharSequence) defaultValue(fields()[4]);
- record.startTime = fieldSetFlags()[5] ? this.startTime : (java.lang.CharSequence) defaultValue(fields()[5]);
- record.endTime = fieldSetFlags()[6] ? this.endTime : (java.lang.CharSequence) defaultValue(fields()[6]);
+ record.id = fieldSetFlags()[0] ? this.id : (java.lang.String) defaultValue(fields()[0]);
+ record.userID = fieldSetFlags()[1] ? this.userID : (java.lang.String) defaultValue(fields()[1]);
+ record.status = fieldSetFlags()[2] ? this.status : (java.lang.String) defaultValue(fields()[2]);
+ record.remainingCredits = fieldSetFlags()[3] ? this.remainingCredits : (java.lang.String) defaultValue(fields()[3]);
+ record.deductedCredits = fieldSetFlags()[4] ? this.deductedCredits : (java.lang.String) defaultValue(fields()[4]);
+ record.startTime = fieldSetFlags()[5] ? this.startTime : (java.lang.String) defaultValue(fields()[5]);
+ record.endTime = fieldSetFlags()[6] ? this.endTime : (java.lang.String) defaultValue(fields()[6]);
record.bill = fieldSetFlags()[7] ? this.bill : (java.util.List<gr.grnet.aquarium.message.avro.gen.ResourceEntryMsg>) defaultValue(fields()[7]);
return record;
} catch (Exception e) {
package gr.grnet.aquarium.message.avro.gen;
@SuppressWarnings("all")
public class ChargeEntryMsg 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\":\"ChargeEntryMsg\",\"namespace\":\"gr.grnet.aquarium.message.avro.gen\",\"fields\":[{\"name\":\"id\",\"type\":\"string\"},{\"name\":\"unitPrice\",\"type\":\"string\"},{\"name\":\"startTime\",\"type\":\"string\"},{\"name\":\"endTime\",\"type\":\"string\"},{\"name\":\"ellapsedTime\",\"type\":\"string\"},{\"name\":\"credits\",\"type\":\"string\"}]}");
- @Deprecated public java.lang.CharSequence id;
- @Deprecated public java.lang.CharSequence unitPrice;
- @Deprecated public java.lang.CharSequence startTime;
- @Deprecated public java.lang.CharSequence endTime;
- @Deprecated public java.lang.CharSequence ellapsedTime;
- @Deprecated public java.lang.CharSequence credits;
+ public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"ChargeEntryMsg\",\"namespace\":\"gr.grnet.aquarium.message.avro.gen\",\"fields\":[{\"name\":\"id\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"unitPrice\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"startTime\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"endTime\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"ellapsedTime\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"credits\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}}]}");
+ @Deprecated public java.lang.String id;
+ @Deprecated public java.lang.String unitPrice;
+ @Deprecated public java.lang.String startTime;
+ @Deprecated public java.lang.String endTime;
+ @Deprecated public java.lang.String ellapsedTime;
+ @Deprecated public java.lang.String credits;
public org.apache.avro.Schema getSchema() { return SCHEMA$; }
// Used by DatumWriter. Applications should not call.
public java.lang.Object get(int field$) {
@SuppressWarnings(value="unchecked")
public void put(int field$, java.lang.Object value$) {
switch (field$) {
- case 0: id = (java.lang.CharSequence)value$; break;
- case 1: unitPrice = (java.lang.CharSequence)value$; break;
- case 2: startTime = (java.lang.CharSequence)value$; break;
- case 3: endTime = (java.lang.CharSequence)value$; break;
- case 4: ellapsedTime = (java.lang.CharSequence)value$; break;
- case 5: credits = (java.lang.CharSequence)value$; break;
+ case 0: id = (java.lang.String)value$; break;
+ case 1: unitPrice = (java.lang.String)value$; break;
+ case 2: startTime = (java.lang.String)value$; break;
+ case 3: endTime = (java.lang.String)value$; break;
+ case 4: ellapsedTime = (java.lang.String)value$; break;
+ case 5: credits = (java.lang.String)value$; break;
default: throw new org.apache.avro.AvroRuntimeException("Bad index");
}
}
/**
* Gets the value of the 'id' field.
*/
- public java.lang.CharSequence getId() {
+ public java.lang.String getId() {
return id;
}
* Sets the value of the 'id' field.
* @param value the value to set.
*/
- public void setId(java.lang.CharSequence value) {
+ public void setId(java.lang.String value) {
this.id = value;
}
/**
* Gets the value of the 'unitPrice' field.
*/
- public java.lang.CharSequence getUnitPrice() {
+ public java.lang.String getUnitPrice() {
return unitPrice;
}
* Sets the value of the 'unitPrice' field.
* @param value the value to set.
*/
- public void setUnitPrice(java.lang.CharSequence value) {
+ public void setUnitPrice(java.lang.String value) {
this.unitPrice = value;
}
/**
* Gets the value of the 'startTime' field.
*/
- public java.lang.CharSequence getStartTime() {
+ public java.lang.String getStartTime() {
return startTime;
}
* Sets the value of the 'startTime' field.
* @param value the value to set.
*/
- public void setStartTime(java.lang.CharSequence value) {
+ public void setStartTime(java.lang.String value) {
this.startTime = value;
}
/**
* Gets the value of the 'endTime' field.
*/
- public java.lang.CharSequence getEndTime() {
+ public java.lang.String getEndTime() {
return endTime;
}
* Sets the value of the 'endTime' field.
* @param value the value to set.
*/
- public void setEndTime(java.lang.CharSequence value) {
+ public void setEndTime(java.lang.String value) {
this.endTime = value;
}
/**
* Gets the value of the 'ellapsedTime' field.
*/
- public java.lang.CharSequence getEllapsedTime() {
+ public java.lang.String getEllapsedTime() {
return ellapsedTime;
}
* Sets the value of the 'ellapsedTime' field.
* @param value the value to set.
*/
- public void setEllapsedTime(java.lang.CharSequence value) {
+ public void setEllapsedTime(java.lang.String value) {
this.ellapsedTime = value;
}
/**
* Gets the value of the 'credits' field.
*/
- public java.lang.CharSequence getCredits() {
+ public java.lang.String getCredits() {
return credits;
}
* Sets the value of the 'credits' field.
* @param value the value to set.
*/
- public void setCredits(java.lang.CharSequence value) {
+ public void setCredits(java.lang.String value) {
this.credits = value;
}
public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<ChargeEntryMsg>
implements org.apache.avro.data.RecordBuilder<ChargeEntryMsg> {
- private java.lang.CharSequence id;
- private java.lang.CharSequence unitPrice;
- private java.lang.CharSequence startTime;
- private java.lang.CharSequence endTime;
- private java.lang.CharSequence ellapsedTime;
- private java.lang.CharSequence credits;
+ private java.lang.String id;
+ private java.lang.String unitPrice;
+ private java.lang.String startTime;
+ private java.lang.String endTime;
+ private java.lang.String ellapsedTime;
+ private java.lang.String credits;
/** Creates a new Builder */
private Builder() {
private Builder(gr.grnet.aquarium.message.avro.gen.ChargeEntryMsg other) {
super(gr.grnet.aquarium.message.avro.gen.ChargeEntryMsg.SCHEMA$);
if (isValidValue(fields()[0], other.id)) {
- this.id = (java.lang.CharSequence) data().deepCopy(fields()[0].schema(), other.id);
+ this.id = (java.lang.String) data().deepCopy(fields()[0].schema(), other.id);
fieldSetFlags()[0] = true;
}
if (isValidValue(fields()[1], other.unitPrice)) {
- this.unitPrice = (java.lang.CharSequence) data().deepCopy(fields()[1].schema(), other.unitPrice);
+ this.unitPrice = (java.lang.String) data().deepCopy(fields()[1].schema(), other.unitPrice);
fieldSetFlags()[1] = true;
}
if (isValidValue(fields()[2], other.startTime)) {
- this.startTime = (java.lang.CharSequence) data().deepCopy(fields()[2].schema(), other.startTime);
+ this.startTime = (java.lang.String) data().deepCopy(fields()[2].schema(), other.startTime);
fieldSetFlags()[2] = true;
}
if (isValidValue(fields()[3], other.endTime)) {
- this.endTime = (java.lang.CharSequence) data().deepCopy(fields()[3].schema(), other.endTime);
+ this.endTime = (java.lang.String) data().deepCopy(fields()[3].schema(), other.endTime);
fieldSetFlags()[3] = true;
}
if (isValidValue(fields()[4], other.ellapsedTime)) {
- this.ellapsedTime = (java.lang.CharSequence) data().deepCopy(fields()[4].schema(), other.ellapsedTime);
+ this.ellapsedTime = (java.lang.String) data().deepCopy(fields()[4].schema(), other.ellapsedTime);
fieldSetFlags()[4] = true;
}
if (isValidValue(fields()[5], other.credits)) {
- this.credits = (java.lang.CharSequence) data().deepCopy(fields()[5].schema(), other.credits);
+ this.credits = (java.lang.String) data().deepCopy(fields()[5].schema(), other.credits);
fieldSetFlags()[5] = true;
}
}
/** Gets the value of the 'id' field */
- public java.lang.CharSequence getId() {
+ public java.lang.String getId() {
return id;
}
/** Sets the value of the 'id' field */
- public gr.grnet.aquarium.message.avro.gen.ChargeEntryMsg.Builder setId(java.lang.CharSequence value) {
+ public gr.grnet.aquarium.message.avro.gen.ChargeEntryMsg.Builder setId(java.lang.String value) {
validate(fields()[0], value);
this.id = value;
fieldSetFlags()[0] = true;
}
/** Gets the value of the 'unitPrice' field */
- public java.lang.CharSequence getUnitPrice() {
+ public java.lang.String getUnitPrice() {
return unitPrice;
}
/** Sets the value of the 'unitPrice' field */
- public gr.grnet.aquarium.message.avro.gen.ChargeEntryMsg.Builder setUnitPrice(java.lang.CharSequence value) {
+ public gr.grnet.aquarium.message.avro.gen.ChargeEntryMsg.Builder setUnitPrice(java.lang.String value) {
validate(fields()[1], value);
this.unitPrice = value;
fieldSetFlags()[1] = true;
}
/** Gets the value of the 'startTime' field */
- public java.lang.CharSequence getStartTime() {
+ public java.lang.String getStartTime() {
return startTime;
}
/** Sets the value of the 'startTime' field */
- public gr.grnet.aquarium.message.avro.gen.ChargeEntryMsg.Builder setStartTime(java.lang.CharSequence value) {
+ public gr.grnet.aquarium.message.avro.gen.ChargeEntryMsg.Builder setStartTime(java.lang.String value) {
validate(fields()[2], value);
this.startTime = value;
fieldSetFlags()[2] = true;
}
/** Gets the value of the 'endTime' field */
- public java.lang.CharSequence getEndTime() {
+ public java.lang.String getEndTime() {
return endTime;
}
/** Sets the value of the 'endTime' field */
- public gr.grnet.aquarium.message.avro.gen.ChargeEntryMsg.Builder setEndTime(java.lang.CharSequence value) {
+ public gr.grnet.aquarium.message.avro.gen.ChargeEntryMsg.Builder setEndTime(java.lang.String value) {
validate(fields()[3], value);
this.endTime = value;
fieldSetFlags()[3] = true;
}
/** Gets the value of the 'ellapsedTime' field */
- public java.lang.CharSequence getEllapsedTime() {
+ public java.lang.String getEllapsedTime() {
return ellapsedTime;
}
/** Sets the value of the 'ellapsedTime' field */
- public gr.grnet.aquarium.message.avro.gen.ChargeEntryMsg.Builder setEllapsedTime(java.lang.CharSequence value) {
+ public gr.grnet.aquarium.message.avro.gen.ChargeEntryMsg.Builder setEllapsedTime(java.lang.String value) {
validate(fields()[4], value);
this.ellapsedTime = value;
fieldSetFlags()[4] = true;
}
/** Gets the value of the 'credits' field */
- public java.lang.CharSequence getCredits() {
+ public java.lang.String getCredits() {
return credits;
}
/** Sets the value of the 'credits' field */
- public gr.grnet.aquarium.message.avro.gen.ChargeEntryMsg.Builder setCredits(java.lang.CharSequence value) {
+ public gr.grnet.aquarium.message.avro.gen.ChargeEntryMsg.Builder setCredits(java.lang.String value) {
validate(fields()[5], value);
this.credits = value;
fieldSetFlags()[5] = true;
public ChargeEntryMsg build() {
try {
ChargeEntryMsg record = new ChargeEntryMsg();
- record.id = fieldSetFlags()[0] ? this.id : (java.lang.CharSequence) defaultValue(fields()[0]);
- record.unitPrice = fieldSetFlags()[1] ? this.unitPrice : (java.lang.CharSequence) defaultValue(fields()[1]);
- record.startTime = fieldSetFlags()[2] ? this.startTime : (java.lang.CharSequence) defaultValue(fields()[2]);
- record.endTime = fieldSetFlags()[3] ? this.endTime : (java.lang.CharSequence) defaultValue(fields()[3]);
- record.ellapsedTime = fieldSetFlags()[4] ? this.ellapsedTime : (java.lang.CharSequence) defaultValue(fields()[4]);
- record.credits = fieldSetFlags()[5] ? this.credits : (java.lang.CharSequence) defaultValue(fields()[5]);
+ record.id = fieldSetFlags()[0] ? this.id : (java.lang.String) defaultValue(fields()[0]);
+ record.unitPrice = fieldSetFlags()[1] ? this.unitPrice : (java.lang.String) defaultValue(fields()[1]);
+ record.startTime = fieldSetFlags()[2] ? this.startTime : (java.lang.String) defaultValue(fields()[2]);
+ record.endTime = fieldSetFlags()[3] ? this.endTime : (java.lang.String) defaultValue(fields()[3]);
+ record.ellapsedTime = fieldSetFlags()[4] ? this.ellapsedTime : (java.lang.String) defaultValue(fields()[4]);
+ record.credits = fieldSetFlags()[5] ? this.credits : (java.lang.String) defaultValue(fields()[5]);
return record;
} catch (Exception e) {
throw new org.apache.avro.AvroRuntimeException(e);
package gr.grnet.aquarium.message.avro.gen;
@SuppressWarnings("all")
public class ChargeslotMsg 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\":\"ChargeslotMsg\",\"namespace\":\"gr.grnet.aquarium.message.avro.gen\",\"fields\":[{\"name\":\"startMillis\",\"type\":\"long\"},{\"name\":\"stopMillis\",\"type\":\"long\"},{\"name\":\"unitPrice\",\"type\":\"double\"},{\"name\":\"explanation\",\"type\":\"string\",\"default\":\"\"},{\"name\":\"creditsToSubtract\",\"type\":\"double\"}]}");
+ public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"ChargeslotMsg\",\"namespace\":\"gr.grnet.aquarium.message.avro.gen\",\"fields\":[{\"name\":\"startMillis\",\"type\":\"long\"},{\"name\":\"stopMillis\",\"type\":\"long\"},{\"name\":\"unitPrice\",\"type\":\"double\"},{\"name\":\"explanation\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"default\":\"\"},{\"name\":\"creditsToSubtract\",\"type\":\"double\",\"default\":0.0}]}");
@Deprecated public long startMillis;
@Deprecated public long stopMillis;
@Deprecated public double unitPrice;
- @Deprecated public java.lang.CharSequence explanation;
+ @Deprecated public java.lang.String explanation;
@Deprecated public double creditsToSubtract;
public org.apache.avro.Schema getSchema() { return SCHEMA$; }
// Used by DatumWriter. Applications should not call.
case 0: startMillis = (java.lang.Long)value$; break;
case 1: stopMillis = (java.lang.Long)value$; break;
case 2: unitPrice = (java.lang.Double)value$; break;
- case 3: explanation = (java.lang.CharSequence)value$; break;
+ case 3: explanation = (java.lang.String)value$; break;
case 4: creditsToSubtract = (java.lang.Double)value$; break;
default: throw new org.apache.avro.AvroRuntimeException("Bad index");
}
/**
* Gets the value of the 'explanation' field.
*/
- public java.lang.CharSequence getExplanation() {
+ public java.lang.String getExplanation() {
return explanation;
}
* Sets the value of the 'explanation' field.
* @param value the value to set.
*/
- public void setExplanation(java.lang.CharSequence value) {
+ public void setExplanation(java.lang.String value) {
this.explanation = value;
}
private long startMillis;
private long stopMillis;
private double unitPrice;
- private java.lang.CharSequence explanation;
+ private java.lang.String explanation;
private double creditsToSubtract;
/** Creates a new Builder */
fieldSetFlags()[2] = true;
}
if (isValidValue(fields()[3], other.explanation)) {
- this.explanation = (java.lang.CharSequence) data().deepCopy(fields()[3].schema(), other.explanation);
+ this.explanation = (java.lang.String) data().deepCopy(fields()[3].schema(), other.explanation);
fieldSetFlags()[3] = true;
}
if (isValidValue(fields()[4], other.creditsToSubtract)) {
}
/** Gets the value of the 'explanation' field */
- public java.lang.CharSequence getExplanation() {
+ public java.lang.String getExplanation() {
return explanation;
}
/** Sets the value of the 'explanation' field */
- public gr.grnet.aquarium.message.avro.gen.ChargeslotMsg.Builder setExplanation(java.lang.CharSequence value) {
+ public gr.grnet.aquarium.message.avro.gen.ChargeslotMsg.Builder setExplanation(java.lang.String value) {
validate(fields()[3], value);
this.explanation = value;
fieldSetFlags()[3] = true;
record.startMillis = fieldSetFlags()[0] ? this.startMillis : (java.lang.Long) defaultValue(fields()[0]);
record.stopMillis = fieldSetFlags()[1] ? this.stopMillis : (java.lang.Long) defaultValue(fields()[1]);
record.unitPrice = fieldSetFlags()[2] ? this.unitPrice : (java.lang.Double) defaultValue(fields()[2]);
- record.explanation = fieldSetFlags()[3] ? this.explanation : (java.lang.CharSequence) defaultValue(fields()[3]);
+ record.explanation = fieldSetFlags()[3] ? this.explanation : (java.lang.String) defaultValue(fields()[3]);
record.creditsToSubtract = fieldSetFlags()[4] ? this.creditsToSubtract : (java.lang.Double) defaultValue(fields()[4]);
return record;
} catch (Exception e) {
package gr.grnet.aquarium.message.avro.gen;
@SuppressWarnings("all")
public class CronSpecTupleMsg 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\":\"CronSpecTupleMsg\",\"namespace\":\"gr.grnet.aquarium.message.avro.gen\",\"fields\":[{\"name\":\"a\",\"type\":\"string\"},{\"name\":\"b\",\"type\":\"string\"}]}");
- @Deprecated public java.lang.CharSequence a;
- @Deprecated public java.lang.CharSequence b;
+ public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"CronSpecTupleMsg\",\"namespace\":\"gr.grnet.aquarium.message.avro.gen\",\"fields\":[{\"name\":\"a\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"b\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}}]}");
+ @Deprecated public java.lang.String a;
+ @Deprecated public java.lang.String b;
public org.apache.avro.Schema getSchema() { return SCHEMA$; }
// Used by DatumWriter. Applications should not call.
public java.lang.Object get(int field$) {
@SuppressWarnings(value="unchecked")
public void put(int field$, java.lang.Object value$) {
switch (field$) {
- case 0: a = (java.lang.CharSequence)value$; break;
- case 1: b = (java.lang.CharSequence)value$; break;
+ case 0: a = (java.lang.String)value$; break;
+ case 1: b = (java.lang.String)value$; break;
default: throw new org.apache.avro.AvroRuntimeException("Bad index");
}
}
/**
* Gets the value of the 'a' field.
*/
- public java.lang.CharSequence getA() {
+ public java.lang.String getA() {
return a;
}
* Sets the value of the 'a' field.
* @param value the value to set.
*/
- public void setA(java.lang.CharSequence value) {
+ public void setA(java.lang.String value) {
this.a = value;
}
/**
* Gets the value of the 'b' field.
*/
- public java.lang.CharSequence getB() {
+ public java.lang.String getB() {
return b;
}
* Sets the value of the 'b' field.
* @param value the value to set.
*/
- public void setB(java.lang.CharSequence value) {
+ public void setB(java.lang.String value) {
this.b = value;
}
public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<CronSpecTupleMsg>
implements org.apache.avro.data.RecordBuilder<CronSpecTupleMsg> {
- private java.lang.CharSequence a;
- private java.lang.CharSequence b;
+ private java.lang.String a;
+ private java.lang.String b;
/** Creates a new Builder */
private Builder() {
private Builder(gr.grnet.aquarium.message.avro.gen.CronSpecTupleMsg other) {
super(gr.grnet.aquarium.message.avro.gen.CronSpecTupleMsg.SCHEMA$);
if (isValidValue(fields()[0], other.a)) {
- this.a = (java.lang.CharSequence) data().deepCopy(fields()[0].schema(), other.a);
+ this.a = (java.lang.String) data().deepCopy(fields()[0].schema(), other.a);
fieldSetFlags()[0] = true;
}
if (isValidValue(fields()[1], other.b)) {
- this.b = (java.lang.CharSequence) data().deepCopy(fields()[1].schema(), other.b);
+ this.b = (java.lang.String) data().deepCopy(fields()[1].schema(), other.b);
fieldSetFlags()[1] = true;
}
}
/** Gets the value of the 'a' field */
- public java.lang.CharSequence getA() {
+ public java.lang.String getA() {
return a;
}
/** Sets the value of the 'a' field */
- public gr.grnet.aquarium.message.avro.gen.CronSpecTupleMsg.Builder setA(java.lang.CharSequence value) {
+ public gr.grnet.aquarium.message.avro.gen.CronSpecTupleMsg.Builder setA(java.lang.String value) {
validate(fields()[0], value);
this.a = value;
fieldSetFlags()[0] = true;
}
/** Gets the value of the 'b' field */
- public java.lang.CharSequence getB() {
+ public java.lang.String getB() {
return b;
}
/** Sets the value of the 'b' field */
- public gr.grnet.aquarium.message.avro.gen.CronSpecTupleMsg.Builder setB(java.lang.CharSequence value) {
+ public gr.grnet.aquarium.message.avro.gen.CronSpecTupleMsg.Builder setB(java.lang.String value) {
validate(fields()[1], value);
this.b = value;
fieldSetFlags()[1] = true;
public CronSpecTupleMsg build() {
try {
CronSpecTupleMsg record = new CronSpecTupleMsg();
- record.a = fieldSetFlags()[0] ? this.a : (java.lang.CharSequence) defaultValue(fields()[0]);
- record.b = fieldSetFlags()[1] ? this.b : (java.lang.CharSequence) defaultValue(fields()[1]);
+ record.a = fieldSetFlags()[0] ? this.a : (java.lang.String) defaultValue(fields()[0]);
+ record.b = fieldSetFlags()[1] ? this.b : (java.lang.String) defaultValue(fields()[1]);
return record;
} catch (Exception e) {
throw new org.apache.avro.AvroRuntimeException(e);
--- /dev/null
+/**
+ * Autogenerated by Avro
+ *
+ * DO NOT EDIT DIRECTLY
+ */
+package gr.grnet.aquarium.message.avro.gen;
+@SuppressWarnings("all")
+public class DetailsMsg 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\":\"DetailsMsg\",\"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\",{\"type\":\"string\",\"avro.java.string\":\"String\"},{\"type\":\"array\",\"items\":\"AnyValueMsg\"},{\"type\":\"map\",\"values\":\"AnyValueMsg\",\"avro.java.string\":\"String\"}]}]},\"avro.java.string\":\"String\"}}]}");
+ @Deprecated public java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.AnyValueMsg> details;
+ public org.apache.avro.Schema getSchema() { return SCHEMA$; }
+ // Used by DatumWriter. Applications should not call.
+ public java.lang.Object get(int field$) {
+ switch (field$) {
+ case 0: return details;
+ default: throw new org.apache.avro.AvroRuntimeException("Bad index");
+ }
+ }
+ // Used by DatumReader. Applications should not call.
+ @SuppressWarnings(value="unchecked")
+ public void put(int field$, java.lang.Object value$) {
+ switch (field$) {
+ case 0: details = (java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.AnyValueMsg>)value$; break;
+ default: throw new org.apache.avro.AvroRuntimeException("Bad index");
+ }
+ }
+
+ /**
+ * Gets the value of the 'details' field.
+ */
+ public java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.AnyValueMsg> getDetails() {
+ return details;
+ }
+
+ /**
+ * Sets the value of the 'details' field.
+ * @param value the value to set.
+ */
+ public void setDetails(java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.AnyValueMsg> value) {
+ this.details = value;
+ }
+
+ /** Creates a new DetailsMsg RecordBuilder */
+ public static gr.grnet.aquarium.message.avro.gen.DetailsMsg.Builder newBuilder() {
+ return new gr.grnet.aquarium.message.avro.gen.DetailsMsg.Builder();
+ }
+
+ /** Creates a new DetailsMsg RecordBuilder by copying an existing Builder */
+ public static gr.grnet.aquarium.message.avro.gen.DetailsMsg.Builder newBuilder(gr.grnet.aquarium.message.avro.gen.DetailsMsg.Builder other) {
+ return new gr.grnet.aquarium.message.avro.gen.DetailsMsg.Builder(other);
+ }
+
+ /** Creates a new DetailsMsg RecordBuilder by copying an existing DetailsMsg instance */
+ public static gr.grnet.aquarium.message.avro.gen.DetailsMsg.Builder newBuilder(gr.grnet.aquarium.message.avro.gen.DetailsMsg other) {
+ return new gr.grnet.aquarium.message.avro.gen.DetailsMsg.Builder(other);
+ }
+
+ /**
+ * RecordBuilder for DetailsMsg instances.
+ */
+ public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<DetailsMsg>
+ implements org.apache.avro.data.RecordBuilder<DetailsMsg> {
+
+ private java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.AnyValueMsg> details;
+
+ /** Creates a new Builder */
+ private Builder() {
+ super(gr.grnet.aquarium.message.avro.gen.DetailsMsg.SCHEMA$);
+ }
+
+ /** Creates a Builder by copying an existing Builder */
+ private Builder(gr.grnet.aquarium.message.avro.gen.DetailsMsg.Builder other) {
+ super(other);
+ }
+
+ /** Creates a Builder by copying an existing DetailsMsg instance */
+ private Builder(gr.grnet.aquarium.message.avro.gen.DetailsMsg other) {
+ super(gr.grnet.aquarium.message.avro.gen.DetailsMsg.SCHEMA$);
+ if (isValidValue(fields()[0], other.details)) {
+ this.details = (java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.AnyValueMsg>) data().deepCopy(fields()[0].schema(), other.details);
+ fieldSetFlags()[0] = true;
+ }
+ }
+
+ /** Gets the value of the 'details' field */
+ public java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.AnyValueMsg> getDetails() {
+ return details;
+ }
+
+ /** Sets the value of the 'details' field */
+ public gr.grnet.aquarium.message.avro.gen.DetailsMsg.Builder setDetails(java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.AnyValueMsg> value) {
+ validate(fields()[0], value);
+ this.details = value;
+ fieldSetFlags()[0] = true;
+ return this;
+ }
+
+ /** Checks whether the 'details' field has been set */
+ public boolean hasDetails() {
+ return fieldSetFlags()[0];
+ }
+
+ /** Clears the value of the 'details' field */
+ public gr.grnet.aquarium.message.avro.gen.DetailsMsg.Builder clearDetails() {
+ details = null;
+ fieldSetFlags()[0] = false;
+ return this;
+ }
+
+ @Override
+ public DetailsMsg build() {
+ try {
+ DetailsMsg record = new DetailsMsg();
+ record.details = fieldSetFlags()[0] ? this.details : (java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.AnyValueMsg>) defaultValue(fields()[0]);
+ return record;
+ } catch (Exception e) {
+ throw new org.apache.avro.AvroRuntimeException(e);
+ }
+ }
+ }
+}
package gr.grnet.aquarium.message.avro.gen;
@SuppressWarnings("all")
public class EffectivePriceTableMsg 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\":\"EffectivePriceTableMsg\",\"namespace\":\"gr.grnet.aquarium.message.avro.gen\",\"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\"]}]}}}]}");
+ public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"EffectivePriceTableMsg\",\"namespace\":\"gr.grnet.aquarium.message.avro.gen\",\"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\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"b\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}}]},\"null\"]}]}}}]}");
@Deprecated public java.util.List<gr.grnet.aquarium.message.avro.gen.EffectiveUnitPriceMsg> priceOverrides;
public org.apache.avro.Schema getSchema() { return SCHEMA$; }
// Used by DatumWriter. Applications should not call.
package gr.grnet.aquarium.message.avro.gen;
@SuppressWarnings("all")
public class EffectiveUnitPriceMsg 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\":\"EffectiveUnitPriceMsg\",\"namespace\":\"gr.grnet.aquarium.message.avro.gen\",\"fields\":[{\"name\":\"unitPrice\",\"type\":\"double\"},{\"name\":\"when\",\"type\":[{\"type\":\"record\",\"name\":\"CronSpecTupleMsg\",\"fields\":[{\"name\":\"a\",\"type\":\"string\"},{\"name\":\"b\",\"type\":\"string\"}]},\"null\"]}]}");
+ public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"EffectiveUnitPriceMsg\",\"namespace\":\"gr.grnet.aquarium.message.avro.gen\",\"fields\":[{\"name\":\"unitPrice\",\"type\":\"double\"},{\"name\":\"when\",\"type\":[{\"type\":\"record\",\"name\":\"CronSpecTupleMsg\",\"fields\":[{\"name\":\"a\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"b\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}}]},\"null\"]}]}");
@Deprecated public double unitPrice;
@Deprecated public gr.grnet.aquarium.message.avro.gen.CronSpecTupleMsg when;
public org.apache.avro.Schema getSchema() { return SCHEMA$; }
package gr.grnet.aquarium.message.avro.gen;
@SuppressWarnings("all")
public class EventEntryMsg 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\":\"EventEntryMsg\",\"namespace\":\"gr.grnet.aquarium.message.avro.gen\",\"fields\":[{\"name\":\"eventType\",\"type\":\"string\"},{\"name\":\"details\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"ChargeEntryMsg\",\"fields\":[{\"name\":\"id\",\"type\":\"string\"},{\"name\":\"unitPrice\",\"type\":\"string\"},{\"name\":\"startTime\",\"type\":\"string\"},{\"name\":\"endTime\",\"type\":\"string\"},{\"name\":\"ellapsedTime\",\"type\":\"string\"},{\"name\":\"credits\",\"type\":\"string\"}]}}}]}");
- @Deprecated public java.lang.CharSequence eventType;
+ public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"EventEntryMsg\",\"namespace\":\"gr.grnet.aquarium.message.avro.gen\",\"fields\":[{\"name\":\"eventType\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"details\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"ChargeEntryMsg\",\"fields\":[{\"name\":\"id\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"unitPrice\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"startTime\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"endTime\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"ellapsedTime\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"credits\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}}]}}}]}");
+ @Deprecated public java.lang.String eventType;
@Deprecated public java.util.List<gr.grnet.aquarium.message.avro.gen.ChargeEntryMsg> details;
public org.apache.avro.Schema getSchema() { return SCHEMA$; }
// Used by DatumWriter. Applications should not call.
@SuppressWarnings(value="unchecked")
public void put(int field$, java.lang.Object value$) {
switch (field$) {
- case 0: eventType = (java.lang.CharSequence)value$; break;
+ case 0: eventType = (java.lang.String)value$; break;
case 1: details = (java.util.List<gr.grnet.aquarium.message.avro.gen.ChargeEntryMsg>)value$; break;
default: throw new org.apache.avro.AvroRuntimeException("Bad index");
}
/**
* Gets the value of the 'eventType' field.
*/
- public java.lang.CharSequence getEventType() {
+ public java.lang.String getEventType() {
return eventType;
}
* Sets the value of the 'eventType' field.
* @param value the value to set.
*/
- public void setEventType(java.lang.CharSequence value) {
+ public void setEventType(java.lang.String value) {
this.eventType = value;
}
public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<EventEntryMsg>
implements org.apache.avro.data.RecordBuilder<EventEntryMsg> {
- private java.lang.CharSequence eventType;
+ private java.lang.String eventType;
private java.util.List<gr.grnet.aquarium.message.avro.gen.ChargeEntryMsg> details;
/** Creates a new Builder */
private Builder(gr.grnet.aquarium.message.avro.gen.EventEntryMsg other) {
super(gr.grnet.aquarium.message.avro.gen.EventEntryMsg.SCHEMA$);
if (isValidValue(fields()[0], other.eventType)) {
- this.eventType = (java.lang.CharSequence) data().deepCopy(fields()[0].schema(), other.eventType);
+ this.eventType = (java.lang.String) data().deepCopy(fields()[0].schema(), other.eventType);
fieldSetFlags()[0] = true;
}
if (isValidValue(fields()[1], other.details)) {
}
/** Gets the value of the 'eventType' field */
- public java.lang.CharSequence getEventType() {
+ public java.lang.String getEventType() {
return eventType;
}
/** Sets the value of the 'eventType' field */
- public gr.grnet.aquarium.message.avro.gen.EventEntryMsg.Builder setEventType(java.lang.CharSequence value) {
+ public gr.grnet.aquarium.message.avro.gen.EventEntryMsg.Builder setEventType(java.lang.String value) {
validate(fields()[0], value);
this.eventType = value;
fieldSetFlags()[0] = true;
public EventEntryMsg build() {
try {
EventEntryMsg record = new EventEntryMsg();
- record.eventType = fieldSetFlags()[0] ? this.eventType : (java.lang.CharSequence) defaultValue(fields()[0]);
+ record.eventType = fieldSetFlags()[0] ? this.eventType : (java.lang.String) defaultValue(fields()[0]);
record.details = fieldSetFlags()[1] ? this.details : (java.util.List<gr.grnet.aquarium.message.avro.gen.ChargeEntryMsg>) defaultValue(fields()[1]);
return record;
} catch (Exception e) {
package gr.grnet.aquarium.message.avro.gen;
@SuppressWarnings("all")
public class FullPriceTableMsg 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\":\"FullPriceTableMsg\",\"namespace\":\"gr.grnet.aquarium.message.avro.gen\",\"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.util.Map<java.lang.CharSequence,java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.SelectorValueMsg>> perResource;
+ public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"FullPriceTableMsg\",\"namespace\":\"gr.grnet.aquarium.message.avro.gen\",\"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\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"b\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}}]},\"null\"]}]}}}]},{\"type\":\"map\",\"values\":\"SelectorValueMsg\",\"avro.java.string\":\"String\"}]}]},\"avro.java.string\":\"String\"},\"avro.java.string\":\"String\"}}]}");
+ @Deprecated public java.util.Map<java.lang.String,java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.SelectorValueMsg>> perResource;
public org.apache.avro.Schema getSchema() { return SCHEMA$; }
// Used by DatumWriter. Applications should not call.
public java.lang.Object get(int field$) {
@SuppressWarnings(value="unchecked")
public void put(int field$, java.lang.Object value$) {
switch (field$) {
- case 0: perResource = (java.util.Map<java.lang.CharSequence,java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.SelectorValueMsg>>)value$; break;
+ case 0: perResource = (java.util.Map<java.lang.String,java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.SelectorValueMsg>>)value$; break;
default: throw new org.apache.avro.AvroRuntimeException("Bad index");
}
}
/**
* Gets the value of the 'perResource' field.
*/
- public java.util.Map<java.lang.CharSequence,java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.SelectorValueMsg>> getPerResource() {
+ public java.util.Map<java.lang.String,java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.SelectorValueMsg>> getPerResource() {
return perResource;
}
* Sets the value of the 'perResource' field.
* @param value the value to set.
*/
- public void setPerResource(java.util.Map<java.lang.CharSequence,java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.SelectorValueMsg>> value) {
+ public void setPerResource(java.util.Map<java.lang.String,java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.SelectorValueMsg>> value) {
this.perResource = value;
}
public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<FullPriceTableMsg>
implements org.apache.avro.data.RecordBuilder<FullPriceTableMsg> {
- private java.util.Map<java.lang.CharSequence,java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.SelectorValueMsg>> perResource;
+ private java.util.Map<java.lang.String,java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.SelectorValueMsg>> perResource;
/** Creates a new Builder */
private Builder() {
private Builder(gr.grnet.aquarium.message.avro.gen.FullPriceTableMsg other) {
super(gr.grnet.aquarium.message.avro.gen.FullPriceTableMsg.SCHEMA$);
if (isValidValue(fields()[0], other.perResource)) {
- this.perResource = (java.util.Map<java.lang.CharSequence,java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.SelectorValueMsg>>) data().deepCopy(fields()[0].schema(), other.perResource);
+ this.perResource = (java.util.Map<java.lang.String,java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.SelectorValueMsg>>) data().deepCopy(fields()[0].schema(), other.perResource);
fieldSetFlags()[0] = true;
}
}
/** Gets the value of the 'perResource' field */
- public java.util.Map<java.lang.CharSequence,java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.SelectorValueMsg>> getPerResource() {
+ public java.util.Map<java.lang.String,java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.SelectorValueMsg>> getPerResource() {
return perResource;
}
/** Sets the value of the 'perResource' field */
- public gr.grnet.aquarium.message.avro.gen.FullPriceTableMsg.Builder setPerResource(java.util.Map<java.lang.CharSequence,java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.SelectorValueMsg>> value) {
+ public gr.grnet.aquarium.message.avro.gen.FullPriceTableMsg.Builder setPerResource(java.util.Map<java.lang.String,java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.SelectorValueMsg>> value) {
validate(fields()[0], value);
this.perResource = value;
fieldSetFlags()[0] = true;
public FullPriceTableMsg build() {
try {
FullPriceTableMsg record = new FullPriceTableMsg();
- record.perResource = fieldSetFlags()[0] ? this.perResource : (java.util.Map<java.lang.CharSequence,java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.SelectorValueMsg>>) defaultValue(fields()[0]);
+ record.perResource = fieldSetFlags()[0] ? this.perResource : (java.util.Map<java.lang.String,java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.SelectorValueMsg>>) defaultValue(fields()[0]);
return record;
} catch (Exception e) {
throw new org.apache.avro.AvroRuntimeException(e);
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\":\"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;
+ 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\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"inStoreID\",\"type\":[{\"type\":\"string\",\"avro.java.string\":\"String\"},\"null\"]},{\"name\":\"occurredMillis\",\"type\":\"long\"},{\"name\":\"receivedMillis\",\"type\":\"long\",\"default\":0},{\"name\":\"userID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"clientID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"eventVersion\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"default\":\"1.0\"},{\"name\":\"eventType\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"isActive\",\"type\":\"boolean\"},{\"name\":\"role\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"isSynthetic\",\"type\":\"boolean\",\"default\":false},{\"name\":\"details\",\"type\":{\"type\":\"map\",\"values\":{\"type\":\"record\",\"name\":\"AnyValueMsg\",\"fields\":[{\"name\":\"anyValue\",\"type\":[\"null\",\"int\",\"long\",\"boolean\",\"double\",\"bytes\",{\"type\":\"string\",\"avro.java.string\":\"String\"},{\"type\":\"array\",\"items\":\"AnyValueMsg\"},{\"type\":\"map\",\"values\":\"AnyValueMsg\",\"avro.java.string\":\"String\"}]}]},\"avro.java.string\":\"String\"}}]}");
+ @Deprecated public java.lang.String originalID;
+ @Deprecated public java.lang.String inStoreID;
@Deprecated public long occurredMillis;
@Deprecated public long receivedMillis;
- @Deprecated public java.lang.CharSequence userID;
- @Deprecated public java.lang.CharSequence clientID;
- @Deprecated public java.lang.CharSequence eventVersion;
+ @Deprecated public java.lang.String userID;
+ @Deprecated public java.lang.String clientID;
+ @Deprecated public java.lang.String eventVersion;
+ @Deprecated public java.lang.String eventType;
@Deprecated public boolean isActive;
- @Deprecated public java.lang.CharSequence role;
- @Deprecated public java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.AnyValueMsg> details;
+ @Deprecated public java.lang.String role;
+ @Deprecated public boolean isSynthetic;
+ @Deprecated public java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.AnyValueMsg> details;
public org.apache.avro.Schema getSchema() { return SCHEMA$; }
// Used by DatumWriter. Applications should not call.
public java.lang.Object get(int field$) {
case 4: return userID;
case 5: return clientID;
case 6: return eventVersion;
- case 7: return isActive;
- case 8: return role;
- case 9: return details;
+ case 7: return eventType;
+ case 8: return isActive;
+ case 9: return role;
+ case 10: return isSynthetic;
+ case 11: return details;
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: originalID = (java.lang.CharSequence)value$; break;
- case 1: inStoreID = (java.lang.CharSequence)value$; break;
+ case 0: originalID = (java.lang.String)value$; break;
+ case 1: inStoreID = (java.lang.String)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;
- case 5: clientID = (java.lang.CharSequence)value$; break;
- case 6: eventVersion = (java.lang.CharSequence)value$; break;
- case 7: isActive = (java.lang.Boolean)value$; break;
- case 8: role = (java.lang.CharSequence)value$; break;
- case 9: details = (java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.AnyValueMsg>)value$; break;
+ case 4: userID = (java.lang.String)value$; break;
+ case 5: clientID = (java.lang.String)value$; break;
+ case 6: eventVersion = (java.lang.String)value$; break;
+ case 7: eventType = (java.lang.String)value$; break;
+ case 8: isActive = (java.lang.Boolean)value$; break;
+ case 9: role = (java.lang.String)value$; break;
+ case 10: isSynthetic = (java.lang.Boolean)value$; break;
+ case 11: details = (java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.AnyValueMsg>)value$; break;
default: throw new org.apache.avro.AvroRuntimeException("Bad index");
}
}
/**
* Gets the value of the 'originalID' field.
*/
- public java.lang.CharSequence getOriginalID() {
+ public java.lang.String getOriginalID() {
return originalID;
}
* Sets the value of the 'originalID' field.
* @param value the value to set.
*/
- public void setOriginalID(java.lang.CharSequence value) {
+ public void setOriginalID(java.lang.String value) {
this.originalID = value;
}
/**
* Gets the value of the 'inStoreID' field.
*/
- public java.lang.CharSequence getInStoreID() {
+ public java.lang.String getInStoreID() {
return inStoreID;
}
* Sets the value of the 'inStoreID' field.
* @param value the value to set.
*/
- public void setInStoreID(java.lang.CharSequence value) {
+ public void setInStoreID(java.lang.String value) {
this.inStoreID = value;
}
/**
* Gets the value of the 'userID' field.
*/
- public java.lang.CharSequence getUserID() {
+ public java.lang.String getUserID() {
return userID;
}
* Sets the value of the 'userID' field.
* @param value the value to set.
*/
- public void setUserID(java.lang.CharSequence value) {
+ public void setUserID(java.lang.String value) {
this.userID = value;
}
/**
* Gets the value of the 'clientID' field.
*/
- public java.lang.CharSequence getClientID() {
+ public java.lang.String getClientID() {
return clientID;
}
* Sets the value of the 'clientID' field.
* @param value the value to set.
*/
- public void setClientID(java.lang.CharSequence value) {
+ public void setClientID(java.lang.String value) {
this.clientID = value;
}
/**
* Gets the value of the 'eventVersion' field.
*/
- public java.lang.CharSequence getEventVersion() {
+ public java.lang.String getEventVersion() {
return eventVersion;
}
* Sets the value of the 'eventVersion' field.
* @param value the value to set.
*/
- public void setEventVersion(java.lang.CharSequence value) {
+ public void setEventVersion(java.lang.String value) {
this.eventVersion = value;
}
/**
+ * Gets the value of the 'eventType' field.
+ */
+ public java.lang.String getEventType() {
+ return eventType;
+ }
+
+ /**
+ * Sets the value of the 'eventType' field.
+ * @param value the value to set.
+ */
+ public void setEventType(java.lang.String value) {
+ this.eventType = value;
+ }
+
+ /**
* Gets the value of the 'isActive' field.
*/
public java.lang.Boolean getIsActive() {
/**
* Gets the value of the 'role' field.
*/
- public java.lang.CharSequence getRole() {
+ public java.lang.String getRole() {
return role;
}
* Sets the value of the 'role' field.
* @param value the value to set.
*/
- public void setRole(java.lang.CharSequence value) {
+ public void setRole(java.lang.String value) {
this.role = value;
}
/**
+ * Gets the value of the 'isSynthetic' field.
+ */
+ public java.lang.Boolean getIsSynthetic() {
+ return isSynthetic;
+ }
+
+ /**
+ * Sets the value of the 'isSynthetic' field.
+ * @param value the value to set.
+ */
+ public void setIsSynthetic(java.lang.Boolean value) {
+ this.isSynthetic = value;
+ }
+
+ /**
* Gets the value of the 'details' field.
*/
- public java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.AnyValueMsg> getDetails() {
+ public java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.AnyValueMsg> getDetails() {
return details;
}
* Sets the value of the 'details' field.
* @param value the value to set.
*/
- public void setDetails(java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.AnyValueMsg> value) {
+ public void setDetails(java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.AnyValueMsg> value) {
this.details = value;
}
public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<IMEventMsg>
implements org.apache.avro.data.RecordBuilder<IMEventMsg> {
- private java.lang.CharSequence originalID;
- private java.lang.CharSequence inStoreID;
+ private java.lang.String originalID;
+ private java.lang.String inStoreID;
private long occurredMillis;
private long receivedMillis;
- private java.lang.CharSequence userID;
- private java.lang.CharSequence clientID;
- private java.lang.CharSequence eventVersion;
+ private java.lang.String userID;
+ private java.lang.String clientID;
+ private java.lang.String eventVersion;
+ private java.lang.String eventType;
private boolean isActive;
- private java.lang.CharSequence role;
- private java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.AnyValueMsg> details;
+ private java.lang.String role;
+ private boolean isSynthetic;
+ private java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.AnyValueMsg> details;
/** Creates a new Builder */
private Builder() {
private Builder(gr.grnet.aquarium.message.avro.gen.IMEventMsg other) {
super(gr.grnet.aquarium.message.avro.gen.IMEventMsg.SCHEMA$);
if (isValidValue(fields()[0], other.originalID)) {
- this.originalID = (java.lang.CharSequence) data().deepCopy(fields()[0].schema(), other.originalID);
+ this.originalID = (java.lang.String) data().deepCopy(fields()[0].schema(), other.originalID);
fieldSetFlags()[0] = true;
}
if (isValidValue(fields()[1], other.inStoreID)) {
- this.inStoreID = (java.lang.CharSequence) data().deepCopy(fields()[1].schema(), other.inStoreID);
+ this.inStoreID = (java.lang.String) data().deepCopy(fields()[1].schema(), other.inStoreID);
fieldSetFlags()[1] = true;
}
if (isValidValue(fields()[2], other.occurredMillis)) {
fieldSetFlags()[3] = true;
}
if (isValidValue(fields()[4], other.userID)) {
- this.userID = (java.lang.CharSequence) data().deepCopy(fields()[4].schema(), other.userID);
+ this.userID = (java.lang.String) data().deepCopy(fields()[4].schema(), other.userID);
fieldSetFlags()[4] = true;
}
if (isValidValue(fields()[5], other.clientID)) {
- this.clientID = (java.lang.CharSequence) data().deepCopy(fields()[5].schema(), other.clientID);
+ this.clientID = (java.lang.String) data().deepCopy(fields()[5].schema(), other.clientID);
fieldSetFlags()[5] = true;
}
if (isValidValue(fields()[6], other.eventVersion)) {
- this.eventVersion = (java.lang.CharSequence) data().deepCopy(fields()[6].schema(), other.eventVersion);
+ this.eventVersion = (java.lang.String) data().deepCopy(fields()[6].schema(), other.eventVersion);
fieldSetFlags()[6] = true;
}
- if (isValidValue(fields()[7], other.isActive)) {
- this.isActive = (java.lang.Boolean) data().deepCopy(fields()[7].schema(), other.isActive);
+ if (isValidValue(fields()[7], other.eventType)) {
+ this.eventType = (java.lang.String) data().deepCopy(fields()[7].schema(), other.eventType);
fieldSetFlags()[7] = true;
}
- if (isValidValue(fields()[8], other.role)) {
- this.role = (java.lang.CharSequence) data().deepCopy(fields()[8].schema(), other.role);
+ if (isValidValue(fields()[8], other.isActive)) {
+ this.isActive = (java.lang.Boolean) data().deepCopy(fields()[8].schema(), other.isActive);
fieldSetFlags()[8] = true;
}
- if (isValidValue(fields()[9], other.details)) {
- this.details = (java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.AnyValueMsg>) data().deepCopy(fields()[9].schema(), other.details);
+ if (isValidValue(fields()[9], other.role)) {
+ this.role = (java.lang.String) data().deepCopy(fields()[9].schema(), other.role);
fieldSetFlags()[9] = true;
}
+ if (isValidValue(fields()[10], other.isSynthetic)) {
+ this.isSynthetic = (java.lang.Boolean) data().deepCopy(fields()[10].schema(), other.isSynthetic);
+ fieldSetFlags()[10] = true;
+ }
+ if (isValidValue(fields()[11], other.details)) {
+ this.details = (java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.AnyValueMsg>) data().deepCopy(fields()[11].schema(), other.details);
+ fieldSetFlags()[11] = true;
+ }
}
/** Gets the value of the 'originalID' field */
- public java.lang.CharSequence getOriginalID() {
+ public java.lang.String getOriginalID() {
return originalID;
}
/** Sets the value of the 'originalID' field */
- public gr.grnet.aquarium.message.avro.gen.IMEventMsg.Builder setOriginalID(java.lang.CharSequence value) {
+ public gr.grnet.aquarium.message.avro.gen.IMEventMsg.Builder setOriginalID(java.lang.String value) {
validate(fields()[0], value);
this.originalID = value;
fieldSetFlags()[0] = true;
}
/** Gets the value of the 'inStoreID' field */
- public java.lang.CharSequence getInStoreID() {
+ public java.lang.String getInStoreID() {
return inStoreID;
}
/** Sets the value of the 'inStoreID' field */
- public gr.grnet.aquarium.message.avro.gen.IMEventMsg.Builder setInStoreID(java.lang.CharSequence value) {
+ public gr.grnet.aquarium.message.avro.gen.IMEventMsg.Builder setInStoreID(java.lang.String value) {
validate(fields()[1], value);
this.inStoreID = value;
fieldSetFlags()[1] = true;
}
/** Gets the value of the 'userID' field */
- public java.lang.CharSequence getUserID() {
+ public java.lang.String getUserID() {
return userID;
}
/** Sets the value of the 'userID' field */
- public gr.grnet.aquarium.message.avro.gen.IMEventMsg.Builder setUserID(java.lang.CharSequence value) {
+ public gr.grnet.aquarium.message.avro.gen.IMEventMsg.Builder setUserID(java.lang.String value) {
validate(fields()[4], value);
this.userID = value;
fieldSetFlags()[4] = true;
}
/** Gets the value of the 'clientID' field */
- public java.lang.CharSequence getClientID() {
+ public java.lang.String getClientID() {
return clientID;
}
/** Sets the value of the 'clientID' field */
- public gr.grnet.aquarium.message.avro.gen.IMEventMsg.Builder setClientID(java.lang.CharSequence value) {
+ public gr.grnet.aquarium.message.avro.gen.IMEventMsg.Builder setClientID(java.lang.String value) {
validate(fields()[5], value);
this.clientID = value;
fieldSetFlags()[5] = true;
}
/** Gets the value of the 'eventVersion' field */
- public java.lang.CharSequence getEventVersion() {
+ public java.lang.String getEventVersion() {
return eventVersion;
}
/** Sets the value of the 'eventVersion' field */
- public gr.grnet.aquarium.message.avro.gen.IMEventMsg.Builder setEventVersion(java.lang.CharSequence value) {
+ public gr.grnet.aquarium.message.avro.gen.IMEventMsg.Builder setEventVersion(java.lang.String value) {
validate(fields()[6], value);
this.eventVersion = value;
fieldSetFlags()[6] = true;
return this;
}
+ /** Gets the value of the 'eventType' field */
+ public java.lang.String getEventType() {
+ return eventType;
+ }
+
+ /** Sets the value of the 'eventType' field */
+ public gr.grnet.aquarium.message.avro.gen.IMEventMsg.Builder setEventType(java.lang.String value) {
+ validate(fields()[7], value);
+ this.eventType = value;
+ fieldSetFlags()[7] = true;
+ return this;
+ }
+
+ /** Checks whether the 'eventType' field has been set */
+ public boolean hasEventType() {
+ return fieldSetFlags()[7];
+ }
+
+ /** Clears the value of the 'eventType' field */
+ public gr.grnet.aquarium.message.avro.gen.IMEventMsg.Builder clearEventType() {
+ eventType = null;
+ fieldSetFlags()[7] = false;
+ return this;
+ }
+
/** Gets the value of the 'isActive' field */
public java.lang.Boolean getIsActive() {
return isActive;
/** Sets the value of the 'isActive' field */
public gr.grnet.aquarium.message.avro.gen.IMEventMsg.Builder setIsActive(boolean value) {
- validate(fields()[7], value);
+ validate(fields()[8], value);
this.isActive = value;
- fieldSetFlags()[7] = true;
+ fieldSetFlags()[8] = true;
return this;
}
/** Checks whether the 'isActive' field has been set */
public boolean hasIsActive() {
- return fieldSetFlags()[7];
+ return fieldSetFlags()[8];
}
/** Clears the value of the 'isActive' field */
public gr.grnet.aquarium.message.avro.gen.IMEventMsg.Builder clearIsActive() {
- fieldSetFlags()[7] = false;
+ fieldSetFlags()[8] = false;
return this;
}
/** Gets the value of the 'role' field */
- public java.lang.CharSequence getRole() {
+ public java.lang.String getRole() {
return role;
}
/** Sets the value of the 'role' field */
- public gr.grnet.aquarium.message.avro.gen.IMEventMsg.Builder setRole(java.lang.CharSequence value) {
- validate(fields()[8], value);
+ public gr.grnet.aquarium.message.avro.gen.IMEventMsg.Builder setRole(java.lang.String value) {
+ validate(fields()[9], value);
this.role = value;
- fieldSetFlags()[8] = true;
+ fieldSetFlags()[9] = true;
return this;
}
/** Checks whether the 'role' field has been set */
public boolean hasRole() {
- return fieldSetFlags()[8];
+ return fieldSetFlags()[9];
}
/** Clears the value of the 'role' field */
public gr.grnet.aquarium.message.avro.gen.IMEventMsg.Builder clearRole() {
role = null;
- fieldSetFlags()[8] = false;
+ fieldSetFlags()[9] = false;
+ return this;
+ }
+
+ /** Gets the value of the 'isSynthetic' field */
+ public java.lang.Boolean getIsSynthetic() {
+ return isSynthetic;
+ }
+
+ /** Sets the value of the 'isSynthetic' field */
+ public gr.grnet.aquarium.message.avro.gen.IMEventMsg.Builder setIsSynthetic(boolean value) {
+ validate(fields()[10], value);
+ this.isSynthetic = value;
+ fieldSetFlags()[10] = true;
+ return this;
+ }
+
+ /** Checks whether the 'isSynthetic' field has been set */
+ public boolean hasIsSynthetic() {
+ return fieldSetFlags()[10];
+ }
+
+ /** Clears the value of the 'isSynthetic' field */
+ public gr.grnet.aquarium.message.avro.gen.IMEventMsg.Builder clearIsSynthetic() {
+ fieldSetFlags()[10] = false;
return this;
}
/** Gets the value of the 'details' field */
- public java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.AnyValueMsg> getDetails() {
+ public java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.AnyValueMsg> getDetails() {
return details;
}
/** Sets the value of the 'details' field */
- public gr.grnet.aquarium.message.avro.gen.IMEventMsg.Builder setDetails(java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.AnyValueMsg> value) {
- validate(fields()[9], value);
+ public gr.grnet.aquarium.message.avro.gen.IMEventMsg.Builder setDetails(java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.AnyValueMsg> value) {
+ validate(fields()[11], value);
this.details = value;
- fieldSetFlags()[9] = true;
+ fieldSetFlags()[11] = true;
return this;
}
/** Checks whether the 'details' field has been set */
public boolean hasDetails() {
- return fieldSetFlags()[9];
+ return fieldSetFlags()[11];
}
/** Clears the value of the 'details' field */
public gr.grnet.aquarium.message.avro.gen.IMEventMsg.Builder clearDetails() {
details = null;
- fieldSetFlags()[9] = false;
+ fieldSetFlags()[11] = false;
return this;
}
public IMEventMsg build() {
try {
IMEventMsg record = new IMEventMsg();
- 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.originalID = fieldSetFlags()[0] ? this.originalID : (java.lang.String) defaultValue(fields()[0]);
+ record.inStoreID = fieldSetFlags()[1] ? this.inStoreID : (java.lang.String) 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]);
- record.clientID = fieldSetFlags()[5] ? this.clientID : (java.lang.CharSequence) defaultValue(fields()[5]);
- record.eventVersion = fieldSetFlags()[6] ? this.eventVersion : (java.lang.CharSequence) defaultValue(fields()[6]);
- record.isActive = fieldSetFlags()[7] ? this.isActive : (java.lang.Boolean) defaultValue(fields()[7]);
- record.role = fieldSetFlags()[8] ? this.role : (java.lang.CharSequence) defaultValue(fields()[8]);
- record.details = fieldSetFlags()[9] ? this.details : (java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.AnyValueMsg>) defaultValue(fields()[9]);
+ record.userID = fieldSetFlags()[4] ? this.userID : (java.lang.String) defaultValue(fields()[4]);
+ record.clientID = fieldSetFlags()[5] ? this.clientID : (java.lang.String) defaultValue(fields()[5]);
+ record.eventVersion = fieldSetFlags()[6] ? this.eventVersion : (java.lang.String) defaultValue(fields()[6]);
+ record.eventType = fieldSetFlags()[7] ? this.eventType : (java.lang.String) defaultValue(fields()[7]);
+ record.isActive = fieldSetFlags()[8] ? this.isActive : (java.lang.Boolean) defaultValue(fields()[8]);
+ record.role = fieldSetFlags()[9] ? this.role : (java.lang.String) defaultValue(fields()[9]);
+ record.isSynthetic = fieldSetFlags()[10] ? this.isSynthetic : (java.lang.Boolean) defaultValue(fields()[10]);
+ record.details = fieldSetFlags()[11] ? this.details : (java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.AnyValueMsg>) defaultValue(fields()[11]);
return record;
} catch (Exception e) {
throw new org.apache.avro.AvroRuntimeException(e);
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\":\"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;
+ 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\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"inStoreID\",\"type\":[{\"type\":\"string\",\"avro.java.string\":\"String\"},\"null\"]},{\"name\":\"parentID\",\"type\":[{\"type\":\"string\",\"avro.java.string\":\"String\"},\"null\"]},{\"name\":\"validFromMillis\",\"type\":\"long\"},{\"name\":\"validToMillis\",\"type\":\"long\"},{\"name\":\"resourceTypes\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"ResourceTypeMsg\",\"fields\":[{\"name\":\"name\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"unit\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"chargingBehaviorClass\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}}]}}},{\"name\":\"chargingBehaviors\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"string\",\"avro.java.string\":\"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\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"b\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}}]},\"null\"]}]}}}]},{\"type\":\"map\",\"values\":\"SelectorValueMsg\",\"avro.java.string\":\"String\"}]}]},\"avro.java.string\":\"String\"},\"avro.java.string\":\"String\"}}]},\"avro.java.string\":\"String\"}}]}");
+ @Deprecated public java.lang.String originalID;
+ @Deprecated public java.lang.String inStoreID;
+ @Deprecated public java.lang.String parentID;
@Deprecated public long validFromMillis;
@Deprecated public long validToMillis;
@Deprecated public java.util.List<gr.grnet.aquarium.message.avro.gen.ResourceTypeMsg> resourceTypes;
- @Deprecated public java.util.List<java.lang.CharSequence> chargingBehaviors;
- @Deprecated public java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.FullPriceTableMsg> roleMapping;
+ @Deprecated public java.util.List<java.lang.String> chargingBehaviors;
+ @Deprecated public java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.FullPriceTableMsg> roleMapping;
public org.apache.avro.Schema getSchema() { return SCHEMA$; }
// Used by DatumWriter. Applications should not call.
public java.lang.Object get(int field$) {
@SuppressWarnings(value="unchecked")
public void put(int field$, java.lang.Object value$) {
switch (field$) {
- 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 0: originalID = (java.lang.String)value$; break;
+ case 1: inStoreID = (java.lang.String)value$; break;
+ case 2: parentID = (java.lang.String)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;
+ case 6: chargingBehaviors = (java.util.List<java.lang.String>)value$; break;
+ case 7: roleMapping = (java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.FullPriceTableMsg>)value$; break;
default: throw new org.apache.avro.AvroRuntimeException("Bad index");
}
}
/**
* Gets the value of the 'originalID' field.
*/
- public java.lang.CharSequence getOriginalID() {
+ public java.lang.String getOriginalID() {
return originalID;
}
* Sets the value of the 'originalID' field.
* @param value the value to set.
*/
- public void setOriginalID(java.lang.CharSequence value) {
+ public void setOriginalID(java.lang.String value) {
this.originalID = value;
}
/**
* Gets the value of the 'inStoreID' field.
*/
- public java.lang.CharSequence getInStoreID() {
+ public java.lang.String getInStoreID() {
return inStoreID;
}
* Sets the value of the 'inStoreID' field.
* @param value the value to set.
*/
- public void setInStoreID(java.lang.CharSequence value) {
+ public void setInStoreID(java.lang.String value) {
this.inStoreID = value;
}
/**
* Gets the value of the 'parentID' field.
*/
- public java.lang.CharSequence getParentID() {
+ public java.lang.String getParentID() {
return parentID;
}
* Sets the value of the 'parentID' field.
* @param value the value to set.
*/
- public void setParentID(java.lang.CharSequence value) {
+ public void setParentID(java.lang.String value) {
this.parentID = value;
}
/**
* Gets the value of the 'chargingBehaviors' field.
*/
- public java.util.List<java.lang.CharSequence> getChargingBehaviors() {
+ public java.util.List<java.lang.String> getChargingBehaviors() {
return chargingBehaviors;
}
* Sets the value of the 'chargingBehaviors' field.
* @param value the value to set.
*/
- public void setChargingBehaviors(java.util.List<java.lang.CharSequence> value) {
+ public void setChargingBehaviors(java.util.List<java.lang.String> value) {
this.chargingBehaviors = value;
}
/**
* Gets the value of the 'roleMapping' field.
*/
- public java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.FullPriceTableMsg> getRoleMapping() {
+ public java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.FullPriceTableMsg> getRoleMapping() {
return roleMapping;
}
* Sets the value of the 'roleMapping' field.
* @param value the value to set.
*/
- public void setRoleMapping(java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.FullPriceTableMsg> value) {
+ public void setRoleMapping(java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.FullPriceTableMsg> value) {
this.roleMapping = value;
}
public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<PolicyMsg>
implements org.apache.avro.data.RecordBuilder<PolicyMsg> {
- private java.lang.CharSequence originalID;
- private java.lang.CharSequence inStoreID;
- private java.lang.CharSequence parentID;
+ private java.lang.String originalID;
+ private java.lang.String inStoreID;
+ private java.lang.String parentID;
private long validFromMillis;
private long validToMillis;
private java.util.List<gr.grnet.aquarium.message.avro.gen.ResourceTypeMsg> resourceTypes;
- private java.util.List<java.lang.CharSequence> chargingBehaviors;
- private java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.FullPriceTableMsg> roleMapping;
+ private java.util.List<java.lang.String> chargingBehaviors;
+ private java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.FullPriceTableMsg> roleMapping;
/** Creates a new Builder */
private Builder() {
private Builder(gr.grnet.aquarium.message.avro.gen.PolicyMsg other) {
super(gr.grnet.aquarium.message.avro.gen.PolicyMsg.SCHEMA$);
if (isValidValue(fields()[0], other.originalID)) {
- this.originalID = (java.lang.CharSequence) data().deepCopy(fields()[0].schema(), other.originalID);
+ this.originalID = (java.lang.String) data().deepCopy(fields()[0].schema(), other.originalID);
fieldSetFlags()[0] = true;
}
if (isValidValue(fields()[1], other.inStoreID)) {
- this.inStoreID = (java.lang.CharSequence) data().deepCopy(fields()[1].schema(), other.inStoreID);
+ this.inStoreID = (java.lang.String) data().deepCopy(fields()[1].schema(), other.inStoreID);
fieldSetFlags()[1] = true;
}
if (isValidValue(fields()[2], other.parentID)) {
- this.parentID = (java.lang.CharSequence) data().deepCopy(fields()[2].schema(), other.parentID);
+ this.parentID = (java.lang.String) data().deepCopy(fields()[2].schema(), other.parentID);
fieldSetFlags()[2] = true;
}
if (isValidValue(fields()[3], other.validFromMillis)) {
fieldSetFlags()[5] = true;
}
if (isValidValue(fields()[6], other.chargingBehaviors)) {
- this.chargingBehaviors = (java.util.List<java.lang.CharSequence>) data().deepCopy(fields()[6].schema(), other.chargingBehaviors);
+ this.chargingBehaviors = (java.util.List<java.lang.String>) 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);
+ this.roleMapping = (java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.FullPriceTableMsg>) data().deepCopy(fields()[7].schema(), other.roleMapping);
fieldSetFlags()[7] = true;
}
}
/** Gets the value of the 'originalID' field */
- public java.lang.CharSequence getOriginalID() {
+ public java.lang.String getOriginalID() {
return originalID;
}
/** Sets the value of the 'originalID' field */
- public gr.grnet.aquarium.message.avro.gen.PolicyMsg.Builder setOriginalID(java.lang.CharSequence value) {
+ public gr.grnet.aquarium.message.avro.gen.PolicyMsg.Builder setOriginalID(java.lang.String value) {
validate(fields()[0], value);
this.originalID = value;
fieldSetFlags()[0] = true;
}
/** Gets the value of the 'inStoreID' field */
- public java.lang.CharSequence getInStoreID() {
+ public java.lang.String getInStoreID() {
return inStoreID;
}
/** Sets the value of the 'inStoreID' field */
- public gr.grnet.aquarium.message.avro.gen.PolicyMsg.Builder setInStoreID(java.lang.CharSequence value) {
+ public gr.grnet.aquarium.message.avro.gen.PolicyMsg.Builder setInStoreID(java.lang.String value) {
validate(fields()[1], value);
this.inStoreID = value;
fieldSetFlags()[1] = true;
}
/** Gets the value of the 'parentID' field */
- public java.lang.CharSequence getParentID() {
+ public java.lang.String getParentID() {
return parentID;
}
/** Sets the value of the 'parentID' field */
- public gr.grnet.aquarium.message.avro.gen.PolicyMsg.Builder setParentID(java.lang.CharSequence value) {
+ public gr.grnet.aquarium.message.avro.gen.PolicyMsg.Builder setParentID(java.lang.String value) {
validate(fields()[2], value);
this.parentID = value;
fieldSetFlags()[2] = true;
}
/** Gets the value of the 'chargingBehaviors' field */
- public java.util.List<java.lang.CharSequence> getChargingBehaviors() {
+ public java.util.List<java.lang.String> getChargingBehaviors() {
return chargingBehaviors;
}
/** Sets the value of the 'chargingBehaviors' field */
- public gr.grnet.aquarium.message.avro.gen.PolicyMsg.Builder setChargingBehaviors(java.util.List<java.lang.CharSequence> value) {
+ public gr.grnet.aquarium.message.avro.gen.PolicyMsg.Builder setChargingBehaviors(java.util.List<java.lang.String> value) {
validate(fields()[6], value);
this.chargingBehaviors = value;
fieldSetFlags()[6] = true;
}
/** Gets the value of the 'roleMapping' field */
- public java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.FullPriceTableMsg> getRoleMapping() {
+ public java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.FullPriceTableMsg> getRoleMapping() {
return roleMapping;
}
/** 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) {
+ public gr.grnet.aquarium.message.avro.gen.PolicyMsg.Builder setRoleMapping(java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.FullPriceTableMsg> value) {
validate(fields()[7], value);
this.roleMapping = value;
fieldSetFlags()[7] = true;
public PolicyMsg build() {
try {
PolicyMsg record = new PolicyMsg();
- 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.originalID = fieldSetFlags()[0] ? this.originalID : (java.lang.String) defaultValue(fields()[0]);
+ record.inStoreID = fieldSetFlags()[1] ? this.inStoreID : (java.lang.String) defaultValue(fields()[1]);
+ record.parentID = fieldSetFlags()[2] ? this.parentID : (java.lang.String) 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]);
+ record.chargingBehaviors = fieldSetFlags()[6] ? this.chargingBehaviors : (java.util.List<java.lang.String>) defaultValue(fields()[6]);
+ record.roleMapping = fieldSetFlags()[7] ? this.roleMapping : (java.util.Map<java.lang.String,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 ResourceEntryMsg 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\":\"ResourceEntryMsg\",\"namespace\":\"gr.grnet.aquarium.message.avro.gen\",\"fields\":[{\"name\":\"resourceName\",\"type\":\"string\"},{\"name\":\"resourceType\",\"type\":\"string\"},{\"name\":\"unitName\",\"type\":\"string\"},{\"name\":\"totalCredits\",\"type\":\"string\"},{\"name\":\"details\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"EventEntryMsg\",\"fields\":[{\"name\":\"eventType\",\"type\":\"string\"},{\"name\":\"details\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"ChargeEntryMsg\",\"fields\":[{\"name\":\"id\",\"type\":\"string\"},{\"name\":\"unitPrice\",\"type\":\"string\"},{\"name\":\"startTime\",\"type\":\"string\"},{\"name\":\"endTime\",\"type\":\"string\"},{\"name\":\"ellapsedTime\",\"type\":\"string\"},{\"name\":\"credits\",\"type\":\"string\"}]}}}]}}}]}");
- @Deprecated public java.lang.CharSequence resourceName;
- @Deprecated public java.lang.CharSequence resourceType;
- @Deprecated public java.lang.CharSequence unitName;
- @Deprecated public java.lang.CharSequence totalCredits;
+ public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"ResourceEntryMsg\",\"namespace\":\"gr.grnet.aquarium.message.avro.gen\",\"fields\":[{\"name\":\"resourceName\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"resourceType\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"unitName\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"totalCredits\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"details\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"EventEntryMsg\",\"fields\":[{\"name\":\"eventType\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"details\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"ChargeEntryMsg\",\"fields\":[{\"name\":\"id\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"unitPrice\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"startTime\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"endTime\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"ellapsedTime\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"credits\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}}]}}}]}}}]}");
+ @Deprecated public java.lang.String resourceName;
+ @Deprecated public java.lang.String resourceType;
+ @Deprecated public java.lang.String unitName;
+ @Deprecated public java.lang.String totalCredits;
@Deprecated public java.util.List<gr.grnet.aquarium.message.avro.gen.EventEntryMsg> details;
public org.apache.avro.Schema getSchema() { return SCHEMA$; }
// Used by DatumWriter. Applications should not call.
@SuppressWarnings(value="unchecked")
public void put(int field$, java.lang.Object value$) {
switch (field$) {
- case 0: resourceName = (java.lang.CharSequence)value$; break;
- case 1: resourceType = (java.lang.CharSequence)value$; break;
- case 2: unitName = (java.lang.CharSequence)value$; break;
- case 3: totalCredits = (java.lang.CharSequence)value$; break;
+ case 0: resourceName = (java.lang.String)value$; break;
+ case 1: resourceType = (java.lang.String)value$; break;
+ case 2: unitName = (java.lang.String)value$; break;
+ case 3: totalCredits = (java.lang.String)value$; break;
case 4: details = (java.util.List<gr.grnet.aquarium.message.avro.gen.EventEntryMsg>)value$; break;
default: throw new org.apache.avro.AvroRuntimeException("Bad index");
}
/**
* Gets the value of the 'resourceName' field.
*/
- public java.lang.CharSequence getResourceName() {
+ public java.lang.String getResourceName() {
return resourceName;
}
* Sets the value of the 'resourceName' field.
* @param value the value to set.
*/
- public void setResourceName(java.lang.CharSequence value) {
+ public void setResourceName(java.lang.String value) {
this.resourceName = value;
}
/**
* Gets the value of the 'resourceType' field.
*/
- public java.lang.CharSequence getResourceType() {
+ public java.lang.String getResourceType() {
return resourceType;
}
* Sets the value of the 'resourceType' field.
* @param value the value to set.
*/
- public void setResourceType(java.lang.CharSequence value) {
+ public void setResourceType(java.lang.String value) {
this.resourceType = value;
}
/**
* Gets the value of the 'unitName' field.
*/
- public java.lang.CharSequence getUnitName() {
+ public java.lang.String getUnitName() {
return unitName;
}
* Sets the value of the 'unitName' field.
* @param value the value to set.
*/
- public void setUnitName(java.lang.CharSequence value) {
+ public void setUnitName(java.lang.String value) {
this.unitName = value;
}
/**
* Gets the value of the 'totalCredits' field.
*/
- public java.lang.CharSequence getTotalCredits() {
+ public java.lang.String getTotalCredits() {
return totalCredits;
}
* Sets the value of the 'totalCredits' field.
* @param value the value to set.
*/
- public void setTotalCredits(java.lang.CharSequence value) {
+ public void setTotalCredits(java.lang.String value) {
this.totalCredits = value;
}
public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<ResourceEntryMsg>
implements org.apache.avro.data.RecordBuilder<ResourceEntryMsg> {
- private java.lang.CharSequence resourceName;
- private java.lang.CharSequence resourceType;
- private java.lang.CharSequence unitName;
- private java.lang.CharSequence totalCredits;
+ private java.lang.String resourceName;
+ private java.lang.String resourceType;
+ private java.lang.String unitName;
+ private java.lang.String totalCredits;
private java.util.List<gr.grnet.aquarium.message.avro.gen.EventEntryMsg> details;
/** Creates a new Builder */
private Builder(gr.grnet.aquarium.message.avro.gen.ResourceEntryMsg other) {
super(gr.grnet.aquarium.message.avro.gen.ResourceEntryMsg.SCHEMA$);
if (isValidValue(fields()[0], other.resourceName)) {
- this.resourceName = (java.lang.CharSequence) data().deepCopy(fields()[0].schema(), other.resourceName);
+ this.resourceName = (java.lang.String) data().deepCopy(fields()[0].schema(), other.resourceName);
fieldSetFlags()[0] = true;
}
if (isValidValue(fields()[1], other.resourceType)) {
- this.resourceType = (java.lang.CharSequence) data().deepCopy(fields()[1].schema(), other.resourceType);
+ this.resourceType = (java.lang.String) data().deepCopy(fields()[1].schema(), other.resourceType);
fieldSetFlags()[1] = true;
}
if (isValidValue(fields()[2], other.unitName)) {
- this.unitName = (java.lang.CharSequence) data().deepCopy(fields()[2].schema(), other.unitName);
+ this.unitName = (java.lang.String) data().deepCopy(fields()[2].schema(), other.unitName);
fieldSetFlags()[2] = true;
}
if (isValidValue(fields()[3], other.totalCredits)) {
- this.totalCredits = (java.lang.CharSequence) data().deepCopy(fields()[3].schema(), other.totalCredits);
+ this.totalCredits = (java.lang.String) data().deepCopy(fields()[3].schema(), other.totalCredits);
fieldSetFlags()[3] = true;
}
if (isValidValue(fields()[4], other.details)) {
}
/** Gets the value of the 'resourceName' field */
- public java.lang.CharSequence getResourceName() {
+ public java.lang.String getResourceName() {
return resourceName;
}
/** Sets the value of the 'resourceName' field */
- public gr.grnet.aquarium.message.avro.gen.ResourceEntryMsg.Builder setResourceName(java.lang.CharSequence value) {
+ public gr.grnet.aquarium.message.avro.gen.ResourceEntryMsg.Builder setResourceName(java.lang.String value) {
validate(fields()[0], value);
this.resourceName = value;
fieldSetFlags()[0] = true;
}
/** Gets the value of the 'resourceType' field */
- public java.lang.CharSequence getResourceType() {
+ public java.lang.String getResourceType() {
return resourceType;
}
/** Sets the value of the 'resourceType' field */
- public gr.grnet.aquarium.message.avro.gen.ResourceEntryMsg.Builder setResourceType(java.lang.CharSequence value) {
+ public gr.grnet.aquarium.message.avro.gen.ResourceEntryMsg.Builder setResourceType(java.lang.String value) {
validate(fields()[1], value);
this.resourceType = value;
fieldSetFlags()[1] = true;
}
/** Gets the value of the 'unitName' field */
- public java.lang.CharSequence getUnitName() {
+ public java.lang.String getUnitName() {
return unitName;
}
/** Sets the value of the 'unitName' field */
- public gr.grnet.aquarium.message.avro.gen.ResourceEntryMsg.Builder setUnitName(java.lang.CharSequence value) {
+ public gr.grnet.aquarium.message.avro.gen.ResourceEntryMsg.Builder setUnitName(java.lang.String value) {
validate(fields()[2], value);
this.unitName = value;
fieldSetFlags()[2] = true;
}
/** Gets the value of the 'totalCredits' field */
- public java.lang.CharSequence getTotalCredits() {
+ public java.lang.String getTotalCredits() {
return totalCredits;
}
/** Sets the value of the 'totalCredits' field */
- public gr.grnet.aquarium.message.avro.gen.ResourceEntryMsg.Builder setTotalCredits(java.lang.CharSequence value) {
+ public gr.grnet.aquarium.message.avro.gen.ResourceEntryMsg.Builder setTotalCredits(java.lang.String value) {
validate(fields()[3], value);
this.totalCredits = value;
fieldSetFlags()[3] = true;
public ResourceEntryMsg build() {
try {
ResourceEntryMsg record = new ResourceEntryMsg();
- record.resourceName = fieldSetFlags()[0] ? this.resourceName : (java.lang.CharSequence) defaultValue(fields()[0]);
- record.resourceType = fieldSetFlags()[1] ? this.resourceType : (java.lang.CharSequence) defaultValue(fields()[1]);
- record.unitName = fieldSetFlags()[2] ? this.unitName : (java.lang.CharSequence) defaultValue(fields()[2]);
- record.totalCredits = fieldSetFlags()[3] ? this.totalCredits : (java.lang.CharSequence) defaultValue(fields()[3]);
+ record.resourceName = fieldSetFlags()[0] ? this.resourceName : (java.lang.String) defaultValue(fields()[0]);
+ record.resourceType = fieldSetFlags()[1] ? this.resourceType : (java.lang.String) defaultValue(fields()[1]);
+ record.unitName = fieldSetFlags()[2] ? this.unitName : (java.lang.String) defaultValue(fields()[2]);
+ record.totalCredits = fieldSetFlags()[3] ? this.totalCredits : (java.lang.String) defaultValue(fields()[3]);
record.details = fieldSetFlags()[4] ? this.details : (java.util.List<gr.grnet.aquarium.message.avro.gen.EventEntryMsg>) defaultValue(fields()[4]);
return record;
} catch (Exception 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\":\"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;
+ 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\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"inStoreID\",\"type\":[{\"type\":\"string\",\"avro.java.string\":\"String\"},\"null\"]},{\"name\":\"occurredMillis\",\"type\":\"long\"},{\"name\":\"receivedMillis\",\"type\":\"long\",\"default\":0},{\"name\":\"userID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"clientID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"eventVersion\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"default\":\"1.0\"},{\"name\":\"resource\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"instanceID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"value\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"isSynthetic\",\"type\":\"boolean\",\"default\":false},{\"name\":\"details\",\"type\":{\"type\":\"map\",\"values\":{\"type\":\"record\",\"name\":\"AnyValueMsg\",\"fields\":[{\"name\":\"anyValue\",\"type\":[\"null\",\"int\",\"long\",\"boolean\",\"double\",\"bytes\",{\"type\":\"string\",\"avro.java.string\":\"String\"},{\"type\":\"array\",\"items\":\"AnyValueMsg\"},{\"type\":\"map\",\"values\":\"AnyValueMsg\",\"avro.java.string\":\"String\"}]}]},\"avro.java.string\":\"String\"}}]}");
+ @Deprecated public java.lang.String originalID;
+ @Deprecated public java.lang.String inStoreID;
@Deprecated public long occurredMillis;
@Deprecated public long receivedMillis;
- @Deprecated public java.lang.CharSequence userID;
- @Deprecated public java.lang.CharSequence clientID;
- @Deprecated public java.lang.CharSequence eventVersion;
- @Deprecated public java.lang.CharSequence resource;
- @Deprecated public java.lang.CharSequence instanceID;
- @Deprecated public java.lang.CharSequence value;
- @Deprecated public java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.AnyValueMsg> details;
+ @Deprecated public java.lang.String userID;
+ @Deprecated public java.lang.String clientID;
+ @Deprecated public java.lang.String eventVersion;
+ @Deprecated public java.lang.String resource;
+ @Deprecated public java.lang.String instanceID;
+ @Deprecated public java.lang.String value;
+ @Deprecated public boolean isSynthetic;
+ @Deprecated public java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.AnyValueMsg> details;
public org.apache.avro.Schema getSchema() { return SCHEMA$; }
// Used by DatumWriter. Applications should not call.
public java.lang.Object get(int field$) {
case 7: return resource;
case 8: return instanceID;
case 9: return value;
- case 10: return details;
+ case 10: return isSynthetic;
+ case 11: return details;
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: originalID = (java.lang.CharSequence)value$; break;
- case 1: inStoreID = (java.lang.CharSequence)value$; break;
+ case 0: originalID = (java.lang.String)value$; break;
+ case 1: inStoreID = (java.lang.String)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;
- case 5: clientID = (java.lang.CharSequence)value$; break;
- case 6: eventVersion = (java.lang.CharSequence)value$; break;
- case 7: resource = (java.lang.CharSequence)value$; break;
- case 8: instanceID = (java.lang.CharSequence)value$; break;
- case 9: value = (java.lang.CharSequence)value$; break;
- case 10: details = (java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.AnyValueMsg>)value$; break;
+ case 4: userID = (java.lang.String)value$; break;
+ case 5: clientID = (java.lang.String)value$; break;
+ case 6: eventVersion = (java.lang.String)value$; break;
+ case 7: resource = (java.lang.String)value$; break;
+ case 8: instanceID = (java.lang.String)value$; break;
+ case 9: value = (java.lang.String)value$; break;
+ case 10: isSynthetic = (java.lang.Boolean)value$; break;
+ case 11: details = (java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.AnyValueMsg>)value$; break;
default: throw new org.apache.avro.AvroRuntimeException("Bad index");
}
}
/**
* Gets the value of the 'originalID' field.
*/
- public java.lang.CharSequence getOriginalID() {
+ public java.lang.String getOriginalID() {
return originalID;
}
* Sets the value of the 'originalID' field.
* @param value the value to set.
*/
- public void setOriginalID(java.lang.CharSequence value) {
+ public void setOriginalID(java.lang.String value) {
this.originalID = value;
}
/**
* Gets the value of the 'inStoreID' field.
*/
- public java.lang.CharSequence getInStoreID() {
+ public java.lang.String getInStoreID() {
return inStoreID;
}
* Sets the value of the 'inStoreID' field.
* @param value the value to set.
*/
- public void setInStoreID(java.lang.CharSequence value) {
+ public void setInStoreID(java.lang.String value) {
this.inStoreID = value;
}
/**
* Gets the value of the 'userID' field.
*/
- public java.lang.CharSequence getUserID() {
+ public java.lang.String getUserID() {
return userID;
}
* Sets the value of the 'userID' field.
* @param value the value to set.
*/
- public void setUserID(java.lang.CharSequence value) {
+ public void setUserID(java.lang.String value) {
this.userID = value;
}
/**
* Gets the value of the 'clientID' field.
*/
- public java.lang.CharSequence getClientID() {
+ public java.lang.String getClientID() {
return clientID;
}
* Sets the value of the 'clientID' field.
* @param value the value to set.
*/
- public void setClientID(java.lang.CharSequence value) {
+ public void setClientID(java.lang.String value) {
this.clientID = value;
}
/**
* Gets the value of the 'eventVersion' field.
*/
- public java.lang.CharSequence getEventVersion() {
+ public java.lang.String getEventVersion() {
return eventVersion;
}
* Sets the value of the 'eventVersion' field.
* @param value the value to set.
*/
- public void setEventVersion(java.lang.CharSequence value) {
+ public void setEventVersion(java.lang.String value) {
this.eventVersion = value;
}
/**
* Gets the value of the 'resource' field.
*/
- public java.lang.CharSequence getResource() {
+ public java.lang.String getResource() {
return resource;
}
* Sets the value of the 'resource' field.
* @param value the value to set.
*/
- public void setResource(java.lang.CharSequence value) {
+ public void setResource(java.lang.String value) {
this.resource = value;
}
/**
* Gets the value of the 'instanceID' field.
*/
- public java.lang.CharSequence getInstanceID() {
+ public java.lang.String getInstanceID() {
return instanceID;
}
* Sets the value of the 'instanceID' field.
* @param value the value to set.
*/
- public void setInstanceID(java.lang.CharSequence value) {
+ public void setInstanceID(java.lang.String value) {
this.instanceID = value;
}
/**
* Gets the value of the 'value' field.
*/
- public java.lang.CharSequence getValue() {
+ public java.lang.String getValue() {
return value;
}
* Sets the value of the 'value' field.
* @param value the value to set.
*/
- public void setValue(java.lang.CharSequence value) {
+ public void setValue(java.lang.String value) {
this.value = value;
}
/**
+ * Gets the value of the 'isSynthetic' field.
+ */
+ public java.lang.Boolean getIsSynthetic() {
+ return isSynthetic;
+ }
+
+ /**
+ * Sets the value of the 'isSynthetic' field.
+ * @param value the value to set.
+ */
+ public void setIsSynthetic(java.lang.Boolean value) {
+ this.isSynthetic = value;
+ }
+
+ /**
* Gets the value of the 'details' field.
*/
- public java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.AnyValueMsg> getDetails() {
+ public java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.AnyValueMsg> getDetails() {
return details;
}
* Sets the value of the 'details' field.
* @param value the value to set.
*/
- public void setDetails(java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.AnyValueMsg> value) {
+ public void setDetails(java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.AnyValueMsg> value) {
this.details = value;
}
public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<ResourceEventMsg>
implements org.apache.avro.data.RecordBuilder<ResourceEventMsg> {
- private java.lang.CharSequence originalID;
- private java.lang.CharSequence inStoreID;
+ private java.lang.String originalID;
+ private java.lang.String inStoreID;
private long occurredMillis;
private long receivedMillis;
- private java.lang.CharSequence userID;
- private java.lang.CharSequence clientID;
- private java.lang.CharSequence eventVersion;
- private java.lang.CharSequence resource;
- private java.lang.CharSequence instanceID;
- private java.lang.CharSequence value;
- private java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.AnyValueMsg> details;
+ private java.lang.String userID;
+ private java.lang.String clientID;
+ private java.lang.String eventVersion;
+ private java.lang.String resource;
+ private java.lang.String instanceID;
+ private java.lang.String value;
+ private boolean isSynthetic;
+ private java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.AnyValueMsg> details;
/** Creates a new Builder */
private Builder() {
private Builder(gr.grnet.aquarium.message.avro.gen.ResourceEventMsg other) {
super(gr.grnet.aquarium.message.avro.gen.ResourceEventMsg.SCHEMA$);
if (isValidValue(fields()[0], other.originalID)) {
- this.originalID = (java.lang.CharSequence) data().deepCopy(fields()[0].schema(), other.originalID);
+ this.originalID = (java.lang.String) data().deepCopy(fields()[0].schema(), other.originalID);
fieldSetFlags()[0] = true;
}
if (isValidValue(fields()[1], other.inStoreID)) {
- this.inStoreID = (java.lang.CharSequence) data().deepCopy(fields()[1].schema(), other.inStoreID);
+ this.inStoreID = (java.lang.String) data().deepCopy(fields()[1].schema(), other.inStoreID);
fieldSetFlags()[1] = true;
}
if (isValidValue(fields()[2], other.occurredMillis)) {
fieldSetFlags()[3] = true;
}
if (isValidValue(fields()[4], other.userID)) {
- this.userID = (java.lang.CharSequence) data().deepCopy(fields()[4].schema(), other.userID);
+ this.userID = (java.lang.String) data().deepCopy(fields()[4].schema(), other.userID);
fieldSetFlags()[4] = true;
}
if (isValidValue(fields()[5], other.clientID)) {
- this.clientID = (java.lang.CharSequence) data().deepCopy(fields()[5].schema(), other.clientID);
+ this.clientID = (java.lang.String) data().deepCopy(fields()[5].schema(), other.clientID);
fieldSetFlags()[5] = true;
}
if (isValidValue(fields()[6], other.eventVersion)) {
- this.eventVersion = (java.lang.CharSequence) data().deepCopy(fields()[6].schema(), other.eventVersion);
+ this.eventVersion = (java.lang.String) data().deepCopy(fields()[6].schema(), other.eventVersion);
fieldSetFlags()[6] = true;
}
if (isValidValue(fields()[7], other.resource)) {
- this.resource = (java.lang.CharSequence) data().deepCopy(fields()[7].schema(), other.resource);
+ this.resource = (java.lang.String) data().deepCopy(fields()[7].schema(), other.resource);
fieldSetFlags()[7] = true;
}
if (isValidValue(fields()[8], other.instanceID)) {
- this.instanceID = (java.lang.CharSequence) data().deepCopy(fields()[8].schema(), other.instanceID);
+ this.instanceID = (java.lang.String) data().deepCopy(fields()[8].schema(), other.instanceID);
fieldSetFlags()[8] = true;
}
if (isValidValue(fields()[9], other.value)) {
- this.value = (java.lang.CharSequence) data().deepCopy(fields()[9].schema(), other.value);
+ this.value = (java.lang.String) data().deepCopy(fields()[9].schema(), other.value);
fieldSetFlags()[9] = true;
}
- if (isValidValue(fields()[10], other.details)) {
- this.details = (java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.AnyValueMsg>) data().deepCopy(fields()[10].schema(), other.details);
+ if (isValidValue(fields()[10], other.isSynthetic)) {
+ this.isSynthetic = (java.lang.Boolean) data().deepCopy(fields()[10].schema(), other.isSynthetic);
fieldSetFlags()[10] = true;
}
+ if (isValidValue(fields()[11], other.details)) {
+ this.details = (java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.AnyValueMsg>) data().deepCopy(fields()[11].schema(), other.details);
+ fieldSetFlags()[11] = true;
+ }
}
/** Gets the value of the 'originalID' field */
- public java.lang.CharSequence getOriginalID() {
+ public java.lang.String getOriginalID() {
return originalID;
}
/** Sets the value of the 'originalID' field */
- public gr.grnet.aquarium.message.avro.gen.ResourceEventMsg.Builder setOriginalID(java.lang.CharSequence value) {
+ public gr.grnet.aquarium.message.avro.gen.ResourceEventMsg.Builder setOriginalID(java.lang.String value) {
validate(fields()[0], value);
this.originalID = value;
fieldSetFlags()[0] = true;
}
/** Gets the value of the 'inStoreID' field */
- public java.lang.CharSequence getInStoreID() {
+ public java.lang.String getInStoreID() {
return inStoreID;
}
/** Sets the value of the 'inStoreID' field */
- public gr.grnet.aquarium.message.avro.gen.ResourceEventMsg.Builder setInStoreID(java.lang.CharSequence value) {
+ public gr.grnet.aquarium.message.avro.gen.ResourceEventMsg.Builder setInStoreID(java.lang.String value) {
validate(fields()[1], value);
this.inStoreID = value;
fieldSetFlags()[1] = true;
}
/** Gets the value of the 'userID' field */
- public java.lang.CharSequence getUserID() {
+ public java.lang.String getUserID() {
return userID;
}
/** Sets the value of the 'userID' field */
- public gr.grnet.aquarium.message.avro.gen.ResourceEventMsg.Builder setUserID(java.lang.CharSequence value) {
+ public gr.grnet.aquarium.message.avro.gen.ResourceEventMsg.Builder setUserID(java.lang.String value) {
validate(fields()[4], value);
this.userID = value;
fieldSetFlags()[4] = true;
}
/** Gets the value of the 'clientID' field */
- public java.lang.CharSequence getClientID() {
+ public java.lang.String getClientID() {
return clientID;
}
/** Sets the value of the 'clientID' field */
- public gr.grnet.aquarium.message.avro.gen.ResourceEventMsg.Builder setClientID(java.lang.CharSequence value) {
+ public gr.grnet.aquarium.message.avro.gen.ResourceEventMsg.Builder setClientID(java.lang.String value) {
validate(fields()[5], value);
this.clientID = value;
fieldSetFlags()[5] = true;
}
/** Gets the value of the 'eventVersion' field */
- public java.lang.CharSequence getEventVersion() {
+ public java.lang.String getEventVersion() {
return eventVersion;
}
/** Sets the value of the 'eventVersion' field */
- public gr.grnet.aquarium.message.avro.gen.ResourceEventMsg.Builder setEventVersion(java.lang.CharSequence value) {
+ public gr.grnet.aquarium.message.avro.gen.ResourceEventMsg.Builder setEventVersion(java.lang.String value) {
validate(fields()[6], value);
this.eventVersion = value;
fieldSetFlags()[6] = true;
}
/** Gets the value of the 'resource' field */
- public java.lang.CharSequence getResource() {
+ public java.lang.String getResource() {
return resource;
}
/** Sets the value of the 'resource' field */
- public gr.grnet.aquarium.message.avro.gen.ResourceEventMsg.Builder setResource(java.lang.CharSequence value) {
+ public gr.grnet.aquarium.message.avro.gen.ResourceEventMsg.Builder setResource(java.lang.String value) {
validate(fields()[7], value);
this.resource = value;
fieldSetFlags()[7] = true;
}
/** Gets the value of the 'instanceID' field */
- public java.lang.CharSequence getInstanceID() {
+ public java.lang.String getInstanceID() {
return instanceID;
}
/** Sets the value of the 'instanceID' field */
- public gr.grnet.aquarium.message.avro.gen.ResourceEventMsg.Builder setInstanceID(java.lang.CharSequence value) {
+ public gr.grnet.aquarium.message.avro.gen.ResourceEventMsg.Builder setInstanceID(java.lang.String value) {
validate(fields()[8], value);
this.instanceID = value;
fieldSetFlags()[8] = true;
}
/** Gets the value of the 'value' field */
- public java.lang.CharSequence getValue() {
+ public java.lang.String getValue() {
return value;
}
/** Sets the value of the 'value' field */
- public gr.grnet.aquarium.message.avro.gen.ResourceEventMsg.Builder setValue(java.lang.CharSequence value) {
+ public gr.grnet.aquarium.message.avro.gen.ResourceEventMsg.Builder setValue(java.lang.String value) {
validate(fields()[9], value);
this.value = value;
fieldSetFlags()[9] = true;
return this;
}
+ /** Gets the value of the 'isSynthetic' field */
+ public java.lang.Boolean getIsSynthetic() {
+ return isSynthetic;
+ }
+
+ /** Sets the value of the 'isSynthetic' field */
+ public gr.grnet.aquarium.message.avro.gen.ResourceEventMsg.Builder setIsSynthetic(boolean value) {
+ validate(fields()[10], value);
+ this.isSynthetic = value;
+ fieldSetFlags()[10] = true;
+ return this;
+ }
+
+ /** Checks whether the 'isSynthetic' field has been set */
+ public boolean hasIsSynthetic() {
+ return fieldSetFlags()[10];
+ }
+
+ /** Clears the value of the 'isSynthetic' field */
+ public gr.grnet.aquarium.message.avro.gen.ResourceEventMsg.Builder clearIsSynthetic() {
+ fieldSetFlags()[10] = false;
+ return this;
+ }
+
/** Gets the value of the 'details' field */
- public java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.AnyValueMsg> getDetails() {
+ public java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.AnyValueMsg> getDetails() {
return details;
}
/** Sets the value of the 'details' field */
- public gr.grnet.aquarium.message.avro.gen.ResourceEventMsg.Builder setDetails(java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.AnyValueMsg> value) {
- validate(fields()[10], value);
+ public gr.grnet.aquarium.message.avro.gen.ResourceEventMsg.Builder setDetails(java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.AnyValueMsg> value) {
+ validate(fields()[11], value);
this.details = value;
- fieldSetFlags()[10] = true;
+ fieldSetFlags()[11] = true;
return this;
}
/** Checks whether the 'details' field has been set */
public boolean hasDetails() {
- return fieldSetFlags()[10];
+ return fieldSetFlags()[11];
}
/** Clears the value of the 'details' field */
public gr.grnet.aquarium.message.avro.gen.ResourceEventMsg.Builder clearDetails() {
details = null;
- fieldSetFlags()[10] = false;
+ fieldSetFlags()[11] = false;
return this;
}
public ResourceEventMsg build() {
try {
ResourceEventMsg record = new ResourceEventMsg();
- 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.originalID = fieldSetFlags()[0] ? this.originalID : (java.lang.String) defaultValue(fields()[0]);
+ record.inStoreID = fieldSetFlags()[1] ? this.inStoreID : (java.lang.String) 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]);
- record.clientID = fieldSetFlags()[5] ? this.clientID : (java.lang.CharSequence) defaultValue(fields()[5]);
- record.eventVersion = fieldSetFlags()[6] ? this.eventVersion : (java.lang.CharSequence) defaultValue(fields()[6]);
- record.resource = fieldSetFlags()[7] ? this.resource : (java.lang.CharSequence) defaultValue(fields()[7]);
- record.instanceID = fieldSetFlags()[8] ? this.instanceID : (java.lang.CharSequence) defaultValue(fields()[8]);
- record.value = fieldSetFlags()[9] ? this.value : (java.lang.CharSequence) defaultValue(fields()[9]);
- record.details = fieldSetFlags()[10] ? this.details : (java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.AnyValueMsg>) defaultValue(fields()[10]);
+ record.userID = fieldSetFlags()[4] ? this.userID : (java.lang.String) defaultValue(fields()[4]);
+ record.clientID = fieldSetFlags()[5] ? this.clientID : (java.lang.String) defaultValue(fields()[5]);
+ record.eventVersion = fieldSetFlags()[6] ? this.eventVersion : (java.lang.String) defaultValue(fields()[6]);
+ record.resource = fieldSetFlags()[7] ? this.resource : (java.lang.String) defaultValue(fields()[7]);
+ record.instanceID = fieldSetFlags()[8] ? this.instanceID : (java.lang.String) defaultValue(fields()[8]);
+ record.value = fieldSetFlags()[9] ? this.value : (java.lang.String) defaultValue(fields()[9]);
+ record.isSynthetic = fieldSetFlags()[10] ? this.isSynthetic : (java.lang.Boolean) defaultValue(fields()[10]);
+ record.details = fieldSetFlags()[11] ? this.details : (java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.AnyValueMsg>) defaultValue(fields()[11]);
return record;
} catch (Exception e) {
throw new org.apache.avro.AvroRuntimeException(e);
--- /dev/null
+/**
+ * Autogenerated by Avro
+ *
+ * DO NOT EDIT DIRECTLY
+ */
+package gr.grnet.aquarium.message.avro.gen;
+@SuppressWarnings("all")
+public class ResourceInstanceChargingStateMsg 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\":\"ResourceInstanceChargingStateMsg\",\"namespace\":\"gr.grnet.aquarium.message.avro.gen\",\"fields\":[{\"name\":\"clientID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"resource\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"instanceID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"details\",\"type\":{\"type\":\"map\",\"values\":{\"type\":\"record\",\"name\":\"AnyValueMsg\",\"fields\":[{\"name\":\"anyValue\",\"type\":[\"null\",\"int\",\"long\",\"boolean\",\"double\",\"bytes\",{\"type\":\"string\",\"avro.java.string\":\"String\"},{\"type\":\"array\",\"items\":\"AnyValueMsg\"},{\"type\":\"map\",\"values\":\"AnyValueMsg\",\"avro.java.string\":\"String\"}]}]},\"avro.java.string\":\"String\"}},{\"name\":\"previousEvents\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"ResourceEventMsg\",\"fields\":[{\"name\":\"originalID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"inStoreID\",\"type\":[{\"type\":\"string\",\"avro.java.string\":\"String\"},\"null\"]},{\"name\":\"occurredMillis\",\"type\":\"long\"},{\"name\":\"receivedMillis\",\"type\":\"long\",\"default\":0},{\"name\":\"userID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"clientID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"eventVersion\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"default\":\"1.0\"},{\"name\":\"resource\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"instanceID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"value\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"isSynthetic\",\"type\":\"boolean\",\"default\":false},{\"name\":\"details\",\"type\":{\"type\":\"map\",\"values\":\"AnyValueMsg\",\"avro.java.string\":\"String\"}}]}}},{\"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.lang.String clientID;
+ @Deprecated public java.lang.String resource;
+ @Deprecated public java.lang.String instanceID;
+ @Deprecated public java.util.Map<java.lang.String,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;
+ @Deprecated public double accumulatingAmount;
+ @Deprecated public double oldAccumulatingAmount;
+ @Deprecated public double previousValue;
+ @Deprecated public double currentValue;
+ public org.apache.avro.Schema getSchema() { return SCHEMA$; }
+ // Used by DatumWriter. Applications should not call.
+ public java.lang.Object get(int field$) {
+ switch (field$) {
+ case 0: return clientID;
+ case 1: return resource;
+ case 2: return instanceID;
+ case 3: return details;
+ case 4: return previousEvents;
+ case 5: return implicitlyIssuedStartEvents;
+ case 6: return accumulatingAmount;
+ case 7: return oldAccumulatingAmount;
+ case 8: return previousValue;
+ case 9: return currentValue;
+ default: throw new org.apache.avro.AvroRuntimeException("Bad index");
+ }
+ }
+ // Used by DatumReader. Applications should not call.
+ @SuppressWarnings(value="unchecked")
+ public void put(int field$, java.lang.Object value$) {
+ switch (field$) {
+ case 0: clientID = (java.lang.String)value$; break;
+ case 1: resource = (java.lang.String)value$; break;
+ case 2: instanceID = (java.lang.String)value$; break;
+ case 3: details = (java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.AnyValueMsg>)value$; break;
+ case 4: previousEvents = (java.util.List<gr.grnet.aquarium.message.avro.gen.ResourceEventMsg>)value$; break;
+ case 5: implicitlyIssuedStartEvents = (java.util.List<gr.grnet.aquarium.message.avro.gen.ResourceEventMsg>)value$; break;
+ case 6: accumulatingAmount = (java.lang.Double)value$; break;
+ case 7: oldAccumulatingAmount = (java.lang.Double)value$; break;
+ case 8: previousValue = (java.lang.Double)value$; break;
+ case 9: currentValue = (java.lang.Double)value$; break;
+ default: throw new org.apache.avro.AvroRuntimeException("Bad index");
+ }
+ }
+
+ /**
+ * Gets the value of the 'clientID' field.
+ */
+ public java.lang.String getClientID() {
+ return clientID;
+ }
+
+ /**
+ * Sets the value of the 'clientID' field.
+ * @param value the value to set.
+ */
+ public void setClientID(java.lang.String value) {
+ this.clientID = value;
+ }
+
+ /**
+ * Gets the value of the 'resource' field.
+ */
+ public java.lang.String getResource() {
+ return resource;
+ }
+
+ /**
+ * Sets the value of the 'resource' field.
+ * @param value the value to set.
+ */
+ public void setResource(java.lang.String value) {
+ this.resource = value;
+ }
+
+ /**
+ * Gets the value of the 'instanceID' field.
+ */
+ public java.lang.String getInstanceID() {
+ return instanceID;
+ }
+
+ /**
+ * Sets the value of the 'instanceID' field.
+ * @param value the value to set.
+ */
+ public void setInstanceID(java.lang.String value) {
+ this.instanceID = value;
+ }
+
+ /**
+ * Gets the value of the 'details' field.
+ */
+ public java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.AnyValueMsg> getDetails() {
+ return details;
+ }
+
+ /**
+ * Sets the value of the 'details' field.
+ * @param value the value to set.
+ */
+ public void setDetails(java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.AnyValueMsg> value) {
+ this.details = value;
+ }
+
+ /**
+ * Gets the value of the 'previousEvents' field.
+ */
+ public java.util.List<gr.grnet.aquarium.message.avro.gen.ResourceEventMsg> getPreviousEvents() {
+ return previousEvents;
+ }
+
+ /**
+ * Sets the value of the 'previousEvents' field.
+ * @param value the value to set.
+ */
+ public void setPreviousEvents(java.util.List<gr.grnet.aquarium.message.avro.gen.ResourceEventMsg> value) {
+ this.previousEvents = value;
+ }
+
+ /**
+ * Gets the value of the 'implicitlyIssuedStartEvents' field.
+ */
+ public java.util.List<gr.grnet.aquarium.message.avro.gen.ResourceEventMsg> getImplicitlyIssuedStartEvents() {
+ return implicitlyIssuedStartEvents;
+ }
+
+ /**
+ * Sets the value of the 'implicitlyIssuedStartEvents' field.
+ * @param value the value to set.
+ */
+ public void setImplicitlyIssuedStartEvents(java.util.List<gr.grnet.aquarium.message.avro.gen.ResourceEventMsg> value) {
+ this.implicitlyIssuedStartEvents = value;
+ }
+
+ /**
+ * Gets the value of the 'accumulatingAmount' field.
+ */
+ public java.lang.Double getAccumulatingAmount() {
+ return accumulatingAmount;
+ }
+
+ /**
+ * Sets the value of the 'accumulatingAmount' field.
+ * @param value the value to set.
+ */
+ public void setAccumulatingAmount(java.lang.Double value) {
+ this.accumulatingAmount = value;
+ }
+
+ /**
+ * Gets the value of the 'oldAccumulatingAmount' field.
+ */
+ public java.lang.Double getOldAccumulatingAmount() {
+ return oldAccumulatingAmount;
+ }
+
+ /**
+ * Sets the value of the 'oldAccumulatingAmount' field.
+ * @param value the value to set.
+ */
+ public void setOldAccumulatingAmount(java.lang.Double value) {
+ this.oldAccumulatingAmount = value;
+ }
+
+ /**
+ * Gets the value of the 'previousValue' field.
+ */
+ public java.lang.Double getPreviousValue() {
+ return previousValue;
+ }
+
+ /**
+ * Sets the value of the 'previousValue' field.
+ * @param value the value to set.
+ */
+ public void setPreviousValue(java.lang.Double value) {
+ this.previousValue = value;
+ }
+
+ /**
+ * Gets the value of the 'currentValue' field.
+ */
+ public java.lang.Double getCurrentValue() {
+ return currentValue;
+ }
+
+ /**
+ * Sets the value of the 'currentValue' field.
+ * @param value the value to set.
+ */
+ public void setCurrentValue(java.lang.Double value) {
+ this.currentValue = value;
+ }
+
+ /** Creates a new ResourceInstanceChargingStateMsg RecordBuilder */
+ public static gr.grnet.aquarium.message.avro.gen.ResourceInstanceChargingStateMsg.Builder newBuilder() {
+ return new gr.grnet.aquarium.message.avro.gen.ResourceInstanceChargingStateMsg.Builder();
+ }
+
+ /** Creates a new ResourceInstanceChargingStateMsg RecordBuilder by copying an existing Builder */
+ public static gr.grnet.aquarium.message.avro.gen.ResourceInstanceChargingStateMsg.Builder newBuilder(gr.grnet.aquarium.message.avro.gen.ResourceInstanceChargingStateMsg.Builder other) {
+ return new gr.grnet.aquarium.message.avro.gen.ResourceInstanceChargingStateMsg.Builder(other);
+ }
+
+ /** Creates a new ResourceInstanceChargingStateMsg RecordBuilder by copying an existing ResourceInstanceChargingStateMsg instance */
+ public static gr.grnet.aquarium.message.avro.gen.ResourceInstanceChargingStateMsg.Builder newBuilder(gr.grnet.aquarium.message.avro.gen.ResourceInstanceChargingStateMsg other) {
+ return new gr.grnet.aquarium.message.avro.gen.ResourceInstanceChargingStateMsg.Builder(other);
+ }
+
+ /**
+ * RecordBuilder for ResourceInstanceChargingStateMsg instances.
+ */
+ public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<ResourceInstanceChargingStateMsg>
+ implements org.apache.avro.data.RecordBuilder<ResourceInstanceChargingStateMsg> {
+
+ private java.lang.String clientID;
+ private java.lang.String resource;
+ private java.lang.String instanceID;
+ private java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.AnyValueMsg> details;
+ private java.util.List<gr.grnet.aquarium.message.avro.gen.ResourceEventMsg> previousEvents;
+ private java.util.List<gr.grnet.aquarium.message.avro.gen.ResourceEventMsg> implicitlyIssuedStartEvents;
+ private double accumulatingAmount;
+ private double oldAccumulatingAmount;
+ private double previousValue;
+ private double currentValue;
+
+ /** Creates a new Builder */
+ private Builder() {
+ super(gr.grnet.aquarium.message.avro.gen.ResourceInstanceChargingStateMsg.SCHEMA$);
+ }
+
+ /** Creates a Builder by copying an existing Builder */
+ private Builder(gr.grnet.aquarium.message.avro.gen.ResourceInstanceChargingStateMsg.Builder other) {
+ super(other);
+ }
+
+ /** Creates a Builder by copying an existing ResourceInstanceChargingStateMsg instance */
+ private Builder(gr.grnet.aquarium.message.avro.gen.ResourceInstanceChargingStateMsg other) {
+ super(gr.grnet.aquarium.message.avro.gen.ResourceInstanceChargingStateMsg.SCHEMA$);
+ if (isValidValue(fields()[0], other.clientID)) {
+ this.clientID = (java.lang.String) data().deepCopy(fields()[0].schema(), other.clientID);
+ fieldSetFlags()[0] = true;
+ }
+ if (isValidValue(fields()[1], other.resource)) {
+ this.resource = (java.lang.String) data().deepCopy(fields()[1].schema(), other.resource);
+ fieldSetFlags()[1] = true;
+ }
+ if (isValidValue(fields()[2], other.instanceID)) {
+ this.instanceID = (java.lang.String) data().deepCopy(fields()[2].schema(), other.instanceID);
+ fieldSetFlags()[2] = true;
+ }
+ if (isValidValue(fields()[3], other.details)) {
+ this.details = (java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.AnyValueMsg>) data().deepCopy(fields()[3].schema(), other.details);
+ fieldSetFlags()[3] = true;
+ }
+ if (isValidValue(fields()[4], other.previousEvents)) {
+ this.previousEvents = (java.util.List<gr.grnet.aquarium.message.avro.gen.ResourceEventMsg>) data().deepCopy(fields()[4].schema(), other.previousEvents);
+ fieldSetFlags()[4] = true;
+ }
+ if (isValidValue(fields()[5], other.implicitlyIssuedStartEvents)) {
+ this.implicitlyIssuedStartEvents = (java.util.List<gr.grnet.aquarium.message.avro.gen.ResourceEventMsg>) data().deepCopy(fields()[5].schema(), other.implicitlyIssuedStartEvents);
+ fieldSetFlags()[5] = true;
+ }
+ if (isValidValue(fields()[6], other.accumulatingAmount)) {
+ this.accumulatingAmount = (java.lang.Double) data().deepCopy(fields()[6].schema(), other.accumulatingAmount);
+ fieldSetFlags()[6] = true;
+ }
+ if (isValidValue(fields()[7], other.oldAccumulatingAmount)) {
+ this.oldAccumulatingAmount = (java.lang.Double) data().deepCopy(fields()[7].schema(), other.oldAccumulatingAmount);
+ fieldSetFlags()[7] = true;
+ }
+ if (isValidValue(fields()[8], other.previousValue)) {
+ this.previousValue = (java.lang.Double) data().deepCopy(fields()[8].schema(), other.previousValue);
+ fieldSetFlags()[8] = true;
+ }
+ if (isValidValue(fields()[9], other.currentValue)) {
+ this.currentValue = (java.lang.Double) data().deepCopy(fields()[9].schema(), other.currentValue);
+ fieldSetFlags()[9] = true;
+ }
+ }
+
+ /** Gets the value of the 'clientID' field */
+ public java.lang.String getClientID() {
+ return clientID;
+ }
+
+ /** Sets the value of the 'clientID' field */
+ public gr.grnet.aquarium.message.avro.gen.ResourceInstanceChargingStateMsg.Builder setClientID(java.lang.String value) {
+ validate(fields()[0], value);
+ this.clientID = value;
+ fieldSetFlags()[0] = true;
+ return this;
+ }
+
+ /** Checks whether the 'clientID' field has been set */
+ public boolean hasClientID() {
+ return fieldSetFlags()[0];
+ }
+
+ /** Clears the value of the 'clientID' field */
+ public gr.grnet.aquarium.message.avro.gen.ResourceInstanceChargingStateMsg.Builder clearClientID() {
+ clientID = null;
+ fieldSetFlags()[0] = false;
+ return this;
+ }
+
+ /** Gets the value of the 'resource' field */
+ public java.lang.String getResource() {
+ return resource;
+ }
+
+ /** Sets the value of the 'resource' field */
+ public gr.grnet.aquarium.message.avro.gen.ResourceInstanceChargingStateMsg.Builder setResource(java.lang.String value) {
+ validate(fields()[1], value);
+ this.resource = value;
+ fieldSetFlags()[1] = true;
+ return this;
+ }
+
+ /** Checks whether the 'resource' field has been set */
+ public boolean hasResource() {
+ return fieldSetFlags()[1];
+ }
+
+ /** Clears the value of the 'resource' field */
+ public gr.grnet.aquarium.message.avro.gen.ResourceInstanceChargingStateMsg.Builder clearResource() {
+ resource = null;
+ fieldSetFlags()[1] = false;
+ return this;
+ }
+
+ /** Gets the value of the 'instanceID' field */
+ public java.lang.String getInstanceID() {
+ return instanceID;
+ }
+
+ /** Sets the value of the 'instanceID' field */
+ public gr.grnet.aquarium.message.avro.gen.ResourceInstanceChargingStateMsg.Builder setInstanceID(java.lang.String value) {
+ validate(fields()[2], value);
+ this.instanceID = value;
+ fieldSetFlags()[2] = true;
+ return this;
+ }
+
+ /** Checks whether the 'instanceID' field has been set */
+ public boolean hasInstanceID() {
+ return fieldSetFlags()[2];
+ }
+
+ /** Clears the value of the 'instanceID' field */
+ public gr.grnet.aquarium.message.avro.gen.ResourceInstanceChargingStateMsg.Builder clearInstanceID() {
+ instanceID = null;
+ fieldSetFlags()[2] = false;
+ return this;
+ }
+
+ /** Gets the value of the 'details' field */
+ public java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.AnyValueMsg> getDetails() {
+ return details;
+ }
+
+ /** Sets the value of the 'details' field */
+ public gr.grnet.aquarium.message.avro.gen.ResourceInstanceChargingStateMsg.Builder setDetails(java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.AnyValueMsg> value) {
+ validate(fields()[3], value);
+ this.details = value;
+ fieldSetFlags()[3] = true;
+ return this;
+ }
+
+ /** Checks whether the 'details' field has been set */
+ public boolean hasDetails() {
+ return fieldSetFlags()[3];
+ }
+
+ /** Clears the value of the 'details' field */
+ public gr.grnet.aquarium.message.avro.gen.ResourceInstanceChargingStateMsg.Builder clearDetails() {
+ details = null;
+ fieldSetFlags()[3] = false;
+ return this;
+ }
+
+ /** Gets the value of the 'previousEvents' field */
+ public java.util.List<gr.grnet.aquarium.message.avro.gen.ResourceEventMsg> getPreviousEvents() {
+ return previousEvents;
+ }
+
+ /** Sets the value of the 'previousEvents' field */
+ public gr.grnet.aquarium.message.avro.gen.ResourceInstanceChargingStateMsg.Builder setPreviousEvents(java.util.List<gr.grnet.aquarium.message.avro.gen.ResourceEventMsg> value) {
+ validate(fields()[4], value);
+ this.previousEvents = value;
+ fieldSetFlags()[4] = true;
+ return this;
+ }
+
+ /** Checks whether the 'previousEvents' field has been set */
+ public boolean hasPreviousEvents() {
+ return fieldSetFlags()[4];
+ }
+
+ /** Clears the value of the 'previousEvents' field */
+ public gr.grnet.aquarium.message.avro.gen.ResourceInstanceChargingStateMsg.Builder clearPreviousEvents() {
+ previousEvents = null;
+ fieldSetFlags()[4] = false;
+ return this;
+ }
+
+ /** Gets the value of the 'implicitlyIssuedStartEvents' field */
+ public java.util.List<gr.grnet.aquarium.message.avro.gen.ResourceEventMsg> getImplicitlyIssuedStartEvents() {
+ return implicitlyIssuedStartEvents;
+ }
+
+ /** Sets the value of the 'implicitlyIssuedStartEvents' field */
+ public gr.grnet.aquarium.message.avro.gen.ResourceInstanceChargingStateMsg.Builder setImplicitlyIssuedStartEvents(java.util.List<gr.grnet.aquarium.message.avro.gen.ResourceEventMsg> value) {
+ validate(fields()[5], value);
+ this.implicitlyIssuedStartEvents = value;
+ fieldSetFlags()[5] = true;
+ return this;
+ }
+
+ /** Checks whether the 'implicitlyIssuedStartEvents' field has been set */
+ public boolean hasImplicitlyIssuedStartEvents() {
+ return fieldSetFlags()[5];
+ }
+
+ /** Clears the value of the 'implicitlyIssuedStartEvents' field */
+ public gr.grnet.aquarium.message.avro.gen.ResourceInstanceChargingStateMsg.Builder clearImplicitlyIssuedStartEvents() {
+ implicitlyIssuedStartEvents = null;
+ fieldSetFlags()[5] = false;
+ return this;
+ }
+
+ /** Gets the value of the 'accumulatingAmount' field */
+ public java.lang.Double getAccumulatingAmount() {
+ return accumulatingAmount;
+ }
+
+ /** Sets the value of the 'accumulatingAmount' field */
+ public gr.grnet.aquarium.message.avro.gen.ResourceInstanceChargingStateMsg.Builder setAccumulatingAmount(double value) {
+ validate(fields()[6], value);
+ this.accumulatingAmount = value;
+ fieldSetFlags()[6] = true;
+ return this;
+ }
+
+ /** Checks whether the 'accumulatingAmount' field has been set */
+ public boolean hasAccumulatingAmount() {
+ return fieldSetFlags()[6];
+ }
+
+ /** Clears the value of the 'accumulatingAmount' field */
+ public gr.grnet.aquarium.message.avro.gen.ResourceInstanceChargingStateMsg.Builder clearAccumulatingAmount() {
+ fieldSetFlags()[6] = false;
+ return this;
+ }
+
+ /** Gets the value of the 'oldAccumulatingAmount' field */
+ public java.lang.Double getOldAccumulatingAmount() {
+ return oldAccumulatingAmount;
+ }
+
+ /** Sets the value of the 'oldAccumulatingAmount' field */
+ public gr.grnet.aquarium.message.avro.gen.ResourceInstanceChargingStateMsg.Builder setOldAccumulatingAmount(double value) {
+ validate(fields()[7], value);
+ this.oldAccumulatingAmount = value;
+ fieldSetFlags()[7] = true;
+ return this;
+ }
+
+ /** Checks whether the 'oldAccumulatingAmount' field has been set */
+ public boolean hasOldAccumulatingAmount() {
+ return fieldSetFlags()[7];
+ }
+
+ /** Clears the value of the 'oldAccumulatingAmount' field */
+ public gr.grnet.aquarium.message.avro.gen.ResourceInstanceChargingStateMsg.Builder clearOldAccumulatingAmount() {
+ fieldSetFlags()[7] = false;
+ return this;
+ }
+
+ /** Gets the value of the 'previousValue' field */
+ public java.lang.Double getPreviousValue() {
+ return previousValue;
+ }
+
+ /** Sets the value of the 'previousValue' field */
+ public gr.grnet.aquarium.message.avro.gen.ResourceInstanceChargingStateMsg.Builder setPreviousValue(double value) {
+ validate(fields()[8], value);
+ this.previousValue = value;
+ fieldSetFlags()[8] = true;
+ return this;
+ }
+
+ /** Checks whether the 'previousValue' field has been set */
+ public boolean hasPreviousValue() {
+ return fieldSetFlags()[8];
+ }
+
+ /** Clears the value of the 'previousValue' field */
+ public gr.grnet.aquarium.message.avro.gen.ResourceInstanceChargingStateMsg.Builder clearPreviousValue() {
+ fieldSetFlags()[8] = false;
+ return this;
+ }
+
+ /** Gets the value of the 'currentValue' field */
+ public java.lang.Double getCurrentValue() {
+ return currentValue;
+ }
+
+ /** Sets the value of the 'currentValue' field */
+ public gr.grnet.aquarium.message.avro.gen.ResourceInstanceChargingStateMsg.Builder setCurrentValue(double value) {
+ validate(fields()[9], value);
+ this.currentValue = value;
+ fieldSetFlags()[9] = true;
+ return this;
+ }
+
+ /** Checks whether the 'currentValue' field has been set */
+ public boolean hasCurrentValue() {
+ return fieldSetFlags()[9];
+ }
+
+ /** Clears the value of the 'currentValue' field */
+ public gr.grnet.aquarium.message.avro.gen.ResourceInstanceChargingStateMsg.Builder clearCurrentValue() {
+ fieldSetFlags()[9] = false;
+ return this;
+ }
+
+ @Override
+ public ResourceInstanceChargingStateMsg build() {
+ try {
+ ResourceInstanceChargingStateMsg record = new ResourceInstanceChargingStateMsg();
+ record.clientID = fieldSetFlags()[0] ? this.clientID : (java.lang.String) defaultValue(fields()[0]);
+ record.resource = fieldSetFlags()[1] ? this.resource : (java.lang.String) defaultValue(fields()[1]);
+ record.instanceID = fieldSetFlags()[2] ? this.instanceID : (java.lang.String) defaultValue(fields()[2]);
+ record.details = fieldSetFlags()[3] ? this.details : (java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.AnyValueMsg>) defaultValue(fields()[3]);
+ record.previousEvents = fieldSetFlags()[4] ? this.previousEvents : (java.util.List<gr.grnet.aquarium.message.avro.gen.ResourceEventMsg>) defaultValue(fields()[4]);
+ record.implicitlyIssuedStartEvents = fieldSetFlags()[5] ? this.implicitlyIssuedStartEvents : (java.util.List<gr.grnet.aquarium.message.avro.gen.ResourceEventMsg>) defaultValue(fields()[5]);
+ record.accumulatingAmount = fieldSetFlags()[6] ? this.accumulatingAmount : (java.lang.Double) defaultValue(fields()[6]);
+ record.oldAccumulatingAmount = fieldSetFlags()[7] ? this.oldAccumulatingAmount : (java.lang.Double) defaultValue(fields()[7]);
+ record.previousValue = fieldSetFlags()[8] ? this.previousValue : (java.lang.Double) defaultValue(fields()[8]);
+ record.currentValue = fieldSetFlags()[9] ? this.currentValue : (java.lang.Double) defaultValue(fields()[9]);
+ return record;
+ } catch (Exception e) {
+ throw new org.apache.avro.AvroRuntimeException(e);
+ }
+ }
+ }
+}
package gr.grnet.aquarium.message.avro.gen;
@SuppressWarnings("all")
public class ResourceTypeMsg 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\":\"ResourceTypeMsg\",\"namespace\":\"gr.grnet.aquarium.message.avro.gen\",\"fields\":[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"unit\",\"type\":\"string\"},{\"name\":\"chargingBehaviorClass\",\"type\":\"string\"}]}");
- @Deprecated public java.lang.CharSequence name;
- @Deprecated public java.lang.CharSequence unit;
- @Deprecated public java.lang.CharSequence chargingBehaviorClass;
+ public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"ResourceTypeMsg\",\"namespace\":\"gr.grnet.aquarium.message.avro.gen\",\"fields\":[{\"name\":\"name\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"unit\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"chargingBehaviorClass\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}}]}");
+ @Deprecated public java.lang.String name;
+ @Deprecated public java.lang.String unit;
+ @Deprecated public java.lang.String chargingBehaviorClass;
public org.apache.avro.Schema getSchema() { return SCHEMA$; }
// Used by DatumWriter. Applications should not call.
public java.lang.Object get(int field$) {
@SuppressWarnings(value="unchecked")
public void put(int field$, java.lang.Object value$) {
switch (field$) {
- case 0: name = (java.lang.CharSequence)value$; break;
- case 1: unit = (java.lang.CharSequence)value$; break;
- case 2: chargingBehaviorClass = (java.lang.CharSequence)value$; break;
+ case 0: name = (java.lang.String)value$; break;
+ case 1: unit = (java.lang.String)value$; break;
+ case 2: chargingBehaviorClass = (java.lang.String)value$; break;
default: throw new org.apache.avro.AvroRuntimeException("Bad index");
}
}
/**
* Gets the value of the 'name' field.
*/
- public java.lang.CharSequence getName() {
+ public java.lang.String getName() {
return name;
}
* Sets the value of the 'name' field.
* @param value the value to set.
*/
- public void setName(java.lang.CharSequence value) {
+ public void setName(java.lang.String value) {
this.name = value;
}
/**
* Gets the value of the 'unit' field.
*/
- public java.lang.CharSequence getUnit() {
+ public java.lang.String getUnit() {
return unit;
}
* Sets the value of the 'unit' field.
* @param value the value to set.
*/
- public void setUnit(java.lang.CharSequence value) {
+ public void setUnit(java.lang.String value) {
this.unit = value;
}
/**
* Gets the value of the 'chargingBehaviorClass' field.
*/
- public java.lang.CharSequence getChargingBehaviorClass() {
+ public java.lang.String getChargingBehaviorClass() {
return chargingBehaviorClass;
}
* Sets the value of the 'chargingBehaviorClass' field.
* @param value the value to set.
*/
- public void setChargingBehaviorClass(java.lang.CharSequence value) {
+ public void setChargingBehaviorClass(java.lang.String value) {
this.chargingBehaviorClass = value;
}
public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<ResourceTypeMsg>
implements org.apache.avro.data.RecordBuilder<ResourceTypeMsg> {
- private java.lang.CharSequence name;
- private java.lang.CharSequence unit;
- private java.lang.CharSequence chargingBehaviorClass;
+ private java.lang.String name;
+ private java.lang.String unit;
+ private java.lang.String chargingBehaviorClass;
/** Creates a new Builder */
private Builder() {
private Builder(gr.grnet.aquarium.message.avro.gen.ResourceTypeMsg other) {
super(gr.grnet.aquarium.message.avro.gen.ResourceTypeMsg.SCHEMA$);
if (isValidValue(fields()[0], other.name)) {
- this.name = (java.lang.CharSequence) data().deepCopy(fields()[0].schema(), other.name);
+ this.name = (java.lang.String) data().deepCopy(fields()[0].schema(), other.name);
fieldSetFlags()[0] = true;
}
if (isValidValue(fields()[1], other.unit)) {
- this.unit = (java.lang.CharSequence) data().deepCopy(fields()[1].schema(), other.unit);
+ this.unit = (java.lang.String) data().deepCopy(fields()[1].schema(), other.unit);
fieldSetFlags()[1] = true;
}
if (isValidValue(fields()[2], other.chargingBehaviorClass)) {
- this.chargingBehaviorClass = (java.lang.CharSequence) data().deepCopy(fields()[2].schema(), other.chargingBehaviorClass);
+ this.chargingBehaviorClass = (java.lang.String) data().deepCopy(fields()[2].schema(), other.chargingBehaviorClass);
fieldSetFlags()[2] = true;
}
}
/** Gets the value of the 'name' field */
- public java.lang.CharSequence getName() {
+ public java.lang.String getName() {
return name;
}
/** Sets the value of the 'name' field */
- public gr.grnet.aquarium.message.avro.gen.ResourceTypeMsg.Builder setName(java.lang.CharSequence value) {
+ public gr.grnet.aquarium.message.avro.gen.ResourceTypeMsg.Builder setName(java.lang.String value) {
validate(fields()[0], value);
this.name = value;
fieldSetFlags()[0] = true;
}
/** Gets the value of the 'unit' field */
- public java.lang.CharSequence getUnit() {
+ public java.lang.String getUnit() {
return unit;
}
/** Sets the value of the 'unit' field */
- public gr.grnet.aquarium.message.avro.gen.ResourceTypeMsg.Builder setUnit(java.lang.CharSequence value) {
+ public gr.grnet.aquarium.message.avro.gen.ResourceTypeMsg.Builder setUnit(java.lang.String value) {
validate(fields()[1], value);
this.unit = value;
fieldSetFlags()[1] = true;
}
/** Gets the value of the 'chargingBehaviorClass' field */
- public java.lang.CharSequence getChargingBehaviorClass() {
+ public java.lang.String getChargingBehaviorClass() {
return chargingBehaviorClass;
}
/** Sets the value of the 'chargingBehaviorClass' field */
- public gr.grnet.aquarium.message.avro.gen.ResourceTypeMsg.Builder setChargingBehaviorClass(java.lang.CharSequence value) {
+ public gr.grnet.aquarium.message.avro.gen.ResourceTypeMsg.Builder setChargingBehaviorClass(java.lang.String value) {
validate(fields()[2], value);
this.chargingBehaviorClass = value;
fieldSetFlags()[2] = true;
public ResourceTypeMsg build() {
try {
ResourceTypeMsg record = new ResourceTypeMsg();
- record.name = fieldSetFlags()[0] ? this.name : (java.lang.CharSequence) defaultValue(fields()[0]);
- record.unit = fieldSetFlags()[1] ? this.unit : (java.lang.CharSequence) defaultValue(fields()[1]);
- record.chargingBehaviorClass = fieldSetFlags()[2] ? this.chargingBehaviorClass : (java.lang.CharSequence) defaultValue(fields()[2]);
+ record.name = fieldSetFlags()[0] ? this.name : (java.lang.String) defaultValue(fields()[0]);
+ record.unit = fieldSetFlags()[1] ? this.unit : (java.lang.String) defaultValue(fields()[1]);
+ record.chargingBehaviorClass = fieldSetFlags()[2] ? this.chargingBehaviorClass : (java.lang.String) defaultValue(fields()[2]);
return record;
} catch (Exception e) {
throw new org.apache.avro.AvroRuntimeException(e);
--- /dev/null
+/**
+ * Autogenerated by Avro
+ *
+ * DO NOT EDIT DIRECTLY
+ */
+package gr.grnet.aquarium.message.avro.gen;
+@SuppressWarnings("all")
+public class ResourcesChargingStateMsg 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\":\"ResourcesChargingStateMsg\",\"namespace\":\"gr.grnet.aquarium.message.avro.gen\",\"fields\":[{\"name\":\"resource\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"details\",\"type\":{\"type\":\"map\",\"values\":{\"type\":\"record\",\"name\":\"AnyValueMsg\",\"fields\":[{\"name\":\"anyValue\",\"type\":[\"null\",\"int\",\"long\",\"boolean\",\"double\",\"bytes\",{\"type\":\"string\",\"avro.java.string\":\"String\"},{\"type\":\"array\",\"items\":\"AnyValueMsg\"},{\"type\":\"map\",\"values\":\"AnyValueMsg\",\"avro.java.string\":\"String\"}]}]},\"avro.java.string\":\"String\"}},{\"name\":\"stateOfResourceInstance\",\"type\":{\"type\":\"map\",\"values\":{\"type\":\"record\",\"name\":\"ResourceInstanceChargingStateMsg\",\"fields\":[{\"name\":\"clientID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"resource\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"instanceID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"details\",\"type\":{\"type\":\"map\",\"values\":\"AnyValueMsg\",\"avro.java.string\":\"String\"}},{\"name\":\"previousEvents\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"ResourceEventMsg\",\"fields\":[{\"name\":\"originalID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"inStoreID\",\"type\":[{\"type\":\"string\",\"avro.java.string\":\"String\"},\"null\"]},{\"name\":\"occurredMillis\",\"type\":\"long\"},{\"name\":\"receivedMillis\",\"type\":\"long\",\"default\":0},{\"name\":\"userID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"clientID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"eventVersion\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"default\":\"1.0\"},{\"name\":\"resource\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"instanceID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"value\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"isSynthetic\",\"type\":\"boolean\",\"default\":false},{\"name\":\"details\",\"type\":{\"type\":\"map\",\"values\":\"AnyValueMsg\",\"avro.java.string\":\"String\"}}]}}},{\"name\":\"implicitlyIssuedStartEvents\",\"type\":{\"type\":\"array\",\"items\":\"ResourceEventMsg\"}},{\"name\":\"accumulatingAmount\",\"type\":\"double\"},{\"name\":\"oldAccumulatingAmount\",\"type\":\"double\"},{\"name\":\"previousValue\",\"type\":\"double\"},{\"name\":\"currentValue\",\"type\":\"double\"}]},\"avro.java.string\":\"String\"}}]}");
+ @Deprecated public java.lang.String resource;
+ @Deprecated public java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.AnyValueMsg> details;
+ @Deprecated public java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.ResourceInstanceChargingStateMsg> stateOfResourceInstance;
+ public org.apache.avro.Schema getSchema() { return SCHEMA$; }
+ // Used by DatumWriter. Applications should not call.
+ public java.lang.Object get(int field$) {
+ switch (field$) {
+ case 0: return resource;
+ case 1: return details;
+ case 2: return stateOfResourceInstance;
+ default: throw new org.apache.avro.AvroRuntimeException("Bad index");
+ }
+ }
+ // Used by DatumReader. Applications should not call.
+ @SuppressWarnings(value="unchecked")
+ public void put(int field$, java.lang.Object value$) {
+ switch (field$) {
+ case 0: resource = (java.lang.String)value$; break;
+ case 1: details = (java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.AnyValueMsg>)value$; break;
+ case 2: stateOfResourceInstance = (java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.ResourceInstanceChargingStateMsg>)value$; break;
+ default: throw new org.apache.avro.AvroRuntimeException("Bad index");
+ }
+ }
+
+ /**
+ * Gets the value of the 'resource' field.
+ */
+ public java.lang.String getResource() {
+ return resource;
+ }
+
+ /**
+ * Sets the value of the 'resource' field.
+ * @param value the value to set.
+ */
+ public void setResource(java.lang.String value) {
+ this.resource = value;
+ }
+
+ /**
+ * Gets the value of the 'details' field.
+ */
+ public java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.AnyValueMsg> getDetails() {
+ return details;
+ }
+
+ /**
+ * Sets the value of the 'details' field.
+ * @param value the value to set.
+ */
+ public void setDetails(java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.AnyValueMsg> value) {
+ this.details = value;
+ }
+
+ /**
+ * Gets the value of the 'stateOfResourceInstance' field.
+ */
+ public java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.ResourceInstanceChargingStateMsg> getStateOfResourceInstance() {
+ return stateOfResourceInstance;
+ }
+
+ /**
+ * Sets the value of the 'stateOfResourceInstance' field.
+ * @param value the value to set.
+ */
+ public void setStateOfResourceInstance(java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.ResourceInstanceChargingStateMsg> value) {
+ this.stateOfResourceInstance = value;
+ }
+
+ /** Creates a new ResourcesChargingStateMsg RecordBuilder */
+ public static gr.grnet.aquarium.message.avro.gen.ResourcesChargingStateMsg.Builder newBuilder() {
+ return new gr.grnet.aquarium.message.avro.gen.ResourcesChargingStateMsg.Builder();
+ }
+
+ /** Creates a new ResourcesChargingStateMsg RecordBuilder by copying an existing Builder */
+ public static gr.grnet.aquarium.message.avro.gen.ResourcesChargingStateMsg.Builder newBuilder(gr.grnet.aquarium.message.avro.gen.ResourcesChargingStateMsg.Builder other) {
+ return new gr.grnet.aquarium.message.avro.gen.ResourcesChargingStateMsg.Builder(other);
+ }
+
+ /** Creates a new ResourcesChargingStateMsg RecordBuilder by copying an existing ResourcesChargingStateMsg instance */
+ public static gr.grnet.aquarium.message.avro.gen.ResourcesChargingStateMsg.Builder newBuilder(gr.grnet.aquarium.message.avro.gen.ResourcesChargingStateMsg other) {
+ return new gr.grnet.aquarium.message.avro.gen.ResourcesChargingStateMsg.Builder(other);
+ }
+
+ /**
+ * RecordBuilder for ResourcesChargingStateMsg instances.
+ */
+ public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<ResourcesChargingStateMsg>
+ implements org.apache.avro.data.RecordBuilder<ResourcesChargingStateMsg> {
+
+ private java.lang.String resource;
+ private java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.AnyValueMsg> details;
+ private java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.ResourceInstanceChargingStateMsg> stateOfResourceInstance;
+
+ /** Creates a new Builder */
+ private Builder() {
+ super(gr.grnet.aquarium.message.avro.gen.ResourcesChargingStateMsg.SCHEMA$);
+ }
+
+ /** Creates a Builder by copying an existing Builder */
+ private Builder(gr.grnet.aquarium.message.avro.gen.ResourcesChargingStateMsg.Builder other) {
+ super(other);
+ }
+
+ /** Creates a Builder by copying an existing ResourcesChargingStateMsg instance */
+ private Builder(gr.grnet.aquarium.message.avro.gen.ResourcesChargingStateMsg other) {
+ super(gr.grnet.aquarium.message.avro.gen.ResourcesChargingStateMsg.SCHEMA$);
+ if (isValidValue(fields()[0], other.resource)) {
+ this.resource = (java.lang.String) data().deepCopy(fields()[0].schema(), other.resource);
+ fieldSetFlags()[0] = true;
+ }
+ if (isValidValue(fields()[1], other.details)) {
+ this.details = (java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.AnyValueMsg>) data().deepCopy(fields()[1].schema(), other.details);
+ fieldSetFlags()[1] = true;
+ }
+ if (isValidValue(fields()[2], other.stateOfResourceInstance)) {
+ this.stateOfResourceInstance = (java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.ResourceInstanceChargingStateMsg>) data().deepCopy(fields()[2].schema(), other.stateOfResourceInstance);
+ fieldSetFlags()[2] = true;
+ }
+ }
+
+ /** Gets the value of the 'resource' field */
+ public java.lang.String getResource() {
+ return resource;
+ }
+
+ /** Sets the value of the 'resource' field */
+ public gr.grnet.aquarium.message.avro.gen.ResourcesChargingStateMsg.Builder setResource(java.lang.String value) {
+ validate(fields()[0], value);
+ this.resource = value;
+ fieldSetFlags()[0] = true;
+ return this;
+ }
+
+ /** Checks whether the 'resource' field has been set */
+ public boolean hasResource() {
+ return fieldSetFlags()[0];
+ }
+
+ /** Clears the value of the 'resource' field */
+ public gr.grnet.aquarium.message.avro.gen.ResourcesChargingStateMsg.Builder clearResource() {
+ resource = null;
+ fieldSetFlags()[0] = false;
+ return this;
+ }
+
+ /** Gets the value of the 'details' field */
+ public java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.AnyValueMsg> getDetails() {
+ return details;
+ }
+
+ /** Sets the value of the 'details' field */
+ public gr.grnet.aquarium.message.avro.gen.ResourcesChargingStateMsg.Builder setDetails(java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.AnyValueMsg> value) {
+ validate(fields()[1], value);
+ this.details = value;
+ fieldSetFlags()[1] = true;
+ return this;
+ }
+
+ /** Checks whether the 'details' field has been set */
+ public boolean hasDetails() {
+ return fieldSetFlags()[1];
+ }
+
+ /** Clears the value of the 'details' field */
+ public gr.grnet.aquarium.message.avro.gen.ResourcesChargingStateMsg.Builder clearDetails() {
+ details = null;
+ fieldSetFlags()[1] = false;
+ return this;
+ }
+
+ /** Gets the value of the 'stateOfResourceInstance' field */
+ public java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.ResourceInstanceChargingStateMsg> getStateOfResourceInstance() {
+ return stateOfResourceInstance;
+ }
+
+ /** Sets the value of the 'stateOfResourceInstance' field */
+ public gr.grnet.aquarium.message.avro.gen.ResourcesChargingStateMsg.Builder setStateOfResourceInstance(java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.ResourceInstanceChargingStateMsg> value) {
+ validate(fields()[2], value);
+ this.stateOfResourceInstance = value;
+ fieldSetFlags()[2] = true;
+ return this;
+ }
+
+ /** Checks whether the 'stateOfResourceInstance' field has been set */
+ public boolean hasStateOfResourceInstance() {
+ return fieldSetFlags()[2];
+ }
+
+ /** Clears the value of the 'stateOfResourceInstance' field */
+ public gr.grnet.aquarium.message.avro.gen.ResourcesChargingStateMsg.Builder clearStateOfResourceInstance() {
+ stateOfResourceInstance = null;
+ fieldSetFlags()[2] = false;
+ return this;
+ }
+
+ @Override
+ public ResourcesChargingStateMsg build() {
+ try {
+ ResourcesChargingStateMsg record = new ResourcesChargingStateMsg();
+ record.resource = fieldSetFlags()[0] ? this.resource : (java.lang.String) defaultValue(fields()[0]);
+ record.details = fieldSetFlags()[1] ? this.details : (java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.AnyValueMsg>) defaultValue(fields()[1]);
+ record.stateOfResourceInstance = fieldSetFlags()[2] ? this.stateOfResourceInstance : (java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.ResourceInstanceChargingStateMsg>) defaultValue(fields()[2]);
+ return record;
+ } catch (Exception e) {
+ throw new org.apache.avro.AvroRuntimeException(e);
+ }
+ }
+ }
+}
package gr.grnet.aquarium.message.avro.gen;
@SuppressWarnings("all")
public class SelectorValueMsg 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\":\"SelectorValueMsg\",\"namespace\":\"gr.grnet.aquarium.message.avro.gen\",\"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\"}]}]}");
+ public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"SelectorValueMsg\",\"namespace\":\"gr.grnet.aquarium.message.avro.gen\",\"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\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"b\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}}]},\"null\"]}]}}}]},{\"type\":\"map\",\"values\":\"SelectorValueMsg\",\"avro.java.string\":\"String\"}]}]}");
@Deprecated public java.lang.Object selectorValue;
public org.apache.avro.Schema getSchema() { return SCHEMA$; }
// Used by DatumWriter. Applications should not call.
--- /dev/null
+/**
+ * Autogenerated by Avro
+ *
+ * DO NOT EDIT DIRECTLY
+ */
+package gr.grnet.aquarium.message.avro.gen;
+@SuppressWarnings("all")
+public class UserAgreementHistoryMsg 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\":\"UserAgreementHistoryMsg\",\"namespace\":\"gr.grnet.aquarium.message.avro.gen\",\"fields\":[{\"name\":\"agreements\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"UserAgreementMsg\",\"fields\":[{\"name\":\"id\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"relatedIMEventOriginalID\",\"type\":[{\"type\":\"string\",\"avro.java.string\":\"String\"},\"null\"]},{\"name\":\"userID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"validFromMillis\",\"type\":\"long\"},{\"name\":\"validToMillis\",\"type\":\"long\"},{\"name\":\"role\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"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\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"b\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}}]},\"null\"]}]}}}]},{\"type\":\"map\",\"values\":\"SelectorValueMsg\",\"avro.java.string\":\"String\"}]}]},\"avro.java.string\":\"String\"},\"avro.java.string\":\"String\"}}]},\"null\"]}]}}}]}");
+ @Deprecated public java.util.List<gr.grnet.aquarium.message.avro.gen.UserAgreementMsg> agreements;
+ public org.apache.avro.Schema getSchema() { return SCHEMA$; }
+ // Used by DatumWriter. Applications should not call.
+ public java.lang.Object get(int field$) {
+ switch (field$) {
+ case 0: return agreements;
+ default: throw new org.apache.avro.AvroRuntimeException("Bad index");
+ }
+ }
+ // Used by DatumReader. Applications should not call.
+ @SuppressWarnings(value="unchecked")
+ public void put(int field$, java.lang.Object value$) {
+ switch (field$) {
+ case 0: agreements = (java.util.List<gr.grnet.aquarium.message.avro.gen.UserAgreementMsg>)value$; break;
+ default: throw new org.apache.avro.AvroRuntimeException("Bad index");
+ }
+ }
+
+ /**
+ * Gets the value of the 'agreements' field.
+ */
+ public java.util.List<gr.grnet.aquarium.message.avro.gen.UserAgreementMsg> getAgreements() {
+ return agreements;
+ }
+
+ /**
+ * Sets the value of the 'agreements' field.
+ * @param value the value to set.
+ */
+ public void setAgreements(java.util.List<gr.grnet.aquarium.message.avro.gen.UserAgreementMsg> value) {
+ this.agreements = value;
+ }
+
+ /** Creates a new UserAgreementHistoryMsg RecordBuilder */
+ public static gr.grnet.aquarium.message.avro.gen.UserAgreementHistoryMsg.Builder newBuilder() {
+ return new gr.grnet.aquarium.message.avro.gen.UserAgreementHistoryMsg.Builder();
+ }
+
+ /** Creates a new UserAgreementHistoryMsg RecordBuilder by copying an existing Builder */
+ public static gr.grnet.aquarium.message.avro.gen.UserAgreementHistoryMsg.Builder newBuilder(gr.grnet.aquarium.message.avro.gen.UserAgreementHistoryMsg.Builder other) {
+ return new gr.grnet.aquarium.message.avro.gen.UserAgreementHistoryMsg.Builder(other);
+ }
+
+ /** Creates a new UserAgreementHistoryMsg RecordBuilder by copying an existing UserAgreementHistoryMsg instance */
+ public static gr.grnet.aquarium.message.avro.gen.UserAgreementHistoryMsg.Builder newBuilder(gr.grnet.aquarium.message.avro.gen.UserAgreementHistoryMsg other) {
+ return new gr.grnet.aquarium.message.avro.gen.UserAgreementHistoryMsg.Builder(other);
+ }
+
+ /**
+ * RecordBuilder for UserAgreementHistoryMsg instances.
+ */
+ public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<UserAgreementHistoryMsg>
+ implements org.apache.avro.data.RecordBuilder<UserAgreementHistoryMsg> {
+
+ private java.util.List<gr.grnet.aquarium.message.avro.gen.UserAgreementMsg> agreements;
+
+ /** Creates a new Builder */
+ private Builder() {
+ super(gr.grnet.aquarium.message.avro.gen.UserAgreementHistoryMsg.SCHEMA$);
+ }
+
+ /** Creates a Builder by copying an existing Builder */
+ private Builder(gr.grnet.aquarium.message.avro.gen.UserAgreementHistoryMsg.Builder other) {
+ super(other);
+ }
+
+ /** Creates a Builder by copying an existing UserAgreementHistoryMsg instance */
+ private Builder(gr.grnet.aquarium.message.avro.gen.UserAgreementHistoryMsg other) {
+ super(gr.grnet.aquarium.message.avro.gen.UserAgreementHistoryMsg.SCHEMA$);
+ if (isValidValue(fields()[0], other.agreements)) {
+ this.agreements = (java.util.List<gr.grnet.aquarium.message.avro.gen.UserAgreementMsg>) data().deepCopy(fields()[0].schema(), other.agreements);
+ fieldSetFlags()[0] = true;
+ }
+ }
+
+ /** Gets the value of the 'agreements' field */
+ public java.util.List<gr.grnet.aquarium.message.avro.gen.UserAgreementMsg> getAgreements() {
+ return agreements;
+ }
+
+ /** Sets the value of the 'agreements' field */
+ public gr.grnet.aquarium.message.avro.gen.UserAgreementHistoryMsg.Builder setAgreements(java.util.List<gr.grnet.aquarium.message.avro.gen.UserAgreementMsg> value) {
+ validate(fields()[0], value);
+ this.agreements = value;
+ fieldSetFlags()[0] = true;
+ return this;
+ }
+
+ /** Checks whether the 'agreements' field has been set */
+ public boolean hasAgreements() {
+ return fieldSetFlags()[0];
+ }
+
+ /** Clears the value of the 'agreements' field */
+ public gr.grnet.aquarium.message.avro.gen.UserAgreementHistoryMsg.Builder clearAgreements() {
+ agreements = null;
+ fieldSetFlags()[0] = false;
+ return this;
+ }
+
+ @Override
+ public UserAgreementHistoryMsg build() {
+ try {
+ UserAgreementHistoryMsg record = new UserAgreementHistoryMsg();
+ record.agreements = fieldSetFlags()[0] ? this.agreements : (java.util.List<gr.grnet.aquarium.message.avro.gen.UserAgreementMsg>) defaultValue(fields()[0]);
+ return record;
+ } catch (Exception e) {
+ throw new org.apache.avro.AvroRuntimeException(e);
+ }
+ }
+ }
+}
package gr.grnet.aquarium.message.avro.gen;
@SuppressWarnings("all")
public class UserAgreementMsg 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\":\"UserAgreementMsg\",\"namespace\":\"gr.grnet.aquarium.message.avro.gen\",\"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\"]}]}");
- @Deprecated public java.lang.CharSequence id;
- @Deprecated public java.lang.CharSequence relatedIMEventID;
+ public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"UserAgreementMsg\",\"namespace\":\"gr.grnet.aquarium.message.avro.gen\",\"fields\":[{\"name\":\"id\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"relatedIMEventOriginalID\",\"type\":[{\"type\":\"string\",\"avro.java.string\":\"String\"},\"null\"]},{\"name\":\"userID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"validFromMillis\",\"type\":\"long\"},{\"name\":\"validToMillis\",\"type\":\"long\"},{\"name\":\"role\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"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\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"b\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}}]},\"null\"]}]}}}]},{\"type\":\"map\",\"values\":\"SelectorValueMsg\",\"avro.java.string\":\"String\"}]}]},\"avro.java.string\":\"String\"},\"avro.java.string\":\"String\"}}]},\"null\"]}]}");
+ @Deprecated public java.lang.String id;
+ @Deprecated public java.lang.String relatedIMEventOriginalID;
+ @Deprecated public java.lang.String userID;
@Deprecated public long validFromMillis;
@Deprecated public long validToMillis;
- @Deprecated public java.lang.CharSequence role;
+ @Deprecated public java.lang.String role;
@Deprecated public gr.grnet.aquarium.message.avro.gen.FullPriceTableMsg fullPriceTableRef;
public org.apache.avro.Schema getSchema() { return SCHEMA$; }
// Used by DatumWriter. Applications should not call.
public java.lang.Object get(int field$) {
switch (field$) {
case 0: return id;
- case 1: return relatedIMEventID;
- case 2: return validFromMillis;
- case 3: return validToMillis;
- case 4: return role;
- case 5: return fullPriceTableRef;
+ case 1: return relatedIMEventOriginalID;
+ case 2: return userID;
+ case 3: return validFromMillis;
+ case 4: return validToMillis;
+ case 5: return role;
+ case 6: return fullPriceTableRef;
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: relatedIMEventID = (java.lang.CharSequence)value$; break;
- case 2: validFromMillis = (java.lang.Long)value$; break;
- case 3: validToMillis = (java.lang.Long)value$; break;
- case 4: role = (java.lang.CharSequence)value$; break;
- case 5: fullPriceTableRef = (gr.grnet.aquarium.message.avro.gen.FullPriceTableMsg)value$; break;
+ case 0: id = (java.lang.String)value$; break;
+ case 1: relatedIMEventOriginalID = (java.lang.String)value$; break;
+ case 2: userID = (java.lang.String)value$; break;
+ case 3: validFromMillis = (java.lang.Long)value$; break;
+ case 4: validToMillis = (java.lang.Long)value$; break;
+ case 5: role = (java.lang.String)value$; break;
+ case 6: fullPriceTableRef = (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.
*/
- public java.lang.CharSequence getId() {
+ public java.lang.String getId() {
return id;
}
* Sets the value of the 'id' field.
* @param value the value to set.
*/
- public void setId(java.lang.CharSequence value) {
+ public void setId(java.lang.String value) {
this.id = value;
}
/**
- * Gets the value of the 'relatedIMEventID' field.
+ * Gets the value of the 'relatedIMEventOriginalID' field.
*/
- public java.lang.CharSequence getRelatedIMEventID() {
- return relatedIMEventID;
+ public java.lang.String getRelatedIMEventOriginalID() {
+ return relatedIMEventOriginalID;
}
/**
- * Sets the value of the 'relatedIMEventID' field.
+ * Sets the value of the 'relatedIMEventOriginalID' field.
* @param value the value to set.
*/
- public void setRelatedIMEventID(java.lang.CharSequence value) {
- this.relatedIMEventID = value;
+ public void setRelatedIMEventOriginalID(java.lang.String value) {
+ this.relatedIMEventOriginalID = value;
+ }
+
+ /**
+ * Gets the value of the 'userID' field.
+ */
+ public java.lang.String getUserID() {
+ return userID;
+ }
+
+ /**
+ * Sets the value of the 'userID' field.
+ * @param value the value to set.
+ */
+ public void setUserID(java.lang.String value) {
+ this.userID = value;
}
/**
/**
* Gets the value of the 'role' field.
*/
- public java.lang.CharSequence getRole() {
+ public java.lang.String getRole() {
return role;
}
* Sets the value of the 'role' field.
* @param value the value to set.
*/
- public void setRole(java.lang.CharSequence value) {
+ public void setRole(java.lang.String value) {
this.role = value;
}
public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<UserAgreementMsg>
implements org.apache.avro.data.RecordBuilder<UserAgreementMsg> {
- private java.lang.CharSequence id;
- private java.lang.CharSequence relatedIMEventID;
+ private java.lang.String id;
+ private java.lang.String relatedIMEventOriginalID;
+ private java.lang.String userID;
private long validFromMillis;
private long validToMillis;
- private java.lang.CharSequence role;
+ private java.lang.String role;
private gr.grnet.aquarium.message.avro.gen.FullPriceTableMsg fullPriceTableRef;
/** Creates a new Builder */
private Builder(gr.grnet.aquarium.message.avro.gen.UserAgreementMsg other) {
super(gr.grnet.aquarium.message.avro.gen.UserAgreementMsg.SCHEMA$);
if (isValidValue(fields()[0], other.id)) {
- this.id = (java.lang.CharSequence) data().deepCopy(fields()[0].schema(), other.id);
+ this.id = (java.lang.String) data().deepCopy(fields()[0].schema(), other.id);
fieldSetFlags()[0] = true;
}
- if (isValidValue(fields()[1], other.relatedIMEventID)) {
- this.relatedIMEventID = (java.lang.CharSequence) data().deepCopy(fields()[1].schema(), other.relatedIMEventID);
+ if (isValidValue(fields()[1], other.relatedIMEventOriginalID)) {
+ this.relatedIMEventOriginalID = (java.lang.String) data().deepCopy(fields()[1].schema(), other.relatedIMEventOriginalID);
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.userID)) {
+ this.userID = (java.lang.String) data().deepCopy(fields()[2].schema(), other.userID);
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.role)) {
- this.role = (java.lang.CharSequence) data().deepCopy(fields()[4].schema(), other.role);
+ 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.fullPriceTableRef)) {
- this.fullPriceTableRef = (gr.grnet.aquarium.message.avro.gen.FullPriceTableMsg) data().deepCopy(fields()[5].schema(), other.fullPriceTableRef);
+ if (isValidValue(fields()[5], other.role)) {
+ this.role = (java.lang.String) data().deepCopy(fields()[5].schema(), other.role);
fieldSetFlags()[5] = true;
}
+ if (isValidValue(fields()[6], other.fullPriceTableRef)) {
+ this.fullPriceTableRef = (gr.grnet.aquarium.message.avro.gen.FullPriceTableMsg) data().deepCopy(fields()[6].schema(), other.fullPriceTableRef);
+ fieldSetFlags()[6] = true;
+ }
}
/** Gets the value of the 'id' field */
- public java.lang.CharSequence getId() {
+ public java.lang.String getId() {
return id;
}
/** Sets the value of the 'id' field */
- public gr.grnet.aquarium.message.avro.gen.UserAgreementMsg.Builder setId(java.lang.CharSequence value) {
+ public gr.grnet.aquarium.message.avro.gen.UserAgreementMsg.Builder setId(java.lang.String value) {
validate(fields()[0], value);
this.id = value;
fieldSetFlags()[0] = true;
return this;
}
- /** Gets the value of the 'relatedIMEventID' field */
- public java.lang.CharSequence getRelatedIMEventID() {
- return relatedIMEventID;
+ /** Gets the value of the 'relatedIMEventOriginalID' field */
+ public java.lang.String getRelatedIMEventOriginalID() {
+ return relatedIMEventOriginalID;
}
- /** Sets the value of the 'relatedIMEventID' field */
- public gr.grnet.aquarium.message.avro.gen.UserAgreementMsg.Builder setRelatedIMEventID(java.lang.CharSequence value) {
+ /** Sets the value of the 'relatedIMEventOriginalID' field */
+ public gr.grnet.aquarium.message.avro.gen.UserAgreementMsg.Builder setRelatedIMEventOriginalID(java.lang.String value) {
validate(fields()[1], value);
- this.relatedIMEventID = value;
+ this.relatedIMEventOriginalID = value;
fieldSetFlags()[1] = true;
return this;
}
- /** Checks whether the 'relatedIMEventID' field has been set */
- public boolean hasRelatedIMEventID() {
+ /** Checks whether the 'relatedIMEventOriginalID' field has been set */
+ public boolean hasRelatedIMEventOriginalID() {
return fieldSetFlags()[1];
}
- /** Clears the value of the 'relatedIMEventID' field */
- public gr.grnet.aquarium.message.avro.gen.UserAgreementMsg.Builder clearRelatedIMEventID() {
- relatedIMEventID = null;
+ /** Clears the value of the 'relatedIMEventOriginalID' field */
+ public gr.grnet.aquarium.message.avro.gen.UserAgreementMsg.Builder clearRelatedIMEventOriginalID() {
+ relatedIMEventOriginalID = null;
fieldSetFlags()[1] = false;
return this;
}
+ /** Gets the value of the 'userID' field */
+ public java.lang.String getUserID() {
+ return userID;
+ }
+
+ /** Sets the value of the 'userID' field */
+ public gr.grnet.aquarium.message.avro.gen.UserAgreementMsg.Builder setUserID(java.lang.String value) {
+ validate(fields()[2], value);
+ this.userID = value;
+ fieldSetFlags()[2] = true;
+ return this;
+ }
+
+ /** Checks whether the 'userID' field has been set */
+ public boolean hasUserID() {
+ return fieldSetFlags()[2];
+ }
+
+ /** Clears the value of the 'userID' field */
+ public gr.grnet.aquarium.message.avro.gen.UserAgreementMsg.Builder clearUserID() {
+ userID = null;
+ fieldSetFlags()[2] = false;
+ return this;
+ }
+
/** Gets the value of the 'validFromMillis' field */
public java.lang.Long getValidFromMillis() {
return validFromMillis;
/** Sets the value of the 'validFromMillis' field */
public gr.grnet.aquarium.message.avro.gen.UserAgreementMsg.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.UserAgreementMsg.Builder clearValidFromMillis() {
- fieldSetFlags()[2] = false;
+ fieldSetFlags()[3] = false;
return this;
}
/** Sets the value of the 'validToMillis' field */
public gr.grnet.aquarium.message.avro.gen.UserAgreementMsg.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.UserAgreementMsg.Builder clearValidToMillis() {
- fieldSetFlags()[3] = false;
+ fieldSetFlags()[4] = false;
return this;
}
/** Gets the value of the 'role' field */
- public java.lang.CharSequence getRole() {
+ public java.lang.String getRole() {
return role;
}
/** Sets the value of the 'role' field */
- public gr.grnet.aquarium.message.avro.gen.UserAgreementMsg.Builder setRole(java.lang.CharSequence value) {
- validate(fields()[4], value);
+ public gr.grnet.aquarium.message.avro.gen.UserAgreementMsg.Builder setRole(java.lang.String value) {
+ validate(fields()[5], value);
this.role = value;
- fieldSetFlags()[4] = true;
+ fieldSetFlags()[5] = true;
return this;
}
/** Checks whether the 'role' field has been set */
public boolean hasRole() {
- return fieldSetFlags()[4];
+ return fieldSetFlags()[5];
}
/** Clears the value of the 'role' field */
public gr.grnet.aquarium.message.avro.gen.UserAgreementMsg.Builder clearRole() {
role = null;
- fieldSetFlags()[4] = false;
+ fieldSetFlags()[5] = false;
return this;
}
/** Sets the value of the 'fullPriceTableRef' field */
public gr.grnet.aquarium.message.avro.gen.UserAgreementMsg.Builder setFullPriceTableRef(gr.grnet.aquarium.message.avro.gen.FullPriceTableMsg value) {
- validate(fields()[5], value);
+ validate(fields()[6], value);
this.fullPriceTableRef = value;
- fieldSetFlags()[5] = true;
+ fieldSetFlags()[6] = true;
return this;
}
/** Checks whether the 'fullPriceTableRef' field has been set */
public boolean hasFullPriceTableRef() {
- return fieldSetFlags()[5];
+ return fieldSetFlags()[6];
}
/** Clears the value of the 'fullPriceTableRef' field */
public gr.grnet.aquarium.message.avro.gen.UserAgreementMsg.Builder clearFullPriceTableRef() {
fullPriceTableRef = null;
- fieldSetFlags()[5] = false;
+ fieldSetFlags()[6] = false;
return this;
}
public UserAgreementMsg build() {
try {
UserAgreementMsg record = new UserAgreementMsg();
- record.id = fieldSetFlags()[0] ? this.id : (java.lang.CharSequence) defaultValue(fields()[0]);
- record.relatedIMEventID = fieldSetFlags()[1] ? this.relatedIMEventID : (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.role = fieldSetFlags()[4] ? this.role : (java.lang.CharSequence) defaultValue(fields()[4]);
- record.fullPriceTableRef = fieldSetFlags()[5] ? this.fullPriceTableRef : (gr.grnet.aquarium.message.avro.gen.FullPriceTableMsg) defaultValue(fields()[5]);
+ record.id = fieldSetFlags()[0] ? this.id : (java.lang.String) defaultValue(fields()[0]);
+ record.relatedIMEventOriginalID = fieldSetFlags()[1] ? this.relatedIMEventOriginalID : (java.lang.String) defaultValue(fields()[1]);
+ record.userID = fieldSetFlags()[2] ? this.userID : (java.lang.String) 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.role = fieldSetFlags()[5] ? this.role : (java.lang.String) defaultValue(fields()[5]);
+ record.fullPriceTableRef = fieldSetFlags()[6] ? this.fullPriceTableRef : (gr.grnet.aquarium.message.avro.gen.FullPriceTableMsg) defaultValue(fields()[6]);
return record;
} catch (Exception e) {
throw new org.apache.avro.AvroRuntimeException(e);
--- /dev/null
+/**
+ * Autogenerated by Avro
+ *
+ * DO NOT EDIT DIRECTLY
+ */
+package gr.grnet.aquarium.message.avro.gen;
+@SuppressWarnings("all")
+public class UserStateMsg 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\":\"UserStateMsg\",\"namespace\":\"gr.grnet.aquarium.message.avro.gen\",\"fields\":[{\"name\":\"originalID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"inStoreID\",\"type\":[{\"type\":\"string\",\"avro.java.string\":\"String\"},\"null\"]},{\"name\":\"userID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"occurredMillis\",\"type\":\"long\"},{\"name\":\"parentOriginalID\",\"type\":[{\"type\":\"string\",\"avro.java.string\":\"String\"},\"null\"]},{\"name\":\"parentInStoreID\",\"type\":[{\"type\":\"string\",\"avro.java.string\":\"String\"},\"null\"]},{\"name\":\"resourceTypesMap\",\"type\":{\"type\":\"map\",\"values\":{\"type\":\"record\",\"name\":\"ResourceTypeMsg\",\"fields\":[{\"name\":\"name\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"unit\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"chargingBehaviorClass\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}}]},\"avro.java.string\":\"String\"}},{\"name\":\"stateOfResources\",\"type\":{\"type\":\"map\",\"values\":{\"type\":\"record\",\"name\":\"ResourcesChargingStateMsg\",\"fields\":[{\"name\":\"resource\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"details\",\"type\":{\"type\":\"map\",\"values\":{\"type\":\"record\",\"name\":\"AnyValueMsg\",\"fields\":[{\"name\":\"anyValue\",\"type\":[\"null\",\"int\",\"long\",\"boolean\",\"double\",\"bytes\",{\"type\":\"string\",\"avro.java.string\":\"String\"},{\"type\":\"array\",\"items\":\"AnyValueMsg\"},{\"type\":\"map\",\"values\":\"AnyValueMsg\",\"avro.java.string\":\"String\"}]}]},\"avro.java.string\":\"String\"}},{\"name\":\"stateOfResourceInstance\",\"type\":{\"type\":\"map\",\"values\":{\"type\":\"record\",\"name\":\"ResourceInstanceChargingStateMsg\",\"fields\":[{\"name\":\"clientID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"resource\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"instanceID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"details\",\"type\":{\"type\":\"map\",\"values\":\"AnyValueMsg\",\"avro.java.string\":\"String\"}},{\"name\":\"previousEvents\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"ResourceEventMsg\",\"fields\":[{\"name\":\"originalID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"inStoreID\",\"type\":[{\"type\":\"string\",\"avro.java.string\":\"String\"},\"null\"]},{\"name\":\"occurredMillis\",\"type\":\"long\"},{\"name\":\"receivedMillis\",\"type\":\"long\",\"default\":0},{\"name\":\"userID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"clientID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"eventVersion\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"default\":\"1.0\"},{\"name\":\"resource\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"instanceID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"value\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"isSynthetic\",\"type\":\"boolean\",\"default\":false},{\"name\":\"details\",\"type\":{\"type\":\"map\",\"values\":\"AnyValueMsg\",\"avro.java.string\":\"String\"}}]}}},{\"name\":\"implicitlyIssuedStartEvents\",\"type\":{\"type\":\"array\",\"items\":\"ResourceEventMsg\"}},{\"name\":\"accumulatingAmount\",\"type\":\"double\"},{\"name\":\"oldAccumulatingAmount\",\"type\":\"double\"},{\"name\":\"previousValue\",\"type\":\"double\"},{\"name\":\"currentValue\",\"type\":\"double\"}]},\"avro.java.string\":\"String\"}}]},\"avro.java.string\":\"String\"}},{\"name\":\"totalCredits\",\"type\":\"double\",\"default\":0.0},{\"name\":\"agreementHistory\",\"type\":{\"type\":\"record\",\"name\":\"UserAgreementHistoryMsg\",\"fields\":[{\"name\":\"agreements\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"UserAgreementMsg\",\"fields\":[{\"name\":\"id\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"relatedIMEventOriginalID\",\"type\":[{\"type\":\"string\",\"avro.java.string\":\"String\"},\"null\"]},{\"name\":\"userID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"validFromMillis\",\"type\":\"long\"},{\"name\":\"validToMillis\",\"type\":\"long\"},{\"name\":\"role\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"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\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"b\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}}]},\"null\"]}]}}}]},{\"type\":\"map\",\"values\":\"SelectorValueMsg\",\"avro.java.string\":\"String\"}]}]},\"avro.java.string\":\"String\"},\"avro.java.string\":\"String\"}}]},\"null\"]}]}}}]}},{\"name\":\"latestUpdateMillis\",\"type\":\"long\"},{\"name\":\"latestResourceEventOccurredMillis\",\"type\":\"long\"},{\"name\":\"billingPeriodOutOfSyncResourceEventsCounter\",\"type\":\"long\",\"default\":0},{\"name\":\"billingYear\",\"type\":\"int\"},{\"name\":\"billingMonth\",\"type\":\"int\"},{\"name\":\"billingMonthDay\",\"type\":\"int\"},{\"name\":\"isFullBillingMonth\",\"type\":\"boolean\",\"default\":false},{\"name\":\"walletEntries\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"WalletEntryMsg\",\"fields\":[{\"name\":\"userID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"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\":\"billingMonthDay\",\"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\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"default\":\"\"},{\"name\":\"creditsToSubtract\",\"type\":\"double\",\"default\":0.0}]}}},{\"name\":\"resourceEvents\",\"type\":{\"type\":\"array\",\"items\":\"ResourceEventMsg\"}},{\"name\":\"resourceType\",\"type\":\"ResourceTypeMsg\"},{\"name\":\"isSynthetic\",\"type\":\"boolean\",\"default\":false}]}}}]}");
+ @Deprecated public java.lang.String originalID;
+ @Deprecated public java.lang.String inStoreID;
+ @Deprecated public java.lang.String userID;
+ @Deprecated public long occurredMillis;
+ @Deprecated public java.lang.String parentOriginalID;
+ @Deprecated public java.lang.String parentInStoreID;
+ @Deprecated public java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.ResourceTypeMsg> resourceTypesMap;
+ @Deprecated public java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.ResourcesChargingStateMsg> stateOfResources;
+ @Deprecated public double totalCredits;
+ @Deprecated public gr.grnet.aquarium.message.avro.gen.UserAgreementHistoryMsg agreementHistory;
+ @Deprecated public long latestUpdateMillis;
+ @Deprecated public long latestResourceEventOccurredMillis;
+ @Deprecated public long billingPeriodOutOfSyncResourceEventsCounter;
+ @Deprecated public int billingYear;
+ @Deprecated public int billingMonth;
+ @Deprecated public int billingMonthDay;
+ @Deprecated public boolean isFullBillingMonth;
+ @Deprecated public java.util.List<gr.grnet.aquarium.message.avro.gen.WalletEntryMsg> walletEntries;
+ public org.apache.avro.Schema getSchema() { return SCHEMA$; }
+ // Used by DatumWriter. Applications should not call.
+ public java.lang.Object get(int field$) {
+ switch (field$) {
+ case 0: return originalID;
+ case 1: return inStoreID;
+ case 2: return userID;
+ case 3: return occurredMillis;
+ case 4: return parentOriginalID;
+ case 5: return parentInStoreID;
+ case 6: return resourceTypesMap;
+ case 7: return stateOfResources;
+ case 8: return totalCredits;
+ case 9: return agreementHistory;
+ case 10: return latestUpdateMillis;
+ case 11: return latestResourceEventOccurredMillis;
+ case 12: return billingPeriodOutOfSyncResourceEventsCounter;
+ case 13: return billingYear;
+ case 14: return billingMonth;
+ case 15: return billingMonthDay;
+ case 16: return isFullBillingMonth;
+ case 17: return walletEntries;
+ default: throw new org.apache.avro.AvroRuntimeException("Bad index");
+ }
+ }
+ // Used by DatumReader. Applications should not call.
+ @SuppressWarnings(value="unchecked")
+ public void put(int field$, java.lang.Object value$) {
+ switch (field$) {
+ case 0: originalID = (java.lang.String)value$; break;
+ case 1: inStoreID = (java.lang.String)value$; break;
+ case 2: userID = (java.lang.String)value$; break;
+ case 3: occurredMillis = (java.lang.Long)value$; break;
+ case 4: parentOriginalID = (java.lang.String)value$; break;
+ case 5: parentInStoreID = (java.lang.String)value$; break;
+ case 6: resourceTypesMap = (java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.ResourceTypeMsg>)value$; break;
+ case 7: stateOfResources = (java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.ResourcesChargingStateMsg>)value$; break;
+ case 8: totalCredits = (java.lang.Double)value$; break;
+ case 9: agreementHistory = (gr.grnet.aquarium.message.avro.gen.UserAgreementHistoryMsg)value$; break;
+ case 10: latestUpdateMillis = (java.lang.Long)value$; break;
+ case 11: latestResourceEventOccurredMillis = (java.lang.Long)value$; break;
+ case 12: billingPeriodOutOfSyncResourceEventsCounter = (java.lang.Long)value$; break;
+ case 13: billingYear = (java.lang.Integer)value$; break;
+ case 14: billingMonth = (java.lang.Integer)value$; break;
+ case 15: billingMonthDay = (java.lang.Integer)value$; break;
+ case 16: isFullBillingMonth = (java.lang.Boolean)value$; break;
+ case 17: walletEntries = (java.util.List<gr.grnet.aquarium.message.avro.gen.WalletEntryMsg>)value$; break;
+ default: throw new org.apache.avro.AvroRuntimeException("Bad index");
+ }
+ }
+
+ /**
+ * Gets the value of the 'originalID' field.
+ */
+ public java.lang.String getOriginalID() {
+ return originalID;
+ }
+
+ /**
+ * Sets the value of the 'originalID' field.
+ * @param value the value to set.
+ */
+ public void setOriginalID(java.lang.String value) {
+ this.originalID = value;
+ }
+
+ /**
+ * Gets the value of the 'inStoreID' field.
+ */
+ public java.lang.String getInStoreID() {
+ return inStoreID;
+ }
+
+ /**
+ * Sets the value of the 'inStoreID' field.
+ * @param value the value to set.
+ */
+ public void setInStoreID(java.lang.String value) {
+ this.inStoreID = value;
+ }
+
+ /**
+ * Gets the value of the 'userID' field.
+ */
+ public java.lang.String getUserID() {
+ return userID;
+ }
+
+ /**
+ * Sets the value of the 'userID' field.
+ * @param value the value to set.
+ */
+ public void setUserID(java.lang.String value) {
+ this.userID = value;
+ }
+
+ /**
+ * Gets the value of the 'occurredMillis' field.
+ */
+ public java.lang.Long getOccurredMillis() {
+ return occurredMillis;
+ }
+
+ /**
+ * Sets the value of the 'occurredMillis' field.
+ * @param value the value to set.
+ */
+ public void setOccurredMillis(java.lang.Long value) {
+ this.occurredMillis = value;
+ }
+
+ /**
+ * Gets the value of the 'parentOriginalID' field.
+ */
+ public java.lang.String getParentOriginalID() {
+ return parentOriginalID;
+ }
+
+ /**
+ * Sets the value of the 'parentOriginalID' field.
+ * @param value the value to set.
+ */
+ public void setParentOriginalID(java.lang.String value) {
+ this.parentOriginalID = value;
+ }
+
+ /**
+ * Gets the value of the 'parentInStoreID' field.
+ */
+ public java.lang.String getParentInStoreID() {
+ return parentInStoreID;
+ }
+
+ /**
+ * Sets the value of the 'parentInStoreID' field.
+ * @param value the value to set.
+ */
+ public void setParentInStoreID(java.lang.String value) {
+ this.parentInStoreID = value;
+ }
+
+ /**
+ * Gets the value of the 'resourceTypesMap' field.
+ */
+ public java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.ResourceTypeMsg> getResourceTypesMap() {
+ return resourceTypesMap;
+ }
+
+ /**
+ * Sets the value of the 'resourceTypesMap' field.
+ * @param value the value to set.
+ */
+ public void setResourceTypesMap(java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.ResourceTypeMsg> value) {
+ this.resourceTypesMap = value;
+ }
+
+ /**
+ * Gets the value of the 'stateOfResources' field.
+ */
+ public java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.ResourcesChargingStateMsg> getStateOfResources() {
+ return stateOfResources;
+ }
+
+ /**
+ * Sets the value of the 'stateOfResources' field.
+ * @param value the value to set.
+ */
+ public void setStateOfResources(java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.ResourcesChargingStateMsg> value) {
+ this.stateOfResources = value;
+ }
+
+ /**
+ * Gets the value of the 'totalCredits' field.
+ */
+ public java.lang.Double getTotalCredits() {
+ return totalCredits;
+ }
+
+ /**
+ * Sets the value of the 'totalCredits' field.
+ * @param value the value to set.
+ */
+ public void setTotalCredits(java.lang.Double value) {
+ this.totalCredits = value;
+ }
+
+ /**
+ * Gets the value of the 'agreementHistory' field.
+ */
+ public gr.grnet.aquarium.message.avro.gen.UserAgreementHistoryMsg getAgreementHistory() {
+ return agreementHistory;
+ }
+
+ /**
+ * Sets the value of the 'agreementHistory' field.
+ * @param value the value to set.
+ */
+ public void setAgreementHistory(gr.grnet.aquarium.message.avro.gen.UserAgreementHistoryMsg value) {
+ this.agreementHistory = value;
+ }
+
+ /**
+ * Gets the value of the 'latestUpdateMillis' field.
+ */
+ public java.lang.Long getLatestUpdateMillis() {
+ return latestUpdateMillis;
+ }
+
+ /**
+ * Sets the value of the 'latestUpdateMillis' field.
+ * @param value the value to set.
+ */
+ public void setLatestUpdateMillis(java.lang.Long value) {
+ this.latestUpdateMillis = value;
+ }
+
+ /**
+ * Gets the value of the 'latestResourceEventOccurredMillis' field.
+ */
+ public java.lang.Long getLatestResourceEventOccurredMillis() {
+ return latestResourceEventOccurredMillis;
+ }
+
+ /**
+ * Sets the value of the 'latestResourceEventOccurredMillis' field.
+ * @param value the value to set.
+ */
+ public void setLatestResourceEventOccurredMillis(java.lang.Long value) {
+ this.latestResourceEventOccurredMillis = value;
+ }
+
+ /**
+ * Gets the value of the 'billingPeriodOutOfSyncResourceEventsCounter' field.
+ */
+ public java.lang.Long getBillingPeriodOutOfSyncResourceEventsCounter() {
+ return billingPeriodOutOfSyncResourceEventsCounter;
+ }
+
+ /**
+ * Sets the value of the 'billingPeriodOutOfSyncResourceEventsCounter' field.
+ * @param value the value to set.
+ */
+ public void setBillingPeriodOutOfSyncResourceEventsCounter(java.lang.Long value) {
+ this.billingPeriodOutOfSyncResourceEventsCounter = value;
+ }
+
+ /**
+ * Gets the value of the 'billingYear' field.
+ */
+ public java.lang.Integer getBillingYear() {
+ return billingYear;
+ }
+
+ /**
+ * Sets the value of the 'billingYear' field.
+ * @param value the value to set.
+ */
+ public void setBillingYear(java.lang.Integer value) {
+ this.billingYear = value;
+ }
+
+ /**
+ * Gets the value of the 'billingMonth' field.
+ */
+ public java.lang.Integer getBillingMonth() {
+ return billingMonth;
+ }
+
+ /**
+ * Sets the value of the 'billingMonth' field.
+ * @param value the value to set.
+ */
+ public void setBillingMonth(java.lang.Integer value) {
+ this.billingMonth = value;
+ }
+
+ /**
+ * Gets the value of the 'billingMonthDay' field.
+ */
+ public java.lang.Integer getBillingMonthDay() {
+ return billingMonthDay;
+ }
+
+ /**
+ * Sets the value of the 'billingMonthDay' field.
+ * @param value the value to set.
+ */
+ public void setBillingMonthDay(java.lang.Integer value) {
+ this.billingMonthDay = value;
+ }
+
+ /**
+ * Gets the value of the 'isFullBillingMonth' field.
+ */
+ public java.lang.Boolean getIsFullBillingMonth() {
+ return isFullBillingMonth;
+ }
+
+ /**
+ * Sets the value of the 'isFullBillingMonth' field.
+ * @param value the value to set.
+ */
+ public void setIsFullBillingMonth(java.lang.Boolean value) {
+ this.isFullBillingMonth = value;
+ }
+
+ /**
+ * Gets the value of the 'walletEntries' field.
+ */
+ public java.util.List<gr.grnet.aquarium.message.avro.gen.WalletEntryMsg> getWalletEntries() {
+ return walletEntries;
+ }
+
+ /**
+ * Sets the value of the 'walletEntries' field.
+ * @param value the value to set.
+ */
+ public void setWalletEntries(java.util.List<gr.grnet.aquarium.message.avro.gen.WalletEntryMsg> value) {
+ this.walletEntries = value;
+ }
+
+ /** Creates a new UserStateMsg RecordBuilder */
+ public static gr.grnet.aquarium.message.avro.gen.UserStateMsg.Builder newBuilder() {
+ return new gr.grnet.aquarium.message.avro.gen.UserStateMsg.Builder();
+ }
+
+ /** Creates a new UserStateMsg RecordBuilder by copying an existing Builder */
+ public static gr.grnet.aquarium.message.avro.gen.UserStateMsg.Builder newBuilder(gr.grnet.aquarium.message.avro.gen.UserStateMsg.Builder other) {
+ return new gr.grnet.aquarium.message.avro.gen.UserStateMsg.Builder(other);
+ }
+
+ /** Creates a new UserStateMsg RecordBuilder by copying an existing UserStateMsg instance */
+ public static gr.grnet.aquarium.message.avro.gen.UserStateMsg.Builder newBuilder(gr.grnet.aquarium.message.avro.gen.UserStateMsg other) {
+ return new gr.grnet.aquarium.message.avro.gen.UserStateMsg.Builder(other);
+ }
+
+ /**
+ * RecordBuilder for UserStateMsg instances.
+ */
+ public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<UserStateMsg>
+ implements org.apache.avro.data.RecordBuilder<UserStateMsg> {
+
+ private java.lang.String originalID;
+ private java.lang.String inStoreID;
+ private java.lang.String userID;
+ private long occurredMillis;
+ private java.lang.String parentOriginalID;
+ private java.lang.String parentInStoreID;
+ private java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.ResourceTypeMsg> resourceTypesMap;
+ private java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.ResourcesChargingStateMsg> stateOfResources;
+ private double totalCredits;
+ private gr.grnet.aquarium.message.avro.gen.UserAgreementHistoryMsg agreementHistory;
+ private long latestUpdateMillis;
+ private long latestResourceEventOccurredMillis;
+ private long billingPeriodOutOfSyncResourceEventsCounter;
+ private int billingYear;
+ private int billingMonth;
+ private int billingMonthDay;
+ private boolean isFullBillingMonth;
+ private java.util.List<gr.grnet.aquarium.message.avro.gen.WalletEntryMsg> walletEntries;
+
+ /** Creates a new Builder */
+ private Builder() {
+ super(gr.grnet.aquarium.message.avro.gen.UserStateMsg.SCHEMA$);
+ }
+
+ /** Creates a Builder by copying an existing Builder */
+ private Builder(gr.grnet.aquarium.message.avro.gen.UserStateMsg.Builder other) {
+ super(other);
+ }
+
+ /** Creates a Builder by copying an existing UserStateMsg instance */
+ private Builder(gr.grnet.aquarium.message.avro.gen.UserStateMsg other) {
+ super(gr.grnet.aquarium.message.avro.gen.UserStateMsg.SCHEMA$);
+ if (isValidValue(fields()[0], other.originalID)) {
+ this.originalID = (java.lang.String) data().deepCopy(fields()[0].schema(), other.originalID);
+ fieldSetFlags()[0] = true;
+ }
+ if (isValidValue(fields()[1], other.inStoreID)) {
+ this.inStoreID = (java.lang.String) data().deepCopy(fields()[1].schema(), other.inStoreID);
+ fieldSetFlags()[1] = true;
+ }
+ if (isValidValue(fields()[2], other.userID)) {
+ this.userID = (java.lang.String) data().deepCopy(fields()[2].schema(), other.userID);
+ fieldSetFlags()[2] = true;
+ }
+ if (isValidValue(fields()[3], other.occurredMillis)) {
+ this.occurredMillis = (java.lang.Long) data().deepCopy(fields()[3].schema(), other.occurredMillis);
+ fieldSetFlags()[3] = true;
+ }
+ if (isValidValue(fields()[4], other.parentOriginalID)) {
+ this.parentOriginalID = (java.lang.String) data().deepCopy(fields()[4].schema(), other.parentOriginalID);
+ fieldSetFlags()[4] = true;
+ }
+ if (isValidValue(fields()[5], other.parentInStoreID)) {
+ this.parentInStoreID = (java.lang.String) data().deepCopy(fields()[5].schema(), other.parentInStoreID);
+ fieldSetFlags()[5] = true;
+ }
+ if (isValidValue(fields()[6], other.resourceTypesMap)) {
+ this.resourceTypesMap = (java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.ResourceTypeMsg>) data().deepCopy(fields()[6].schema(), other.resourceTypesMap);
+ fieldSetFlags()[6] = true;
+ }
+ if (isValidValue(fields()[7], other.stateOfResources)) {
+ this.stateOfResources = (java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.ResourcesChargingStateMsg>) data().deepCopy(fields()[7].schema(), other.stateOfResources);
+ fieldSetFlags()[7] = true;
+ }
+ if (isValidValue(fields()[8], other.totalCredits)) {
+ this.totalCredits = (java.lang.Double) data().deepCopy(fields()[8].schema(), other.totalCredits);
+ fieldSetFlags()[8] = true;
+ }
+ if (isValidValue(fields()[9], other.agreementHistory)) {
+ this.agreementHistory = (gr.grnet.aquarium.message.avro.gen.UserAgreementHistoryMsg) data().deepCopy(fields()[9].schema(), other.agreementHistory);
+ fieldSetFlags()[9] = true;
+ }
+ if (isValidValue(fields()[10], other.latestUpdateMillis)) {
+ this.latestUpdateMillis = (java.lang.Long) data().deepCopy(fields()[10].schema(), other.latestUpdateMillis);
+ fieldSetFlags()[10] = true;
+ }
+ if (isValidValue(fields()[11], other.latestResourceEventOccurredMillis)) {
+ this.latestResourceEventOccurredMillis = (java.lang.Long) data().deepCopy(fields()[11].schema(), other.latestResourceEventOccurredMillis);
+ fieldSetFlags()[11] = true;
+ }
+ if (isValidValue(fields()[12], other.billingPeriodOutOfSyncResourceEventsCounter)) {
+ this.billingPeriodOutOfSyncResourceEventsCounter = (java.lang.Long) data().deepCopy(fields()[12].schema(), other.billingPeriodOutOfSyncResourceEventsCounter);
+ fieldSetFlags()[12] = true;
+ }
+ if (isValidValue(fields()[13], other.billingYear)) {
+ this.billingYear = (java.lang.Integer) data().deepCopy(fields()[13].schema(), other.billingYear);
+ fieldSetFlags()[13] = true;
+ }
+ if (isValidValue(fields()[14], other.billingMonth)) {
+ this.billingMonth = (java.lang.Integer) data().deepCopy(fields()[14].schema(), other.billingMonth);
+ fieldSetFlags()[14] = true;
+ }
+ if (isValidValue(fields()[15], other.billingMonthDay)) {
+ this.billingMonthDay = (java.lang.Integer) data().deepCopy(fields()[15].schema(), other.billingMonthDay);
+ fieldSetFlags()[15] = true;
+ }
+ if (isValidValue(fields()[16], other.isFullBillingMonth)) {
+ this.isFullBillingMonth = (java.lang.Boolean) data().deepCopy(fields()[16].schema(), other.isFullBillingMonth);
+ fieldSetFlags()[16] = true;
+ }
+ if (isValidValue(fields()[17], other.walletEntries)) {
+ this.walletEntries = (java.util.List<gr.grnet.aquarium.message.avro.gen.WalletEntryMsg>) data().deepCopy(fields()[17].schema(), other.walletEntries);
+ fieldSetFlags()[17] = true;
+ }
+ }
+
+ /** Gets the value of the 'originalID' field */
+ public java.lang.String getOriginalID() {
+ return originalID;
+ }
+
+ /** Sets the value of the 'originalID' field */
+ public gr.grnet.aquarium.message.avro.gen.UserStateMsg.Builder setOriginalID(java.lang.String value) {
+ validate(fields()[0], value);
+ this.originalID = value;
+ fieldSetFlags()[0] = true;
+ return this;
+ }
+
+ /** Checks whether the 'originalID' field has been set */
+ public boolean hasOriginalID() {
+ return fieldSetFlags()[0];
+ }
+
+ /** Clears the value of the 'originalID' field */
+ public gr.grnet.aquarium.message.avro.gen.UserStateMsg.Builder clearOriginalID() {
+ originalID = null;
+ fieldSetFlags()[0] = false;
+ return this;
+ }
+
+ /** Gets the value of the 'inStoreID' field */
+ public java.lang.String getInStoreID() {
+ return inStoreID;
+ }
+
+ /** Sets the value of the 'inStoreID' field */
+ public gr.grnet.aquarium.message.avro.gen.UserStateMsg.Builder setInStoreID(java.lang.String 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.UserStateMsg.Builder clearInStoreID() {
+ inStoreID = null;
+ fieldSetFlags()[1] = false;
+ return this;
+ }
+
+ /** Gets the value of the 'userID' field */
+ public java.lang.String getUserID() {
+ return userID;
+ }
+
+ /** Sets the value of the 'userID' field */
+ public gr.grnet.aquarium.message.avro.gen.UserStateMsg.Builder setUserID(java.lang.String value) {
+ validate(fields()[2], value);
+ this.userID = value;
+ fieldSetFlags()[2] = true;
+ return this;
+ }
+
+ /** Checks whether the 'userID' field has been set */
+ public boolean hasUserID() {
+ return fieldSetFlags()[2];
+ }
+
+ /** Clears the value of the 'userID' field */
+ public gr.grnet.aquarium.message.avro.gen.UserStateMsg.Builder clearUserID() {
+ userID = null;
+ fieldSetFlags()[2] = false;
+ return this;
+ }
+
+ /** Gets the value of the 'occurredMillis' field */
+ public java.lang.Long getOccurredMillis() {
+ return occurredMillis;
+ }
+
+ /** Sets the value of the 'occurredMillis' field */
+ public gr.grnet.aquarium.message.avro.gen.UserStateMsg.Builder setOccurredMillis(long value) {
+ validate(fields()[3], value);
+ this.occurredMillis = value;
+ fieldSetFlags()[3] = true;
+ return this;
+ }
+
+ /** Checks whether the 'occurredMillis' field has been set */
+ public boolean hasOccurredMillis() {
+ return fieldSetFlags()[3];
+ }
+
+ /** Clears the value of the 'occurredMillis' field */
+ public gr.grnet.aquarium.message.avro.gen.UserStateMsg.Builder clearOccurredMillis() {
+ fieldSetFlags()[3] = false;
+ return this;
+ }
+
+ /** Gets the value of the 'parentOriginalID' field */
+ public java.lang.String getParentOriginalID() {
+ return parentOriginalID;
+ }
+
+ /** Sets the value of the 'parentOriginalID' field */
+ public gr.grnet.aquarium.message.avro.gen.UserStateMsg.Builder setParentOriginalID(java.lang.String value) {
+ validate(fields()[4], value);
+ this.parentOriginalID = value;
+ fieldSetFlags()[4] = true;
+ return this;
+ }
+
+ /** Checks whether the 'parentOriginalID' field has been set */
+ public boolean hasParentOriginalID() {
+ return fieldSetFlags()[4];
+ }
+
+ /** Clears the value of the 'parentOriginalID' field */
+ public gr.grnet.aquarium.message.avro.gen.UserStateMsg.Builder clearParentOriginalID() {
+ parentOriginalID = null;
+ fieldSetFlags()[4] = false;
+ return this;
+ }
+
+ /** Gets the value of the 'parentInStoreID' field */
+ public java.lang.String getParentInStoreID() {
+ return parentInStoreID;
+ }
+
+ /** Sets the value of the 'parentInStoreID' field */
+ public gr.grnet.aquarium.message.avro.gen.UserStateMsg.Builder setParentInStoreID(java.lang.String value) {
+ validate(fields()[5], value);
+ this.parentInStoreID = value;
+ fieldSetFlags()[5] = true;
+ return this;
+ }
+
+ /** Checks whether the 'parentInStoreID' field has been set */
+ public boolean hasParentInStoreID() {
+ return fieldSetFlags()[5];
+ }
+
+ /** Clears the value of the 'parentInStoreID' field */
+ public gr.grnet.aquarium.message.avro.gen.UserStateMsg.Builder clearParentInStoreID() {
+ parentInStoreID = null;
+ fieldSetFlags()[5] = false;
+ return this;
+ }
+
+ /** Gets the value of the 'resourceTypesMap' field */
+ public java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.ResourceTypeMsg> getResourceTypesMap() {
+ return resourceTypesMap;
+ }
+
+ /** Sets the value of the 'resourceTypesMap' field */
+ public gr.grnet.aquarium.message.avro.gen.UserStateMsg.Builder setResourceTypesMap(java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.ResourceTypeMsg> value) {
+ validate(fields()[6], value);
+ this.resourceTypesMap = value;
+ fieldSetFlags()[6] = true;
+ return this;
+ }
+
+ /** Checks whether the 'resourceTypesMap' field has been set */
+ public boolean hasResourceTypesMap() {
+ return fieldSetFlags()[6];
+ }
+
+ /** Clears the value of the 'resourceTypesMap' field */
+ public gr.grnet.aquarium.message.avro.gen.UserStateMsg.Builder clearResourceTypesMap() {
+ resourceTypesMap = null;
+ fieldSetFlags()[6] = false;
+ return this;
+ }
+
+ /** Gets the value of the 'stateOfResources' field */
+ public java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.ResourcesChargingStateMsg> getStateOfResources() {
+ return stateOfResources;
+ }
+
+ /** Sets the value of the 'stateOfResources' field */
+ public gr.grnet.aquarium.message.avro.gen.UserStateMsg.Builder setStateOfResources(java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.ResourcesChargingStateMsg> value) {
+ validate(fields()[7], value);
+ this.stateOfResources = value;
+ fieldSetFlags()[7] = true;
+ return this;
+ }
+
+ /** Checks whether the 'stateOfResources' field has been set */
+ public boolean hasStateOfResources() {
+ return fieldSetFlags()[7];
+ }
+
+ /** Clears the value of the 'stateOfResources' field */
+ public gr.grnet.aquarium.message.avro.gen.UserStateMsg.Builder clearStateOfResources() {
+ stateOfResources = null;
+ fieldSetFlags()[7] = false;
+ return this;
+ }
+
+ /** Gets the value of the 'totalCredits' field */
+ public java.lang.Double getTotalCredits() {
+ return totalCredits;
+ }
+
+ /** Sets the value of the 'totalCredits' field */
+ public gr.grnet.aquarium.message.avro.gen.UserStateMsg.Builder setTotalCredits(double value) {
+ validate(fields()[8], value);
+ this.totalCredits = value;
+ fieldSetFlags()[8] = true;
+ return this;
+ }
+
+ /** Checks whether the 'totalCredits' field has been set */
+ public boolean hasTotalCredits() {
+ return fieldSetFlags()[8];
+ }
+
+ /** Clears the value of the 'totalCredits' field */
+ public gr.grnet.aquarium.message.avro.gen.UserStateMsg.Builder clearTotalCredits() {
+ fieldSetFlags()[8] = false;
+ return this;
+ }
+
+ /** Gets the value of the 'agreementHistory' field */
+ public gr.grnet.aquarium.message.avro.gen.UserAgreementHistoryMsg getAgreementHistory() {
+ return agreementHistory;
+ }
+
+ /** Sets the value of the 'agreementHistory' field */
+ public gr.grnet.aquarium.message.avro.gen.UserStateMsg.Builder setAgreementHistory(gr.grnet.aquarium.message.avro.gen.UserAgreementHistoryMsg value) {
+ validate(fields()[9], value);
+ this.agreementHistory = value;
+ fieldSetFlags()[9] = true;
+ return this;
+ }
+
+ /** Checks whether the 'agreementHistory' field has been set */
+ public boolean hasAgreementHistory() {
+ return fieldSetFlags()[9];
+ }
+
+ /** Clears the value of the 'agreementHistory' field */
+ public gr.grnet.aquarium.message.avro.gen.UserStateMsg.Builder clearAgreementHistory() {
+ agreementHistory = null;
+ fieldSetFlags()[9] = false;
+ return this;
+ }
+
+ /** Gets the value of the 'latestUpdateMillis' field */
+ public java.lang.Long getLatestUpdateMillis() {
+ return latestUpdateMillis;
+ }
+
+ /** Sets the value of the 'latestUpdateMillis' field */
+ public gr.grnet.aquarium.message.avro.gen.UserStateMsg.Builder setLatestUpdateMillis(long value) {
+ validate(fields()[10], value);
+ this.latestUpdateMillis = value;
+ fieldSetFlags()[10] = true;
+ return this;
+ }
+
+ /** Checks whether the 'latestUpdateMillis' field has been set */
+ public boolean hasLatestUpdateMillis() {
+ return fieldSetFlags()[10];
+ }
+
+ /** Clears the value of the 'latestUpdateMillis' field */
+ public gr.grnet.aquarium.message.avro.gen.UserStateMsg.Builder clearLatestUpdateMillis() {
+ fieldSetFlags()[10] = false;
+ return this;
+ }
+
+ /** Gets the value of the 'latestResourceEventOccurredMillis' field */
+ public java.lang.Long getLatestResourceEventOccurredMillis() {
+ return latestResourceEventOccurredMillis;
+ }
+
+ /** Sets the value of the 'latestResourceEventOccurredMillis' field */
+ public gr.grnet.aquarium.message.avro.gen.UserStateMsg.Builder setLatestResourceEventOccurredMillis(long value) {
+ validate(fields()[11], value);
+ this.latestResourceEventOccurredMillis = value;
+ fieldSetFlags()[11] = true;
+ return this;
+ }
+
+ /** Checks whether the 'latestResourceEventOccurredMillis' field has been set */
+ public boolean hasLatestResourceEventOccurredMillis() {
+ return fieldSetFlags()[11];
+ }
+
+ /** Clears the value of the 'latestResourceEventOccurredMillis' field */
+ public gr.grnet.aquarium.message.avro.gen.UserStateMsg.Builder clearLatestResourceEventOccurredMillis() {
+ fieldSetFlags()[11] = false;
+ return this;
+ }
+
+ /** Gets the value of the 'billingPeriodOutOfSyncResourceEventsCounter' field */
+ public java.lang.Long getBillingPeriodOutOfSyncResourceEventsCounter() {
+ return billingPeriodOutOfSyncResourceEventsCounter;
+ }
+
+ /** Sets the value of the 'billingPeriodOutOfSyncResourceEventsCounter' field */
+ public gr.grnet.aquarium.message.avro.gen.UserStateMsg.Builder setBillingPeriodOutOfSyncResourceEventsCounter(long value) {
+ validate(fields()[12], value);
+ this.billingPeriodOutOfSyncResourceEventsCounter = value;
+ fieldSetFlags()[12] = true;
+ return this;
+ }
+
+ /** Checks whether the 'billingPeriodOutOfSyncResourceEventsCounter' field has been set */
+ public boolean hasBillingPeriodOutOfSyncResourceEventsCounter() {
+ return fieldSetFlags()[12];
+ }
+
+ /** Clears the value of the 'billingPeriodOutOfSyncResourceEventsCounter' field */
+ public gr.grnet.aquarium.message.avro.gen.UserStateMsg.Builder clearBillingPeriodOutOfSyncResourceEventsCounter() {
+ fieldSetFlags()[12] = false;
+ return this;
+ }
+
+ /** Gets the value of the 'billingYear' field */
+ public java.lang.Integer getBillingYear() {
+ return billingYear;
+ }
+
+ /** Sets the value of the 'billingYear' field */
+ public gr.grnet.aquarium.message.avro.gen.UserStateMsg.Builder setBillingYear(int value) {
+ validate(fields()[13], value);
+ this.billingYear = value;
+ fieldSetFlags()[13] = true;
+ return this;
+ }
+
+ /** Checks whether the 'billingYear' field has been set */
+ public boolean hasBillingYear() {
+ return fieldSetFlags()[13];
+ }
+
+ /** Clears the value of the 'billingYear' field */
+ public gr.grnet.aquarium.message.avro.gen.UserStateMsg.Builder clearBillingYear() {
+ fieldSetFlags()[13] = false;
+ return this;
+ }
+
+ /** Gets the value of the 'billingMonth' field */
+ public java.lang.Integer getBillingMonth() {
+ return billingMonth;
+ }
+
+ /** Sets the value of the 'billingMonth' field */
+ public gr.grnet.aquarium.message.avro.gen.UserStateMsg.Builder setBillingMonth(int value) {
+ validate(fields()[14], value);
+ this.billingMonth = value;
+ fieldSetFlags()[14] = true;
+ return this;
+ }
+
+ /** Checks whether the 'billingMonth' field has been set */
+ public boolean hasBillingMonth() {
+ return fieldSetFlags()[14];
+ }
+
+ /** Clears the value of the 'billingMonth' field */
+ public gr.grnet.aquarium.message.avro.gen.UserStateMsg.Builder clearBillingMonth() {
+ fieldSetFlags()[14] = false;
+ return this;
+ }
+
+ /** Gets the value of the 'billingMonthDay' field */
+ public java.lang.Integer getBillingMonthDay() {
+ return billingMonthDay;
+ }
+
+ /** Sets the value of the 'billingMonthDay' field */
+ public gr.grnet.aquarium.message.avro.gen.UserStateMsg.Builder setBillingMonthDay(int value) {
+ validate(fields()[15], value);
+ this.billingMonthDay = value;
+ fieldSetFlags()[15] = true;
+ return this;
+ }
+
+ /** Checks whether the 'billingMonthDay' field has been set */
+ public boolean hasBillingMonthDay() {
+ return fieldSetFlags()[15];
+ }
+
+ /** Clears the value of the 'billingMonthDay' field */
+ public gr.grnet.aquarium.message.avro.gen.UserStateMsg.Builder clearBillingMonthDay() {
+ fieldSetFlags()[15] = false;
+ return this;
+ }
+
+ /** Gets the value of the 'isFullBillingMonth' field */
+ public java.lang.Boolean getIsFullBillingMonth() {
+ return isFullBillingMonth;
+ }
+
+ /** Sets the value of the 'isFullBillingMonth' field */
+ public gr.grnet.aquarium.message.avro.gen.UserStateMsg.Builder setIsFullBillingMonth(boolean value) {
+ validate(fields()[16], value);
+ this.isFullBillingMonth = value;
+ fieldSetFlags()[16] = true;
+ return this;
+ }
+
+ /** Checks whether the 'isFullBillingMonth' field has been set */
+ public boolean hasIsFullBillingMonth() {
+ return fieldSetFlags()[16];
+ }
+
+ /** Clears the value of the 'isFullBillingMonth' field */
+ public gr.grnet.aquarium.message.avro.gen.UserStateMsg.Builder clearIsFullBillingMonth() {
+ fieldSetFlags()[16] = false;
+ return this;
+ }
+
+ /** Gets the value of the 'walletEntries' field */
+ public java.util.List<gr.grnet.aquarium.message.avro.gen.WalletEntryMsg> getWalletEntries() {
+ return walletEntries;
+ }
+
+ /** Sets the value of the 'walletEntries' field */
+ public gr.grnet.aquarium.message.avro.gen.UserStateMsg.Builder setWalletEntries(java.util.List<gr.grnet.aquarium.message.avro.gen.WalletEntryMsg> value) {
+ validate(fields()[17], value);
+ this.walletEntries = value;
+ fieldSetFlags()[17] = true;
+ return this;
+ }
+
+ /** Checks whether the 'walletEntries' field has been set */
+ public boolean hasWalletEntries() {
+ return fieldSetFlags()[17];
+ }
+
+ /** Clears the value of the 'walletEntries' field */
+ public gr.grnet.aquarium.message.avro.gen.UserStateMsg.Builder clearWalletEntries() {
+ walletEntries = null;
+ fieldSetFlags()[17] = false;
+ return this;
+ }
+
+ @Override
+ public UserStateMsg build() {
+ try {
+ UserStateMsg record = new UserStateMsg();
+ record.originalID = fieldSetFlags()[0] ? this.originalID : (java.lang.String) defaultValue(fields()[0]);
+ record.inStoreID = fieldSetFlags()[1] ? this.inStoreID : (java.lang.String) defaultValue(fields()[1]);
+ record.userID = fieldSetFlags()[2] ? this.userID : (java.lang.String) defaultValue(fields()[2]);
+ record.occurredMillis = fieldSetFlags()[3] ? this.occurredMillis : (java.lang.Long) defaultValue(fields()[3]);
+ record.parentOriginalID = fieldSetFlags()[4] ? this.parentOriginalID : (java.lang.String) defaultValue(fields()[4]);
+ record.parentInStoreID = fieldSetFlags()[5] ? this.parentInStoreID : (java.lang.String) defaultValue(fields()[5]);
+ record.resourceTypesMap = fieldSetFlags()[6] ? this.resourceTypesMap : (java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.ResourceTypeMsg>) defaultValue(fields()[6]);
+ record.stateOfResources = fieldSetFlags()[7] ? this.stateOfResources : (java.util.Map<java.lang.String,gr.grnet.aquarium.message.avro.gen.ResourcesChargingStateMsg>) defaultValue(fields()[7]);
+ record.totalCredits = fieldSetFlags()[8] ? this.totalCredits : (java.lang.Double) defaultValue(fields()[8]);
+ record.agreementHistory = fieldSetFlags()[9] ? this.agreementHistory : (gr.grnet.aquarium.message.avro.gen.UserAgreementHistoryMsg) defaultValue(fields()[9]);
+ record.latestUpdateMillis = fieldSetFlags()[10] ? this.latestUpdateMillis : (java.lang.Long) defaultValue(fields()[10]);
+ record.latestResourceEventOccurredMillis = fieldSetFlags()[11] ? this.latestResourceEventOccurredMillis : (java.lang.Long) defaultValue(fields()[11]);
+ record.billingPeriodOutOfSyncResourceEventsCounter = fieldSetFlags()[12] ? this.billingPeriodOutOfSyncResourceEventsCounter : (java.lang.Long) defaultValue(fields()[12]);
+ record.billingYear = fieldSetFlags()[13] ? this.billingYear : (java.lang.Integer) defaultValue(fields()[13]);
+ record.billingMonth = fieldSetFlags()[14] ? this.billingMonth : (java.lang.Integer) defaultValue(fields()[14]);
+ record.billingMonthDay = fieldSetFlags()[15] ? this.billingMonthDay : (java.lang.Integer) defaultValue(fields()[15]);
+ record.isFullBillingMonth = fieldSetFlags()[16] ? this.isFullBillingMonth : (java.lang.Boolean) defaultValue(fields()[16]);
+ record.walletEntries = fieldSetFlags()[17] ? this.walletEntries : (java.util.List<gr.grnet.aquarium.message.avro.gen.WalletEntryMsg>) defaultValue(fields()[17]);
+ return record;
+ } catch (Exception e) {
+ throw new org.apache.avro.AvroRuntimeException(e);
+ }
+ }
+ }
+}
--- /dev/null
+/**
+ * Autogenerated by Avro
+ *
+ * DO NOT EDIT DIRECTLY
+ */
+package gr.grnet.aquarium.message.avro.gen;
+@SuppressWarnings("all")
+public class WalletEntriesMsg 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\":\"WalletEntriesMsg\",\"namespace\":\"gr.grnet.aquarium.message.avro.gen\",\"fields\":[{\"name\":\"entries\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"WalletEntryMsg\",\"fields\":[{\"name\":\"userID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"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\":\"billingMonthDay\",\"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\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"default\":\"\"},{\"name\":\"creditsToSubtract\",\"type\":\"double\",\"default\":0.0}]}}},{\"name\":\"resourceEvents\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"ResourceEventMsg\",\"fields\":[{\"name\":\"originalID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"inStoreID\",\"type\":[{\"type\":\"string\",\"avro.java.string\":\"String\"},\"null\"]},{\"name\":\"occurredMillis\",\"type\":\"long\"},{\"name\":\"receivedMillis\",\"type\":\"long\",\"default\":0},{\"name\":\"userID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"clientID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"eventVersion\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"default\":\"1.0\"},{\"name\":\"resource\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"instanceID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"value\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"isSynthetic\",\"type\":\"boolean\",\"default\":false},{\"name\":\"details\",\"type\":{\"type\":\"map\",\"values\":{\"type\":\"record\",\"name\":\"AnyValueMsg\",\"fields\":[{\"name\":\"anyValue\",\"type\":[\"null\",\"int\",\"long\",\"boolean\",\"double\",\"bytes\",{\"type\":\"string\",\"avro.java.string\":\"String\"},{\"type\":\"array\",\"items\":\"AnyValueMsg\"},{\"type\":\"map\",\"values\":\"AnyValueMsg\",\"avro.java.string\":\"String\"}]}]},\"avro.java.string\":\"String\"}}]}}},{\"name\":\"resourceType\",\"type\":{\"type\":\"record\",\"name\":\"ResourceTypeMsg\",\"fields\":[{\"name\":\"name\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"unit\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"chargingBehaviorClass\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}}]}},{\"name\":\"isSynthetic\",\"type\":\"boolean\",\"default\":false}]}}}]}");
+ @Deprecated public java.util.List<gr.grnet.aquarium.message.avro.gen.WalletEntryMsg> entries;
+ public org.apache.avro.Schema getSchema() { return SCHEMA$; }
+ // Used by DatumWriter. Applications should not call.
+ public java.lang.Object get(int field$) {
+ switch (field$) {
+ case 0: return entries;
+ default: throw new org.apache.avro.AvroRuntimeException("Bad index");
+ }
+ }
+ // Used by DatumReader. Applications should not call.
+ @SuppressWarnings(value="unchecked")
+ public void put(int field$, java.lang.Object value$) {
+ switch (field$) {
+ case 0: entries = (java.util.List<gr.grnet.aquarium.message.avro.gen.WalletEntryMsg>)value$; break;
+ default: throw new org.apache.avro.AvroRuntimeException("Bad index");
+ }
+ }
+
+ /**
+ * Gets the value of the 'entries' field.
+ */
+ public java.util.List<gr.grnet.aquarium.message.avro.gen.WalletEntryMsg> getEntries() {
+ return entries;
+ }
+
+ /**
+ * Sets the value of the 'entries' field.
+ * @param value the value to set.
+ */
+ public void setEntries(java.util.List<gr.grnet.aquarium.message.avro.gen.WalletEntryMsg> value) {
+ this.entries = value;
+ }
+
+ /** Creates a new WalletEntriesMsg RecordBuilder */
+ public static gr.grnet.aquarium.message.avro.gen.WalletEntriesMsg.Builder newBuilder() {
+ return new gr.grnet.aquarium.message.avro.gen.WalletEntriesMsg.Builder();
+ }
+
+ /** Creates a new WalletEntriesMsg RecordBuilder by copying an existing Builder */
+ public static gr.grnet.aquarium.message.avro.gen.WalletEntriesMsg.Builder newBuilder(gr.grnet.aquarium.message.avro.gen.WalletEntriesMsg.Builder other) {
+ return new gr.grnet.aquarium.message.avro.gen.WalletEntriesMsg.Builder(other);
+ }
+
+ /** Creates a new WalletEntriesMsg RecordBuilder by copying an existing WalletEntriesMsg instance */
+ public static gr.grnet.aquarium.message.avro.gen.WalletEntriesMsg.Builder newBuilder(gr.grnet.aquarium.message.avro.gen.WalletEntriesMsg other) {
+ return new gr.grnet.aquarium.message.avro.gen.WalletEntriesMsg.Builder(other);
+ }
+
+ /**
+ * RecordBuilder for WalletEntriesMsg instances.
+ */
+ public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<WalletEntriesMsg>
+ implements org.apache.avro.data.RecordBuilder<WalletEntriesMsg> {
+
+ private java.util.List<gr.grnet.aquarium.message.avro.gen.WalletEntryMsg> entries;
+
+ /** Creates a new Builder */
+ private Builder() {
+ super(gr.grnet.aquarium.message.avro.gen.WalletEntriesMsg.SCHEMA$);
+ }
+
+ /** Creates a Builder by copying an existing Builder */
+ private Builder(gr.grnet.aquarium.message.avro.gen.WalletEntriesMsg.Builder other) {
+ super(other);
+ }
+
+ /** Creates a Builder by copying an existing WalletEntriesMsg instance */
+ private Builder(gr.grnet.aquarium.message.avro.gen.WalletEntriesMsg other) {
+ super(gr.grnet.aquarium.message.avro.gen.WalletEntriesMsg.SCHEMA$);
+ if (isValidValue(fields()[0], other.entries)) {
+ this.entries = (java.util.List<gr.grnet.aquarium.message.avro.gen.WalletEntryMsg>) data().deepCopy(fields()[0].schema(), other.entries);
+ fieldSetFlags()[0] = true;
+ }
+ }
+
+ /** Gets the value of the 'entries' field */
+ public java.util.List<gr.grnet.aquarium.message.avro.gen.WalletEntryMsg> getEntries() {
+ return entries;
+ }
+
+ /** Sets the value of the 'entries' field */
+ public gr.grnet.aquarium.message.avro.gen.WalletEntriesMsg.Builder setEntries(java.util.List<gr.grnet.aquarium.message.avro.gen.WalletEntryMsg> value) {
+ validate(fields()[0], value);
+ this.entries = value;
+ fieldSetFlags()[0] = true;
+ return this;
+ }
+
+ /** Checks whether the 'entries' field has been set */
+ public boolean hasEntries() {
+ return fieldSetFlags()[0];
+ }
+
+ /** Clears the value of the 'entries' field */
+ public gr.grnet.aquarium.message.avro.gen.WalletEntriesMsg.Builder clearEntries() {
+ entries = null;
+ fieldSetFlags()[0] = false;
+ return this;
+ }
+
+ @Override
+ public WalletEntriesMsg build() {
+ try {
+ WalletEntriesMsg record = new WalletEntriesMsg();
+ record.entries = fieldSetFlags()[0] ? this.entries : (java.util.List<gr.grnet.aquarium.message.avro.gen.WalletEntryMsg>) defaultValue(fields()[0]);
+ return record;
+ } catch (Exception e) {
+ throw new org.apache.avro.AvroRuntimeException(e);
+ }
+ }
+ }
+}
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\":\"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;
+ 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\":{\"type\":\"string\",\"avro.java.string\":\"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\":\"billingMonthDay\",\"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\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"default\":\"\"},{\"name\":\"creditsToSubtract\",\"type\":\"double\",\"default\":0.0}]}}},{\"name\":\"resourceEvents\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"ResourceEventMsg\",\"fields\":[{\"name\":\"originalID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"inStoreID\",\"type\":[{\"type\":\"string\",\"avro.java.string\":\"String\"},\"null\"]},{\"name\":\"occurredMillis\",\"type\":\"long\"},{\"name\":\"receivedMillis\",\"type\":\"long\",\"default\":0},{\"name\":\"userID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"clientID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"eventVersion\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"default\":\"1.0\"},{\"name\":\"resource\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"instanceID\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"value\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"isSynthetic\",\"type\":\"boolean\",\"default\":false},{\"name\":\"details\",\"type\":{\"type\":\"map\",\"values\":{\"type\":\"record\",\"name\":\"AnyValueMsg\",\"fields\":[{\"name\":\"anyValue\",\"type\":[\"null\",\"int\",\"long\",\"boolean\",\"double\",\"bytes\",{\"type\":\"string\",\"avro.java.string\":\"String\"},{\"type\":\"array\",\"items\":\"AnyValueMsg\"},{\"type\":\"map\",\"values\":\"AnyValueMsg\",\"avro.java.string\":\"String\"}]}]},\"avro.java.string\":\"String\"}}]}}},{\"name\":\"resourceType\",\"type\":{\"type\":\"record\",\"name\":\"ResourceTypeMsg\",\"fields\":[{\"name\":\"name\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"unit\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"chargingBehaviorClass\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}}]}},{\"name\":\"isSynthetic\",\"type\":\"boolean\",\"default\":false}]}");
+ @Deprecated public java.lang.String userID;
@Deprecated public double sumOfCreditsToSubtract;
@Deprecated public double oldTotalCredits;
@Deprecated public double newTotalCredits;
@Deprecated public long referenceStopMillis;
@Deprecated public int billingYear;
@Deprecated public int billingMonth;
- @Deprecated public int billingDay;
+ @Deprecated public int billingMonthDay;
@Deprecated public java.util.List<gr.grnet.aquarium.message.avro.gen.ChargeslotMsg> chargeslots;
@Deprecated public java.util.List<gr.grnet.aquarium.message.avro.gen.ResourceEventMsg> resourceEvents;
@Deprecated public gr.grnet.aquarium.message.avro.gen.ResourceTypeMsg resourceType;
case 6: return referenceStopMillis;
case 7: return billingYear;
case 8: return billingMonth;
- case 9: return billingDay;
+ case 9: return billingMonthDay;
case 10: return chargeslots;
case 11: return resourceEvents;
case 12: return resourceType;
@SuppressWarnings(value="unchecked")
public void put(int field$, java.lang.Object value$) {
switch (field$) {
- case 0: userID = (java.lang.CharSequence)value$; break;
+ case 0: userID = (java.lang.String)value$; break;
case 1: sumOfCreditsToSubtract = (java.lang.Double)value$; break;
case 2: oldTotalCredits = (java.lang.Double)value$; break;
case 3: newTotalCredits = (java.lang.Double)value$; break;
case 6: referenceStopMillis = (java.lang.Long)value$; break;
case 7: billingYear = (java.lang.Integer)value$; break;
case 8: billingMonth = (java.lang.Integer)value$; break;
- case 9: billingDay = (java.lang.Integer)value$; break;
+ case 9: billingMonthDay = (java.lang.Integer)value$; break;
case 10: chargeslots = (java.util.List<gr.grnet.aquarium.message.avro.gen.ChargeslotMsg>)value$; break;
case 11: resourceEvents = (java.util.List<gr.grnet.aquarium.message.avro.gen.ResourceEventMsg>)value$; break;
case 12: resourceType = (gr.grnet.aquarium.message.avro.gen.ResourceTypeMsg)value$; break;
/**
* Gets the value of the 'userID' field.
*/
- public java.lang.CharSequence getUserID() {
+ public java.lang.String getUserID() {
return userID;
}
* Sets the value of the 'userID' field.
* @param value the value to set.
*/
- public void setUserID(java.lang.CharSequence value) {
+ public void setUserID(java.lang.String value) {
this.userID = value;
}
}
/**
- * Gets the value of the 'billingDay' field.
+ * Gets the value of the 'billingMonthDay' field.
*/
- public java.lang.Integer getBillingDay() {
- return billingDay;
+ public java.lang.Integer getBillingMonthDay() {
+ return billingMonthDay;
}
/**
- * Sets the value of the 'billingDay' field.
+ * Sets the value of the 'billingMonthDay' field.
* @param value the value to set.
*/
- public void setBillingDay(java.lang.Integer value) {
- this.billingDay = value;
+ public void setBillingMonthDay(java.lang.Integer value) {
+ this.billingMonthDay = value;
}
/**
public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<WalletEntryMsg>
implements org.apache.avro.data.RecordBuilder<WalletEntryMsg> {
- private java.lang.CharSequence userID;
+ private java.lang.String userID;
private double sumOfCreditsToSubtract;
private double oldTotalCredits;
private double newTotalCredits;
private long referenceStopMillis;
private int billingYear;
private int billingMonth;
- private int billingDay;
+ private int billingMonthDay;
private java.util.List<gr.grnet.aquarium.message.avro.gen.ChargeslotMsg> chargeslots;
private java.util.List<gr.grnet.aquarium.message.avro.gen.ResourceEventMsg> resourceEvents;
private gr.grnet.aquarium.message.avro.gen.ResourceTypeMsg resourceType;
private Builder(gr.grnet.aquarium.message.avro.gen.WalletEntryMsg other) {
super(gr.grnet.aquarium.message.avro.gen.WalletEntryMsg.SCHEMA$);
if (isValidValue(fields()[0], other.userID)) {
- this.userID = (java.lang.CharSequence) data().deepCopy(fields()[0].schema(), other.userID);
+ this.userID = (java.lang.String) data().deepCopy(fields()[0].schema(), other.userID);
fieldSetFlags()[0] = true;
}
if (isValidValue(fields()[1], other.sumOfCreditsToSubtract)) {
this.billingMonth = (java.lang.Integer) data().deepCopy(fields()[8].schema(), other.billingMonth);
fieldSetFlags()[8] = true;
}
- if (isValidValue(fields()[9], other.billingDay)) {
- this.billingDay = (java.lang.Integer) data().deepCopy(fields()[9].schema(), other.billingDay);
+ if (isValidValue(fields()[9], other.billingMonthDay)) {
+ this.billingMonthDay = (java.lang.Integer) data().deepCopy(fields()[9].schema(), other.billingMonthDay);
fieldSetFlags()[9] = true;
}
if (isValidValue(fields()[10], other.chargeslots)) {
}
/** Gets the value of the 'userID' field */
- public java.lang.CharSequence getUserID() {
+ public java.lang.String getUserID() {
return userID;
}
/** Sets the value of the 'userID' field */
- public gr.grnet.aquarium.message.avro.gen.WalletEntryMsg.Builder setUserID(java.lang.CharSequence value) {
+ public gr.grnet.aquarium.message.avro.gen.WalletEntryMsg.Builder setUserID(java.lang.String value) {
validate(fields()[0], value);
this.userID = value;
fieldSetFlags()[0] = true;
return this;
}
- /** Gets the value of the 'billingDay' field */
- public java.lang.Integer getBillingDay() {
- return billingDay;
+ /** Gets the value of the 'billingMonthDay' field */
+ public java.lang.Integer getBillingMonthDay() {
+ return billingMonthDay;
}
- /** Sets the value of the 'billingDay' field */
- public gr.grnet.aquarium.message.avro.gen.WalletEntryMsg.Builder setBillingDay(int value) {
+ /** Sets the value of the 'billingMonthDay' field */
+ public gr.grnet.aquarium.message.avro.gen.WalletEntryMsg.Builder setBillingMonthDay(int value) {
validate(fields()[9], value);
- this.billingDay = value;
+ this.billingMonthDay = value;
fieldSetFlags()[9] = true;
return this;
}
- /** Checks whether the 'billingDay' field has been set */
- public boolean hasBillingDay() {
+ /** Checks whether the 'billingMonthDay' field has been set */
+ public boolean hasBillingMonthDay() {
return fieldSetFlags()[9];
}
- /** Clears the value of the 'billingDay' field */
- public gr.grnet.aquarium.message.avro.gen.WalletEntryMsg.Builder clearBillingDay() {
+ /** Clears the value of the 'billingMonthDay' field */
+ public gr.grnet.aquarium.message.avro.gen.WalletEntryMsg.Builder clearBillingMonthDay() {
fieldSetFlags()[9] = false;
return this;
}
public WalletEntryMsg build() {
try {
WalletEntryMsg record = new WalletEntryMsg();
- record.userID = fieldSetFlags()[0] ? this.userID : (java.lang.CharSequence) defaultValue(fields()[0]);
+ record.userID = fieldSetFlags()[0] ? this.userID : (java.lang.String) defaultValue(fields()[0]);
record.sumOfCreditsToSubtract = fieldSetFlags()[1] ? this.sumOfCreditsToSubtract : (java.lang.Double) defaultValue(fields()[1]);
record.oldTotalCredits = fieldSetFlags()[2] ? this.oldTotalCredits : (java.lang.Double) defaultValue(fields()[2]);
record.newTotalCredits = fieldSetFlags()[3] ? this.newTotalCredits : (java.lang.Double) defaultValue(fields()[3]);
record.referenceStopMillis = fieldSetFlags()[6] ? this.referenceStopMillis : (java.lang.Long) defaultValue(fields()[6]);
record.billingYear = fieldSetFlags()[7] ? this.billingYear : (java.lang.Integer) defaultValue(fields()[7]);
record.billingMonth = fieldSetFlags()[8] ? this.billingMonth : (java.lang.Integer) defaultValue(fields()[8]);
- record.billingDay = fieldSetFlags()[9] ? this.billingDay : (java.lang.Integer) defaultValue(fields()[9]);
+ record.billingMonthDay = fieldSetFlags()[9] ? this.billingMonthDay : (java.lang.Integer) defaultValue(fields()[9]);
record.chargeslots = fieldSetFlags()[10] ? this.chargeslots : (java.util.List<gr.grnet.aquarium.message.avro.gen.ChargeslotMsg>) defaultValue(fields()[10]);
record.resourceEvents = fieldSetFlags()[11] ? this.resourceEvents : (java.util.List<gr.grnet.aquarium.message.avro.gen.ResourceEventMsg>) defaultValue(fields()[11]);
record.resourceType = fieldSetFlags()[12] ? this.resourceType : (gr.grnet.aquarium.message.avro.gen.ResourceTypeMsg) defaultValue(fields()[12]);
+++ /dev/null
-/**
- * Autogenerated by Avro
- *
- * DO NOT EDIT DIRECTLY
- */
-package gr.grnet.aquarium.message.avro.gen;
-@SuppressWarnings("all")
-public class WorkingAgreementHistoryMsg 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\":\"WorkingAgreementHistoryMsg\",\"namespace\":\"gr.grnet.aquarium.message.avro.gen\",\"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\"]}]}}}]}");
- @Deprecated public java.util.List<gr.grnet.aquarium.message.avro.gen.UserAgreementMsg> agreements;
- public org.apache.avro.Schema getSchema() { return SCHEMA$; }
- // Used by DatumWriter. Applications should not call.
- public java.lang.Object get(int field$) {
- switch (field$) {
- case 0: return agreements;
- default: throw new org.apache.avro.AvroRuntimeException("Bad index");
- }
- }
- // Used by DatumReader. Applications should not call.
- @SuppressWarnings(value="unchecked")
- public void put(int field$, java.lang.Object value$) {
- switch (field$) {
- case 0: agreements = (java.util.List<gr.grnet.aquarium.message.avro.gen.UserAgreementMsg>)value$; break;
- default: throw new org.apache.avro.AvroRuntimeException("Bad index");
- }
- }
-
- /**
- * Gets the value of the 'agreements' field.
- */
- public java.util.List<gr.grnet.aquarium.message.avro.gen.UserAgreementMsg> getAgreements() {
- return agreements;
- }
-
- /**
- * Sets the value of the 'agreements' field.
- * @param value the value to set.
- */
- public void setAgreements(java.util.List<gr.grnet.aquarium.message.avro.gen.UserAgreementMsg> value) {
- this.agreements = value;
- }
-
- /** Creates a new WorkingAgreementHistoryMsg RecordBuilder */
- public static gr.grnet.aquarium.message.avro.gen.WorkingAgreementHistoryMsg.Builder newBuilder() {
- return new gr.grnet.aquarium.message.avro.gen.WorkingAgreementHistoryMsg.Builder();
- }
-
- /** Creates a new WorkingAgreementHistoryMsg RecordBuilder by copying an existing Builder */
- public static gr.grnet.aquarium.message.avro.gen.WorkingAgreementHistoryMsg.Builder newBuilder(gr.grnet.aquarium.message.avro.gen.WorkingAgreementHistoryMsg.Builder other) {
- return new gr.grnet.aquarium.message.avro.gen.WorkingAgreementHistoryMsg.Builder(other);
- }
-
- /** Creates a new WorkingAgreementHistoryMsg RecordBuilder by copying an existing WorkingAgreementHistoryMsg instance */
- public static gr.grnet.aquarium.message.avro.gen.WorkingAgreementHistoryMsg.Builder newBuilder(gr.grnet.aquarium.message.avro.gen.WorkingAgreementHistoryMsg other) {
- return new gr.grnet.aquarium.message.avro.gen.WorkingAgreementHistoryMsg.Builder(other);
- }
-
- /**
- * RecordBuilder for WorkingAgreementHistoryMsg instances.
- */
- public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<WorkingAgreementHistoryMsg>
- implements org.apache.avro.data.RecordBuilder<WorkingAgreementHistoryMsg> {
-
- private java.util.List<gr.grnet.aquarium.message.avro.gen.UserAgreementMsg> agreements;
-
- /** Creates a new Builder */
- private Builder() {
- super(gr.grnet.aquarium.message.avro.gen.WorkingAgreementHistoryMsg.SCHEMA$);
- }
-
- /** Creates a Builder by copying an existing Builder */
- private Builder(gr.grnet.aquarium.message.avro.gen.WorkingAgreementHistoryMsg.Builder other) {
- super(other);
- }
-
- /** Creates a Builder by copying an existing WorkingAgreementHistoryMsg instance */
- private Builder(gr.grnet.aquarium.message.avro.gen.WorkingAgreementHistoryMsg other) {
- super(gr.grnet.aquarium.message.avro.gen.WorkingAgreementHistoryMsg.SCHEMA$);
- if (isValidValue(fields()[0], other.agreements)) {
- this.agreements = (java.util.List<gr.grnet.aquarium.message.avro.gen.UserAgreementMsg>) data().deepCopy(fields()[0].schema(), other.agreements);
- fieldSetFlags()[0] = true;
- }
- }
-
- /** Gets the value of the 'agreements' field */
- public java.util.List<gr.grnet.aquarium.message.avro.gen.UserAgreementMsg> getAgreements() {
- return agreements;
- }
-
- /** Sets the value of the 'agreements' field */
- public gr.grnet.aquarium.message.avro.gen.WorkingAgreementHistoryMsg.Builder setAgreements(java.util.List<gr.grnet.aquarium.message.avro.gen.UserAgreementMsg> value) {
- validate(fields()[0], value);
- this.agreements = value;
- fieldSetFlags()[0] = true;
- return this;
- }
-
- /** Checks whether the 'agreements' field has been set */
- public boolean hasAgreements() {
- return fieldSetFlags()[0];
- }
-
- /** Clears the value of the 'agreements' field */
- public gr.grnet.aquarium.message.avro.gen.WorkingAgreementHistoryMsg.Builder clearAgreements() {
- agreements = null;
- fieldSetFlags()[0] = false;
- return this;
- }
-
- @Override
- public WorkingAgreementHistoryMsg build() {
- try {
- WorkingAgreementHistoryMsg record = new WorkingAgreementHistoryMsg();
- record.agreements = fieldSetFlags()[0] ? this.agreements : (java.util.List<gr.grnet.aquarium.message.avro.gen.UserAgreementMsg>) defaultValue(fields()[0]);
- return record;
- } catch (Exception e) {
- throw new org.apache.avro.AvroRuntimeException(e);
- }
- }
- }
-}
+++ /dev/null
-/**
- * Autogenerated by Avro
- *
- * DO NOT EDIT DIRECTLY
- */
-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\":\"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;
- @Deprecated public double accumulatingAmount;
- @Deprecated public double oldAccumulatingAmount;
- @Deprecated public double previousValue;
- @Deprecated public double currentValue;
- public org.apache.avro.Schema getSchema() { return SCHEMA$; }
- // Used by DatumWriter. Applications should not call.
- public java.lang.Object get(int field$) {
- switch (field$) {
- case 0: return details;
- case 1: return previousEvents;
- case 2: return implicitlyIssuedStartEvents;
- case 3: return accumulatingAmount;
- case 4: return oldAccumulatingAmount;
- case 5: return previousValue;
- case 6: return currentValue;
- default: throw new org.apache.avro.AvroRuntimeException("Bad index");
- }
- }
- // Used by DatumReader. Applications should not call.
- @SuppressWarnings(value="unchecked")
- public void put(int field$, java.lang.Object value$) {
- switch (field$) {
- case 0: details = (java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.AnyValueMsg>)value$; break;
- case 1: previousEvents = (java.util.List<gr.grnet.aquarium.message.avro.gen.ResourceEventMsg>)value$; break;
- case 2: implicitlyIssuedStartEvents = (java.util.List<gr.grnet.aquarium.message.avro.gen.ResourceEventMsg>)value$; break;
- case 3: accumulatingAmount = (java.lang.Double)value$; break;
- case 4: oldAccumulatingAmount = (java.lang.Double)value$; break;
- case 5: previousValue = (java.lang.Double)value$; break;
- case 6: currentValue = (java.lang.Double)value$; break;
- default: throw new org.apache.avro.AvroRuntimeException("Bad index");
- }
- }
-
- /**
- * Gets the value of the 'details' field.
- */
- public java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.AnyValueMsg> getDetails() {
- return details;
- }
-
- /**
- * Sets the value of the 'details' field.
- * @param value the value to set.
- */
- public void setDetails(java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.AnyValueMsg> value) {
- this.details = value;
- }
-
- /**
- * Gets the value of the 'previousEvents' field.
- */
- public java.util.List<gr.grnet.aquarium.message.avro.gen.ResourceEventMsg> getPreviousEvents() {
- return previousEvents;
- }
-
- /**
- * Sets the value of the 'previousEvents' field.
- * @param value the value to set.
- */
- public void setPreviousEvents(java.util.List<gr.grnet.aquarium.message.avro.gen.ResourceEventMsg> value) {
- this.previousEvents = value;
- }
-
- /**
- * Gets the value of the 'implicitlyIssuedStartEvents' field.
- */
- public java.util.List<gr.grnet.aquarium.message.avro.gen.ResourceEventMsg> getImplicitlyIssuedStartEvents() {
- return implicitlyIssuedStartEvents;
- }
-
- /**
- * Sets the value of the 'implicitlyIssuedStartEvents' field.
- * @param value the value to set.
- */
- public void setImplicitlyIssuedStartEvents(java.util.List<gr.grnet.aquarium.message.avro.gen.ResourceEventMsg> value) {
- this.implicitlyIssuedStartEvents = value;
- }
-
- /**
- * Gets the value of the 'accumulatingAmount' field.
- */
- public java.lang.Double getAccumulatingAmount() {
- return accumulatingAmount;
- }
-
- /**
- * Sets the value of the 'accumulatingAmount' field.
- * @param value the value to set.
- */
- public void setAccumulatingAmount(java.lang.Double value) {
- this.accumulatingAmount = value;
- }
-
- /**
- * Gets the value of the 'oldAccumulatingAmount' field.
- */
- public java.lang.Double getOldAccumulatingAmount() {
- return oldAccumulatingAmount;
- }
-
- /**
- * Sets the value of the 'oldAccumulatingAmount' field.
- * @param value the value to set.
- */
- public void setOldAccumulatingAmount(java.lang.Double value) {
- this.oldAccumulatingAmount = value;
- }
-
- /**
- * Gets the value of the 'previousValue' field.
- */
- public java.lang.Double getPreviousValue() {
- return previousValue;
- }
-
- /**
- * Sets the value of the 'previousValue' field.
- * @param value the value to set.
- */
- public void setPreviousValue(java.lang.Double value) {
- this.previousValue = value;
- }
-
- /**
- * Gets the value of the 'currentValue' field.
- */
- public java.lang.Double getCurrentValue() {
- return currentValue;
- }
-
- /**
- * Sets the value of the 'currentValue' field.
- * @param value the value to set.
- */
- public void setCurrentValue(java.lang.Double value) {
- this.currentValue = value;
- }
-
- /** Creates a new WorkingResourceInstanceChargingStateMsg RecordBuilder */
- public static gr.grnet.aquarium.message.avro.gen.WorkingResourceInstanceChargingStateMsg.Builder newBuilder() {
- return new gr.grnet.aquarium.message.avro.gen.WorkingResourceInstanceChargingStateMsg.Builder();
- }
-
- /** Creates a new WorkingResourceInstanceChargingStateMsg RecordBuilder by copying an existing Builder */
- public static gr.grnet.aquarium.message.avro.gen.WorkingResourceInstanceChargingStateMsg.Builder newBuilder(gr.grnet.aquarium.message.avro.gen.WorkingResourceInstanceChargingStateMsg.Builder other) {
- return new gr.grnet.aquarium.message.avro.gen.WorkingResourceInstanceChargingStateMsg.Builder(other);
- }
-
- /** Creates a new WorkingResourceInstanceChargingStateMsg RecordBuilder by copying an existing WorkingResourceInstanceChargingStateMsg instance */
- public static gr.grnet.aquarium.message.avro.gen.WorkingResourceInstanceChargingStateMsg.Builder newBuilder(gr.grnet.aquarium.message.avro.gen.WorkingResourceInstanceChargingStateMsg other) {
- return new gr.grnet.aquarium.message.avro.gen.WorkingResourceInstanceChargingStateMsg.Builder(other);
- }
-
- /**
- * RecordBuilder for WorkingResourceInstanceChargingStateMsg instances.
- */
- public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<WorkingResourceInstanceChargingStateMsg>
- implements org.apache.avro.data.RecordBuilder<WorkingResourceInstanceChargingStateMsg> {
-
- private java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.AnyValueMsg> details;
- private java.util.List<gr.grnet.aquarium.message.avro.gen.ResourceEventMsg> previousEvents;
- private java.util.List<gr.grnet.aquarium.message.avro.gen.ResourceEventMsg> implicitlyIssuedStartEvents;
- private double accumulatingAmount;
- private double oldAccumulatingAmount;
- private double previousValue;
- private double currentValue;
-
- /** Creates a new Builder */
- private Builder() {
- super(gr.grnet.aquarium.message.avro.gen.WorkingResourceInstanceChargingStateMsg.SCHEMA$);
- }
-
- /** Creates a Builder by copying an existing Builder */
- private Builder(gr.grnet.aquarium.message.avro.gen.WorkingResourceInstanceChargingStateMsg.Builder other) {
- super(other);
- }
-
- /** Creates a Builder by copying an existing WorkingResourceInstanceChargingStateMsg instance */
- private Builder(gr.grnet.aquarium.message.avro.gen.WorkingResourceInstanceChargingStateMsg other) {
- super(gr.grnet.aquarium.message.avro.gen.WorkingResourceInstanceChargingStateMsg.SCHEMA$);
- if (isValidValue(fields()[0], other.details)) {
- this.details = (java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.AnyValueMsg>) data().deepCopy(fields()[0].schema(), other.details);
- fieldSetFlags()[0] = true;
- }
- if (isValidValue(fields()[1], other.previousEvents)) {
- this.previousEvents = (java.util.List<gr.grnet.aquarium.message.avro.gen.ResourceEventMsg>) data().deepCopy(fields()[1].schema(), other.previousEvents);
- fieldSetFlags()[1] = true;
- }
- if (isValidValue(fields()[2], other.implicitlyIssuedStartEvents)) {
- this.implicitlyIssuedStartEvents = (java.util.List<gr.grnet.aquarium.message.avro.gen.ResourceEventMsg>) data().deepCopy(fields()[2].schema(), other.implicitlyIssuedStartEvents);
- fieldSetFlags()[2] = true;
- }
- if (isValidValue(fields()[3], other.accumulatingAmount)) {
- this.accumulatingAmount = (java.lang.Double) data().deepCopy(fields()[3].schema(), other.accumulatingAmount);
- fieldSetFlags()[3] = true;
- }
- if (isValidValue(fields()[4], other.oldAccumulatingAmount)) {
- this.oldAccumulatingAmount = (java.lang.Double) data().deepCopy(fields()[4].schema(), other.oldAccumulatingAmount);
- fieldSetFlags()[4] = true;
- }
- if (isValidValue(fields()[5], other.previousValue)) {
- this.previousValue = (java.lang.Double) data().deepCopy(fields()[5].schema(), other.previousValue);
- fieldSetFlags()[5] = true;
- }
- if (isValidValue(fields()[6], other.currentValue)) {
- this.currentValue = (java.lang.Double) data().deepCopy(fields()[6].schema(), other.currentValue);
- fieldSetFlags()[6] = true;
- }
- }
-
- /** Gets the value of the 'details' field */
- public java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.AnyValueMsg> getDetails() {
- return details;
- }
-
- /** Sets the value of the 'details' field */
- public gr.grnet.aquarium.message.avro.gen.WorkingResourceInstanceChargingStateMsg.Builder setDetails(java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.AnyValueMsg> value) {
- validate(fields()[0], value);
- this.details = value;
- fieldSetFlags()[0] = true;
- return this;
- }
-
- /** Checks whether the 'details' field has been set */
- public boolean hasDetails() {
- return fieldSetFlags()[0];
- }
-
- /** Clears the value of the 'details' field */
- public gr.grnet.aquarium.message.avro.gen.WorkingResourceInstanceChargingStateMsg.Builder clearDetails() {
- details = null;
- fieldSetFlags()[0] = false;
- return this;
- }
-
- /** Gets the value of the 'previousEvents' field */
- public java.util.List<gr.grnet.aquarium.message.avro.gen.ResourceEventMsg> getPreviousEvents() {
- return previousEvents;
- }
-
- /** Sets the value of the 'previousEvents' field */
- public gr.grnet.aquarium.message.avro.gen.WorkingResourceInstanceChargingStateMsg.Builder setPreviousEvents(java.util.List<gr.grnet.aquarium.message.avro.gen.ResourceEventMsg> value) {
- validate(fields()[1], value);
- this.previousEvents = value;
- fieldSetFlags()[1] = true;
- return this;
- }
-
- /** Checks whether the 'previousEvents' field has been set */
- public boolean hasPreviousEvents() {
- return fieldSetFlags()[1];
- }
-
- /** Clears the value of the 'previousEvents' field */
- public gr.grnet.aquarium.message.avro.gen.WorkingResourceInstanceChargingStateMsg.Builder clearPreviousEvents() {
- previousEvents = null;
- fieldSetFlags()[1] = false;
- return this;
- }
-
- /** Gets the value of the 'implicitlyIssuedStartEvents' field */
- public java.util.List<gr.grnet.aquarium.message.avro.gen.ResourceEventMsg> getImplicitlyIssuedStartEvents() {
- return implicitlyIssuedStartEvents;
- }
-
- /** Sets the value of the 'implicitlyIssuedStartEvents' field */
- public gr.grnet.aquarium.message.avro.gen.WorkingResourceInstanceChargingStateMsg.Builder setImplicitlyIssuedStartEvents(java.util.List<gr.grnet.aquarium.message.avro.gen.ResourceEventMsg> value) {
- validate(fields()[2], value);
- this.implicitlyIssuedStartEvents = value;
- fieldSetFlags()[2] = true;
- return this;
- }
-
- /** Checks whether the 'implicitlyIssuedStartEvents' field has been set */
- public boolean hasImplicitlyIssuedStartEvents() {
- return fieldSetFlags()[2];
- }
-
- /** Clears the value of the 'implicitlyIssuedStartEvents' field */
- public gr.grnet.aquarium.message.avro.gen.WorkingResourceInstanceChargingStateMsg.Builder clearImplicitlyIssuedStartEvents() {
- implicitlyIssuedStartEvents = null;
- fieldSetFlags()[2] = false;
- return this;
- }
-
- /** Gets the value of the 'accumulatingAmount' field */
- public java.lang.Double getAccumulatingAmount() {
- return accumulatingAmount;
- }
-
- /** Sets the value of the 'accumulatingAmount' field */
- public gr.grnet.aquarium.message.avro.gen.WorkingResourceInstanceChargingStateMsg.Builder setAccumulatingAmount(double value) {
- validate(fields()[3], value);
- this.accumulatingAmount = value;
- fieldSetFlags()[3] = true;
- return this;
- }
-
- /** Checks whether the 'accumulatingAmount' field has been set */
- public boolean hasAccumulatingAmount() {
- return fieldSetFlags()[3];
- }
-
- /** Clears the value of the 'accumulatingAmount' field */
- public gr.grnet.aquarium.message.avro.gen.WorkingResourceInstanceChargingStateMsg.Builder clearAccumulatingAmount() {
- fieldSetFlags()[3] = false;
- return this;
- }
-
- /** Gets the value of the 'oldAccumulatingAmount' field */
- public java.lang.Double getOldAccumulatingAmount() {
- return oldAccumulatingAmount;
- }
-
- /** Sets the value of the 'oldAccumulatingAmount' field */
- public gr.grnet.aquarium.message.avro.gen.WorkingResourceInstanceChargingStateMsg.Builder setOldAccumulatingAmount(double value) {
- validate(fields()[4], value);
- this.oldAccumulatingAmount = value;
- fieldSetFlags()[4] = true;
- return this;
- }
-
- /** Checks whether the 'oldAccumulatingAmount' field has been set */
- public boolean hasOldAccumulatingAmount() {
- return fieldSetFlags()[4];
- }
-
- /** Clears the value of the 'oldAccumulatingAmount' field */
- public gr.grnet.aquarium.message.avro.gen.WorkingResourceInstanceChargingStateMsg.Builder clearOldAccumulatingAmount() {
- fieldSetFlags()[4] = false;
- return this;
- }
-
- /** Gets the value of the 'previousValue' field */
- public java.lang.Double getPreviousValue() {
- return previousValue;
- }
-
- /** Sets the value of the 'previousValue' field */
- public gr.grnet.aquarium.message.avro.gen.WorkingResourceInstanceChargingStateMsg.Builder setPreviousValue(double value) {
- validate(fields()[5], value);
- this.previousValue = value;
- fieldSetFlags()[5] = true;
- return this;
- }
-
- /** Checks whether the 'previousValue' field has been set */
- public boolean hasPreviousValue() {
- return fieldSetFlags()[5];
- }
-
- /** Clears the value of the 'previousValue' field */
- public gr.grnet.aquarium.message.avro.gen.WorkingResourceInstanceChargingStateMsg.Builder clearPreviousValue() {
- fieldSetFlags()[5] = false;
- return this;
- }
-
- /** Gets the value of the 'currentValue' field */
- public java.lang.Double getCurrentValue() {
- return currentValue;
- }
-
- /** Sets the value of the 'currentValue' field */
- public gr.grnet.aquarium.message.avro.gen.WorkingResourceInstanceChargingStateMsg.Builder setCurrentValue(double value) {
- validate(fields()[6], value);
- this.currentValue = value;
- fieldSetFlags()[6] = true;
- return this;
- }
-
- /** Checks whether the 'currentValue' field has been set */
- public boolean hasCurrentValue() {
- return fieldSetFlags()[6];
- }
-
- /** Clears the value of the 'currentValue' field */
- public gr.grnet.aquarium.message.avro.gen.WorkingResourceInstanceChargingStateMsg.Builder clearCurrentValue() {
- fieldSetFlags()[6] = false;
- return this;
- }
-
- @Override
- public WorkingResourceInstanceChargingStateMsg build() {
- try {
- WorkingResourceInstanceChargingStateMsg record = new WorkingResourceInstanceChargingStateMsg();
- record.details = fieldSetFlags()[0] ? this.details : (java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.AnyValueMsg>) defaultValue(fields()[0]);
- record.previousEvents = fieldSetFlags()[1] ? this.previousEvents : (java.util.List<gr.grnet.aquarium.message.avro.gen.ResourceEventMsg>) defaultValue(fields()[1]);
- record.implicitlyIssuedStartEvents = fieldSetFlags()[2] ? this.implicitlyIssuedStartEvents : (java.util.List<gr.grnet.aquarium.message.avro.gen.ResourceEventMsg>) defaultValue(fields()[2]);
- record.accumulatingAmount = fieldSetFlags()[3] ? this.accumulatingAmount : (java.lang.Double) defaultValue(fields()[3]);
- record.oldAccumulatingAmount = fieldSetFlags()[4] ? this.oldAccumulatingAmount : (java.lang.Double) defaultValue(fields()[4]);
- record.previousValue = fieldSetFlags()[5] ? this.previousValue : (java.lang.Double) defaultValue(fields()[5]);
- record.currentValue = fieldSetFlags()[6] ? this.currentValue : (java.lang.Double) defaultValue(fields()[6]);
- return record;
- } catch (Exception e) {
- throw new org.apache.avro.AvroRuntimeException(e);
- }
- }
- }
-}
+++ /dev/null
-/**
- * Autogenerated by Avro
- *
- * DO NOT EDIT DIRECTLY
- */
-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\":\"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$; }
- // Used by DatumWriter. Applications should not call.
- public java.lang.Object get(int field$) {
- switch (field$) {
- case 0: return details;
- case 1: return stateOfResourceInstance;
- default: throw new org.apache.avro.AvroRuntimeException("Bad index");
- }
- }
- // Used by DatumReader. Applications should not call.
- @SuppressWarnings(value="unchecked")
- public void put(int field$, java.lang.Object value$) {
- switch (field$) {
- case 0: details = (java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.AnyValueMsg>)value$; break;
- case 1: stateOfResourceInstance = (java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.WorkingResourceInstanceChargingStateMsg>)value$; break;
- default: throw new org.apache.avro.AvroRuntimeException("Bad index");
- }
- }
-
- /**
- * Gets the value of the 'details' field.
- */
- public java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.AnyValueMsg> getDetails() {
- return details;
- }
-
- /**
- * Sets the value of the 'details' field.
- * @param value the value to set.
- */
- public void setDetails(java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.AnyValueMsg> value) {
- this.details = value;
- }
-
- /**
- * Gets the value of the 'stateOfResourceInstance' field.
- */
- public java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.WorkingResourceInstanceChargingStateMsg> getStateOfResourceInstance() {
- return stateOfResourceInstance;
- }
-
- /**
- * Sets the value of the 'stateOfResourceInstance' field.
- * @param value the value to set.
- */
- public void setStateOfResourceInstance(java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.WorkingResourceInstanceChargingStateMsg> value) {
- this.stateOfResourceInstance = value;
- }
-
- /** Creates a new WorkingResourcesChargingStateMsg RecordBuilder */
- public static gr.grnet.aquarium.message.avro.gen.WorkingResourcesChargingStateMsg.Builder newBuilder() {
- return new gr.grnet.aquarium.message.avro.gen.WorkingResourcesChargingStateMsg.Builder();
- }
-
- /** Creates a new WorkingResourcesChargingStateMsg RecordBuilder by copying an existing Builder */
- public static gr.grnet.aquarium.message.avro.gen.WorkingResourcesChargingStateMsg.Builder newBuilder(gr.grnet.aquarium.message.avro.gen.WorkingResourcesChargingStateMsg.Builder other) {
- return new gr.grnet.aquarium.message.avro.gen.WorkingResourcesChargingStateMsg.Builder(other);
- }
-
- /** Creates a new WorkingResourcesChargingStateMsg RecordBuilder by copying an existing WorkingResourcesChargingStateMsg instance */
- public static gr.grnet.aquarium.message.avro.gen.WorkingResourcesChargingStateMsg.Builder newBuilder(gr.grnet.aquarium.message.avro.gen.WorkingResourcesChargingStateMsg other) {
- return new gr.grnet.aquarium.message.avro.gen.WorkingResourcesChargingStateMsg.Builder(other);
- }
-
- /**
- * RecordBuilder for WorkingResourcesChargingStateMsg instances.
- */
- public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<WorkingResourcesChargingStateMsg>
- implements org.apache.avro.data.RecordBuilder<WorkingResourcesChargingStateMsg> {
-
- private java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.AnyValueMsg> details;
- private java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.WorkingResourceInstanceChargingStateMsg> stateOfResourceInstance;
-
- /** Creates a new Builder */
- private Builder() {
- super(gr.grnet.aquarium.message.avro.gen.WorkingResourcesChargingStateMsg.SCHEMA$);
- }
-
- /** Creates a Builder by copying an existing Builder */
- private Builder(gr.grnet.aquarium.message.avro.gen.WorkingResourcesChargingStateMsg.Builder other) {
- super(other);
- }
-
- /** Creates a Builder by copying an existing WorkingResourcesChargingStateMsg instance */
- private Builder(gr.grnet.aquarium.message.avro.gen.WorkingResourcesChargingStateMsg other) {
- super(gr.grnet.aquarium.message.avro.gen.WorkingResourcesChargingStateMsg.SCHEMA$);
- if (isValidValue(fields()[0], other.details)) {
- this.details = (java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.AnyValueMsg>) data().deepCopy(fields()[0].schema(), other.details);
- fieldSetFlags()[0] = true;
- }
- if (isValidValue(fields()[1], other.stateOfResourceInstance)) {
- this.stateOfResourceInstance = (java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.WorkingResourceInstanceChargingStateMsg>) data().deepCopy(fields()[1].schema(), other.stateOfResourceInstance);
- fieldSetFlags()[1] = true;
- }
- }
-
- /** Gets the value of the 'details' field */
- public java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.AnyValueMsg> getDetails() {
- return details;
- }
-
- /** Sets the value of the 'details' field */
- public gr.grnet.aquarium.message.avro.gen.WorkingResourcesChargingStateMsg.Builder setDetails(java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.AnyValueMsg> value) {
- validate(fields()[0], value);
- this.details = value;
- fieldSetFlags()[0] = true;
- return this;
- }
-
- /** Checks whether the 'details' field has been set */
- public boolean hasDetails() {
- return fieldSetFlags()[0];
- }
-
- /** Clears the value of the 'details' field */
- public gr.grnet.aquarium.message.avro.gen.WorkingResourcesChargingStateMsg.Builder clearDetails() {
- details = null;
- fieldSetFlags()[0] = false;
- return this;
- }
-
- /** Gets the value of the 'stateOfResourceInstance' field */
- public java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.WorkingResourceInstanceChargingStateMsg> getStateOfResourceInstance() {
- return stateOfResourceInstance;
- }
-
- /** Sets the value of the 'stateOfResourceInstance' field */
- public gr.grnet.aquarium.message.avro.gen.WorkingResourcesChargingStateMsg.Builder setStateOfResourceInstance(java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.WorkingResourceInstanceChargingStateMsg> value) {
- validate(fields()[1], value);
- this.stateOfResourceInstance = value;
- fieldSetFlags()[1] = true;
- return this;
- }
-
- /** Checks whether the 'stateOfResourceInstance' field has been set */
- public boolean hasStateOfResourceInstance() {
- return fieldSetFlags()[1];
- }
-
- /** Clears the value of the 'stateOfResourceInstance' field */
- public gr.grnet.aquarium.message.avro.gen.WorkingResourcesChargingStateMsg.Builder clearStateOfResourceInstance() {
- stateOfResourceInstance = null;
- fieldSetFlags()[1] = false;
- return this;
- }
-
- @Override
- public WorkingResourcesChargingStateMsg build() {
- try {
- WorkingResourcesChargingStateMsg record = new WorkingResourcesChargingStateMsg();
- record.details = fieldSetFlags()[0] ? this.details : (java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.AnyValueMsg>) defaultValue(fields()[0]);
- record.stateOfResourceInstance = fieldSetFlags()[1] ? this.stateOfResourceInstance : (java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.WorkingResourceInstanceChargingStateMsg>) defaultValue(fields()[1]);
- return record;
- } catch (Exception e) {
- throw new org.apache.avro.AvroRuntimeException(e);
- }
- }
- }
-}
+++ /dev/null
-/**
- * Autogenerated by Avro
- *
- * DO NOT EDIT DIRECTLY
- */
-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\":\"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;
- @Deprecated public java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.WorkingResourcesChargingStateMsg> workingStateOfResources;
- @Deprecated public double totalCredits;
- @Deprecated public gr.grnet.aquarium.message.avro.gen.WorkingAgreementHistoryMsg workingAgreementHistory;
- @Deprecated public long latestUpdateMillis;
- @Deprecated public long latestResourceEventOccurredMillis;
- @Deprecated public long billingPeriodOutOfSyncResourceEventsCounter;
- @Deprecated public java.util.List<gr.grnet.aquarium.message.avro.gen.WalletEntryMsg> walletEntries;
- public org.apache.avro.Schema getSchema() { return SCHEMA$; }
- // Used by DatumWriter. Applications should not call.
- public java.lang.Object get(int field$) {
- switch (field$) {
- case 0: return userID;
- case 1: return parentUserStateIDInStore;
- case 2: return resourceTypesMap;
- case 3: return workingStateOfResources;
- case 4: return totalCredits;
- case 5: return workingAgreementHistory;
- case 6: return latestUpdateMillis;
- case 7: return latestResourceEventOccurredMillis;
- case 8: return billingPeriodOutOfSyncResourceEventsCounter;
- case 9: return walletEntries;
- default: throw new org.apache.avro.AvroRuntimeException("Bad index");
- }
- }
- // Used by DatumReader. Applications should not call.
- @SuppressWarnings(value="unchecked")
- public void put(int field$, java.lang.Object value$) {
- switch (field$) {
- case 0: userID = (java.lang.CharSequence)value$; break;
- case 1: parentUserStateIDInStore = (java.lang.CharSequence)value$; break;
- case 2: resourceTypesMap = (java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.ResourceTypeMsg>)value$; break;
- case 3: workingStateOfResources = (java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.WorkingResourcesChargingStateMsg>)value$; break;
- case 4: totalCredits = (java.lang.Double)value$; break;
- case 5: workingAgreementHistory = (gr.grnet.aquarium.message.avro.gen.WorkingAgreementHistoryMsg)value$; break;
- case 6: latestUpdateMillis = (java.lang.Long)value$; break;
- case 7: latestResourceEventOccurredMillis = (java.lang.Long)value$; break;
- case 8: billingPeriodOutOfSyncResourceEventsCounter = (java.lang.Long)value$; break;
- case 9: walletEntries = (java.util.List<gr.grnet.aquarium.message.avro.gen.WalletEntryMsg>)value$; break;
- default: throw new org.apache.avro.AvroRuntimeException("Bad index");
- }
- }
-
- /**
- * Gets the value of the 'userID' field.
- */
- public java.lang.CharSequence getUserID() {
- return userID;
- }
-
- /**
- * Sets the value of the 'userID' field.
- * @param value the value to set.
- */
- public void setUserID(java.lang.CharSequence value) {
- this.userID = value;
- }
-
- /**
- * Gets the value of the 'parentUserStateIDInStore' field.
- */
- public java.lang.CharSequence getParentUserStateIDInStore() {
- return parentUserStateIDInStore;
- }
-
- /**
- * Sets the value of the 'parentUserStateIDInStore' field.
- * @param value the value to set.
- */
- public void setParentUserStateIDInStore(java.lang.CharSequence value) {
- this.parentUserStateIDInStore = value;
- }
-
- /**
- * Gets the value of the 'resourceTypesMap' field.
- */
- public java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.ResourceTypeMsg> getResourceTypesMap() {
- return resourceTypesMap;
- }
-
- /**
- * Sets the value of the 'resourceTypesMap' field.
- * @param value the value to set.
- */
- public void setResourceTypesMap(java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.ResourceTypeMsg> value) {
- this.resourceTypesMap = value;
- }
-
- /**
- * Gets the value of the 'workingStateOfResources' field.
- */
- public java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.WorkingResourcesChargingStateMsg> getWorkingStateOfResources() {
- return workingStateOfResources;
- }
-
- /**
- * Sets the value of the 'workingStateOfResources' field.
- * @param value the value to set.
- */
- public void setWorkingStateOfResources(java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.WorkingResourcesChargingStateMsg> value) {
- this.workingStateOfResources = value;
- }
-
- /**
- * Gets the value of the 'totalCredits' field.
- */
- public java.lang.Double getTotalCredits() {
- return totalCredits;
- }
-
- /**
- * Sets the value of the 'totalCredits' field.
- * @param value the value to set.
- */
- public void setTotalCredits(java.lang.Double value) {
- this.totalCredits = value;
- }
-
- /**
- * Gets the value of the 'workingAgreementHistory' field.
- */
- public gr.grnet.aquarium.message.avro.gen.WorkingAgreementHistoryMsg getWorkingAgreementHistory() {
- return workingAgreementHistory;
- }
-
- /**
- * Sets the value of the 'workingAgreementHistory' field.
- * @param value the value to set.
- */
- public void setWorkingAgreementHistory(gr.grnet.aquarium.message.avro.gen.WorkingAgreementHistoryMsg value) {
- this.workingAgreementHistory = value;
- }
-
- /**
- * Gets the value of the 'latestUpdateMillis' field.
- */
- public java.lang.Long getLatestUpdateMillis() {
- return latestUpdateMillis;
- }
-
- /**
- * Sets the value of the 'latestUpdateMillis' field.
- * @param value the value to set.
- */
- public void setLatestUpdateMillis(java.lang.Long value) {
- this.latestUpdateMillis = value;
- }
-
- /**
- * Gets the value of the 'latestResourceEventOccurredMillis' field.
- */
- public java.lang.Long getLatestResourceEventOccurredMillis() {
- return latestResourceEventOccurredMillis;
- }
-
- /**
- * Sets the value of the 'latestResourceEventOccurredMillis' field.
- * @param value the value to set.
- */
- public void setLatestResourceEventOccurredMillis(java.lang.Long value) {
- this.latestResourceEventOccurredMillis = value;
- }
-
- /**
- * Gets the value of the 'billingPeriodOutOfSyncResourceEventsCounter' field.
- */
- public java.lang.Long getBillingPeriodOutOfSyncResourceEventsCounter() {
- return billingPeriodOutOfSyncResourceEventsCounter;
- }
-
- /**
- * Sets the value of the 'billingPeriodOutOfSyncResourceEventsCounter' field.
- * @param value the value to set.
- */
- public void setBillingPeriodOutOfSyncResourceEventsCounter(java.lang.Long value) {
- this.billingPeriodOutOfSyncResourceEventsCounter = value;
- }
-
- /**
- * Gets the value of the 'walletEntries' field.
- */
- public java.util.List<gr.grnet.aquarium.message.avro.gen.WalletEntryMsg> getWalletEntries() {
- return walletEntries;
- }
-
- /**
- * Sets the value of the 'walletEntries' field.
- * @param value the value to set.
- */
- public void setWalletEntries(java.util.List<gr.grnet.aquarium.message.avro.gen.WalletEntryMsg> value) {
- this.walletEntries = value;
- }
-
- /** Creates a new WorkingUserStateMsg RecordBuilder */
- public static gr.grnet.aquarium.message.avro.gen.WorkingUserStateMsg.Builder newBuilder() {
- return new gr.grnet.aquarium.message.avro.gen.WorkingUserStateMsg.Builder();
- }
-
- /** Creates a new WorkingUserStateMsg RecordBuilder by copying an existing Builder */
- public static gr.grnet.aquarium.message.avro.gen.WorkingUserStateMsg.Builder newBuilder(gr.grnet.aquarium.message.avro.gen.WorkingUserStateMsg.Builder other) {
- return new gr.grnet.aquarium.message.avro.gen.WorkingUserStateMsg.Builder(other);
- }
-
- /** Creates a new WorkingUserStateMsg RecordBuilder by copying an existing WorkingUserStateMsg instance */
- public static gr.grnet.aquarium.message.avro.gen.WorkingUserStateMsg.Builder newBuilder(gr.grnet.aquarium.message.avro.gen.WorkingUserStateMsg other) {
- return new gr.grnet.aquarium.message.avro.gen.WorkingUserStateMsg.Builder(other);
- }
-
- /**
- * RecordBuilder for WorkingUserStateMsg instances.
- */
- public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<WorkingUserStateMsg>
- implements org.apache.avro.data.RecordBuilder<WorkingUserStateMsg> {
-
- private java.lang.CharSequence userID;
- private java.lang.CharSequence parentUserStateIDInStore;
- private java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.ResourceTypeMsg> resourceTypesMap;
- private java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.WorkingResourcesChargingStateMsg> workingStateOfResources;
- private double totalCredits;
- private gr.grnet.aquarium.message.avro.gen.WorkingAgreementHistoryMsg workingAgreementHistory;
- private long latestUpdateMillis;
- private long latestResourceEventOccurredMillis;
- private long billingPeriodOutOfSyncResourceEventsCounter;
- private java.util.List<gr.grnet.aquarium.message.avro.gen.WalletEntryMsg> walletEntries;
-
- /** Creates a new Builder */
- private Builder() {
- super(gr.grnet.aquarium.message.avro.gen.WorkingUserStateMsg.SCHEMA$);
- }
-
- /** Creates a Builder by copying an existing Builder */
- private Builder(gr.grnet.aquarium.message.avro.gen.WorkingUserStateMsg.Builder other) {
- super(other);
- }
-
- /** Creates a Builder by copying an existing WorkingUserStateMsg instance */
- private Builder(gr.grnet.aquarium.message.avro.gen.WorkingUserStateMsg other) {
- super(gr.grnet.aquarium.message.avro.gen.WorkingUserStateMsg.SCHEMA$);
- if (isValidValue(fields()[0], other.userID)) {
- this.userID = (java.lang.CharSequence) data().deepCopy(fields()[0].schema(), other.userID);
- fieldSetFlags()[0] = true;
- }
- if (isValidValue(fields()[1], other.parentUserStateIDInStore)) {
- this.parentUserStateIDInStore = (java.lang.CharSequence) data().deepCopy(fields()[1].schema(), other.parentUserStateIDInStore);
- fieldSetFlags()[1] = true;
- }
- if (isValidValue(fields()[2], other.resourceTypesMap)) {
- this.resourceTypesMap = (java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.ResourceTypeMsg>) data().deepCopy(fields()[2].schema(), other.resourceTypesMap);
- fieldSetFlags()[2] = true;
- }
- if (isValidValue(fields()[3], other.workingStateOfResources)) {
- this.workingStateOfResources = (java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.WorkingResourcesChargingStateMsg>) data().deepCopy(fields()[3].schema(), other.workingStateOfResources);
- fieldSetFlags()[3] = true;
- }
- if (isValidValue(fields()[4], other.totalCredits)) {
- this.totalCredits = (java.lang.Double) data().deepCopy(fields()[4].schema(), other.totalCredits);
- fieldSetFlags()[4] = true;
- }
- if (isValidValue(fields()[5], other.workingAgreementHistory)) {
- this.workingAgreementHistory = (gr.grnet.aquarium.message.avro.gen.WorkingAgreementHistoryMsg) data().deepCopy(fields()[5].schema(), other.workingAgreementHistory);
- fieldSetFlags()[5] = true;
- }
- if (isValidValue(fields()[6], other.latestUpdateMillis)) {
- this.latestUpdateMillis = (java.lang.Long) data().deepCopy(fields()[6].schema(), other.latestUpdateMillis);
- fieldSetFlags()[6] = true;
- }
- if (isValidValue(fields()[7], other.latestResourceEventOccurredMillis)) {
- this.latestResourceEventOccurredMillis = (java.lang.Long) data().deepCopy(fields()[7].schema(), other.latestResourceEventOccurredMillis);
- fieldSetFlags()[7] = true;
- }
- if (isValidValue(fields()[8], other.billingPeriodOutOfSyncResourceEventsCounter)) {
- this.billingPeriodOutOfSyncResourceEventsCounter = (java.lang.Long) data().deepCopy(fields()[8].schema(), other.billingPeriodOutOfSyncResourceEventsCounter);
- fieldSetFlags()[8] = true;
- }
- if (isValidValue(fields()[9], other.walletEntries)) {
- this.walletEntries = (java.util.List<gr.grnet.aquarium.message.avro.gen.WalletEntryMsg>) data().deepCopy(fields()[9].schema(), other.walletEntries);
- fieldSetFlags()[9] = true;
- }
- }
-
- /** Gets the value of the 'userID' field */
- public java.lang.CharSequence getUserID() {
- return userID;
- }
-
- /** Sets the value of the 'userID' field */
- public gr.grnet.aquarium.message.avro.gen.WorkingUserStateMsg.Builder setUserID(java.lang.CharSequence value) {
- validate(fields()[0], value);
- this.userID = value;
- fieldSetFlags()[0] = true;
- return this;
- }
-
- /** Checks whether the 'userID' field has been set */
- public boolean hasUserID() {
- return fieldSetFlags()[0];
- }
-
- /** Clears the value of the 'userID' field */
- public gr.grnet.aquarium.message.avro.gen.WorkingUserStateMsg.Builder clearUserID() {
- userID = null;
- fieldSetFlags()[0] = false;
- return this;
- }
-
- /** Gets the value of the 'parentUserStateIDInStore' field */
- public java.lang.CharSequence getParentUserStateIDInStore() {
- return parentUserStateIDInStore;
- }
-
- /** Sets the value of the 'parentUserStateIDInStore' field */
- public gr.grnet.aquarium.message.avro.gen.WorkingUserStateMsg.Builder setParentUserStateIDInStore(java.lang.CharSequence value) {
- validate(fields()[1], value);
- this.parentUserStateIDInStore = value;
- fieldSetFlags()[1] = true;
- return this;
- }
-
- /** Checks whether the 'parentUserStateIDInStore' field has been set */
- public boolean hasParentUserStateIDInStore() {
- return fieldSetFlags()[1];
- }
-
- /** Clears the value of the 'parentUserStateIDInStore' field */
- public gr.grnet.aquarium.message.avro.gen.WorkingUserStateMsg.Builder clearParentUserStateIDInStore() {
- parentUserStateIDInStore = null;
- fieldSetFlags()[1] = false;
- return this;
- }
-
- /** Gets the value of the 'resourceTypesMap' field */
- public java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.ResourceTypeMsg> getResourceTypesMap() {
- return resourceTypesMap;
- }
-
- /** Sets the value of the 'resourceTypesMap' field */
- public gr.grnet.aquarium.message.avro.gen.WorkingUserStateMsg.Builder setResourceTypesMap(java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.ResourceTypeMsg> value) {
- validate(fields()[2], value);
- this.resourceTypesMap = value;
- fieldSetFlags()[2] = true;
- return this;
- }
-
- /** Checks whether the 'resourceTypesMap' field has been set */
- public boolean hasResourceTypesMap() {
- return fieldSetFlags()[2];
- }
-
- /** Clears the value of the 'resourceTypesMap' field */
- public gr.grnet.aquarium.message.avro.gen.WorkingUserStateMsg.Builder clearResourceTypesMap() {
- resourceTypesMap = null;
- fieldSetFlags()[2] = false;
- return this;
- }
-
- /** Gets the value of the 'workingStateOfResources' field */
- public java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.WorkingResourcesChargingStateMsg> getWorkingStateOfResources() {
- return workingStateOfResources;
- }
-
- /** Sets the value of the 'workingStateOfResources' field */
- public gr.grnet.aquarium.message.avro.gen.WorkingUserStateMsg.Builder setWorkingStateOfResources(java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.WorkingResourcesChargingStateMsg> value) {
- validate(fields()[3], value);
- this.workingStateOfResources = value;
- fieldSetFlags()[3] = true;
- return this;
- }
-
- /** Checks whether the 'workingStateOfResources' field has been set */
- public boolean hasWorkingStateOfResources() {
- return fieldSetFlags()[3];
- }
-
- /** Clears the value of the 'workingStateOfResources' field */
- public gr.grnet.aquarium.message.avro.gen.WorkingUserStateMsg.Builder clearWorkingStateOfResources() {
- workingStateOfResources = null;
- fieldSetFlags()[3] = false;
- return this;
- }
-
- /** Gets the value of the 'totalCredits' field */
- public java.lang.Double getTotalCredits() {
- return totalCredits;
- }
-
- /** Sets the value of the 'totalCredits' field */
- public gr.grnet.aquarium.message.avro.gen.WorkingUserStateMsg.Builder setTotalCredits(double value) {
- validate(fields()[4], value);
- this.totalCredits = value;
- fieldSetFlags()[4] = true;
- return this;
- }
-
- /** Checks whether the 'totalCredits' field has been set */
- public boolean hasTotalCredits() {
- return fieldSetFlags()[4];
- }
-
- /** Clears the value of the 'totalCredits' field */
- public gr.grnet.aquarium.message.avro.gen.WorkingUserStateMsg.Builder clearTotalCredits() {
- fieldSetFlags()[4] = false;
- return this;
- }
-
- /** Gets the value of the 'workingAgreementHistory' field */
- public gr.grnet.aquarium.message.avro.gen.WorkingAgreementHistoryMsg getWorkingAgreementHistory() {
- return workingAgreementHistory;
- }
-
- /** Sets the value of the 'workingAgreementHistory' field */
- public gr.grnet.aquarium.message.avro.gen.WorkingUserStateMsg.Builder setWorkingAgreementHistory(gr.grnet.aquarium.message.avro.gen.WorkingAgreementHistoryMsg value) {
- validate(fields()[5], value);
- this.workingAgreementHistory = value;
- fieldSetFlags()[5] = true;
- return this;
- }
-
- /** Checks whether the 'workingAgreementHistory' field has been set */
- public boolean hasWorkingAgreementHistory() {
- return fieldSetFlags()[5];
- }
-
- /** Clears the value of the 'workingAgreementHistory' field */
- public gr.grnet.aquarium.message.avro.gen.WorkingUserStateMsg.Builder clearWorkingAgreementHistory() {
- workingAgreementHistory = null;
- fieldSetFlags()[5] = false;
- return this;
- }
-
- /** Gets the value of the 'latestUpdateMillis' field */
- public java.lang.Long getLatestUpdateMillis() {
- return latestUpdateMillis;
- }
-
- /** Sets the value of the 'latestUpdateMillis' field */
- public gr.grnet.aquarium.message.avro.gen.WorkingUserStateMsg.Builder setLatestUpdateMillis(long value) {
- validate(fields()[6], value);
- this.latestUpdateMillis = value;
- fieldSetFlags()[6] = true;
- return this;
- }
-
- /** Checks whether the 'latestUpdateMillis' field has been set */
- public boolean hasLatestUpdateMillis() {
- return fieldSetFlags()[6];
- }
-
- /** Clears the value of the 'latestUpdateMillis' field */
- public gr.grnet.aquarium.message.avro.gen.WorkingUserStateMsg.Builder clearLatestUpdateMillis() {
- fieldSetFlags()[6] = false;
- return this;
- }
-
- /** Gets the value of the 'latestResourceEventOccurredMillis' field */
- public java.lang.Long getLatestResourceEventOccurredMillis() {
- return latestResourceEventOccurredMillis;
- }
-
- /** Sets the value of the 'latestResourceEventOccurredMillis' field */
- public gr.grnet.aquarium.message.avro.gen.WorkingUserStateMsg.Builder setLatestResourceEventOccurredMillis(long value) {
- validate(fields()[7], value);
- this.latestResourceEventOccurredMillis = value;
- fieldSetFlags()[7] = true;
- return this;
- }
-
- /** Checks whether the 'latestResourceEventOccurredMillis' field has been set */
- public boolean hasLatestResourceEventOccurredMillis() {
- return fieldSetFlags()[7];
- }
-
- /** Clears the value of the 'latestResourceEventOccurredMillis' field */
- public gr.grnet.aquarium.message.avro.gen.WorkingUserStateMsg.Builder clearLatestResourceEventOccurredMillis() {
- fieldSetFlags()[7] = false;
- return this;
- }
-
- /** Gets the value of the 'billingPeriodOutOfSyncResourceEventsCounter' field */
- public java.lang.Long getBillingPeriodOutOfSyncResourceEventsCounter() {
- return billingPeriodOutOfSyncResourceEventsCounter;
- }
-
- /** Sets the value of the 'billingPeriodOutOfSyncResourceEventsCounter' field */
- public gr.grnet.aquarium.message.avro.gen.WorkingUserStateMsg.Builder setBillingPeriodOutOfSyncResourceEventsCounter(long value) {
- validate(fields()[8], value);
- this.billingPeriodOutOfSyncResourceEventsCounter = value;
- fieldSetFlags()[8] = true;
- return this;
- }
-
- /** Checks whether the 'billingPeriodOutOfSyncResourceEventsCounter' field has been set */
- public boolean hasBillingPeriodOutOfSyncResourceEventsCounter() {
- return fieldSetFlags()[8];
- }
-
- /** Clears the value of the 'billingPeriodOutOfSyncResourceEventsCounter' field */
- public gr.grnet.aquarium.message.avro.gen.WorkingUserStateMsg.Builder clearBillingPeriodOutOfSyncResourceEventsCounter() {
- fieldSetFlags()[8] = false;
- return this;
- }
-
- /** Gets the value of the 'walletEntries' field */
- public java.util.List<gr.grnet.aquarium.message.avro.gen.WalletEntryMsg> getWalletEntries() {
- return walletEntries;
- }
-
- /** Sets the value of the 'walletEntries' field */
- public gr.grnet.aquarium.message.avro.gen.WorkingUserStateMsg.Builder setWalletEntries(java.util.List<gr.grnet.aquarium.message.avro.gen.WalletEntryMsg> value) {
- validate(fields()[9], value);
- this.walletEntries = value;
- fieldSetFlags()[9] = true;
- return this;
- }
-
- /** Checks whether the 'walletEntries' field has been set */
- public boolean hasWalletEntries() {
- return fieldSetFlags()[9];
- }
-
- /** Clears the value of the 'walletEntries' field */
- public gr.grnet.aquarium.message.avro.gen.WorkingUserStateMsg.Builder clearWalletEntries() {
- walletEntries = null;
- fieldSetFlags()[9] = false;
- return this;
- }
-
- @Override
- public WorkingUserStateMsg build() {
- try {
- WorkingUserStateMsg record = new WorkingUserStateMsg();
- record.userID = fieldSetFlags()[0] ? this.userID : (java.lang.CharSequence) defaultValue(fields()[0]);
- record.parentUserStateIDInStore = fieldSetFlags()[1] ? this.parentUserStateIDInStore : (java.lang.CharSequence) defaultValue(fields()[1]);
- record.resourceTypesMap = fieldSetFlags()[2] ? this.resourceTypesMap : (java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.ResourceTypeMsg>) defaultValue(fields()[2]);
- record.workingStateOfResources = fieldSetFlags()[3] ? this.workingStateOfResources : (java.util.Map<java.lang.CharSequence,gr.grnet.aquarium.message.avro.gen.WorkingResourcesChargingStateMsg>) defaultValue(fields()[3]);
- record.totalCredits = fieldSetFlags()[4] ? this.totalCredits : (java.lang.Double) defaultValue(fields()[4]);
- record.workingAgreementHistory = fieldSetFlags()[5] ? this.workingAgreementHistory : (gr.grnet.aquarium.message.avro.gen.WorkingAgreementHistoryMsg) defaultValue(fields()[5]);
- record.latestUpdateMillis = fieldSetFlags()[6] ? this.latestUpdateMillis : (java.lang.Long) defaultValue(fields()[6]);
- record.latestResourceEventOccurredMillis = fieldSetFlags()[7] ? this.latestResourceEventOccurredMillis : (java.lang.Long) defaultValue(fields()[7]);
- record.billingPeriodOutOfSyncResourceEventsCounter = fieldSetFlags()[8] ? this.billingPeriodOutOfSyncResourceEventsCounter : (java.lang.Long) defaultValue(fields()[8]);
- record.walletEntries = fieldSetFlags()[9] ? this.walletEntries : (java.util.List<gr.grnet.aquarium.message.avro.gen.WalletEntryMsg>) defaultValue(fields()[9]);
- return record;
- } catch (Exception e) {
- throw new org.apache.avro.AvroRuntimeException(e);
- }
- }
- }
-}
package gr.grnet.aquarium
+import com.ckkloverdos.convert.Converters
import com.ckkloverdos.env.Env
import com.ckkloverdos.key.{IntKey, StringKey, LongKey, TypedKeySkeleton, TypedKey, BooleanKey}
+import com.ckkloverdos.maybe._
import com.ckkloverdos.props.Props
+import com.ckkloverdos.sys.SysProp
import connector.rabbitmq.RabbitMQProducer
-import gr.grnet.aquarium.store.{PolicyStore, StoreProvider}
-import java.io.File
-import gr.grnet.aquarium.util.{Loggable, Lifecycle}
+import gr.grnet.aquarium.charging.{ChargingService, ChargingBehavior}
+import gr.grnet.aquarium.message.avro.gen.{UserAgreementMsg, FullPriceTableMsg, IMEventMsg, ResourceTypeMsg, PolicyMsg}
+import gr.grnet.aquarium.message.avro.{MessageHelpers, MessageFactory, ModelFactory, AvroHelpers}
+import gr.grnet.aquarium.policy.{AdHocFullPriceTableRef, FullPriceTableModel, PolicyModel, CachingPolicyStore, PolicyDefinedFullPriceTableRef, UserAgreementModel, ResourceType}
+import gr.grnet.aquarium.service.event.AquariumCreatedEvent
import gr.grnet.aquarium.service.{StoreWatcherService, RabbitMQService, TimerService, EventBusService, AkkaService}
-import com.ckkloverdos.convert.Converters
+import gr.grnet.aquarium.store.StoreProvider
+import gr.grnet.aquarium.util.date.TimeHelpers
+import gr.grnet.aquarium.util.{Loggable, Lifecycle}
+import java.io.File
import java.util.concurrent.atomic.AtomicBoolean
import org.slf4j.{LoggerFactory, Logger}
-import com.ckkloverdos.maybe._
-import com.ckkloverdos.sys.SysProp
-import gr.grnet.aquarium.service.event.AquariumCreatedEvent
-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}
+import gr.grnet.aquarium.event.CreditsModel
+import gr.grnet.aquarium.charging.state.UserStateBootstrap
/**
*
*/
final class Aquarium(env: Env) extends Lifecycle with Loggable {
+
import Aquarium.EnvKeys
@volatile private[this] var _chargingBehaviorMap = Map[String, ChargingBehavior]()
}
}
- private[this] lazy val _allServices = Aquarium.ServiceKeys.map(this.apply(_))
+ private[this] lazy val _allServices: Seq[_ <: Lifecycle] = Aquarium.ServiceKeys.map(this.apply(_))
private[this] def startServices(): Unit = {
for(service ← _allServices) {
ModelFactory.newPolicyModel(policyMsg).resourceTypesMap
}
- def unsafeValidPolicyAt(referenceTimeMillis: Long): PolicyModel = {
+ def unsafeValidPolicyModelAt(referenceTimeMillis: Long): PolicyModel = {
policyStore.loadPolicyAt(referenceTimeMillis) match {
case None ⇒
throw new AquariumInternalError(
}
}
- def unsafePriceTableForRoleAt(role: String, referenceTimeMillis: Long): FullPriceTable = {
- val policyAtReferenceTime = unsafeValidPolicyAt(referenceTimeMillis)
- policyAtReferenceTime.roleMapping.get(role) match {
+ def unsafeValidPolicyAt(referenceTimeMillis: Long): PolicyMsg = {
+ unsafeValidPolicyModelAt(referenceTimeMillis).msg
+ }
+
+ def unsafeFullPriceTableModelForRoleAt(role: String, referenceTimeMillis: Long): FullPriceTableModel = {
+ val policyModelAtReferenceTime = unsafeValidPolicyModelAt(referenceTimeMillis)
+
+ policyModelAtReferenceTime.roleMapping.get(role) match {
case None ⇒
throw new AquariumInternalError("Unknown price table for role %s at %s".format(
role,
}
}
+ def unsafeFullPriceTableForRoleAt(role: String, referenceTimeMillis: Long): FullPriceTableMsg = {
+ val policyAtReferenceTime = unsafeValidPolicyAt(referenceTimeMillis)
+ policyAtReferenceTime.getRoleMapping.get(role) match {
+ case null ⇒
+ throw new AquariumInternalError("Unknown price table for role %s at %s".format(
+ role,
+ TimeHelpers.toYYYYMMDDHHMMSSSSS(referenceTimeMillis)
+ ))
+
+ case fullPriceTable ⇒
+ fullPriceTable
+ }
+ }
+
+ def unsafeFullPriceTableModelForAgreement(
+ userAgreementModel: UserAgreementModel,
+ knownPolicyModel: PolicyModel
+ ): FullPriceTableModel = {
+ val policyModel = knownPolicyModel match {
+ case null ⇒
+ unsafeValidPolicyModelAt(userAgreementModel.validFromMillis)
+
+ case policyModel ⇒
+ policyModel
+ }
+
+ userAgreementModel.fullPriceTableRef match {
+ case PolicyDefinedFullPriceTableRef ⇒
+ val role = userAgreementModel.role
+ policyModel.roleMapping.get(role) match {
+ case None ⇒
+ throw new AquariumInternalError("Unknown role %s while computing full price table for user %s at %s",
+ role,
+ userAgreementModel.userID,
+ TimeHelpers.toYYYYMMDDHHMMSSSSS(userAgreementModel.validFromMillis)
+ )
+
+ case Some(fullPriceTable) ⇒
+ fullPriceTable
+ }
+
+ case AdHocFullPriceTableRef(fullPriceTable) ⇒
+ fullPriceTable
+ }
+ }
+
+ def unsafeFullPriceTableForAgreement(
+ userAgreement: UserAgreementMsg,
+ knownPolicyModel: PolicyModel
+ ): FullPriceTableMsg = {
+
+ val policyModel = knownPolicyModel match {
+ case null ⇒
+ unsafeValidPolicyModelAt(userAgreement.getValidFromMillis)
+
+ case policyModel ⇒
+ policyModel
+ }
+
+ unsafeFullPriceTableForAgreement(userAgreement, policyModel.msg)
+ }
+
+ def unsafeFullPriceTableForAgreement(
+ userAgreement: UserAgreementMsg,
+ knownPolicy: PolicyMsg
+ ): FullPriceTableMsg = {
+ val policy = knownPolicy match {
+ case null ⇒
+ unsafeValidPolicyAt(userAgreement.getValidFromMillis)
+
+ case policy ⇒
+ policy
+ }
+
+ val role = userAgreement.getRole
+ userAgreement.getFullPriceTableRef match {
+ case null ⇒
+ policy.getRoleMapping.get(role) match {
+ case null ⇒
+ throw new AquariumInternalError("Unknown role %s while computing full price table for user %s at %s",
+ role,
+ userAgreement.getUserID,
+ TimeHelpers.toYYYYMMDDHHMMSSSSS(userAgreement.getValidFromMillis)
+ )
+
+ case fullPriceTable ⇒
+ fullPriceTable
+ }
+
+ case fullPriceTable ⇒
+ fullPriceTable
+ }
+ }
+
/**
* Computes the initial user agreement for the given role and reference time. Also,
* records the ID from a potential related IMEvent.
*
- * @param role The role in the agreement
- * @param referenceTimeMillis The reference time to consider for the agreement
+ * @param imEvent The IMEvent that creates the user
*/
- def initialUserAgreement(
- role: String,
- referenceTimeMillis: Long,
- relatedIMEventID: Option[String]
- ): UserAgreementModel = {
+ def initialUserAgreement(imEvent: IMEventMsg): UserAgreementModel = {
+ require(MessageHelpers.isIMEventCreate(imEvent))
+
+ val role = imEvent.getRole
+ val referenceTimeMillis = imEvent.getOccurredMillis
// Just checking
- assert(null ne unsafePriceTableForRoleAt(role, referenceTimeMillis))
-
- StdUserAgreement(
- "<StandardUserAgreement>",
- relatedIMEventID,
- 0,
- Long.MaxValue,
- role,
- PolicyDefinedFullPriceTableRef()
- )
+ assert(null ne unsafeFullPriceTableModelForRoleAt(role, referenceTimeMillis))
+
+ ModelFactory.newUserAgreementModelFromIMEvent(imEvent)
}
- def initialUserBalance(role: String, referenceTimeMillis: Long): Double = {
+ def initialUserBalance(role: String, referenceTimeMillis: Long): CreditsModel.Type = {
// FIXME: Where is the mapping?
- 0.0
+ CreditsModel.from(0.0)
+ }
+
+ def getUserStateBootstrap(imEvent: IMEventMsg): UserStateBootstrap = {
+ UserStateBootstrap(
+ this.initialUserAgreement(imEvent),
+ this.initialUserBalance(imEvent.getRole, imEvent.getOccurredMillis)
+ )
}
- def chargingBehaviorOf(resourceType: ResourceType): ChargingBehavior = {
+ def chargingBehaviorOf(resourceType: ResourceTypeMsg): ChargingBehavior = {
// A resource type never changes charging behavior. By definition.
- val className = resourceType.chargingBehavior
+ val className = resourceType.getChargingBehaviorClass
_chargingBehaviorMap.get(className) match {
case Some(chargingBehavior) ⇒
chargingBehavior
+++ /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
-
-/**
- * Timely snapshots of parts.
- *
- * We are interested only on the time aspect here, the parts part is left open to the implementors.
- *
- * @author Christos KK Loverdos <loverdos@gmail.com>
- */
-trait DataSnapshot {
- /**
- * The unix time (millis) when the parts was actually calculated/obtained.
- */
- def snapshotTime: Long
-}
\ No newline at end of file
package gr.grnet.aquarium
+import com.ckkloverdos.convert.Converters
+import com.ckkloverdos.maybe.Failed
+import com.ckkloverdos.maybe.Just
import com.ckkloverdos.maybe.{Maybe, NoVal}
-import com.ckkloverdos.sys.{SysEnv, SysProp}
-import java.io.File
-
-import gr.grnet.aquarium.util.justForSure
-import com.ckkloverdos.resource.{FileStreamResource, StreamResource, CompositeStreamResourceContext, ClassLoaderStreamResourceContext, FileStreamResourceContext}
import com.ckkloverdos.props.Props
-import com.ckkloverdos.maybe.Just
-import com.ckkloverdos.maybe.Failed
-import com.ckkloverdos.convert.Converters
-import gr.grnet.aquarium.converter.{JsonTextFormat, StdConverters}
-import gr.grnet.aquarium.policy.StdPolicy
+import com.ckkloverdos.resource.{FileStreamResource, StreamResource, CompositeStreamResourceContext, ClassLoaderStreamResourceContext, FileStreamResourceContext}
+import com.ckkloverdos.sys.{SysEnv, SysProp}
import gr.grnet.aquarium.message.avro.AvroHelpers
import gr.grnet.aquarium.message.avro.gen.PolicyMsg
+import gr.grnet.aquarium.util.justForSure
+import java.io.File
+
/**
* Locates resources.
}
}
-
def getResource(what: String): Maybe[StreamResource] = {
ResourceContexts.MasterResourceContext.getResource(what)
}
package gr.grnet.aquarium.actor
import service.user.UserActor
-import gr.grnet.aquarium.actor.message.event.{ProcessIMEvent, ProcessResourceEvent}
import message.{GetUserBillRequest, GetUserWalletRequest, GetUserStateRequest, GetUserBalanceRequest}
import gr.grnet.aquarium.actor.message.config.{InitializeUserActorState, AquariumPropertiesLoaded, ActorConfigurationMessage}
+import gr.grnet.aquarium.message.avro.gen.{IMEventMsg, ResourceEventMsg}
/**
* Each actor within Aquarium plays one role.
extends ActorRole("UserActorRole",
false,
classOf[UserActor],
- Set(classOf[ProcessResourceEvent],
- classOf[ProcessIMEvent],
+ Set(classOf[ResourceEventMsg],
+ classOf[IMEventMsg],
classOf[GetUserWalletRequest],
classOf[GetUserBalanceRequest],
classOf[GetUserBillRequest],
package gr.grnet.aquarium.actor.message
import gr.grnet.aquarium.AquariumInternalError
-import gr.grnet.aquarium.charging.state.WorkingUserState
+import gr.grnet.aquarium.message.avro.gen.UserStateMsg
/**
*
*/
case class GetUserStateResponse(
- state: Either[String, WorkingUserState],
+ state: Either[String, UserStateMsg],
override val suggestedHTTPStatus: Int = 200)
extends UserActorResponseMessage(state, suggestedHTTPStatus) {
def userID = state match {
throw new AquariumInternalError("Could not obtain userID. %s".format(error))
case Right(data) ⇒
- data.userID
+ data.getUserID
}
}
package gr.grnet.aquarium.actor.message
import gr.grnet.aquarium.AquariumInternalError
-import gr.grnet.aquarium.charging.wallet.WalletEntry
+import gr.grnet.aquarium.message.avro.gen.WalletEntriesMsg
/**
*
}
}
-case class GetUserWalletResponseData(userID: String, credits: Double, walletEntries: List[WalletEntry])
\ No newline at end of file
+case class GetUserWalletResponseData(userID: String, credits: Double, walletEntries: WalletEntriesMsg)
\ No newline at end of file
+++ /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.actor.message.event
-
-import gr.grnet.aquarium.actor.message.{UserActorRequestMessage, ActorMessage}
-import gr.grnet.aquarium.event.model.im.IMEventModel
-
-/**
- * A message that triggers the user event processing pipeline.
- *
- * Note that the prefix `Process` means that no reply is created or needed.
- *
- * @author Christos KK Loverdos <loverdos@gmail.com>
- */
-
-case class ProcessIMEvent(imEvent: IMEventModel) extends ActorMessage with UserActorRequestMessage {
- def userID = imEvent.userID
-
- def referenceTimeMillis = imEvent.occurredMillis
-}
+++ /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.actor.message.event
-
-import gr.grnet.aquarium.actor.message.{UserActorRequestMessage, ActorMessage}
-import gr.grnet.aquarium.event.model.resource.ResourceEventModel
-
-/**
- * A message that triggers the resource event processing pipeline.
- *
- * Note that the prefix `Process` means that no reply is created or needed.
- *
- * @author Christos KK Loverdos <loverdos@gmail.com>
- */
-case class ProcessResourceEvent(rcEvent: ResourceEventModel) extends ActorMessage with UserActorRequestMessage {
- def userID = rcEvent.userID
-
- def referenceTimeMillis = rcEvent.occurredMillis
-}
package service
package user
-import gr.grnet.aquarium.util.date.TimeHelpers
-import gr.grnet.aquarium.service.event.BalanceEvent
-import gr.grnet.aquarium.event.model.im.IMEventModel
-import gr.grnet.aquarium.actor.message.config.AquariumPropertiesLoaded
-import gr.grnet.aquarium.actor.message.config.InitializeUserActorState
-import gr.grnet.aquarium.actor.message.event.ProcessIMEvent
-import gr.grnet.aquarium.actor.message.event.ProcessResourceEvent
-import gr.grnet.aquarium.util.{LogHelpers, shortClassNameOf}
import gr.grnet.aquarium.AquariumInternalError
-import gr.grnet.aquarium.computation.BillingMonthInfo
-import gr.grnet.aquarium.charging.state.{WorkingUserState, UserStateModel}
-import gr.grnet.aquarium.policy.PolicyDefinedFullPriceTableRef
-import gr.grnet.aquarium.event.model.resource.{StdResourceEvent, ResourceEventModel}
import gr.grnet.aquarium.actor.message.GetUserBalanceRequest
import gr.grnet.aquarium.actor.message.GetUserBalanceResponse
import gr.grnet.aquarium.actor.message.GetUserBalanceResponseData
+import gr.grnet.aquarium.actor.message.GetUserBillRequest
+import gr.grnet.aquarium.actor.message.GetUserBillResponse
+import gr.grnet.aquarium.actor.message.GetUserBillResponseData
import gr.grnet.aquarium.actor.message.GetUserStateRequest
import gr.grnet.aquarium.actor.message.GetUserStateResponse
import gr.grnet.aquarium.actor.message.GetUserWalletRequest
import gr.grnet.aquarium.actor.message.GetUserWalletResponse
import gr.grnet.aquarium.actor.message.GetUserWalletResponseData
-import gr.grnet.aquarium.actor.message.GetUserBillRequest
-import gr.grnet.aquarium.actor.message.GetUserBillResponse
-import gr.grnet.aquarium.actor.message.GetUserBillResponseData
-import gr.grnet.aquarium.charging.state.WorkingAgreementHistory
-import gr.grnet.aquarium.policy.StdUserAgreement
-import gr.grnet.aquarium.charging.state.UserStateBootstrap
-import gr.grnet.aquarium.charging.bill.{AbstractBillEntry, BillEntry}
+import gr.grnet.aquarium.actor.message.config.AquariumPropertiesLoaded
+import gr.grnet.aquarium.actor.message.config.InitializeUserActorState
+import gr.grnet.aquarium.charging.bill.AbstractBillEntry
+import gr.grnet.aquarium.charging.state.{UserStateModel, UserAgreementHistoryModel, UserStateBootstrap}
+import gr.grnet.aquarium.computation.BillingMonthInfo
+import gr.grnet.aquarium.message.avro.gen.{IMEventMsg, ResourceEventMsg, UserStateMsg}
+import gr.grnet.aquarium.message.avro.{ModelFactory, MessageFactory, MessageHelpers, AvroHelpers}
+import gr.grnet.aquarium.service.event.BalanceEvent
+import gr.grnet.aquarium.util.date.TimeHelpers
+import gr.grnet.aquarium.util.{LogHelpers, shortClassNameOf}
/**
*
class UserActor extends ReflectiveRoleableActor {
private[this] var _userID: String = "<?>"
- private[this] var _workingUserState: WorkingUserState = _
- private[this] var _userCreationIMEvent: IMEventModel = _
- private[this] val _workingAgreementHistory: WorkingAgreementHistory = new WorkingAgreementHistory
- private[this] var _latestIMEventID: String = ""
- private[this] var _latestResourceEventID: String = ""
+ private[this] var _userState: UserStateModel = _
+ private[this] var _userCreationIMEvent: IMEventMsg = _
+ private[this] var _userAgreementHistoryModel: UserAgreementHistoryModel = _
+ private[this] var _latestIMEventOriginalID: String = ""
+ private[this] var _latestResourceEventOriginalID: String = ""
private[this] var _userStateBootstrap: UserStateBootstrap = _
def unsafeUserID = {
private[this] def chargingService = aquarium.chargingService
- private[this] def stdUserStateStoreFunc = (userState: UserStateModel) ⇒ {
+ private[this] def stdUserStateStoreFunc = (userState: UserStateMsg) ⇒ {
aquarium.userStateStore.insertUserState(userState)
}
}
@inline private[this] def haveAgreements = {
- this._workingAgreementHistory.size > 0
+ this._userAgreementHistoryModel.size > 0
}
@inline private[this] def haveWorkingUserState = {
- this._workingUserState ne null
+ this._userState ne null
}
@inline private[this] def haveUserStateBootstrap = {
this._userStateBootstrap ne null
}
- private[this] def updateAgreementHistoryFrom(imEvent: IMEventModel): Unit = {
- if(imEvent.isCreateUser) {
+ private[this] def updateAgreementHistoryFrom(imEvent: IMEventMsg): Unit = {
+ val isCreateUser = MessageHelpers.isIMEventCreate(imEvent)
+ if(isCreateUser) {
if(haveUserCreationIMEvent) {
throw new AquariumInternalError(
"Got user creation event (id=%s) but I already have one (id=%s)",
- this._userCreationIMEvent.id,
- imEvent.id
+ this._userCreationIMEvent.getOriginalID,
+ imEvent.getOriginalID
)
}
this._userCreationIMEvent = imEvent
}
- val effectiveFromMillis = imEvent.occurredMillis
- val role = imEvent.role
+ val effectiveFromMillis = imEvent.getOccurredMillis
+ val role = imEvent.getRole
// calling unsafe just for the side-effect
- assert(null ne aquarium.unsafePriceTableForRoleAt(role, effectiveFromMillis))
-
- val newAgreement = StdUserAgreement(
- imEvent.id,
- Some(imEvent.id),
- effectiveFromMillis,
- Long.MaxValue,
- role,
- PolicyDefinedFullPriceTableRef()
- )
+ assert(null ne aquarium.unsafeFullPriceTableForRoleAt(role, effectiveFromMillis))
+
+ val newUserAgreementModel = ModelFactory.newUserAgreementModelFromIMEvent(imEvent, imEvent.getOriginalID)
- this._workingAgreementHistory += newAgreement
+ // add to model (will update the underlying messages as well)
+ this._userAgreementHistoryModel += newUserAgreementModel
}
- private[this] def updateLatestIMEventIDFrom(imEvent: IMEventModel): Unit = {
- this._latestIMEventID = imEvent.id
+ private[this] def updateLatestIMEventIDFrom(imEvent: IMEventMsg): Unit = {
+ this._latestIMEventOriginalID = imEvent.getOriginalID
}
- private[this] def updateLatestResourceEventIDFrom(rcEvent: ResourceEventModel): Unit = {
- this._latestResourceEventID = rcEvent.id
+ private[this] def updateLatestResourceEventIDFrom(rcEvent: ResourceEventMsg): Unit = {
+ this._latestResourceEventOriginalID = rcEvent.getOriginalID
}
/**
}
if(haveAgreements) {
- DEBUG("Initial agreement history %s", this._workingAgreementHistory.toJsonString)
+ DEBUG("Initial agreement history %s", this._userAgreementHistoryModel.toJsonString)
logSeparator()
}
}
assert(this.haveAgreements, "this.haveAgreements")
assert(this.haveUserCreationIMEvent, "this.haveUserCreationIMEvent")
- val userCreationMillis = this._userCreationIMEvent.occurredMillis
- val userCreationRole = this._userCreationIMEvent.role // initial role
- val userCreationIMEventID = this._userCreationIMEvent.id
-
if(!haveUserStateBootstrap) {
- this._userStateBootstrap = UserStateBootstrap(
- this._userID,
- userCreationMillis,
- aquarium.initialUserAgreement(userCreationRole, userCreationMillis, Some(userCreationIMEventID)),
- aquarium.initialUserBalance(userCreationRole, userCreationMillis)
- )
+ this._userStateBootstrap = aquarium.getUserStateBootstrap(this._userCreationIMEvent)
}
val now = TimeHelpers.nowMillis()
- this._workingUserState = chargingService.replayMonthChargingUpTo(
+ this._userState = chargingService.replayMonthChargingUpTo(
BillingMonthInfo.fromMillis(now),
now,
this._userStateBootstrap,
// The assumption is that all agreement changes go via IMEvents, so the
// state this._workingAgreementHistory is always the authoritative source.
if(haveWorkingUserState) {
- this._workingUserState.workingAgreementHistory.setFrom(this._workingAgreementHistory)
- DEBUG("Computed working user state %s", this._workingUserState.toJsonString)
+ this._userState.userAgreementHistoryModel = this._userAgreementHistoryModel
+ DEBUG("Computed working user state %s", AvroHelpers.jsonStringOfSpecificRecord(this._userState.msg))
}
}
loadWorkingUserStateAndUpdateAgreementHistory()
if(haveWorkingUserState) {
- DEBUG("Initial working user state %s", this._workingUserState.toJsonString)
+ DEBUG("Initial working user state %s", AvroHelpers.jsonStringOfSpecificRecord(this._userState.msg))
logSeparator()
}
}
}
/**
- * Process [[gr.grnet.aquarium.event.model.im.IMEventModel]]s.
+ * Process [[gr.grnet.aquarium.message.avro.gen.IMEventMsg]]s.
* When this method is called, we assume that all proper checks have been made and it
* is OK to proceed with the event processing.
*/
- def onProcessIMEvent(processEvent: ProcessIMEvent): Unit = {
- val imEvent = processEvent.imEvent
+ def onIMEventMsg(imEvent: IMEventMsg): Unit = {
val hadUserCreationIMEvent = haveUserCreationIMEvent
if(!haveAgreements) {
// This IMEvent has arrived after any ResourceEvents
- INFO("Arrived after any ResourceEvent: %s", imEvent.toDebugString)
+ INFO("Arrived after any ResourceEvent: %s", AvroHelpers.jsonStringOfSpecificRecord(imEvent))
initializeStateOfIMEvents()
}
else {
- if(this._latestIMEventID == imEvent.id) {
+ if(this._latestIMEventOriginalID == imEvent.getOriginalID) {
// This happens when the actor is brought to life, then immediately initialized, and then
// sent the first IM event. But from the initialization procedure, this IM event will have
// already been loaded from DB!
- INFO("Ignoring first %s", imEvent.toDebugString)
+ INFO("Ignoring first %s", AvroHelpers.jsonStringOfSpecificRecord(imEvent))
logSeparator()
//this._latestIMEventID = imEvent.id
return
}
- if(imEvent.isAddCredits) {
- if(!hadUserCreationIMEvent && haveUserCreationIMEvent)
- loadWorkingUserStateAndUpdateAgreementHistory()
- onHandleAddCreditsEvent(imEvent)
- } else {
updateAgreementHistoryFrom(imEvent)
updateLatestIMEventIDFrom(imEvent)
- //Thread.sleep(3000)
- }
}
// Must also update user state if we know when in history the life of a user begins
logSeparator()
}
- /* Convert astakos message for adding credits
- to a regular RESOURCE message */
- def onHandleAddCreditsEvent(imEvent : IMEventModel) = {
- DEBUG("Got %s", imEvent.toJsonString)
-
- val credits = imEvent.details(IMEventModel.DetailsNames.credits).toInt.toDouble
- val event = new StdResourceEvent(
- imEvent.id,
- imEvent.occurredMillis,
- imEvent.receivedMillis,
- imEvent.userID,
- imEvent.clientID,
- imEvent.eventType,
- imEvent.eventType,
- credits,
- imEvent.eventVersion,
- imEvent.details
- )
- DEBUG("Transformed to %s", event)
- DEBUG("Total credits before: %s", _workingUserState.totalCredits)
- aquarium.resourceEventStore.insertResourceEvent(event)
- onProcessResourceEvent(new ProcessResourceEvent(event))
- DEBUG("Total credits after: %s", _workingUserState.totalCredits)
- //Console.err.println("OK.")
- }
-
- def onProcessResourceEvent(event: ProcessResourceEvent): Unit = {
- val rcEvent = event.rcEvent
-
+ def onResourceEventMsg(rcEvent: ResourceEventMsg): Unit = {
if(!shouldProcessResourceEvents) {
// This means the user has not been created (at least, as far as Aquarium is concerned).
// So, we do not process any resource event
- DEBUG("Not processing %s", rcEvent.toJsonString)
+ DEBUG("Not processing %s", AvroHelpers.jsonStringOfSpecificRecord(rcEvent))
logSeparator()
return
// we do not need to query the store. Just query the in-memory state.
// Note: This is a similar situation with the first IMEvent received right after the user
// actor is created.
- if(this._latestResourceEventID == rcEvent.id) {
- INFO("Ignoring first %s", rcEvent.toDebugString)
+ if(this._latestResourceEventOriginalID == rcEvent.getOriginalID) {
+ INFO("Ignoring first %s", AvroHelpers.jsonStringOfSpecificRecord(rcEvent))
logSeparator()
return
val nowYear = nowBillingMonthInfo.year
val nowMonth = nowBillingMonthInfo.month
- val eventOccurredMillis = rcEvent.occurredMillis
+ val eventOccurredMillis = rcEvent.getOccurredMillis
val eventBillingMonthInfo = BillingMonthInfo.fromMillis(eventOccurredMillis)
val eventYear = eventBillingMonthInfo.year
val eventMonth = eventBillingMonthInfo.month
def computeBatch(): Unit = {
DEBUG("Going for out of sync charging")
- this._workingUserState = chargingService.replayMonthChargingUpTo(
+ this._userState = chargingService.replayMonthChargingUpTo(
nowBillingMonthInfo,
// Take into account that the event may be out-of-sync.
// TODO: Should we use this._latestResourceEventOccurredMillis instead of now?
DEBUG("Going for in sync charging")
chargingService.processResourceEvent(
rcEvent,
- this._workingUserState,
+ this._userState,
nowBillingMonthInfo,
true
)
}
val oldTotalCredits =
- if(this._workingUserState!=null)
- this._workingUserState.totalCredits
+ if(this._userState!=null)
+ this._userState.totalCredits
else
0.0D
// FIXME check these
)
computeBatch()
}
- else if(this._workingUserState.latestResourceEventOccurredMillis < rcEvent.occurredMillis) {
+ else if(this._userState.latestResourceEventOccurredMillis < rcEvent.getOccurredMillis) {
DEBUG("this._workingUserState.latestResourceEventOccurredMillis < rcEvent.occurredMillis")
DEBUG(
"%s < %s",
- TimeHelpers.toYYYYMMDDHHMMSSSSS(this._workingUserState.latestResourceEventOccurredMillis),
- TimeHelpers.toYYYYMMDDHHMMSSSSS(rcEvent.occurredMillis)
+ TimeHelpers.toYYYYMMDDHHMMSSSSS(this._userState.latestResourceEventOccurredMillis),
+ TimeHelpers.toYYYYMMDDHHMMSSSSS(rcEvent.getOccurredMillis)
)
computeRealtime()
}
else {
computeBatch()
}
- val newTotalCredits = this._workingUserState.totalCredits
+ val newTotalCredits = this._userState.totalCredits
if(oldTotalCredits * newTotalCredits < 0)
- aquarium.eventBus ! new BalanceEvent(this._workingUserState.userID,
+ aquarium.eventBus ! new BalanceEvent(this._userState.userID,
newTotalCredits>=0)
- DEBUG("Updated %s", this._workingUserState)
+ DEBUG("Updated %s", this._userState)
logSeparator()
}
def onGetUserBillRequest(event: GetUserBillRequest): Unit = {
try{
val timeslot = event.timeslot
- val state= if(haveWorkingUserState) Some(this._workingUserState) else None
+ val state= if(haveWorkingUserState) Some(this._userState.msg) else None
val billEntry = AbstractBillEntry.fromWorkingUserState(timeslot,this._userID,state)
val billData = GetUserBillResponseData(this._userID,billEntry)
sender ! GetUserBillResponse(Right(billData))
case (true, true) ⇒
// (User CREATEd, with balance state)
val realtimeMillis = TimeHelpers.nowMillis()
- chargingService.calculateRealtimeWorkingUserState(
- this._workingUserState,
+ chargingService.calculateRealtimeUserState(
+ this._userState,
BillingMonthInfo.fromMillis(realtimeMillis),
realtimeMillis
)
- sender ! GetUserBalanceResponse(Right(GetUserBalanceResponseData(this._userID, this._workingUserState.totalCredits)))
+ sender ! GetUserBalanceResponse(Right(GetUserBalanceResponseData(this._userID, this._userState.totalCredits)))
case (true, false) ⇒
// (User CREATEd, no balance state)
Right(
GetUserBalanceResponseData(
this._userID,
- aquarium.initialUserBalance(this._userCreationIMEvent.role, this._userCreationIMEvent.occurredMillis)
+ aquarium.initialUserBalance(this._userCreationIMEvent.getRole, this._userCreationIMEvent.getOccurredMillis)
)))
case (false, true) ⇒
haveWorkingUserState match {
case true ⇒
val realtimeMillis = TimeHelpers.nowMillis()
- chargingService.calculateRealtimeWorkingUserState(
- this._workingUserState,
+ chargingService.calculateRealtimeUserState(
+ this._userState,
BillingMonthInfo.fromMillis(realtimeMillis),
realtimeMillis
)
- sender ! GetUserStateResponse(Right(this._workingUserState))
+ sender ! GetUserStateResponse(Right(this._userState.msg))
case false ⇒
sender ! GetUserStateResponse(Left("No state for user %s [AQU-STA-0006]".format(event.userID)), 404)
case true ⇒
DEBUG("haveWorkingUserState: %s", event)
val realtimeMillis = TimeHelpers.nowMillis()
- chargingService.calculateRealtimeWorkingUserState(
- this._workingUserState,
+ chargingService.calculateRealtimeUserState(
+ this._userState,
BillingMonthInfo.fromMillis(realtimeMillis),
realtimeMillis
)
Right(
GetUserWalletResponseData(
this._userID,
- this._workingUserState.totalCredits,
- this._workingUserState.walletEntries.toList
+ this._userState.totalCredits,
+ MessageFactory.newWalletEntriesMsg(this._userState.msg.getWalletEntries)
)))
case false ⇒
Right(
GetUserWalletResponseData(
this._userID,
- aquarium.initialUserBalance(this._userCreationIMEvent.role, this._userCreationIMEvent.occurredMillis),
- Nil
+ aquarium.initialUserBalance(this._userCreationIMEvent.getRole, this._userCreationIMEvent.getOccurredMillis),
+ MessageFactory.newWalletEntriesMsg()
)))
case false ⇒
+++ /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.charging
-
-import gr.grnet.aquarium.util.shortClassNameOf
-import gr.grnet.aquarium.util.date.TimeHelpers.toYYYYMMDDHHMMSSSSS
-
-/**
- * A credit value computed for a particular time period, using a specific unit price.
- *
- * @param startMillis
- * @param stopMillis
- * @param unitPrice
- * @param creditsToSubtract The computed amount of credits to subtract from the total user credits. If this is
- * an infinite number, then the convention is that no credits have been specified.
- *
- * @author Christos KK Loverdos <loverdos@gmail.com>
- */
-
-case class Chargeslot(
- startMillis: Long,
- stopMillis: Long,
- unitPrice: Double,
- explanation: String = "",
- creditsToSubtract: Double = Double.NaN
-) {
-
- def hasCreditsToSubtract: Boolean = {
- !creditsToSubtract.isInfinite
- }
-
- def copyWithCreditsToSubtract(credits: Double, _explanation: String) = {
- copy(creditsToSubtract = credits, explanation = _explanation)
- }
-
- override def toString = "%s(%s, %s, %s, %s, %s)".format(
- shortClassNameOf(this),
- toYYYYMMDDHHMMSSSSS(startMillis),
- toYYYYMMDDHHMMSSSSS(stopMillis),
- unitPrice,
- explanation,
- creditsToSubtract
- )
-}
package gr.grnet.aquarium.charging
import gr.grnet.aquarium.Aquarium
-import gr.grnet.aquarium.charging.state.{WorkingResourceInstanceChargingState, AgreementHistoryModel, WorkingResourcesChargingState}
-import gr.grnet.aquarium.charging.wallet.WalletEntry
+import gr.grnet.aquarium.charging.state.UserStateModel
import gr.grnet.aquarium.computation.BillingMonthInfo
-import gr.grnet.aquarium.event.model.resource.ResourceEventModel
-import gr.grnet.aquarium.logic.accounting.dsl.Timeslot
-import gr.grnet.aquarium.policy.{ResourceType, EffectivePriceTable, FullPriceTable}
-import gr.grnet.aquarium.uid.{PrefixedUIDGenerator, ConcurrentVMLocalUIDGenerator, UIDGenerator}
-import scala.collection.mutable
+import gr.grnet.aquarium.event.{CreditsModel, DetailsModel}
+import gr.grnet.aquarium.message.avro.gen.{WalletEntryMsg, EffectivePriceTableMsg, FullPriceTableMsg, ResourcesChargingStateMsg, ResourceTypeMsg, ResourceInstanceChargingStateMsg, ResourceEventMsg}
+import gr.grnet.aquarium.uid.{PrefixedUIDGenerator, ConcurrentVMLocalUIDGenerator}
+import gr.grnet.aquarium.policy.{EffectivePriceTableModel, FullPriceTableModel}
/**
* A charging behavior indicates how charging for a resource will be done
*/
trait ChargingBehavior {
- def selectorLabelsHierarchy: List[CharSequence]
+ def selectorLabelsHierarchy: List[String]
/**
* Provides some initial charging details that will be part of the mutable charging state
- * ([[gr.grnet.aquarium.charging.state.WorkingResourcesChargingState]]).
+ * ([[gr.grnet.aquarium.message.avro.gen.ResourcesChargingStateMsg]]).
*/
- def initialChargingDetails: Map[String, Any]
+ def initialChargingDetails: DetailsModel.Type
def computeSelectorPath(
- workingChargingBehaviorDetails: mutable.Map[String, Any],
- workingResourceInstanceChargingState: WorkingResourceInstanceChargingState,
- currentResourceEvent: ResourceEventModel,
- referenceTimeslot: Timeslot,
- totalCredits: Double
+ ChargingBehaviorDetails: DetailsModel.Type,
+ resourceInstanceChargingState: ResourceInstanceChargingStateMsg,
+ currentResourceEvent: ResourceEventMsg,
+ referenceStartMillis: Long,
+ referenceStopMillis: Long,
+ totalCredits: CreditsModel.Type
): List[String]
- def selectEffectivePriceTable(
- fullPriceTable: FullPriceTable,
- workingChargingBehaviorDetails: mutable.Map[String, Any],
- workingResourceInstanceChargingState: WorkingResourceInstanceChargingState,
- currentResourceEvent: ResourceEventModel,
- referenceTimeslot: Timeslot,
+ def selectEffectivePriceTableModel(
+ fullPriceTable: FullPriceTableModel,
+ chargingBehaviorDetails: DetailsModel.Type,
+ resourceInstanceChargingState: ResourceInstanceChargingStateMsg,
+ currentResourceEvent: ResourceEventMsg,
+ referenceStartMillis: Long,
+ referenceStopMillis: Long,
totalCredits: Double
- ): EffectivePriceTable
+ ): EffectivePriceTableModel
/**
*
*/
def processResourceEvent(
aquarium: Aquarium,
- currentResourceEvent: ResourceEventModel,
- resourceType: ResourceType,
+ resourceEvent: ResourceEventMsg,
+ resourceType: ResourceTypeMsg,
billingMonthInfo: BillingMonthInfo,
- workingResourcesChargingState: WorkingResourcesChargingState,
- userAgreements: AgreementHistoryModel,
- totalCredits: Double,
- walletEntryRecorder: WalletEntry ⇒ Unit
- ): (Int, Double)
+ resourcesChargingState: ResourcesChargingStateMsg,
+ userStateModel: UserStateModel,
+ walletEntryRecorder: WalletEntryMsg ⇒ Unit
+ ): (Int, CreditsModel.Type)
def computeCreditsToSubtract(
- workingResourceInstanceChargingState: WorkingResourceInstanceChargingState,
- oldCredits: Double,
+ resourceInstanceChargingState: ResourceInstanceChargingStateMsg,
+ oldCredits: CreditsModel.Type,
timeDeltaMillis: Long,
unitPrice: Double
- ): (Double /* credits */, String /* explanation */)
+ ): (CreditsModel.Type, String /* explanation */)
/**
* Given the charging state of a resource instance and the details of the incoming message, compute the new
* accumulating amount.
*/
def computeNewAccumulatingAmount(
- workingResourceInstanceChargingState: WorkingResourceInstanceChargingState,
- eventDetails: Map[String, String]
- ): Double
+ resourceInstanceChargingState: ResourceInstanceChargingStateMsg,
+ eventDetails: DetailsModel.Type
+ ): CreditsModel.Type
def createVirtualEventsForRealtimeComputation(
userID: String,
resourceTypeName: String,
resourceInstanceID: String,
eventOccurredMillis: Long,
- workingResourceInstanceChargingState: WorkingResourceInstanceChargingState
- ): List[ResourceEventModel]
+ resourceInstanceChargingState: ResourceInstanceChargingStateMsg
+ ): List[ResourceEventMsg]
}
object ChargingBehavior {
package gr.grnet.aquarium.charging
-import gr.grnet.aquarium.charging.state.{WorkingResourceInstanceChargingState, WorkingResourcesChargingState, AgreementHistoryModel}
-import gr.grnet.aquarium.charging.wallet.WalletEntry
+import gr.grnet.aquarium.{Aquarium, AquariumInternalError}
import gr.grnet.aquarium.computation.{TimeslotComputations, BillingMonthInfo}
-import gr.grnet.aquarium.event.model.resource.ResourceEventModel
+import gr.grnet.aquarium.event.{CreditsModel, DetailsModel}
import gr.grnet.aquarium.logic.accounting.dsl.Timeslot
-import gr.grnet.aquarium.policy.{FullPriceTable, EffectivePriceTable, UserAgreementModel, ResourceType}
+import gr.grnet.aquarium.message.avro.gen.{EffectivePriceTableMsg, FullPriceTableMsg, ResourceTypeMsg, WalletEntryMsg, ResourceInstanceChargingStateMsg, ResourcesChargingStateMsg, ResourceEventMsg}
+import gr.grnet.aquarium.message.avro.{MessageHelpers, AvroHelpers, MessageFactory}
+import gr.grnet.aquarium.policy.{PolicyModel, EffectivePriceTableModel, FullPriceTableModel, UserAgreementModel}
import gr.grnet.aquarium.store.PolicyStore
import gr.grnet.aquarium.util._
import gr.grnet.aquarium.util.date.TimeHelpers
-import gr.grnet.aquarium.{Aquarium, AquariumInternalError}
+import java.{util ⇒ ju}
+import java.util.{List ⇒ JList, ArrayList ⇒ JArrayList}
import scala.collection.immutable
import scala.collection.mutable
+import gr.grnet.aquarium.message.MessageConstants
/**
final val selectorLabelsHierarchy: List[String]
) extends ChargingBehavior with Loggable {
- protected def HrsOfMillis(millis: Double) = {
- val hours = millis / (1000 * 60 * 60).toDouble
- val roundedHours = hours
- roundedHours
+ final val HourMillis = CreditsModel.from(1000L * 60 * 60)
+ final val HourMillisInverse = CreditsModel.inv(HourMillis)
+ final val MB = CreditsModel.from(1024L * 1024L)
+ final val MBInverse = CreditsModel.inv(MB)
+ final val GB = CreditsModel.from(1024L * 1024L * 1024L)
+ final val GBInverse = CreditsModel.inv(GB)
+
+ @inline final def HrsOfMillis(timeDeltaMillis: Long): CreditsModel.Type = {
+ CreditsModel.*(
+ HourMillisInverse,
+ CreditsModel.from(timeDeltaMillis)
+ )
}
- protected def MBsOfBytes(bytes: Double) = {
- bytes / (1024 * 1024).toDouble
+ @inline final def MBsOfBytes(bytes: Double): CreditsModel.Type = {
+ CreditsModel.*(
+ MBInverse,
+ CreditsModel.from(bytes)
+ )
}
- protected def rcDebugInfo(rcEvent: ResourceEventModel) = {
- rcEvent.toDebugString
+ @inline final protected def rcDebugInfo(rcEvent: ResourceEventMsg) = {
+ AvroHelpers.jsonStringOfSpecificRecord(rcEvent)
}
- protected def newWorkingResourceInstanceChargingState() = {
- new WorkingResourceInstanceChargingState(
- mutable.Map(),
- Nil,
- Nil,
+ protected def newResourceInstanceChargingStateMsg() = {
+ MessageFactory.newResourceInstanceChargingStateMsg(
+
+ DetailsModel.make,
+ new JArrayList[ResourceEventMsg](),
+ new JArrayList[ResourceEventMsg](),
0.0,
0.0,
0.0,
}
final protected def ensureInitializedWorkingState(
- workingResourcesChargingState: WorkingResourcesChargingState,
- resourceEvent: ResourceEventModel
+ resourcesChargingState: ResourcesChargingStateMsg,
+ resourceEvent: ResourceEventMsg
) {
- ensureInitializedResourcesChargingStateDetails(workingResourcesChargingState.details)
- ensureInitializedResourceInstanceChargingState(workingResourcesChargingState, resourceEvent)
+ ensureInitializedResourcesChargingStateDetails(resourcesChargingState.getDetails)
+ ensureInitializedResourceInstanceChargingState(resourcesChargingState, resourceEvent)
}
- protected def ensureInitializedResourcesChargingStateDetails(details: mutable.Map[String, Any]) {}
+ protected def ensureInitializedResourcesChargingStateDetails(details: DetailsModel.Type) {}
protected def ensureInitializedResourceInstanceChargingState(
- workingResourcesChargingState: WorkingResourcesChargingState,
- resourceEvent: ResourceEventModel
+ resourcesChargingState: ResourcesChargingStateMsg,
+ resourceEvent: ResourceEventMsg
) {
- val instanceID = resourceEvent.instanceID
- val stateOfResourceInstance = workingResourcesChargingState.stateOfResourceInstance
+ val instanceID = resourceEvent.getInstanceID
+ val stateOfResourceInstance = resourcesChargingState.getStateOfResourceInstance
stateOfResourceInstance.get(instanceID) match {
- case None ⇒
- stateOfResourceInstance(instanceID) = newWorkingResourceInstanceChargingState()
+ case null ⇒
+ stateOfResourceInstance.put(instanceID, newResourceInstanceChargingStateMsg())
case _ ⇒
}
}
protected def fillWorkingResourceInstanceChargingStateFromEvent(
- workingResourceInstanceChargingState: WorkingResourceInstanceChargingState,
- resourceEvent: ResourceEventModel
+ resourceInstanceChargingState: ResourceInstanceChargingStateMsg,
+ resourceEvent: ResourceEventMsg
) {
- workingResourceInstanceChargingState.currentValue = resourceEvent.value
+ resourceInstanceChargingState.setCurrentValue(resourceEvent.getValue.toString.toDouble)
}
protected def computeWalletEntriesForNewEvent(
- resourceEvent: ResourceEventModel,
- resourceType: ResourceType,
+ resourceEvent: ResourceEventMsg,
+ resourceType: ResourceTypeMsg,
billingMonthInfo: BillingMonthInfo,
totalCredits: Double,
- referenceTimeslot: Timeslot,
+ referenceStartMillis: Long,
+ referenceStopMillis: Long,
agreementByTimeslot: immutable.SortedMap[Timeslot, UserAgreementModel],
- workingResourcesChargingStateDetails: mutable.Map[String, Any],
- workingResourceInstanceChargingState: WorkingResourceInstanceChargingState,
- policyStore: PolicyStore,
- walletEntryRecorder: WalletEntry ⇒ Unit
+ workingResourcesChargingStateDetails: DetailsModel.Type,
+ resourceInstanceChargingState: ResourceInstanceChargingStateMsg,
+ aquarium: Aquarium,
+ walletEntryRecorder: WalletEntryMsg ⇒ Unit
): (Int, Double) = {
- val userID = resourceEvent.userID
- val resourceEventDetails = resourceEvent.details
+ val userID = resourceEvent.getUserID
+ val resourceEventDetails = resourceEvent.getDetails
var _oldTotalCredits = totalCredits
- var _newAccumulatingAmount = computeNewAccumulatingAmount(workingResourceInstanceChargingState, resourceEventDetails)
+ var _newAccumulatingAmount = computeNewAccumulatingAmount(resourceInstanceChargingState, resourceEventDetails)
// It will also update the old one inside the data structure.
- workingResourceInstanceChargingState.setNewAccumulatingAmount(_newAccumulatingAmount)
+ resourceInstanceChargingState.setAccumulatingAmount(_newAccumulatingAmount)
- val policyByTimeslot = policyStore.loadSortedPolicyModelsWithin(
- referenceTimeslot.from.getTime,
- referenceTimeslot.to.getTime
+ val policyByTimeslot = aquarium.policyStore.loadSortedPolicyModelsWithin(
+ referenceStartMillis,
+ referenceStopMillis
)
- val effectivePriceTableSelector: FullPriceTable ⇒ EffectivePriceTable = fullPriceTable ⇒ {
- this.selectEffectivePriceTable(
+ val effectivePriceTableModelSelector: FullPriceTableModel ⇒ EffectivePriceTableModel = fullPriceTable ⇒ {
+ this.selectEffectivePriceTableModel(
fullPriceTable,
workingResourcesChargingStateDetails,
- workingResourceInstanceChargingState,
+ resourceInstanceChargingState,
resourceEvent,
- referenceTimeslot,
+ referenceStartMillis,
+ referenceStopMillis,
totalCredits
)
}
+ val fullPriceTableModelGetter = aquarium.unsafeFullPriceTableModelForAgreement(_,_)
+
val initialChargeslots = TimeslotComputations.computeInitialChargeslots(
- referenceTimeslot,
+ Timeslot(referenceStartMillis, referenceStopMillis),
policyByTimeslot,
agreementByTimeslot,
- effectivePriceTableSelector
+ fullPriceTableModelGetter,
+ effectivePriceTableModelSelector
)
- val fullChargeslots = initialChargeslots.map {
- case chargeslot@Chargeslot(startMillis, stopMillis, unitPrice, _, _) ⇒
- val timeDeltaMillis = stopMillis - startMillis
+ val fullChargeslots = initialChargeslots.map { cs ⇒
+ val timeDeltaMillis = cs.getStopMillis - cs.getStartMillis
+
+ val (creditsToSubtract, explanation) = this.computeCreditsToSubtract(
+ resourceInstanceChargingState,
+ _oldTotalCredits, // FIXME ??? Should recalculate ???
+ timeDeltaMillis,
+ cs.getUnitPrice
+ )
- val (creditsToSubtract, explanation) = this.computeCreditsToSubtract(
- workingResourceInstanceChargingState,
- _oldTotalCredits, // FIXME ??? Should recalculate ???
- timeDeltaMillis,
- unitPrice
- )
+ cs.setCreditsToSubtract(creditsToSubtract)
+ cs.setExplanation(explanation)
- val newChargeslot = chargeslot.copyWithCreditsToSubtract(creditsToSubtract, explanation)
- newChargeslot
+ cs
}
if(fullChargeslots.length == 0) {
- throw new AquariumInternalError("No chargeslots computed for resource event %s".format(resourceEvent.id))
+ throw new AquariumInternalError("No chargeslots computed for resource event %s".format(resourceEvent.getOriginalID))
}
- val sumOfCreditsToSubtract = fullChargeslots.map(_.creditsToSubtract).sum
+ val sumOfCreditsToSubtract = fullChargeslots.map(_.getCreditsToSubtract.toDouble).sum
val newTotalCredits = _oldTotalCredits - sumOfCreditsToSubtract
- val newWalletEntry = WalletEntry(
+ val eventsForWallet = new ju.ArrayList[ResourceEventMsg](resourceInstanceChargingState.getPreviousEvents)
+ eventsForWallet.add(0, resourceEvent)
+ import scala.collection.JavaConverters.seqAsJavaListConverter
+ val newWalletEntry = MessageFactory.newWalletEntryMsg(
userID,
- sumOfCreditsToSubtract,
- _oldTotalCredits,
- newTotalCredits,
+ CreditsModel.from(sumOfCreditsToSubtract),
+ CreditsModel.from(_oldTotalCredits),
+ CreditsModel.from(newTotalCredits),
TimeHelpers.nowMillis(),
- referenceTimeslot,
+ referenceStartMillis,
+ referenceStopMillis,
billingMonthInfo.year,
billingMonthInfo.month,
- fullChargeslots,
- resourceEvent :: workingResourceInstanceChargingState.previousEvents,
+ billingMonthInfo.day,
+ fullChargeslots.asJava,
+ eventsForWallet,
resourceType,
- resourceEvent.isSynthetic
+ resourceEvent.getIsSynthetic
)
- logger.debug("newWalletEntry = {}", newWalletEntry.toJsonString)
+ logger.debug("newWalletEntry = {}", AvroHelpers.jsonStringOfSpecificRecord(newWalletEntry))
walletEntryRecorder.apply(newWalletEntry)
}
- def selectEffectivePriceTable(
- fullPriceTable: FullPriceTable,
- workingChargingBehaviorDetails: mutable.Map[String, Any],
- workingResourceInstanceChargingState: WorkingResourceInstanceChargingState,
- currentResourceEvent: ResourceEventModel,
- referenceTimeslot: Timeslot,
+ def selectEffectivePriceTableModel(
+ fullPriceTable: FullPriceTableModel,
+ chargingBehaviorDetails: DetailsModel.Type,
+ resourceInstanceChargingState: ResourceInstanceChargingStateMsg,
+ currentResourceEvent: ResourceEventMsg,
+ referenceStartMillis: Long,
+ referenceStopMillis: Long,
totalCredits: Double
- ): EffectivePriceTable = {
+ ): EffectivePriceTableModel = {
val selectorPath = computeSelectorPath(
- workingChargingBehaviorDetails,
- workingResourceInstanceChargingState,
+ chargingBehaviorDetails,
+ resourceInstanceChargingState,
currentResourceEvent,
- referenceTimeslot,
+ referenceStartMillis,
+ referenceStopMillis,
totalCredits
)
- fullPriceTable.effectivePriceTableOfSelectorForResource(selectorPath, currentResourceEvent.safeResource, logger)
- }
-
- /**
- * Given the charging state of a resource instance and the details of the incoming message, compute the new
- * accumulating amount.
- */
- def computeNewAccumulatingAmount(
- workingResourceInstanceChargingState: WorkingResourceInstanceChargingState,
- eventDetails: Map[String, String]
- ): Double
-
-
- def constructDummyFirstEventFor(actualFirst: ResourceEventModel, newOccurredMillis: Long): ResourceEventModel = {
-
- val newDetails = Map(
- ResourceEventModel.Names.details_aquarium_is_synthetic -> "true",
- ResourceEventModel.Names.details_aquarium_is_dummy_first -> "true",
- ResourceEventModel.Names.details_aquarium_reference_event_id -> actualFirst.id,
- ResourceEventModel.Names.details_aquarium_reference_event_id_in_store -> actualFirst.stringIDInStoreOrEmpty
+ fullPriceTable.effectivePriceTableOfSelectorForResource(
+ selectorPath,
+ currentResourceEvent.getResource,
+ logger
)
+ }
- actualFirst.withDetailsAndValue(newDetails, 0.0, newOccurredMillis)
+ final protected def constructDummyFirstEventFor(
+ actualFirst: ResourceEventMsg,
+ newOccurredMillis: Long,
+ value: String
+ ): ResourceEventMsg = {
+
+ val dm = DetailsModel.make
+ DetailsModel.setBoolean(dm, MessageConstants.DetailsKeys.aquarium_is_synthetic)
+ DetailsModel.setBoolean(dm, MessageConstants.DetailsKeys.aquarium_is_dummy_first)
+ DetailsModel.setString(dm, MessageConstants.DetailsKeys.aquarium_reference_event_id, actualFirst.getOriginalID)
+ DetailsModel.setString(dm, MessageConstants.DetailsKeys.aquarium_reference_event_id_in_store, actualFirst.getInStoreID)
+
+ ResourceEventMsg.newBuilder(actualFirst).
+ setDetails(dm).
+ setValue(value).
+ setOccurredMillis(newOccurredMillis).
+ setReceivedMillis(newOccurredMillis).
+ build
}
}
package gr.grnet.aquarium.charging
-import scala.collection.mutable
-import gr.grnet.aquarium.event.model.resource.ResourceEventModel
+import gr.grnet.aquarium.charging.state.{UserStateModel, UserStateBootstrap}
import gr.grnet.aquarium.computation.BillingMonthInfo
-import gr.grnet.aquarium.charging.state.{WorkingResourcesChargingState, UserStateBootstrap, WorkingUserState, UserStateModel, StdUserState}
+import gr.grnet.aquarium.message.avro.gen.{ResourcesChargingStateMsg, UserStateMsg, ResourceEventMsg}
+import gr.grnet.aquarium.message.avro.{ModelFactory, MessageFactory, AvroHelpers}
import gr.grnet.aquarium.policy.ResourceType
-import gr.grnet.aquarium.util.{Lifecycle, Loggable}
import gr.grnet.aquarium.util.LogHelpers.Debug
import gr.grnet.aquarium.util.LogHelpers.DebugSeq
import gr.grnet.aquarium.util.LogHelpers.Warn
import gr.grnet.aquarium.util.date.{MutableDateCalc, TimeHelpers}
+import gr.grnet.aquarium.util.{Lifecycle, Loggable}
import gr.grnet.aquarium.{AquariumInternalError, AquariumAwareSkeleton}
+import java.util.{HashMap ⇒ JHashMap}
/**
*
def stop() {}
//- Lifecycle
-
- //+ Utility methods
- protected def rcDebugInfo(rcEvent: ResourceEventModel) = {
- rcEvent.toDebugString
- }
- //- Utility methods
-
- def calculateRealtimeWorkingUserState(
- workingUserState: WorkingUserState,
+ def calculateRealtimeUserState(
+ userState: UserStateModel,
billingMonthInfo: BillingMonthInfo,
realtimeMillis: Long
) {
- for( (resourceTypeName, workingResourcesState) ← workingUserState.workingStateOfResources) {
- workingUserState.findResourceType(resourceTypeName) match {
- case None ⇒
+
+ import scala.collection.JavaConverters.mapAsScalaMapConverter
+
+ val stateOfResources = userState.msg.getStateOfResources.asScala
+ val resourceTypesMap = userState.msg.getResourceTypesMap.asScala
+
+ for( (resourceTypeName, workingResourcesState) ← stateOfResources) {
+ userState.msg.getResourceTypesMap.get(resourceTypeName) match {
+ case null ⇒
// Ignore
- case Some(resourceType) ⇒
+ case resourceType ⇒
val chargingBehavior = aquarium.chargingBehaviorOf(resourceType)
+ val stateOfResourceInstance = workingResourcesState.getStateOfResourceInstance.asScala
- for((resourceInstanceID, workingResourceInstanceState) ← workingResourcesState.stateOfResourceInstance) {
+ for((resourceInstanceID, resourceInstanceState) ← stateOfResourceInstance) {
Debug(logger, "Realtime calculation for %s, %s", resourceTypeName, resourceInstanceID)
val virtualEvents = chargingBehavior.createVirtualEventsForRealtimeComputation(
- workingUserState.userID,
+ userState.userID,
resourceTypeName,
resourceInstanceID,
realtimeMillis,
- workingResourceInstanceState
+ resourceInstanceState
)
DebugSeq(logger, "virtualEvents", virtualEvents, 1)
processResourceEvents(
virtualEvents,
- workingUserState,
+ userState,
billingMonthInfo,
realtimeMillis
)
billingMonthInfo: BillingMonthInfo,
userStateBootstrap: UserStateBootstrap,
defaultResourceTypesMap: Map[String, ResourceType],
- userStateRecorder: UserStateModel ⇒ UserStateModel
- ): WorkingUserState = {
+ userStateRecorder: UserStateMsg ⇒ UserStateMsg
+ ): UserStateModel = {
- def computeFullMonthBillingAndSaveState(): WorkingUserState = {
- val workingUserState = replayFullMonthBilling(
+ def computeFullMonthBillingAndSaveState(): UserStateModel = {
+ val fullMonthUserState = replayFullMonthBilling(
userStateBootstrap,
billingMonthInfo,
defaultResourceTypesMap,
userStateRecorder
)
- val monthlyUserState0 = workingUserState.toUserState(
- true,
- billingMonthInfo.year,
- billingMonthInfo.month,
- ""
- )
+ val monthlyUserState0 = UserStateMsg.newBuilder(fullMonthUserState.msg).
+ setIsFullBillingMonth(true).
+ setBillingYear(billingMonthInfo.year).
+ setBillingMonth(billingMonthInfo.month). // FIXME What about the billingMonthDay?
+ setOriginalID("").
+ build()
// We always save the state when it is a full month billing
val monthlyUserState1 = userStateRecorder.apply(monthlyUserState0)
- Debug(logger, "Stored full %s %s", billingMonthInfo.toDebugString, monthlyUserState1.toJsonString)
+ Debug(logger, "Stored full %s %s", billingMonthInfo.toDebugString, AvroHelpers.jsonStringOfSpecificRecord(monthlyUserState1))
- workingUserState
+ ModelFactory.newUserStateModel(monthlyUserState1)
}
val userID = userStateBootstrap.userID
// TODO: The initial user state might have already been created.
// First ask if it exists and compute only if not
- val initialUserState0 = StdUserState.createInitialUserStateFromBootstrap(
+ val initialUserState0 = MessageFactory.createInitialUserStateMsg(
userStateBootstrap,
TimeHelpers.nowMillis()
)
// We always save the initial state
val initialUserState1 = userStateRecorder.apply(initialUserState0)
- Debug(logger, "Stored initial state = %s", initialUserState1.toJsonString)
+ Debug(logger, "Stored initial state = %s", AvroHelpers.jsonStringOfSpecificRecord(initialUserState1))
- return initialUserState1.toWorkingUserState(defaultResourceTypesMap)
+ return ModelFactory.newUserStateModel(initialUserState1)
}
// Ask DB cache for the latest known user state for this billing period
case Some(latestUserState) ⇒
// Found a "latest" user state but need to see if it is indeed the true and one latest.
// For this reason, we must count the events again.
- val latestStateOOSEventsCounter = latestUserState.billingPeriodOutOfSyncResourceEventsCounter
+ val latestStateOOSEventsCounter = latestUserState.getBillingPeriodOutOfSyncResourceEventsCounter
val actualOOSEventsCounter = resourceEventStore.countOutOfSyncResourceEventsForBillingPeriod(
userID,
billingMonthStartMillis,
// ZERO, we are OK!
case 0 ⇒
// NOTE: Keep the caller's calculation reason
- latestUserState.toWorkingUserState(defaultResourceTypesMap)
+ ModelFactory.newUserStateModel(latestUserState)
// We had more, so must recompute
case n if n > 0 ⇒
* Processes one resource event and computes relevant, incremental charges.
*
* @param resourceEvent
- * @param workingUserState
+ * @param userStateModel
* @param billingMonthInfo
*/
def processResourceEvent(
- resourceEvent: ResourceEventModel,
- workingUserState: WorkingUserState,
+ resourceEvent: ResourceEventMsg,
+ userStateModel: UserStateModel,
billingMonthInfo: BillingMonthInfo,
updateLatestMillis: Boolean
): Boolean = {
- val resourceTypeName = resourceEvent.resource
- val resourceTypeOpt = workingUserState.findResourceType(resourceTypeName)
- if(resourceTypeOpt.isEmpty) {
+ val resourceTypeName = resourceEvent.getResource
+ val resourceType = userStateModel.msg.getResourceTypesMap.get(resourceTypeName)
+ if(resourceType eq null) {
// Unknown (yet) resource, ignoring event.
return false
}
- val resourceType = resourceTypeOpt.get
val chargingBehavior = aquarium.chargingBehaviorOf(resourceType)
- val workingResourcesState = workingUserState.workingStateOfResources.get(resourceTypeName) match {
- case Some(existingState) ⇒
- existingState
-
- case None ⇒
+ val resourcesChargingState = userStateModel.msg.getStateOfResources.get(resourceTypeName) match {
+ case null ⇒
// First time for this ChargingBehavior.
- val newState = new WorkingResourcesChargingState(
- details = mutable.Map(chargingBehavior.initialChargingDetails.toSeq:_*),
- stateOfResourceInstance = mutable.Map()
- )
-
- workingUserState.workingStateOfResources(resourceTypeName) = newState
+ val newState = new ResourcesChargingStateMsg
+ newState.setResource(resourceTypeName)
+ newState.setDetails(chargingBehavior.initialChargingDetails)
+ newState.setStateOfResourceInstance(new JHashMap())
newState
+
+ case existingState ⇒
+ existingState
+
}
val m0 = TimeHelpers.nowMillis()
resourceEvent,
resourceType,
billingMonthInfo,
- workingResourcesState,
- workingUserState.workingAgreementHistory,
- workingUserState.totalCredits,
- workingUserState.walletEntries += _
+ resourcesChargingState,
+ userStateModel,
+ msg ⇒ userStateModel.msg.getWalletEntries.add(msg)
)
val m1 = TimeHelpers.nowMillis()
if(updateLatestMillis) {
- workingUserState.latestUpdateMillis = m1
+ userStateModel.msg.setLatestUpdateMillis(m1)
}
- workingUserState.updateLatestResourceEventOccurredMillis(resourceEvent.occurredMillis)
- workingUserState.totalCredits -= creditsToSubtract
+ userStateModel.updateLatestResourceEventOccurredMillis(resourceEvent.getOccurredMillis)
+ userStateModel.subtractCredits(creditsToSubtract)
true
}
def processResourceEvents(
- resourceEvents: Traversable[ResourceEventModel],
- workingUserState: WorkingUserState,
+ resourceEvents: Traversable[ResourceEventMsg],
+ userState: UserStateModel,
billingMonthInfo: BillingMonthInfo,
latestUpdateMillis: Long
): Unit = {
for(currentResourceEvent ← resourceEvents) {
processResourceEvent(
currentResourceEvent,
- workingUserState,
+ userState,
billingMonthInfo,
false
)
}
if(_counter > 0) {
- workingUserState.latestUpdateMillis = latestUpdateMillis
+ userState.msg.setLatestUpdateMillis(latestUpdateMillis)
}
}
userStateBootstrap: UserStateBootstrap,
billingMonthInfo: BillingMonthInfo,
defaultResourceTypesMap: Map[String, ResourceType],
- userStateRecorder: UserStateModel ⇒ UserStateModel
- ): WorkingUserState = {
+ userStateRecorder: UserStateMsg ⇒ UserStateMsg
+ ): UserStateModel = {
replayMonthChargingUpTo(
billingMonthInfo,
billingEndTimeMillis: Long,
userStateBootstrap: UserStateBootstrap,
resourceTypesMap: Map[String, ResourceType],
- userStateRecorder: UserStateModel ⇒ UserStateModel
- ): WorkingUserState = {
+ userStateRecorder: UserStateMsg ⇒ UserStateMsg
+ ): UserStateModel = {
val isFullMonthBilling = billingEndTimeMillis == billingMonthInfo.monthStopMillis
val userID = userStateBootstrap.userID
// In order to replay the full month, we start with the state at the beginning of the month.
val previousBillingMonthInfo = billingMonthInfo.previousMonth
- val workingUserState = findOrCalculateWorkingUserStateAtEndOfBillingMonth(
+ val userState = findOrCalculateWorkingUserStateAtEndOfBillingMonth(
previousBillingMonthInfo,
userStateBootstrap,
resourceTypesMap,
// specified in the parameters.
// NOTE: The calculation reason is not the one we get from the previous user state but the one our caller specifies
- Debug(logger, "workingUserState=%s", workingUserState)
+ Debug(logger, "workingUserState=%s", userState)
Debug(logger, "previousBillingMonthUserState(%s) = %s",
previousBillingMonthInfo.toShortDebugString,
- workingUserState
+ userState
)
var _rcEventsCounter = 0
processResourceEvent(
currentResourceEvent,
- workingUserState,
+ userState,
billingMonthInfo,
false
)
}
if(_rcEventsCounter > 0) {
- workingUserState.latestUpdateMillis = TimeHelpers.nowMillis()
+ userState.msg.setLatestUpdateMillis(TimeHelpers.nowMillis())
}
Debug(logger, "Found %s resource events for month %s",
workingUserState.totalCredits = specialWorkingUserState.totalCredits
}*/
- workingUserState
+ userState
}
}
package gr.grnet.aquarium.charging
-import gr.grnet.aquarium.{AquariumInternalError, Aquarium}
-import gr.grnet.aquarium.charging.state.{AgreementHistoryModel, WorkingResourcesChargingState, WorkingResourceInstanceChargingState}
-import gr.grnet.aquarium.charging.wallet.WalletEntry
import gr.grnet.aquarium.computation.BillingMonthInfo
-import gr.grnet.aquarium.event.model.resource.{StdResourceEvent, ResourceEventModel}
-import gr.grnet.aquarium.logic.accounting.dsl.Timeslot
-import gr.grnet.aquarium.policy.{FullPriceTable, ResourceType}
+import gr.grnet.aquarium.event.{CreditsModel, DetailsModel}
+import gr.grnet.aquarium.message.MessageConstants
+import gr.grnet.aquarium.message.avro.gen.{WalletEntryMsg, ResourcesChargingStateMsg, ResourceTypeMsg, ResourceInstanceChargingStateMsg, ResourceEventMsg}
+import gr.grnet.aquarium.message.avro.{MessageHelpers, AvroHelpers, MessageFactory}
+import gr.grnet.aquarium.policy.FullPriceTableModel
import gr.grnet.aquarium.util.LogHelpers.Debug
-import scala.collection.mutable
-import gr.grnet.aquarium.event.model.EventModel
-import java.util.Date
+import gr.grnet.aquarium.{AquariumInternalError, Aquarium}
+import gr.grnet.aquarium.charging.state.{UserStateModel, UserAgreementHistoryModel}
/**
* In practice a resource usage will be charged for the total amount of usage
final class ContinuousChargingBehavior extends ChargingBehaviorSkeleton(Nil) {
def computeCreditsToSubtract(
- workingResourceInstanceChargingState: WorkingResourceInstanceChargingState,
+ resourceInstanceChargingState: ResourceInstanceChargingStateMsg,
oldCredits: Double,
timeDeltaMillis: Long,
unitPrice: Double
): (Double /* credits */, String /* explanation */) = {
- val oldAccumulatingAmount = workingResourceInstanceChargingState.oldAccumulatingAmount
+ val oldAccumulatingAmount = resourceInstanceChargingState.getOldAccumulatingAmount
val credits = HrsOfMillis(timeDeltaMillis) * oldAccumulatingAmount * unitPrice
val explanation = "Hours(%s) * MBs(%s) * UnitPrice(%s)".format(
HrsOfMillis(timeDeltaMillis),
}
def computeSelectorPath(
- workingChargingBehaviorDetails: mutable.Map[String, Any],
- workingResourceInstanceChargingState: WorkingResourceInstanceChargingState,
- currentResourceEvent: ResourceEventModel,
- referenceTimeslot: Timeslot,
+ chargingBehaviorDetails: DetailsModel.Type,
+ resourceInstanceChargingState: ResourceInstanceChargingStateMsg,
+ currentResourceEvent: ResourceEventMsg,
+ referenceStartMillis: Long,
+ referenceStopMillis: Long,
totalCredits: Double
): List[String] = {
- List(FullPriceTable.DefaultSelectorKey)
+ List(MessageConstants.DefaultSelectorKey)
}
- def initialChargingDetails: Map[String, Any] = Map()
+ def initialChargingDetails = {
+ DetailsModel.make
+ }
def computeNewAccumulatingAmount(
- workingResourceInstanceChargingState: WorkingResourceInstanceChargingState,
- eventDetails: Map[String, String]
- ): Double = {
- workingResourceInstanceChargingState.oldAccumulatingAmount +
- workingResourceInstanceChargingState.currentValue
- }
+ resourceInstanceChargingState: ResourceInstanceChargingStateMsg,
+ eventDetails: DetailsModel.Type
+ ) = {
- def constructImplicitEndEventFor(resourceEvent: ResourceEventModel, newOccurredMillis: Long) = {
- val details = resourceEvent.details
- val newDetails = ResourceEventModel.setAquariumSyntheticAndImplicitEnd(details)
+ val oldAccumulatingAmount = CreditsModel.from(resourceInstanceChargingState.getOldAccumulatingAmount)
+ val currentValue = CreditsModel.from(resourceInstanceChargingState.getCurrentValue)
- resourceEvent.withDetails(newDetails, newOccurredMillis)
+ CreditsModel.add(oldAccumulatingAmount, currentValue)
}
- override def processResourceEvent(
+ def constructImplicitEndEventFor(resourceEvent: ResourceEventMsg, newOccurredMillis: Long) = {
+ val details = resourceEvent.getDetails
+ val newDetails = DetailsModel.copyOf(details)
+ MessageHelpers.setAquariumSyntheticAndImplicitEnd(newDetails)
+
+ // FIXME: What value ?
+ ResourceEventMsg.newBuilder(resourceEvent).
+ setDetails(newDetails).
+ setOccurredMillis(newOccurredMillis).
+ setReceivedMillis(newOccurredMillis).
+ build()
+ }
+
+ def processResourceEvent(
aquarium: Aquarium,
- resourceEvent: ResourceEventModel,
- resourceType: ResourceType,
+ resourceEvent: ResourceEventMsg,
+ resourceType: ResourceTypeMsg,
billingMonthInfo: BillingMonthInfo,
- workingResourcesChargingState: WorkingResourcesChargingState,
- userAgreements: AgreementHistoryModel,
- totalCredits: Double,
- walletEntryRecorder: WalletEntry ⇒ Unit
- ): (Int, Double) = {
+ resourcesChargingState: ResourcesChargingStateMsg,
+ userStateModel: UserStateModel,
+ walletEntryRecorder: WalletEntryMsg ⇒ Unit
+ ): (Int, CreditsModel.Type) = {
// 1. Ensure proper initial state per resource and per instance
- ensureInitializedWorkingState(workingResourcesChargingState, resourceEvent)
+ ensureInitializedWorkingState(resourcesChargingState, resourceEvent)
// 2. Fill in data from the new event
- val stateOfResourceInstance = workingResourcesChargingState.stateOfResourceInstance
- val workingResourcesChargingStateDetails = workingResourcesChargingState.details
- val instanceID = resourceEvent.instanceID
- val workingResourceInstanceChargingState = stateOfResourceInstance(instanceID)
- fillWorkingResourceInstanceChargingStateFromEvent(workingResourceInstanceChargingState, resourceEvent)
-
- val previousEvent = workingResourceInstanceChargingState.previousEvents.headOption match {
- case Some(previousEvent) ⇒
- Debug(logger, "I have previous event %s", previousEvent.toDebugString)
- previousEvent
-
-
- case None ⇒
+ val stateOfResourceInstance = resourcesChargingState.getStateOfResourceInstance
+ val resourcesChargingStateDetails = resourcesChargingState.getDetails
+ val instanceID = resourceEvent.getInstanceID
+ val resourceInstanceChargingState = stateOfResourceInstance.get(instanceID)
+ fillWorkingResourceInstanceChargingStateFromEvent(resourceInstanceChargingState, resourceEvent)
+
+ val userAgreementHistoryModel = userStateModel.userAgreementHistoryModel
+ val previousEvents = resourceInstanceChargingState.getPreviousEvents
+ val previousEvent = previousEvents.size() match {
+ case 0 ⇒
// We do not have the needed previous event, so this must be the first resource event of its kind, ever.
// Let's see if we can create a dummy previous event.
- Debug(logger, "First event of its kind %s", resourceEvent.toDebugString)
-
- val dummyFirstEventDetails = Map(
- ResourceEventModel.Names.details_aquarium_is_synthetic -> "true",
- ResourceEventModel.Names.details_aquarium_is_dummy_first -> "true",
- ResourceEventModel.Names.details_aquarium_reference_event_id -> resourceEvent.id,
- ResourceEventModel.Names.details_aquarium_reference_event_id_in_store -> resourceEvent.stringIDInStoreOrEmpty
- )
+ Debug(logger, "First event of its kind %s", AvroHelpers.jsonStringOfSpecificRecord(resourceEvent))
- val dummyFirstEventValue = 0.0 // TODO From configuration
+ val dummyFirstEventValue = "0.0" // TODO ? From configuration
- val millis = userAgreements.agreementByTimeslot.headOption match {
+ val millis = userAgreementHistoryModel.agreementByTimeslot.headOption match {
case None =>
- throw new AquariumInternalError("No agreement!!!")
+ throw new AquariumInternalError("No agreement!!!") // FIXME Better explanation
case Some((_,aggr)) =>
val millisAgg = aggr.timeslot.from.getTime
val millisMon = billingMonthInfo.monthStartMillis
if(millisAgg>millisMon) millisAgg else millisMon
}
- val dummyFirstEvent = resourceEvent.withDetailsAndValue(
- dummyFirstEventDetails,
- dummyFirstEventValue,
- millis)
- Debug(logger, "Dummy first event %s", dummyFirstEvent.toDebugString)
+ val dummyFirstEvent = constructDummyFirstEventFor(resourceEvent, millis, dummyFirstEventValue)
+
+ Debug(logger, "Dummy first event %s", AvroHelpers.jsonStringOfSpecificRecord(dummyFirstEvent))
dummyFirstEvent
+
+
+ case _ ⇒
+ val previousEvent = previousEvents.get(0) // head is most recent
+ Debug(logger, "I have previous event %s", AvroHelpers.jsonStringOfSpecificRecord(previousEvent))
+ previousEvent
+
}
val retval = computeWalletEntriesForNewEvent(
resourceEvent,
resourceType,
billingMonthInfo,
- totalCredits,
- Timeslot(previousEvent.occurredMillis, resourceEvent.occurredMillis),
- userAgreements.agreementByTimeslot,
- workingResourcesChargingStateDetails,
- workingResourceInstanceChargingState,
- aquarium.policyStore,
+ userStateModel.totalCredits,
+ previousEvent.getOccurredMillis,
+ resourceEvent.getOccurredMillis,
+ userAgreementHistoryModel.agreementByTimeslot,
+ resourcesChargingStateDetails,
+ resourceInstanceChargingState,
+ aquarium,
walletEntryRecorder
)
// We need just one previous event, so we update it
- workingResourceInstanceChargingState.setOnePreviousEvent(resourceEvent)
+ MessageHelpers.setOnePreviousEvent(resourceInstanceChargingState, resourceEvent)
retval
}
resourceTypeName: String,
resourceInstanceID: String,
eventOccurredMillis: Long,
- workingResourceInstanceChargingState: WorkingResourceInstanceChargingState
- ): List[ResourceEventModel] = {
- StdResourceEvent(
+ resourceInstanceChargingState: ResourceInstanceChargingStateMsg
+ ): List[ResourceEventMsg] = {
+ MessageFactory.newResourceEventMsg(
ChargingBehavior.VirtualEventsIDGen.nextUID(),
eventOccurredMillis,
eventOccurredMillis,
"aquarium",
resourceTypeName,
resourceInstanceID,
- 0.0,
- EventModel.EventVersion_1_0,
- Map(
- ResourceEventModel.Names.details_aquarium_is_synthetic -> "true",
- ResourceEventModel.Names.details_aquarium_is_realtime_virtual -> "true"
+ "0.0",
+ MessageConstants.EventVersion_1_0,
+ MessageFactory.newDetails(
+ MessageFactory.newBooleanDetail(MessageConstants.DetailsKeys.aquarium_is_synthetic, true),
+ MessageFactory.newBooleanDetail(MessageConstants.DetailsKeys.aquarium_is_realtime_virtual, true)
)
) :: Nil
}
package gr.grnet.aquarium.charging
-import gr.grnet.aquarium.event.model.resource.ResourceEventModel
-import gr.grnet.aquarium.{Aquarium, AquariumException}
-import scala.collection.mutable
-import gr.grnet.aquarium.logic.accounting.dsl.Timeslot
-import gr.grnet.aquarium.policy.{ResourceType, FullPriceTable}
+import gr.grnet.aquarium.Aquarium
+import gr.grnet.aquarium.charging.state.UserStateModel
import gr.grnet.aquarium.computation.BillingMonthInfo
-import gr.grnet.aquarium.charging.state.{WorkingResourceInstanceChargingState, AgreementHistoryModel, WorkingResourcesChargingState}
-import gr.grnet.aquarium.charging.wallet.WalletEntry
+import gr.grnet.aquarium.event.{CreditsModel, DetailsModel}
+import gr.grnet.aquarium.message.avro.gen.{WalletEntryMsg, ResourcesChargingStateMsg, ResourceTypeMsg, ResourceInstanceChargingStateMsg, ResourceEventMsg}
+import gr.grnet.aquarium.policy.FullPriceTableModel
+import gr.grnet.aquarium.message.MessageConstants
/**
* A charging behavior for which resource events just carry a credit amount that will be added to the total one.
*/
final class OnceChargingBehavior extends ChargingBehaviorSkeleton(Nil) {
def computeCreditsToSubtract(
- workingResourceInstanceChargingState: WorkingResourceInstanceChargingState,
- oldCredits: Double,
+ resourceInstanceChargingState: ResourceInstanceChargingStateMsg,
+ oldCredits: CreditsModel.Type,
timeDeltaMillis: Long,
- unitPrice: Double
- ): (Double /* credits */, String /* explanation */) = {
+ unitPrice: CreditsModel.Type
+ ): (CreditsModel.Type, String /* explanation */) = {
- val currentValue = workingResourceInstanceChargingState.currentValue
+ val currentValue = CreditsModel.from(resourceInstanceChargingState.getCurrentValue)
// Always remember to multiply with the `unitPrice`, since it scales the credits, depending on
// the particular resource type tha applies.
- val credits = currentValue * unitPrice
+ val credits = CreditsModel.mul(currentValue, unitPrice)
val explanation = "Value(%s) * UnitPrice(%s)".format(currentValue, unitPrice)
(credits, explanation)
}
def computeSelectorPath(
- workingChargingBehaviorDetails: mutable.Map[String, Any],
- workingResourceInstanceChargingState: WorkingResourceInstanceChargingState,
- currentResourceEvent: ResourceEventModel,
- referenceTimeslot: Timeslot,
- totalCredits: Double
+ chargingBehaviorDetails: DetailsModel.Type,
+ resourceInstanceChargingState: ResourceInstanceChargingStateMsg,
+ currentResourceEvent: ResourceEventMsg,
+ referenceFromMillis: Long,
+ referenceToMillis: Long,
+ totalCredits: CreditsModel.Type
): List[String] = {
- List(FullPriceTable.DefaultSelectorKey)
+ List(MessageConstants.DefaultSelectorKey)
}
override def processResourceEvent(
aquarium: Aquarium,
- resourceEvent: ResourceEventModel,
- resourceType: ResourceType,
+ resourceEvent: ResourceEventMsg,
+ resourceType: ResourceTypeMsg,
billingMonthInfo: BillingMonthInfo,
- workingResourcesChargingState: WorkingResourcesChargingState,
- userAgreements: AgreementHistoryModel,
- totalCredits: Double,
- walletEntryRecorder: WalletEntry ⇒ Unit
+ resourcesChargingState: ResourcesChargingStateMsg,
+ userStateModel: UserStateModel,
+ walletEntryRecorder: WalletEntryMsg ⇒ Unit
): (Int, Double) = {
// The credits are given in the value
// But we cannot just apply them, since we also need to take into account the unit price.
// Normally, the unit price is 1.0 but we have the flexibility to allow more stuff).
// 1. Ensure proper initial state per resource and per instance
- ensureInitializedWorkingState(workingResourcesChargingState, resourceEvent)
+ ensureInitializedWorkingState(resourcesChargingState,resourceEvent)
// 2. Fill in data from the new event
- val stateOfResourceInstance = workingResourcesChargingState.stateOfResourceInstance
- val workingResourcesChargingStateDetails = workingResourcesChargingState.details
- val instanceID = resourceEvent.instanceID
- val workingResourceInstanceChargingState = stateOfResourceInstance(instanceID)
- fillWorkingResourceInstanceChargingStateFromEvent(workingResourceInstanceChargingState, resourceEvent)
+ val stateOfResourceInstance = resourcesChargingState.getStateOfResourceInstance
+ val resourcesChargingStateDetails = resourcesChargingState.getDetails
+ val instanceID = resourceEvent.getInstanceID
+ val resourceInstanceChargingState = stateOfResourceInstance.get(instanceID)
+ fillWorkingResourceInstanceChargingStateFromEvent(resourceInstanceChargingState, resourceEvent)
+
+ val userAgreementHistoryModel = userStateModel.userAgreementHistoryModel
computeWalletEntriesForNewEvent(
resourceEvent,
resourceType,
billingMonthInfo,
- totalCredits,
- Timeslot(resourceEvent.occurredMillis, resourceEvent.occurredMillis + 1), // single point in time
- userAgreements.agreementByTimeslot,
- workingResourcesChargingStateDetails,
- workingResourceInstanceChargingState,
- aquarium.policyStore,
+ userStateModel.totalCredits,
+ resourceEvent.getOccurredMillis,
+ resourceEvent.getOccurredMillis + 1, // single point in time
+ userAgreementHistoryModel.agreementByTimeslot,
+ resourcesChargingStateDetails,
+ resourceInstanceChargingState,
+ aquarium,
walletEntryRecorder
)
}
- def initialChargingDetails: Map[String, Any] = Map()
+ def initialChargingDetails = {
+ DetailsModel.make
+ }
def computeNewAccumulatingAmount(
- workingResourceInstanceChargingState: WorkingResourceInstanceChargingState,
- eventDetails: Map[String, String]
- ): Double = {
- workingResourceInstanceChargingState.oldAccumulatingAmount
+ resourceInstanceChargingState: ResourceInstanceChargingStateMsg,
+ eventDetails: DetailsModel.Type
+ ): CreditsModel.Type = {
+ CreditsModel.from(resourceInstanceChargingState.getOldAccumulatingAmount)
}
def createVirtualEventsForRealtimeComputation(
resourceTypeName: String,
resourceInstanceID: String,
eventOccurredMillis: Long,
- workingResourceInstanceChargingState: WorkingResourceInstanceChargingState
- ): List[ResourceEventModel] = {
+ resourceInstanceChargingState: ResourceInstanceChargingStateMsg
+ ): List[ResourceEventMsg] = {
// We optimize and generate no virtual event
Nil
}
}
-
-object OnceChargingBehavior {
- private[this] final val TheOne = new OnceChargingBehavior
-
- def apply(): OnceChargingBehavior = TheOne
-}
package gr.grnet.aquarium.charging
-import gr.grnet.aquarium.{Aquarium, AquariumInternalError}
-import gr.grnet.aquarium.event.model.resource.{StdResourceEvent, ResourceEventModel}
-import gr.grnet.aquarium.logic.accounting.dsl.Timeslot
-import VMChargingBehavior.Selectors.Power
import VMChargingBehavior.SelectorLabels.PowerStatus
-import gr.grnet.aquarium.policy.ResourceType
+import VMChargingBehavior.Selectors.Power
+import gr.grnet.aquarium.charging.state.UserStateModel
import gr.grnet.aquarium.computation.BillingMonthInfo
-import gr.grnet.aquarium.charging.state.{WorkingResourceInstanceChargingState, WorkingResourcesChargingState, AgreementHistoryModel}
-import gr.grnet.aquarium.charging.wallet.WalletEntry
-import scala.collection.mutable
-import gr.grnet.aquarium.event.model.EventModel
+import gr.grnet.aquarium.event.CreditsModel
+import gr.grnet.aquarium.event.DetailsModel
+import gr.grnet.aquarium.message.MessageConstants
+import gr.grnet.aquarium.message.avro.gen.{WalletEntryMsg, ResourceTypeMsg, ResourcesChargingStateMsg, ResourceInstanceChargingStateMsg, ResourceEventMsg}
+import gr.grnet.aquarium.message.avro.{AvroHelpers, MessageHelpers, MessageFactory}
import gr.grnet.aquarium.util.LogHelpers._
-import scala.Some
-import gr.grnet.aquarium.policy.ResourceType
+import gr.grnet.aquarium.{Aquarium, AquariumInternalError}
+import scala.collection.JavaConverters.asScalaBufferConverter
/**
* The new [[gr.grnet.aquarium.charging.ChargingBehavior]] for VMs usage.
*/
final class VMChargingBehavior extends ChargingBehaviorSkeleton(List(PowerStatus)) {
def computeCreditsToSubtract(
- workingResourceInstanceChargingState: WorkingResourceInstanceChargingState,
- oldCredits: Double,
+ resourceInstanceChargingState: ResourceInstanceChargingStateMsg,
+ oldCredits: CreditsModel.Type,
timeDeltaMillis: Long,
unitPrice: Double
- ): (Double /* credits */, String /* explanation */) = {
+ ): (CreditsModel.Type, String /* explanation */) = {
val credits = HrsOfMillis(timeDeltaMillis) * unitPrice
val explanation = "Hours(%s) * UnitPrice(%s)".format(HrsOfMillis(timeDeltaMillis), unitPrice)
}
def computeSelectorPath(
- workingChargingBehaviorDetails: mutable.Map[String, Any],
- workingResourceInstanceChargingState: WorkingResourceInstanceChargingState,
- currentResourceEvent: ResourceEventModel,
- referenceTimeslot: Timeslot,
- totalCredits: Double
+ chargingBehaviorDetails: DetailsModel.Type,
+ resourceInstanceChargingState: ResourceInstanceChargingStateMsg,
+ currentResourceEvent: ResourceEventMsg,
+ referenceFromMillis: Long,
+ referenceToMillis: Long,
+ totalCredits: CreditsModel.Type
): List[String] = {
- (currentResourceEvent.value.toInt,workingResourceInstanceChargingState.previousEvents) match {
+ val previousEvents = resourceInstanceChargingState.getPreviousEvents.asScala.toList
+ (currentResourceEvent.getValue.toInt,previousEvents) match {
case (1,Nil) => // create --> on
//List(Power.create)
Nil
- case (x,hd::_) => (x,hd.value.toInt) match {
+ case (x,hd::_) => (x,hd.getValue.toInt) match {
case (1,0) => // off ---> on
List(Power.powerOff)
case (0,1) => // on ---> off
//List(Power.powerOff,Power.destroy)
Nil
case _ =>
- throw new Exception("Invalid state")
+ throw new AquariumInternalError("Invalid state") // FIXME better message
}
case _ =>
- throw new Exception("Invalid state")
+ throw new AquariumInternalError("Invalid state") // FIXME better message
}
}
- def initialChargingDetails: Map[String, Any] = Map()
+ def initialChargingDetails = {
+ DetailsModel.make
+ }
def computeNewAccumulatingAmount(
- workingResourceInstanceChargingState: WorkingResourceInstanceChargingState,
- eventDetails: Map[String, String]
- ): Double = {
- workingResourceInstanceChargingState.currentValue
+ resourceInstanceChargingState: ResourceInstanceChargingStateMsg,
+ eventDetails: DetailsModel.Type
+ ) = {
+ CreditsModel.from(resourceInstanceChargingState.getCurrentValue)
}
- def constructImplicitEndEventFor(resourceEvent: ResourceEventModel, newOccurredMillis: Long) = {
- assert(VMChargingBehaviorValues.isONValue(resourceEvent.value))
+ def constructImplicitEndEventFor(resourceEvent: ResourceEventMsg, newOccurredMillis: Long) = {
+ assert(VMChargingBehaviorValues.isONValue(resourceEvent.getValue))
- val details = resourceEvent.details
- val newDetails = ResourceEventModel.setAquariumSyntheticAndImplicitEnd(details)
- val newValue = VMChargingBehaviorValues.OFF
+ val details = resourceEvent.getDetails
+ val newDetails = DetailsModel.copyOf(details)
+ MessageHelpers.setAquariumSyntheticAndImplicitEnd(newDetails)
- resourceEvent.withDetailsAndValue(newDetails, newValue, newOccurredMillis)
+ ResourceEventMsg.newBuilder(resourceEvent).
+ setDetails(newDetails).
+ setOccurredMillis(newOccurredMillis).
+ setReceivedMillis(newOccurredMillis).
+ setValue(VMChargingBehaviorValues.OFF.toString).
+ build()
}
- def constructImplicitStartEventFor(resourceEvent: ResourceEventModel) = {
- throw new AquariumInternalError("constructImplicitStartEventFor() Not compliant with %s".format(this))
+ def constructImplicitStartEventFor(resourceEvent: ResourceEventMsg) = {
+ throw new AquariumInternalError("constructImplicitStartEventFor() Not compliant with %s", this)
}
/**
*/
override def processResourceEvent(
aquarium: Aquarium,
- resourceEvent: ResourceEventModel,
- resourceType: ResourceType,
+ resourceEvent: ResourceEventMsg,
+ resourceType: ResourceTypeMsg,
billingMonthInfo: BillingMonthInfo,
- workingResourcesChargingState: WorkingResourcesChargingState,
- userAgreements: AgreementHistoryModel,
- totalCredits: Double,
- walletEntryRecorder: WalletEntry ⇒ Unit
- ): (Int, Double) = {
+ resourcesChargingState: ResourcesChargingStateMsg,
+ userStateModel: UserStateModel,
+ walletEntryRecorder: WalletEntryMsg ⇒ Unit
+ ): (Int, CreditsModel.Type) = {
// 1. Ensure proper initial state per resource and per instance
- ensureInitializedWorkingState(workingResourcesChargingState,resourceEvent)
+ ensureInitializedWorkingState(resourcesChargingState,resourceEvent)
// 2. Fill in data from the new event
- val stateOfResourceInstance = workingResourcesChargingState.stateOfResourceInstance
- val workingResourcesChargingStateDetails = workingResourcesChargingState.details
- val instanceID = resourceEvent.instanceID
- val workingResourceInstanceChargingState = stateOfResourceInstance(instanceID)
- fillWorkingResourceInstanceChargingStateFromEvent(workingResourceInstanceChargingState, resourceEvent)
-
- val retVal = workingResourceInstanceChargingState.previousEvents.headOption match {
- case Some(previousEvent) ⇒
- Debug(logger, "I have previous event %s", previousEvent.toDebugString)
+ val stateOfResourceInstance = resourcesChargingState.getStateOfResourceInstance
+ val resourcesChargingStateDetails = resourcesChargingState.getDetails
+ val instanceID = resourceEvent.getInstanceID
+ val resourceInstanceChargingState = stateOfResourceInstance.get(instanceID)
+ fillWorkingResourceInstanceChargingStateFromEvent(resourceInstanceChargingState, resourceEvent)
+
+ val userAgreementHistoryModel = userStateModel.userAgreementHistoryModel
+ val previousEvents = resourceInstanceChargingState.getPreviousEvents
+ val retVal = previousEvents.size() match {
+ case 0 ⇒
+ (0,0.0D)
+
+ case _ ⇒
+ val previousEvent = previousEvents.get(0) // head is most recent
+ Debug(logger, "I have previous event %s", AvroHelpers.jsonStringOfSpecificRecord(previousEvent))
+
computeWalletEntriesForNewEvent(
resourceEvent,
resourceType,
billingMonthInfo,
- totalCredits,
- Timeslot(previousEvent.occurredMillis, resourceEvent.occurredMillis),
- userAgreements.agreementByTimeslot,
- workingResourcesChargingStateDetails,
- workingResourceInstanceChargingState,
- aquarium.policyStore,
+ userStateModel.totalCredits,
+ previousEvent.getOccurredMillis,
+ resourceEvent.getOccurredMillis,
+ userAgreementHistoryModel.agreementByTimeslot,
+ resourcesChargingStateDetails,
+ resourceInstanceChargingState,
+ aquarium,
walletEntryRecorder
)
- case None ⇒
- (0,0.0D)
}
+
// We need just one previous event, so we update it
- workingResourceInstanceChargingState.setOnePreviousEvent(resourceEvent)
+ MessageHelpers.setOnePreviousEvent(resourceInstanceChargingState, resourceEvent)
retVal
}
resourceTypeName: String,
resourceInstanceID: String,
eventOccurredMillis: Long,
- workingResourceInstanceChargingState: WorkingResourceInstanceChargingState
- ): List[ResourceEventModel] = {
- //
- def vmEvent(value:Long) : List[ResourceEventModel] =
- StdResourceEvent(
+ resourceInstanceChargingState: ResourceInstanceChargingStateMsg
+ ): List[ResourceEventMsg] = {
+ val resourceInstanceID = resourceInstanceChargingState.getInstanceID
+
+ def vmEvent(value: String) : List[ResourceEventMsg] = {
+ val dm = DetailsModel.make
+ DetailsModel.setBoolean(dm, MessageConstants.DetailsKeys.aquarium_is_synthetic)
+ DetailsModel.setBoolean(dm, MessageConstants.DetailsKeys.aquarium_is_realtime_virtual)
+
+ MessageFactory.newResourceEventMsg(
ChargingBehavior.VirtualEventsIDGen.nextUID(),
eventOccurredMillis,
eventOccurredMillis,
"aquarium",
resourceTypeName,
resourceInstanceID,
- value.toDouble,
- EventModel.EventVersion_1_0,
- Map(
- ResourceEventModel.Names.details_aquarium_is_synthetic -> "true",
- ResourceEventModel.Names.details_aquarium_is_realtime_virtual -> "true"
- )
+ value,
+ MessageConstants.EventVersion_1_0,
+ dm
) :: Nil
- //
- workingResourceInstanceChargingState.previousEvents.headOption match {
- case None => Nil
- case Some(hd) => hd.value.toInt match {
- case 0 => vmEvent(1) //produce an on event
- case 1 => vmEvent(0) //produce an off event
- case 2 => vmEvent(0) //produce an off event
+ }
+
+ def mkON = vmEvent(VMChargingBehaviorValues.ON)
+ def mkOFF = vmEvent(VMChargingBehaviorValues.OFF)
+
+ val previousEvents = resourceInstanceChargingState.getPreviousEvents
+ previousEvents.size() match {
+ case 0 ⇒ Nil
+ case _ ⇒
+
+ previousEvents.get(0).getValue.toInt match {
+ case 0 ⇒ mkON //produce an on event
+ case 1 ⇒ mkOFF //produce an off event
+ case 2 ⇒ mkOFF //produce an off event
}
}
}
* @author Christos KK Loverdos <loverdos@gmail.com>
*/
-object VMChargingBehaviorValues {
- final val DESTROY = 2.0
- final val ON = 1.0
- final val OFF = 0.0
+final object VMChargingBehaviorValues {
+ final val DESTROY = "2"
+ final val DESTROY_INT = DESTROY.toInt
+ final val ON = "1"
+ final val ON_INT = ON.toInt
+ final val OFF = "0"
+ final val OFF_INT = OFF.toInt
- @inline final def isDESTROYValue(value: Double) = value == DESTROY
- @inline final def isONValue (value: Double) = value == ON
- @inline final def isOFFValue (value: Double) = value == OFF
+ final def isDESTROYValue(value: String) = {
+ (value == DESTROY) || {
+ try value.toInt == DESTROY_INT
+ catch { case _ ⇒ false}
+ }
+ }
+
+ final def isONValue(value: String) = {
+ (value == ON) || {
+ try value.toInt == ON_INT
+ catch { case _ ⇒ false}
+ }
+ }
+
+ final def isOFFValue(value: String) = {
+ (value == OFF) || {
+ try value.toInt == OFF_INT
+ catch { case _ ⇒ false}
+ }
+ }
}
-package gr.grnet.aquarium.charging.bill
-
-import gr.grnet.aquarium.charging.state.WorkingUserState
-import gr.grnet.aquarium.util.json.JsonSupport
-import com.ckkloverdos.resource.FileStreamResource
-import java.io.File
-import com.ckkloverdos.props.Props
-import gr.grnet.aquarium.converter.{CompactJsonTextFormat, PrettyJsonTextFormat, StdConverters}
-import gr.grnet.aquarium.{Aquarium, ResourceLocator, AquariumBuilder}
-import gr.grnet.aquarium.store.memory.MemStoreProvider
-import gr.grnet.aquarium.converter.StdConverters._
-import scala._
-import gr.grnet.aquarium.logic.accounting.dsl.Timeslot
-import java.util.concurrent.atomic.AtomicLong
-import java.util.{Date, Calendar, GregorianCalendar}
-import gr.grnet.aquarium.charging.wallet.WalletEntry
-import scala.collection.parallel.mutable
-import scala.collection.mutable.ListBuffer
-import gr.grnet.aquarium.Aquarium.EnvKeys
-import gr.grnet.aquarium.charging.Chargeslot
-import scala.collection.immutable.TreeMap
-import scala.Some
-import gr.grnet.aquarium.charging.Chargeslot
-
-
/*
* Copyright 2011-2012 GRNET S.A. All rights reserved.
*
* or implied, of GRNET S.A.
*/
+package gr.grnet.aquarium.charging.bill
+
+import com.ckkloverdos.props.Props
+import com.ckkloverdos.resource.FileStreamResource
+import gr.grnet.aquarium.converter.{CompactJsonTextFormat, StdConverters}
+import gr.grnet.aquarium.logic.accounting.dsl.Timeslot
+import gr.grnet.aquarium.message.avro.MessageHelpers
+import gr.grnet.aquarium.message.avro.gen.{ChargeslotMsg, WalletEntryMsg, UserStateMsg}
+import gr.grnet.aquarium.store.memory.MemStoreProvider
+import gr.grnet.aquarium.util.json.JsonSupport
+import gr.grnet.aquarium.{Aquarium, ResourceLocator, AquariumBuilder}
+import java.io.File
+import java.util.concurrent.atomic.AtomicLong
+import scala.collection.immutable.TreeMap
+import scala.collection.mutable.ListBuffer
+
/*
* @author Prodromos Gerakios <pgerakios@grnet.gr>
Timeslot(dstart,dend)
} */
- private[this] def toChargeEntry(c:Chargeslot) : ChargeEntry = {
- val unitPrice = c.unitPrice.toString
- val startTime = c.startMillis.toString
- val endTime = c.stopMillis.toString
- val difTime = (c.stopMillis - c.startMillis).toString
- val credits = c.creditsToSubtract.toString
+ private[this] def toChargeEntry(c:ChargeslotMsg) : ChargeEntry = {
+ val unitPrice = c.getUnitPrice.toString
+ val startTime = c.getStartMillis.toString
+ val endTime = c.getStopMillis.toString
+ val difTime = (c.getStopMillis - c.getStartMillis).toString
+ val credits = c.getCreditsToSubtract.toString
new ChargeEntry(counter.getAndIncrement.toString,unitPrice,
startTime,endTime,difTime,credits)
}
- private[this] def toEventEntry(eventType:String,c:Chargeslot) : EventEntry =
+ private[this] def toEventEntry(eventType:String,c:ChargeslotMsg) : EventEntry =
new EventEntry(eventType,List(toChargeEntry(c)))
- private[this] def toResourceEntry(w:WalletEntry) : ResourceEntry = {
- assert(w.sumOfCreditsToSubtract==0.0 || w.chargslotCount > 0)
- val rcType = w.resourceType.name
+ private[this] def toResourceEntry(w:WalletEntryMsg) : ResourceEntry = {
+ assert(w.getSumOfCreditsToSubtract==0.0 || MessageHelpers.chargeslotCountOf(w) > 0)
+ val rcType = w.getResourceType.getName
val rcName = rcType match {
case "diskspace" =>
- w.currentResourceEvent.details("path")
+ String.valueOf(MessageHelpers.currentResourceEventOf(w).getDetails.get("path"))
case _ =>
- w.currentResourceEvent.instanceID
+ MessageHelpers.currentResourceEventOf(w).getInstanceID
}
- val rcUnitName = w.resourceType.unit
+ val rcUnitName = w.getResourceType.getUnit
val eventEntry = new ListBuffer[EventEntry]
- val credits = w.sumOfCreditsToSubtract
+ val credits = w.getSumOfCreditsToSubtract
val eventType = //TODO: This is hardcoded; find a better solution
rcType match {
case "diskspace" =>
- val action = w.currentResourceEvent.details("action")
- val path = w.currentResourceEvent.details("path")
+ val action = MessageHelpers.currentResourceEventOf(w).getDetails.get("action")
+ val path = MessageHelpers.currentResourceEventOf(w).getDetails.get("path")
//"%s@%s".format(action,path)
action
case "vmtime" =>
- w.currentResourceEvent.value.toInt match {
+ MessageHelpers.currentResourceEventOf(w).getValue.toInt match {
case 0 => // OFF
"offOn"
case 1 => // ON
"once"
}
- for { c <- w.chargeslots }{
- if(c.creditsToSubtract != 0.0) {
+ import scala.collection.JavaConverters.asScalaBufferConverter
+ for { c <- w.getChargeslots.asScala }{
+ if(c.getCreditsToSubtract != 0.0) {
//Console.err.println("c.creditsToSubtract : " + c.creditsToSubtract)
eventEntry += toEventEntry(eventType.toString,c)
//credits += c.creditsToSubtract
new ResourceEntry(rcName,rcType,rcUnitName,credits.toString,eventEntry.toList)
}
- private[this] def resourceEntriesAt(t:Timeslot,w:WorkingUserState) : (List[ResourceEntry],Double) = {
+ private[this] def resourceEntriesAt(t:Timeslot,w:UserStateMsg) : (List[ResourceEntry],Double) = {
val ret = new ListBuffer[ResourceEntry]
var sum = 0.0
//Console.err.println("Wallet entries: " + w.walletEntries)
- val walletEntries = w.walletEntries
+ import scala.collection.JavaConverters.asScalaBufferConverter
+ val walletEntries = w.getWalletEntries.asScala
/*Console.err.println("Wallet entries ")
for { i <- walletEntries }
Console.err.println("WALLET ENTRY\n%s\nEND WALLET ENTRY".format(i.toJsonString))
Console.err.println("End wallet entries")*/
for { i <- walletEntries} {
- if(t.contains(i.referenceTimeslot) && i.sumOfCreditsToSubtract != 0.0){
+ val referenceTimeslot = MessageHelpers.referenceTimeslotOf(i)
+ if(t.contains(referenceTimeslot) && i.getSumOfCreditsToSubtract.toDouble != 0.0){
/*Console.err.println("i.sumOfCreditsToSubtract : " + i.sumOfCreditsToSubtract)*/
- if(i.sumOfCreditsToSubtract > 0.0D) sum += i.sumOfCreditsToSubtract
+ if(i.getSumOfCreditsToSubtract.toDouble > 0.0D) sum += i.getSumOfCreditsToSubtract.toDouble
ret += toResourceEntry(i)
} else {
/*Console.err.println("WALLET ENTERY : " + i.toJsonString + "\n" +
}.values.toList
}
- def fromWorkingUserState(t:Timeslot,userID:String,w:Option[WorkingUserState]) : AbstractBillEntry = {
+ def fromWorkingUserState(t:Timeslot,userID:String,w:Option[UserStateMsg]) : AbstractBillEntry = {
val ret = w match {
case None =>
new BillEntry(counter.getAndIncrement.toString,
Console.err.println("Working user state: %s".format(w.toString))
new BillEntry(counter.getAndIncrement.toString,
userID,"ok",
- w.totalCredits.toString,
+ w.getTotalCredits.toString,
rcEntriesCredits.toString,
t.from.getTime.toString,t.to.getTime.toString,
resMap)
+++ /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.charging.state
-
-import scala.collection.immutable
-import gr.grnet.aquarium.logic.accounting.dsl.Timeslot
-import gr.grnet.aquarium.policy.UserAgreementModel
-
-/**
- * The whole history of of a user's agreements.
- *
- * @author Christos KK Loverdos <loverdos@gmail.com>
- */
-
-case class AgreementHistory(agreements: List[UserAgreementModel]) extends AgreementHistoryModel {
- def toWorkingAgreementHistory = {
- (new WorkingAgreementHistory) ++ agreements
- }
-
- def agreementByTimeslot: immutable.SortedMap[Timeslot, UserAgreementModel] = {
- immutable.TreeMap(agreements.map(ag ⇒ (ag.timeslot, ag)): _*)
- }
-
- /**
- * Returns the first, chronologically, agreement.
- */
- def firstAgreement: Option[UserAgreementModel] = {
- agreementByTimeslot.valuesIterator.toList.lastOption
- }
-
- /**
- * Returns the last, chronologically, agreement.
- */
- def lastAgreement: Option[UserAgreementModel] = {
- agreementByTimeslot.valuesIterator.toList.headOption
- }
-}
-
-object AgreementHistory {
- final val Empty = AgreementHistory(Nil)
-
- def initial(userAgreement: UserAgreementModel): AgreementHistory = {
- AgreementHistory(userAgreement :: Nil)
- }
-}
+++ /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.charging.state
-
-import gr.grnet.aquarium.policy.UserAgreementModel
-import scala.collection.immutable
-import gr.grnet.aquarium.logic.accounting.dsl.Timeslot
-
-/**
- *
- * @author Christos KK Loverdos <loverdos@gmail.com>
- */
-trait AgreementHistoryModel {
- def size = agreements.size
-
- def agreements: Traversable[UserAgreementModel]
-
- def agreementByTimeslot: immutable.SortedMap[Timeslot, UserAgreementModel]
-}
+++ /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.charging.state
-
-import scala.collection.mutable
-
-import gr.grnet.aquarium.event.model.resource.ResourceEventModel
-
-/**
- *
- * @author Christos KK Loverdos <loverdos@gmail.com>
- */
-case class ResourceInstanceChargingState(
- details: Map[String, Any],
- previousEvents: List[ResourceEventModel],
- // the implicitly issued resource event at the beginning of the billing period.
- implicitlyIssuedStartEvents: List[ResourceEventModel],
- accumulatingAmount: Double,
- oldAccumulatingAmount: Double,
- previousValue: Double,
- currentValue: Double
-) extends ResourceInstanceChargingStateModel {
-
- def mutableDetails = mutable.Map(this.details.toSeq:_*)
-
- def toWorkingResourceInstanceChargingState = {
- new WorkingResourceInstanceChargingState(
- details = mutableDetails,
- previousEvents = this.previousEvents,
- implicitlyIssuedStartEvents = this.implicitlyIssuedStartEvents,
- accumulatingAmount = this.accumulatingAmount,
- oldAccumulatingAmount = this.oldAccumulatingAmount,
- previousValue = this.previousValue,
- currentValue = this.currentValue
- )
- }
-}
+++ /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.charging.state
-
-import scala.collection.mutable
-
-/**
- *
- * @author Christos KK Loverdos <loverdos@gmail.com>
- */
-case class ResourcesChargingState(
- details: Map[String, Any],
- stateOfResourceInstance: Map[String /* InstanceID */, ResourceInstanceChargingState]
-) {
-
- def mutableDetails = mutable.Map(this.details.toSeq:_*)
-
- def mutableStateOfResourceInstance = mutable.Map((
- for((k, v) ← this.stateOfResourceInstance)
- yield (k, v.toWorkingResourceInstanceChargingState)
- ).toSeq: _*
- )
-
- def toWorkingResourcesChargingState = {
- new WorkingResourcesChargingState(
- details = mutableDetails,
- stateOfResourceInstance = mutableStateOfResourceInstance
- )
- }
-}
+++ /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.charging.state
-
-import gr.grnet.aquarium.policy.UserAgreementModel
-import gr.grnet.aquarium.charging.wallet.WalletEntry
-import gr.grnet.aquarium.AquariumInternalError
-import gr.grnet.aquarium.computation.BillingMonthInfo
-import gr.grnet.aquarium.converter.{StdConverters, JsonTextFormat}
-
-/**
- *
- * @author Christos KK Loverdos <loverdos@gmail.com>
- */
-
-final case class StdUserState(
- id: String,
- parentIDInStore: Option[String],
- userID: String,
- occurredMillis: Long,
- latestResourceEventOccurredMillis: Long,
- totalCredits: Double,
- isFullBillingMonth: Boolean,
- billingYear: Int,
- billingMonth: Int,
- stateOfResources: Map[String, ResourcesChargingState],
- billingPeriodOutOfSyncResourceEventsCounter: Long,
- agreementHistory: AgreementHistory,
- walletEntries: List[WalletEntry]
-) extends UserStateModelSkeleton {
-}
-
-final object StdUserState {
- final val ResourceInstanceSeparator = "<:/:>"
- final val ResourceInstanceSeparatorLength = ResourceInstanceSeparator.length
-
- final def fromJsonTextFormat(jsonTextFormat: JsonTextFormat): StdUserState = {
- StdConverters.AllConverters.convertEx[StdUserState](jsonTextFormat)
- }
-
- final def fromJsonString(json: String): StdUserState = {
- fromJsonTextFormat(JsonTextFormat(json))
- }
-
- final def stringOfResourceAndInstanceID(resource: String, instanceID: String): String = {
- def check(key: String, value: String) = {
- if(value.indexOf(ResourceInstanceSeparator) != -1) {
- throw new AquariumInternalError(
- "The resource/instanceID separator '%s' is part of the %s '%s'".format(
- ResourceInstanceSeparator, key, value
- ))
- }
- }
-
- check("resource type", resource)
- check("resource instance ID", instanceID)
-
- resource + ResourceInstanceSeparator + instanceID
- }
-
- final def resourceAndInstanceIDOfString(resourceAndInstanceID: String): (String, String) = {
- val index = resourceAndInstanceID.indexOf(ResourceInstanceSeparator)
- val resource = resourceAndInstanceID.substring(0, index)
- val instanceID = resourceAndInstanceID.substring(index + ResourceInstanceSeparatorLength)
-
- (resource, instanceID)
- }
-
- def createInitialUserState(
- userID: String,
- userCreationMillis: Long,
- occurredMillis: Long,
- totalCredits: Double,
- initialAgreement: UserAgreementModel
- ): StdUserState = {
-
- val bmi = BillingMonthInfo.fromMillis(occurredMillis)
-
- StdUserState(
- "",
- None,
- userID,
- userCreationMillis,
- 0L, // FIXME is this correct?
- totalCredits,
- false,
- bmi.year,
- bmi.month,
- Map(),
- 0L,
- AgreementHistory.initial(initialAgreement),
- Nil
- )
- }
-
- def createInitialUserStateFromBootstrap(
- usb: UserStateBootstrap,
- occurredMillis: Long
- ): StdUserState = {
-
- createInitialUserState(
- usb.userID,
- usb.userCreationMillis,
- occurredMillis,
- usb.initialCredits,
- usb.initialAgreement
- )
- }
-}
-
package gr.grnet.aquarium.charging.state
-import scala.collection.immutable
-import gr.grnet.aquarium.policy.{PolicyDefinedFullPriceTableRef, StdUserAgreement, UserAgreementModel}
-import gr.grnet.aquarium.util.json.JsonSupport
import gr.grnet.aquarium.logic.accounting.dsl.Timeslot
+import gr.grnet.aquarium.policy.UserAgreementModel
+import gr.grnet.aquarium.util.json.JsonSupport
+import scala.collection.immutable
+import gr.grnet.aquarium.message.avro.gen.UserAgreementHistoryMsg
+import gr.grnet.aquarium.message.avro.ModelFactory
/**
*
* @author Christos KK Loverdos <loverdos@gmail.com>
*/
-final case class WorkingAgreementHistory(
- var agreements: immutable.SortedSet[UserAgreementModel] = immutable.SortedSet[UserAgreementModel]()
-) extends AgreementHistoryModel with JsonSupport {
+final case class UserAgreementHistoryModel(
+ msg: UserAgreementHistoryMsg
+) extends JsonSupport {
+
+ private var _userAgreementModels: immutable.SortedSet[UserAgreementModel] = {
+ var userAgreementModels = immutable.SortedSet[UserAgreementModel]()
+ val userAgreements = msg.getAgreements.iterator()
+ while(userAgreements.hasNext) {
+ val userAgreement = userAgreements.next()
+ val userAgreementModel = ModelFactory.newUserAgreementModel(userAgreement)
+ this._userAgreementModels += userAgreementModel
+ }
+
+ userAgreementModels
+ }
+
+ def size: Int = msg.getAgreements.size()
def agreementByTimeslot: immutable.SortedMap[Timeslot, UserAgreementModel] = {
- immutable.TreeMap(agreements.map(ag ⇒ (ag.timeslot, ag)).toSeq: _*)
+ immutable.TreeMap(_userAgreementModels.map(ag ⇒ (ag.timeslot, ag)).toSeq: _*)
}
- def setFrom(that: WorkingAgreementHistory): this.type = {
- this.agreements = that.agreements
+ def setFrom(that: UserAgreementHistoryModel): this.type = {
+ this._userAgreementModels = that._userAgreementModels
this
}
def +(userAgreement: UserAgreementModel): this.type = {
- agreements += userAgreement
+ msg.getAgreements.add(userAgreement.msg)
+ _userAgreementModels += userAgreement
this
}
def +=(userAgreement: UserAgreementModel): Unit = {
- agreements += userAgreement
+ msg.getAgreements.add(userAgreement.msg)
+ _userAgreementModels += userAgreement
}
def ++(userAgreements: Traversable[UserAgreementModel]): this.type = {
- agreements ++= userAgreements
+ for(userAgreement ← userAgreements) {
+ msg.getAgreements.add(userAgreement.msg)
+ }
+ _userAgreementModels ++= userAgreements
this
}
def ++=(userAgreements: Traversable[UserAgreementModel]): Unit = {
- agreements ++= userAgreements
+ for(userAgreement ← userAgreements) {
+ msg.getAgreements.add(userAgreement.msg)
+ }
+ _userAgreementModels ++= userAgreements
}
- def oldestAgreement: Option[UserAgreementModel] = {
- agreements.headOption
+ def oldestAgreementModel: Option[UserAgreementModel] = {
+ _userAgreementModels.headOption
}
- def newestAgreement: Option[UserAgreementModel] = {
- agreements.lastOption
+ def newestAgreementModel: Option[UserAgreementModel] = {
+ _userAgreementModels.lastOption
}
- def agreementInEffectWhen(whenMillis: Long): Option[UserAgreementModel] = {
- agreements.to(
- StdUserAgreement("", None, whenMillis, Long.MaxValue, "", PolicyDefinedFullPriceTableRef())
- ).lastOption
- }
-
- def toAgreementHistory = {
- AgreementHistory(agreements.toList)
- }
+// def agreementInEffectWhen(whenMillis: Long): Option[UserAgreementModel] = {
+// agreements.to(
+// UserAgreementModel("", None, whenMillis, Long.MaxValue, "", PolicyDefinedFullPriceTableRef())
+// ).lastOption
+// }
}
package gr.grnet.aquarium.charging.state
import gr.grnet.aquarium.policy.UserAgreementModel
+import gr.grnet.aquarium.event.CreditsModel
/**
* This is used to bootstrap the [[gr.grnet.aquarium.charging.state.UserStateModel]].
*/
case class UserStateBootstrap(
- userID: String,
- userCreationMillis: Long,
initialAgreement: UserAgreementModel,
- initialCredits: Double
-)
+ initialCredits: CreditsModel.Type
+) {
+ def userID = initialAgreement.msg.getUserID
+
+ def userCreationMillis = initialAgreement.msg.getValidFromMillis
+}
package gr.grnet.aquarium.charging.state
-import gr.grnet.aquarium.charging.wallet.WalletEntry
-import gr.grnet.aquarium.policy.ResourceType
+import gr.grnet.aquarium.message.avro.gen.UserStateMsg
import gr.grnet.aquarium.util.json.JsonSupport
+import gr.grnet.aquarium.event.CreditsModel
/**
*
+ * A wrapper around [[gr.grnet.aquarium.message.avro.gen.UserStateMsg]] with convenient (sorted)
+ * user agreement history.
+ *
* @author Christos KK Loverdos <loverdos@gmail.com>
*/
-trait UserStateModel extends JsonSupport {
- def id: String
+final case class UserStateModel(
+ msg: UserStateMsg,
+ var userAgreementHistoryModel: UserAgreementHistoryModel
+) extends JsonSupport {
- def idInStore: String = id
+ def updateLatestResourceEventOccurredMillis(millis: Long): Unit = {
+ if(millis > this.msg.getLatestResourceEventOccurredMillis) {
+ this.msg.setLatestResourceEventOccurredMillis(millis)
+ }
+ }
- def parentIDInStore: Option[String]
+ def userID = msg.getUserID
- def userID: String
+ def latestResourceEventOccurredMillis = this.msg.getLatestResourceEventOccurredMillis
- def occurredMillis: Long // When this user state was computed
+ def subtractCredits(credits: CreditsModel.Type) {
+ val oldTotal = CreditsModel.from(msg.getTotalCredits)
+ val newTotal = CreditsModel.-(oldTotal, credits)
+ msg.setTotalCredits(CreditsModel.toTypeInMessage(newTotal))
+ }
- def latestResourceEventOccurredMillis: Long
+ @inline final def totalCredits: CreditsModel.Type = {
+ CreditsModel.from(msg.getTotalCredits)
+ }
- def totalCredits: Double
+// def newForImplicitEndsAsPreviousEvents(
+// previousResourceEvents: mutable.Map[(String, String), ResourceEventModel]
+// ) = {
+//
+// new WorkingUserState(
+// this.userID,
+// this.parentUserStateIDInStore,
+// this.chargingReason,
+// this.resourceTypesMap,
+// previousResourceEvents,
+// this.implicitlyIssuedStartEventOfResourceInstance,
+// this.accumulatingAmountOfResourceInstance,
+// this.chargingDataOfResourceInstance,
+// this.totalCredits,
+// this.workingAgreementHistory,
+// this.latestUpdateMillis,
+// this.latestResourceEventOccurredMillis,
+// this.billingPeriodOutOfSyncResourceEventsCounter,
+// this.walletEntries
+// )
+// }
+
+// def getChargingDataForResourceEvent(resourceAndInstanceInfo: (String, String)): mutable.Map[String, Any] = {
+// chargingDataOfResourceInstance.get(resourceAndInstanceInfo) match {
+// case Some(map) ⇒
+// map
+//
+// case None ⇒
+// val map = mutable.Map[String, Any]()
+// chargingDataOfResourceInstance(resourceAndInstanceInfo) = map
+// map
+//
+// }
+// }
+
+// def setChargingDataForResourceEvent(
+// resourceAndInstanceInfo: (String, String),
+// data: mutable.Map[String, Any]
+// ): Unit = {
+// chargingDataOfResourceInstance(resourceAndInstanceInfo) = data
+// }
/**
- * True iff this user state represents a full billing month.
- */
- def isFullBillingMonth: Boolean
-
- def billingYear: Int
-
- def billingMonth: Int
-
- def stateOfResources: Map[String, ResourcesChargingState]
-
- def billingPeriodOutOfSyncResourceEventsCounter: Long
-
- def agreementHistory: AgreementHistory
-
- def walletEntries: List[WalletEntry]
-
- def toWorkingUserState(resourceTypesMap: Map[String, ResourceType]): WorkingUserState
+ * Find those events from `implicitlyIssuedStartEvents` and `previousResourceEvents` that will generate implicit
+ * end events along with those implicitly issued events. Before returning, remove the events that generated the
+ * implicit ends from the internal state of this instance.
+ *
+ * @see [[gr.grnet.aquarium.charging.ChargingBehavior]]
+ */
+// def findAndRemoveGeneratorsOfImplicitEndEvents(
+// chargingBehaviorOfResourceType: ResourceType ⇒ ChargingBehavior,
+// /**
+// * The `occurredMillis` that will be recorded in the synthetic implicit OFFs.
+// * Normally, this will be the end of a billing month.
+// */
+// newOccuredMillis: Long
+// ): (List[ResourceEventModel], List[ResourceEventModel]) = {
+//
+// val buffer = mutable.ListBuffer[(ResourceEventModel, ResourceEventModel)]()
+// val checkSet = mutable.Set[ResourceEventModel]()
+//
+// def doItFor(map: mutable.Map[(String, String), ResourceEventModel]): Unit = {
+// val resourceEvents = map.valuesIterator
+// for {
+// resourceEvent ← resourceEvents
+// resourceType ← resourceTypesMap.get(resourceEvent.safeResource)
+// chargingBehavior = chargingBehaviorOfResourceType.apply(resourceType)
+// } {
+// if(chargingBehavior.supportsImplicitEvents) {
+// if(chargingBehavior.mustConstructImplicitEndEventFor(resourceEvent)) {
+// val implicitEnd = chargingBehavior.constructImplicitEndEventFor(resourceEvent, newOccuredMillis)
+//
+// if(!checkSet.contains(resourceEvent)) {
+// checkSet.add(resourceEvent)
+// buffer append ((resourceEvent, implicitEnd))
+// }
+//
+// // remove it anyway
+// map.remove((resourceEvent.safeResource, resourceEvent.safeInstanceID))
+// }
+// }
+// }
+// }
+//
+// doItFor(previousEventOfResourceInstance) // we give priority for previous events
+// doItFor(implicitlyIssuedStartEventOfResourceInstance) // ... over implicitly issued ones ...
+//
+// (buffer.view.map(_._1).toList, buffer.view.map(_._2).toList)
+// }
}
-
-object UserStateModel {
- trait NamesT {
- final val userID = "userID"
- final val occurredMillis = "occurredMillis"
- final val isFullBillingMonth = "isFullBillingMonth"
- final val billingYear = "billingYear"
- final val billingMonth = "billingMonth"
- }
-
- object Names extends NamesT
-}
\ No newline at end of file
+++ /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.charging.state
-
-import scala.collection.mutable
-import gr.grnet.aquarium.charging.wallet.WalletEntry
-import gr.grnet.aquarium.policy.ResourceType
-
-/**
- * Provides common, helper operations for a [[gr.grnet.aquarium.charging.state.UserStateModel]].
- *
- * @author Christos KK Loverdos <loverdos@gmail.com>
- */
-
-abstract class UserStateModelSkeleton extends UserStateModel {
- protected def mutableStateOfChargingBehavior: mutable.Map[String, WorkingResourcesChargingState] = {
- val contents = for((k, v) ← stateOfResources) yield (k, v.toWorkingResourcesChargingState)
- mutable.Map(contents.toSeq: _*)
- }
-
- protected def mutableWalletEntries = {
- val buffer = new mutable.ListBuffer[WalletEntry]
- buffer ++= this.walletEntries
- buffer
- }
-
- protected def mutableAgreementHistory = {
- this.agreementHistory.toWorkingAgreementHistory
- }
-
- def toWorkingUserState(resourceTypesMap: Map[String, ResourceType]): WorkingUserState = {
- new WorkingUserState(
- this.userID,
- this.parentIDInStore,
- resourceTypesMap,
- mutableStateOfChargingBehavior,
- this.totalCredits,
- mutableAgreementHistory,
- this.occurredMillis,
- this.latestResourceEventOccurredMillis,
- this.billingPeriodOutOfSyncResourceEventsCounter,
- mutableWalletEntries
- )
- }
-}
+++ /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.charging.state
-
-import scala.collection.mutable
-
-import gr.grnet.aquarium.event.model.resource.ResourceEventModel
-
-/**
- * Working (mutable) state of a resource instance, that is a `(resourceType, instanceID)`.
- *
- * @author Christos KK Loverdos <loverdos@gmail.com>
- */
-final class WorkingResourceInstanceChargingState(
- val details: mutable.Map[String, Any],
- var previousEvents: List[ResourceEventModel],
- // the implicitly issued resource event at the beginning of the billing period.
- var implicitlyIssuedStartEvents: List[ResourceEventModel],
- // Always the new accumulating amount
- var accumulatingAmount: Double,
- var oldAccumulatingAmount: Double,
- var previousValue: Double,
- var currentValue: Double
-) extends ResourceInstanceChargingStateModel {
-
- def toResourceInstanceChargingState = {
- new ResourceInstanceChargingState(
- details = immutableDetails,
- previousEvents = this.previousEvents,
- implicitlyIssuedStartEvents = this.implicitlyIssuedStartEvents,
- accumulatingAmount = this.accumulatingAmount,
- oldAccumulatingAmount = this.oldAccumulatingAmount,
- previousValue = this.previousValue,
- currentValue = this.currentValue
- )
- }
-
- def immutableDetails = this.details.toMap
-
- def setNewAccumulatingAmount(amount: Double) {
- this.oldAccumulatingAmount = this.accumulatingAmount
- this.accumulatingAmount = amount
- }
-
- def setNewCurrentValue(value: Double) {
- this.previousValue = this.currentValue
- this.currentValue = value
- }
-
- def setOnePreviousEvent(event: ResourceEventModel) {
- this.previousEvents = event :: Nil
- }
-}
+++ /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.charging.state
-
-import scala.collection.mutable
-import gr.grnet.aquarium.event.model.resource.ResourceEventModel
-
-/**
- * Working (mutable state) for resource instances of the same resource type.
- *
- * @param details Generic state related to the type of resource as a whole
- * @param stateOfResourceInstance A map from `instanceID` to
- * [[gr.grnet.aquarium.charging.state.WorkingResourceInstanceChargingState]].
- *
- * @author Christos KK Loverdos <loverdos@gmail.com>
- */
-final class WorkingResourcesChargingState(
- val details: mutable.Map[String /* any string */, Any],
- val stateOfResourceInstance: mutable.Map[String /* InstanceID */, WorkingResourceInstanceChargingState]
-) {
-
- def immutableDetails = Map(this.details.toSeq: _*)
-
- def immutableStateOfResourceInstance = Map((
- for((k, v) ← this.stateOfResourceInstance)
- yield (k, v.toResourceInstanceChargingState)
- ).toSeq:_*)
-
- def toResourcesChargingState = {
- ResourcesChargingState(
- details = immutableDetails,
- stateOfResourceInstance = immutableStateOfResourceInstance
- )
- }
-
- /**
- * Find the most recent (latest) holder of a resource event.
- */
-// def findResourceInstanceOfLatestEvent: Option[WorkingResourceInstanceChargingState] = {
-// stateOfResourceInstance.values.toArray.sortWith { (a, b) ⇒
-// (a.previousEvents, b.previousEvents
-// }
-// }
-}
+++ /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.charging.state
-
-import scala.collection.mutable
-import gr.grnet.aquarium.policy.ResourceType
-import gr.grnet.aquarium.event.model.resource.ResourceEventModel
-import gr.grnet.aquarium.util.json.JsonSupport
-import gr.grnet.aquarium.charging.wallet.WalletEntry
-
-/**
- * A mutable view of the [[gr.grnet.aquarium.charging.state.UserStateModel]].
- *
- * @author Christos KK Loverdos <loverdos@gmail.com>
- */
-
-final class WorkingUserState(
- val userID: String,
- var parentUserStateIDInStore: Option[String],
- val resourceTypesMap: Map[String, ResourceType],
- val workingStateOfResources: mutable.Map[String /* resourceType.name */, WorkingResourcesChargingState],
- var totalCredits: Double,
- val workingAgreementHistory: WorkingAgreementHistory,
- var latestUpdateMillis: Long, // last update of this working user state
- var latestResourceEventOccurredMillis: Long,
- var billingPeriodOutOfSyncResourceEventsCounter: Long,
- val walletEntries: mutable.ListBuffer[WalletEntry] // FIXME: not all in memory
-) extends JsonSupport {
-
- def updateLatestResourceEventOccurredMillis(millis: Long): Unit = {
- if(millis > this.latestResourceEventOccurredMillis) {
- this.latestResourceEventOccurredMillis = millis
- }
- }
-
- def immutableAgreementHistory = {
- this.workingAgreementHistory.toAgreementHistory
- }
-
- def immutableChargingBehaviorState = {
- val contents = for((k, v) ← this.workingStateOfResources) yield (k, v.toResourcesChargingState)
- Map(contents.toSeq:_*)
- }
-
- // TODO: Connect this user state to an originating parent working user state (if applicable) => new attribute
- def toUserState(
- isFullBillingMonth: Boolean,
- billingYear: Int,
- billingMonth: Int,
- id: String
- ) = {
- new StdUserState(
- id,
- this.parentUserStateIDInStore,
- this.userID,
- this.latestUpdateMillis,
- this.latestResourceEventOccurredMillis,
- this.totalCredits,
- isFullBillingMonth,
- billingYear,
- billingMonth,
- immutableChargingBehaviorState,
- billingPeriodOutOfSyncResourceEventsCounter,
- immutableAgreementHistory,
- walletEntries.toList
- )
- }
-
-// def newForImplicitEndsAsPreviousEvents(
-// previousResourceEvents: mutable.Map[(String, String), ResourceEventModel]
-// ) = {
-//
-// new WorkingUserState(
-// this.userID,
-// this.parentUserStateIDInStore,
-// this.chargingReason,
-// this.resourceTypesMap,
-// previousResourceEvents,
-// this.implicitlyIssuedStartEventOfResourceInstance,
-// this.accumulatingAmountOfResourceInstance,
-// this.chargingDataOfResourceInstance,
-// this.totalCredits,
-// this.workingAgreementHistory,
-// this.latestUpdateMillis,
-// this.latestResourceEventOccurredMillis,
-// this.billingPeriodOutOfSyncResourceEventsCounter,
-// this.walletEntries
-// )
-// }
-
- def findResourceType(name: String): Option[ResourceType] = {
- resourceTypesMap.get(name)
- }
-
-// def getChargingDataForResourceEvent(resourceAndInstanceInfo: (String, String)): mutable.Map[String, Any] = {
-// chargingDataOfResourceInstance.get(resourceAndInstanceInfo) match {
-// case Some(map) ⇒
-// map
-//
-// case None ⇒
-// val map = mutable.Map[String, Any]()
-// chargingDataOfResourceInstance(resourceAndInstanceInfo) = map
-// map
-//
-// }
-// }
-
-// def setChargingDataForResourceEvent(
-// resourceAndInstanceInfo: (String, String),
-// data: mutable.Map[String, Any]
-// ): Unit = {
-// chargingDataOfResourceInstance(resourceAndInstanceInfo) = data
-// }
-
- /**
- * Find those events from `implicitlyIssuedStartEvents` and `previousResourceEvents` that will generate implicit
- * end events along with those implicitly issued events. Before returning, remove the events that generated the
- * implicit ends from the internal state of this instance.
- *
- * @see [[gr.grnet.aquarium.charging.ChargingBehavior]]
- */
-// def findAndRemoveGeneratorsOfImplicitEndEvents(
-// chargingBehaviorOfResourceType: ResourceType ⇒ ChargingBehavior,
-// /**
-// * The `occurredMillis` that will be recorded in the synthetic implicit OFFs.
-// * Normally, this will be the end of a billing month.
-// */
-// newOccuredMillis: Long
-// ): (List[ResourceEventModel], List[ResourceEventModel]) = {
-//
-// val buffer = mutable.ListBuffer[(ResourceEventModel, ResourceEventModel)]()
-// val checkSet = mutable.Set[ResourceEventModel]()
-//
-// def doItFor(map: mutable.Map[(String, String), ResourceEventModel]): Unit = {
-// val resourceEvents = map.valuesIterator
-// for {
-// resourceEvent ← resourceEvents
-// resourceType ← resourceTypesMap.get(resourceEvent.safeResource)
-// chargingBehavior = chargingBehaviorOfResourceType.apply(resourceType)
-// } {
-// if(chargingBehavior.supportsImplicitEvents) {
-// if(chargingBehavior.mustConstructImplicitEndEventFor(resourceEvent)) {
-// val implicitEnd = chargingBehavior.constructImplicitEndEventFor(resourceEvent, newOccuredMillis)
-//
-// if(!checkSet.contains(resourceEvent)) {
-// checkSet.add(resourceEvent)
-// buffer append ((resourceEvent, implicitEnd))
-// }
-//
-// // remove it anyway
-// map.remove((resourceEvent.safeResource, resourceEvent.safeInstanceID))
-// }
-// }
-// }
-// }
-//
-// doItFor(previousEventOfResourceInstance) // we give priority for previous events
-// doItFor(implicitlyIssuedStartEventOfResourceInstance) // ... over implicitly issued ones ...
-//
-// (buffer.view.map(_._1).toList, buffer.view.map(_._2).toList)
-// }
-}
-
-object WorkingUserState {
- def fromUserState(userState: UserStateModel, resourceTypesMap: Map[String, ResourceType]): WorkingUserState = {
- null: WorkingUserState // FIXME implement
- }
-
- def makePreviousResourceEventMap(
- events: List[ResourceEventModel]
- ): mutable.Map[(String, String), ResourceEventModel] = {
-
- val map = mutable.Map[(String, String), ResourceEventModel]()
- for(event ← events) {
- map(event.safeResourceInstanceInfo) = event
- }
-
- map
- }
-}
+++ /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.charging
-package wallet
-
-import gr.grnet.aquarium.util.date.MutableDateCalc
-import gr.grnet.aquarium.logic.accounting.dsl.{Timeslot}
-import gr.grnet.aquarium.converter.{JsonTextFormat, StdConverters}
-import gr.grnet.aquarium.policy.ResourceType
-import gr.grnet.aquarium.event.model.resource.ResourceEventModel
-import gr.grnet.aquarium.util.json.JsonSupport
-
-/**
- * The following equation must hold: `newTotalCredits = oldTotalCredits - sumOfCreditsToSubtract`.
- *
- * @param userID The user ID this wallet entry is related to.
- * @param sumOfCreditsToSubtract The credit amount generated for this wallet entry.
- * @param oldTotalCredits
- * @param newTotalCredits
- * @param whenComputedMillis When the computation took place
- * @param billingYear
- * @param billingMonth
- * @param resourceEvents
- * @param chargeslots The details of the credit computation
- * @param resourceType
- *
- * @author Christos KK Loverdos <loverdos@gmail.com>
- */
-case class WalletEntry(
- userID: String,
- sumOfCreditsToSubtract: Double,
- oldTotalCredits: Double,
- newTotalCredits: Double,
- whenComputedMillis: Long,
- referenceTimeslot: Timeslot,
- billingYear: Int,
- billingMonth: Int,
- chargeslots: List[Chargeslot],
- resourceEvents: List[ResourceEventModel], // current is the last one
- resourceType: ResourceType,
- isSynthetic: Boolean
-) extends JsonSupport {
-
- def currentResourceEvent = resourceEvents match {
- case previous :: current :: Nil ⇒
- current
-
- case list ⇒
- list.head
- }
-
- def resource = currentResourceEvent.safeResource
-
- def instanceID = currentResourceEvent.safeInstanceID
-
- def chargslotCount = chargeslots.length
-
- def isOutOfSync = currentResourceEvent.isOutOfSyncForBillingMonth(billingYear, billingMonth)
-
- def toDebugString = "%s%s(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)".format(
- if(isSynthetic) "*" else "",
- gr.grnet.aquarium.util.shortClassNameOf(this),
- userID,
- referenceTimeslot,
- sumOfCreditsToSubtract,
- oldTotalCredits,
- newTotalCredits,
- new MutableDateCalc(whenComputedMillis).toYYYYMMDDHHMMSSSSS,
- billingYear,
- billingMonth,
- resourceEvents,
- chargeslots,
- resourceType
- )
-}
-
-object WalletEntry {
- def fromJson(json: String): WalletEntry = {
- StdConverters.AllConverters.convertEx[WalletEntry](JsonTextFormat(json))
- }
-
- object JsonNames {
- final val id = "id"
- final val sumOfCreditsToSubtract = "sumOfCreditsToSubtract"
- final val oldTotalCredits = "oldTotalCredits"
- final val newTotalCredits = "newTotalCredits"
- final val whenComputedMillis = "whenComputedMillis"
- final val yearOfBillingMonth = "yearOfBillingMonth"
- final val billingMonth = "billingMonth"
- final val currentResourceEvent = "currentResourceEvent"
- final val previousResourceEvent = "previousResourceEvent"
- final val chargeslots = "chargeslots"
- final val resourceDef = "resourceDef"
- }
-
-}
/**
* The billing month, in the range from 1 to 12.
*/
- final val month: Int) extends Ordered[BillingMonthInfo] {
+ final val month: Int,
+
+ /**
+ * The month day, starting from 1.
+ */
+ final val day: Int) extends Ordered[BillingMonthInfo] {
final val (monthStartMillis, monthStopMillis) = {
val mdc = new MutableDateCalc(year, month, 1)
override def equals(any: Any) = any match {
- case BillingMonthInfo(thatYear, thatMonth) ⇒
- this.year == thatYear && this.month == thatMonth // normally everything else MUST be the same by construction
+ case BillingMonthInfo(thatYear, thatMonth, thatDay) ⇒
+ this.year == thatYear &&
+ this.month == thatMonth &&
+ this.day == thatDay // normally everything else MUST be the same by construction
+
case _ ⇒
false
}
override def hashCode() = {
- 31 * year + month
+ 31 * (31 * year + month) + day
}
- override def toString = "%s(%s-%02d-01)".format(shortClassNameOf(this), year, month)
+ override def toString = "%s(%s-%02d-%02d)".format(shortClassNameOf(this), year, month, day)
def toDebugString = toString
- def toShortDebugString = "%s-%02d-01".format(year, month)
+ def toShortDebugString = "%s-%02d-%02d".format(year, month, day)
}
object BillingMonthInfo {
def fromDateCalc(mdc: MutableDateCalc): BillingMonthInfo = {
val year = mdc.getYear
val month = mdc.getMonthOfYear
+ val day = mdc.getDayOfMonth
- new BillingMonthInfo(year, month)
+ new BillingMonthInfo(year, month, day)
}
- def unapply(bmi: BillingMonthInfo): Option[(Int, Int)] = {
- Some((bmi.year, bmi.month))
+ def unapply(bmi: BillingMonthInfo): Option[(Int, Int, Int)] = {
+ Some((bmi.year, bmi.month, bmi.day))
}
}
import gr.grnet.aquarium.logic.accounting.dsl.Timeslot
import gr.grnet.aquarium.policy._
import collection.immutable
-import gr.grnet.aquarium.policy.EffectiveUnitPrice
-import gr.grnet.aquarium.charging.Chargeslot
+import gr.grnet.aquarium.policy.EffectiveUnitPriceModel
+import gr.grnet.aquarium.message.avro.gen.{EffectiveUnitPriceMsg, PolicyMsg, UserAgreementMsg, FullPriceTableMsg, EffectivePriceTableMsg, ChargeslotMsg}
/**
* Methods for converting accounting events to wallet entries.
* @param agreementTimeslots
* @return
*/
- protected
- def splitTimeslotByPoliciesAndAgreements(
+ private[this] def splitTimeslotByPoliciesAndAgreements(
referenceTimeslot: Timeslot,
policyTimeslots: List[Timeslot],
agreementTimeslots: List[Timeslot]
* algorithm and price unit is in effect.
*
*/
- protected
- def resolveEffectiveUnitPrices(
+ private[this] def resolveEffectiveUnitPrices(
alignedTimeslot: Timeslot,
policy: PolicyModel,
agreement: UserAgreementModel,
- effectivePriceTableSelector: FullPriceTable ⇒ EffectivePriceTable
+ fullPriceTableModelGetter: (UserAgreementModel, PolicyModel) ⇒ FullPriceTableModel,
+ effectivePriceTableModelSelector: FullPriceTableModel ⇒ EffectivePriceTableModel
): SortedMap[Timeslot, Double] = {
// Note that most of the code is taken from calcChangeChunks()
- val ret = resolveEffectiveUnitPricesForTimeslot(alignedTimeslot, policy, agreement, effectivePriceTableSelector)
+ val ret = resolveEffectiveUnitPricesForTimeslot(
+ alignedTimeslot,
+ policy,
+ agreement,
+ fullPriceTableModelGetter,
+ effectivePriceTableModelSelector)
ret map {case (t,p) => (t,p.unitPrice)}
}
referenceTimeslot: Timeslot,
policyByTimeslot: SortedMap[Timeslot, PolicyModel],
agreementByTimeslot: SortedMap[Timeslot, UserAgreementModel],
- effectivePriceTableSelector: FullPriceTable ⇒ EffectivePriceTable
- ): List[Chargeslot] = {
+ fullPriceTableModelGetter: (UserAgreementModel, PolicyModel) ⇒ FullPriceTableModel,
+ effectivePriceTableModelSelector: FullPriceTableModel ⇒ EffectivePriceTableModel
+ ): List[ChargeslotMsg] = {
val policyTimeslots = policyByTimeslot.keySet
val agreementTimeslots = agreementByTimeslot.keySet
alignedTimeslot,
policy,
userAgreement,
- effectivePriceTableSelector
+ fullPriceTableModelGetter,
+ effectivePriceTableModelSelector
)
// Now, the timeslots must be the same
val finegrainedTimeslots = unitPriceByTimeslot.keySet
- val chargeslots = for (finegrainedTimeslot ← finegrainedTimeslots) yield {
- Chargeslot(
- finegrainedTimeslot.from.getTime,
- finegrainedTimeslot.to.getTime,
- unitPriceByTimeslot(finegrainedTimeslot)
- )
+ val chargeslots = for(finegrainedTimeslot ← finegrainedTimeslots) yield {
+ val cs = new ChargeslotMsg
+
+ cs.setStartMillis(finegrainedTimeslot.from.getTime)
+ cs.setStopMillis(finegrainedTimeslot.to.getTime)
+ cs.setUnitPrice(unitPriceByTimeslot(finegrainedTimeslot))
+
+ cs
}
chargeslots.toList
*
* result: List(Timeslot(a.from, b.to), Timeslot(b.to, a.to))
*/
- private[computation] def alignTimeslots(a: List[Timeslot],
- b: List[Timeslot]): List[Timeslot] = {
+ private[this] def alignTimeslots(
+ a: List[Timeslot],
+ b: List[Timeslot]
+ ): List[Timeslot] = {
def safeTail(foo: List[Timeslot]) = foo match {
case Nil => List()
}
}
- type PriceMap = immutable.SortedMap[Timeslot, EffectiveUnitPrice]
- private type PriceList = List[EffectiveUnitPrice]
- private def emptyMap = immutable.SortedMap[Timeslot,EffectiveUnitPrice]()
+ type PriceMap = immutable.SortedMap[Timeslot, EffectiveUnitPriceModel]
+ private type PriceList = List[EffectiveUnitPriceModel]
+ private def emptyMap = immutable.SortedMap[Timeslot,EffectiveUnitPriceModel]()
/**
* Resolves the effective price list for each chunk of the
private[this] def resolveEffectiveUnitPricesForTimeslot(
alignedTimeslot: Timeslot,
policy: PolicyModel,
- agreement: UserAgreementModel,
- effectivePriceTableSelector: FullPriceTable ⇒ EffectivePriceTable
+ userAgreement: UserAgreementModel,
+ fullPriceTableModelGetter: (UserAgreementModel, PolicyModel) ⇒ FullPriceTableModel,
+ effectivePriceTableModelSelector: FullPriceTableModel ⇒ EffectivePriceTableModel
): PriceMap = {
- val fullPriceTable = agreement.computeFullPriceTable(policy)
- val effectivePriceTable = effectivePriceTableSelector(fullPriceTable)
+ val fullPriceTable = fullPriceTableModelGetter(userAgreement, policy)
+ val effectivePriceTable = effectivePriceTableModelSelector(fullPriceTable)
resolveEffective(alignedTimeslot, effectivePriceTable.priceOverrides)
//immutable.SortedMap(alignedTimeslot -> effectivePriceTable.priceOverrides.head)
}
- private def printPriceList(p: PriceList) : Unit = {
+ private[this] def printPriceList(p: PriceList) : Unit = {
Console.err.println("BEGIN PRICE LIST")
for { p1 <- p } Console.err.println(p1)
Console.err.println("END PRICE LIST")
}
- private def printPriceMap(m: PriceMap) = {
+ private[this] def printPriceMap(m: PriceMap) = {
Console.err.println("BEGIN PRICE MAP")
for { (t,p) <- m.toList } Console.err.println("Timeslot " + t + "\t\t" + p)
Console.err.println("END PRICE MAP")
}
- private def resolveEffective(alignedTimeslot: Timeslot,p:PriceList): PriceMap = {
+ private[this] def resolveEffective(alignedTimeslot: Timeslot,p:PriceList): PriceMap = {
//Console.err.println("\n\nInput timeslot: " + alignedTimeslot + "\n\n")
//printPriceList(p)
val ret = resolveEffective3(alignedTimeslot,p) //HERE
}
- private def resolveEffective3(alignedTimeslot: Timeslot, effectiveUnitPrices: PriceList): PriceMap =
+ private[this] def resolveEffective3(alignedTimeslot: Timeslot, effectiveUnitPrices: PriceList): PriceMap =
effectiveUnitPrices match {
case Nil =>
emptyMap
package gr.grnet.aquarium.connector.handler
-import gr.grnet.aquarium.converter.JsonTextFormat
-import gr.grnet.aquarium.event.model.ExternalEventModel
import com.ckkloverdos.maybe.{Just, Failed, MaybeEither}
+import gr.grnet.aquarium.converter.JsonTextFormat
import gr.grnet.aquarium.util.{LogHelpers, Loggable, safeUnit, shortInfoOf, shortClassNameOf}
/**
* Generic handler of events arriving to Aquarium.
*
- * We first parse them to JSON ([[gr.grnet.aquarium.converter.JsonTextFormat]]) and an appropriate event model
- * (`E <:` [[gr.grnet.aquarium.event.model.ExternalEventModel]]),
- * then store them to DB
- * and then forward them to business logic.
- *
- * All the above actions are given polymorphically via appropriate functions.
- *
* @author Christos KK Loverdos <loverdos@gmail.com>
*/
-class GenericPayloadHandler[E <: ExternalEventModel](
+class GenericPayloadHandler[E <: AnyRef: ClassManifest](
/**
* Parses payload bytes to a JSON string.
* The incoming payload must be in UTF-8.
package gr.grnet.aquarium.connector.handler
import gr.grnet.aquarium.Aquarium
-import gr.grnet.aquarium.actor.message.event.ProcessIMEvent
import gr.grnet.aquarium.converter.JsonTextFormat
-import gr.grnet.aquarium.event.model.im.{StdIMEvent, IMEventModel}
+import gr.grnet.aquarium.message.avro.gen.IMEventMsg
import gr.grnet.aquarium.store.LocalFSEventStore
import gr.grnet.aquarium.util.{LogHelpers, Tags}
import org.slf4j.Logger
+import gr.grnet.aquarium.message.avro.{MessageHelpers, AvroHelpers}
/**
* A [[gr.grnet.aquarium.connector.handler.PayloadHandler]] for
- * [[gr.grnet.aquarium.event.model.im.IMEventModel]]s.
+ * [[gr.grnet.aquarium.message.avro.gen.IMEventMsg]]s.
*
* @author Christos KK Loverdos <loverdos@gmail.com>
*/
class IMEventPayloadHandler(aquarium: Aquarium, logger: Logger)
- extends GenericPayloadHandler[IMEventModel](
+ extends GenericPayloadHandler[IMEventMsg](
// jsonParser: Array[Byte] ⇒ JsonTextFormat
payload ⇒ {
aquarium.converters.convertEx[JsonTextFormat](payload)
// eventParser: JsonTextFormat ⇒ E
jsonTextFormat ⇒ {
- StdIMEvent.fromJsonTextFormat(jsonTextFormat)
+ AvroHelpers.specificRecordOfJsonString(jsonTextFormat.value, new IMEventMsg)
},
// onEventParserSuccess: (Array[Byte], E) ⇒ Unit
// preSaveAction: E ⇒ Option[HandlerResult]
imEvent ⇒ {
- val id = imEvent.id
+ val id = imEvent.getOriginalID
// Let's decide if it is OK to store the event
// Remember that OK == None as the returning result
// It is a requirement that this ID is unique.
val store = aquarium.imEventStore
- val imEventDebugString = imEvent.toDebugString
+ val imEventDebugString = AvroHelpers.jsonStringOfSpecificRecord(imEvent)
store.findIMEventByID(id) match {
case Some(_) ⇒
case None ⇒
// No duplicate. Find the CREATE event if any
- val userID = imEvent.userID
+ val userID = imEvent.getUserID
val createIMEventOpt = store.findCreateIMEventByUserID(userID)
val userHasBeenCreated = createIMEventOpt.isDefined
- val isCreateUser = imEvent.isCreateUser
+ val isCreateUser = MessageHelpers.isIMEventCreate(imEvent)
(userHasBeenCreated, isCreateUser) match {
case (true, true) ⇒
// (User CREATEd, MODIFY event)
// Everything BEFORE the CREATE event is rejected
val createIMEvent = createIMEventOpt.get
- if(imEvent.occurredMillis < createIMEvent.occurredMillis) {
+ if(imEvent.getOccurredMillis < createIMEvent.getOccurredMillis) {
val reason = "IMEvent(id=%s) is before the creation event (id=%s). Rejecting".format(
- imEvent.id,
- createIMEvent.id
+ imEvent.getOriginalID,
+ createIMEvent.getOriginalID
)
logger.warn(reason)
Some(HandlerResultReject(reason))
case (false, true) ⇒
// (User not CREATEd, CREATE event)
- logger.info("User created by %s".format(imEventDebugString))
+ logger.info("Got user CREATE %s".format(imEventDebugString))
None
case (false, false) ⇒
// forwardAction: S ⇒ Unit
imEvent ⇒ {
- aquarium.akkaService.getOrCreateUserActor(imEvent.userID) ! ProcessIMEvent(imEvent)
+ aquarium.akkaService.getOrCreateUserActor(imEvent.getUserID) ! imEvent
}
)
package gr.grnet.aquarium.connector.handler
import gr.grnet.aquarium.Aquarium
-import gr.grnet.aquarium.actor.message.event.ProcessResourceEvent
import gr.grnet.aquarium.converter.JsonTextFormat
-import gr.grnet.aquarium.event.model.resource.{StdResourceEvent, ResourceEventModel}
+import gr.grnet.aquarium.message.avro.AvroHelpers
+import gr.grnet.aquarium.message.avro.gen.ResourceEventMsg
import gr.grnet.aquarium.store.LocalFSEventStore
import gr.grnet.aquarium.util._
import org.slf4j.Logger
/**
* A [[gr.grnet.aquarium.connector.handler.PayloadHandler]] for
- * [[gr.grnet.aquarium.event.model.resource.ResourceEventModel]]s.
+ * [[gr.grnet.aquarium.message.avro.gen.ResourceEventMsg]]s.
*
* @author Christos KK Loverdos <loverdos@gmail.com>
*/
class ResourceEventPayloadHandler(aquarium: Aquarium, logger: Logger)
- extends GenericPayloadHandler[ResourceEventModel](
+ extends GenericPayloadHandler[ResourceEventMsg](
// jsonParser: Array[Byte] ⇒ JsonTextFormat
payload ⇒ {
aquarium.converters.convertEx[JsonTextFormat](payload)
// eventParser: JsonTextFormat ⇒ E
jsonTextFormat ⇒ {
- StdResourceEvent.fromJsonTextFormat(jsonTextFormat)
+ AvroHelpers.specificRecordOfJsonString(jsonTextFormat.value, new ResourceEventMsg)
},
// onEventParserSuccess: (Array[Byte], E) ⇒ Unit
// preSaveAction: E ⇒ Option[HandlerResult]
rcEvent ⇒ {
val className = shortClassNameOf(rcEvent)
- val id = rcEvent.id
+ val id = rcEvent.getOriginalID
// Let's decide if it is OK to store the event
// Remember that OK == None as the returning result
// forwardAction: S ⇒ Unit
rcEvent ⇒ {
- aquarium.akkaService.getOrCreateUserActor(rcEvent.userID) ! ProcessResourceEvent(rcEvent)
+ aquarium.akkaService.getOrCreateUserActor(rcEvent.getUserID) ! rcEvent
}
)
package gr.grnet.aquarium.converter
+import gr.grnet.aquarium.util.{makeString, UTF_8_Charset}
+import java.nio.charset.Charset
import net.liftweb.json.JsonAST.JValue
import net.liftweb.json._
-import ext.JodaTimeSerializers
+import net.liftweb.json.ext.JodaTimeSerializers
-import gr.grnet.aquarium.util.{makeString, UTF_8_Charset}
-import java.nio.charset.Charset
-import gr.grnet.aquarium.policy.{AdHocFullPriceTableRef, PolicyDefinedFullPriceTableRef, FullPriceTableRef, ResourceType, EffectiveUnitPrice, EffectivePriceTable, FullPriceTable, StdPolicy}
-import gr.grnet.aquarium.charging.state.{StdUserState, ResourceInstanceChargingState, ResourcesChargingState, WorkingUserState}
-import gr.grnet.aquarium.computation.BillingMonthInfo
/**
* Provides conversion methods from and to JSON.
/**
* The application-wide JSON formats used from the underlying lift-json library.
*/
-// implicit final val Formats = (DefaultFormats ++ JodaTimeSerializers.all)
- final val StdPolicyFormats = Serialization.formats(FullTypeHints(List(
- // gather here all the "difficult" classes
-// classOf[AnyRef]
-
- // [[PolicyModel]]
- classOf[StdPolicy],
- classOf[ResourceType], // It is OK to leave this out
- classOf[FullPriceTable],
- classOf[EffectivePriceTable],
- classOf[EffectiveUnitPrice],
-
- // [[UserStateModel]]
- classOf[StdUserState],
- classOf[BillingMonthInfo],
- classOf[ResourcesChargingState],
- classOf[ResourceInstanceChargingState],
-
- // [[WorkingUserState]]
- classOf[WorkingUserState],
-
- classOf[FullPriceTableRef],
- classOf[PolicyDefinedFullPriceTableRef],
- classOf[AdHocFullPriceTableRef]
- )))
- final val JodaFormats = JodaTimeSerializers.all
- implicit final val Formats = (DefaultFormats.withHints(FullTypeHints(List(classOf[AnyRef]))) ++ JodaTimeSerializers.all)
-// implicit final val Formats: Formats = StdPolicyFormats ++ JodaFormats
-// Serialization.formats(FullTypeHints(List(classOf[AnyRef])))
-// final val PolicyModelSerializer: Serializer[PolicyModel] = new Serializer[PolicyModel] {
-// def deserialize(implicit format: Formats): PartialFunction[(TypeInfo, _root_.net.liftweb.json.JValue), PolicyModel] = {
-// case (tpe @ TypeInfo(_, _), jValue) ⇒
-// println("!! tpe = " + tpe)
-// println("!! jValue = " + jValue)
-// Extraction.extract(jValue, tpe)(FullFormats).asInstanceOf[PolicyModel]
-// }
-//
-// def serialize(implicit format: Formats): PartialFunction[Any, _root_.net.liftweb.json.JValue] = {
-// case x: PolicyModel ⇒
-// println("GOT a policymodel")
-// Extraction.decompose(x)(FullFormats)
-// }
-// }
+ implicit final val Formats = (DefaultFormats ++ JodaTimeSerializers.all)
/**
* Converts a value to JSON AST (Abstract Syntax Tree) by acting a bit intelligently, depending on the actual type
* or implied, of GRNET S.A.
*/
-package gr.grnet.aquarium.event.model
+package gr.grnet.aquarium.event
+
+//trait CreditsModel {
+// /**
+// * The type of credits
+// */
+// type Type
+//
+// def fromString(s: CharSequence): Type
+//
+// def toString(credits: Type): CharSequence
+//
+// def fromDouble(d: Double): Type
+//
+// def toDouble(credits: Type): Double
+//}
/**
- * Basic properties for all events.
- * An event represents some state change, where state is specific to the use-case.
*
* @author Christos KK Loverdos <loverdos@gmail.com>
*/
+object CreditsModel {
+ type Type = Double // A nice value type would be great here.
+ type TypeInMessage = Double
-trait EventModel {
- /**
- * The unique event id. The responsibility for the id generation is to the event generator.
- */
- def id: String
+ @inline final def from(s: String): Type = s.toString.toDouble
- /**
- * The Unix time of the state change occurrence that this event represents.
- */
- def occurredMillis: Long
+ @inline final def from(d: TypeInMessage): Type = d
- /**
- * The ID given to this event if/when persisted to a store.
- * The exact type of the id is store-specific.
- */
- def idInStore: Option[AnyRef] = None
+ @inline final def from(l: Long): Type = l.toDouble
- def stringIDInStoreOrEmpty = idInStore.map(_.toString).getOrElse("")
+ @inline final def toString(t: Type): String = t.toString
- def eventVersion: String
+ @inline final def toTypeInMessage(t: Type): TypeInMessage = t
- /**
- * An extension point that provides even more properties.
- */
- def details: Map[String, String]
+ @inline final def mul(a: Type, b: Type): Type = a * b
- def withDetails(newDetails: Map[String, String], newOccurredMillis: Long): EventModel
-}
+ @inline final def *(a: Type, b: Type): Type = a * b
+
+ @inline final def div(a: Type, b: Type): Type = a / b
+
+ @inline final def /(a: Type, b: Type): Type = a / b
+
+ @inline final def add(a: Type, b: Type): Type = a + b
+
+ @inline final def +(a: Type, b: Type): Type = a + b
+
+ @inline final def sub(a: Type, b: Type): Type = a - b
-object EventModel {
- final val EventVersion_1_0 = "1.0"
+ @inline final def -(a: Type, b: Type): Type = a - b
- trait NamesT {
- final val id = "id"
- final val occurredMillis = "occurredMillis"
- final val storeID = "storeID"
- final val eventVersion = "eventVersion"
- final val details = "details"
- }
+ @inline final def neg(a: Type): Type = -a
- object Names extends NamesT
+ @inline final def inv(a: Type): Type = 1 / a
}
* or implied, of GRNET S.A.
*/
-package gr.grnet.aquarium.message.avro
+package gr.grnet.aquarium.event
-import gr.grnet.aquarium.message.avro.gen.{FullPriceTableMsg, ResourceTypeMsg, PolicyMsg}
+import gr.grnet.aquarium.message.avro.MessageFactory
+import gr.grnet.aquarium.message.avro.gen.{DetailsMsg, AnyValueMsg}
import java.{util ⇒ ju}
+import org.apache.avro.generic.IndexedRecord
+import org.apache.avro.specific.SpecificData
+import scala.collection.JavaConverters.mapAsJavaMapConverter
/**
*
* @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()
+object DetailsModel {
+ type Type = ju.Map[String, AnyValueMsg] // This is from Avro messages
+
+ def make: Type = new ju.HashMap()
+
+ def setBoolean(msgDetails: Type, name: String, value: Boolean = true) {
+ msgDetails.put(name, MessageFactory.anyValueMsgOfBoolean(value))
+ }
+
+ def setString(msgDetails: Type, name: String, value: String) {
+ msgDetails.put(name, MessageFactory.anyValueMsgOfString(value))
+ }
+
+ def fromScalaMap(map: scala.collection.Map[String, AnyValueMsg]): Type = {
+ map.asJava
+ }
+
+ def fromScalaTuples(tuples: (String, AnyValueMsg)*): Type = {
+ fromScalaMap(Map(tuples:_*))
+ }
+
+ def copyOf(details: Type): Type = {
+ val wrapper = DetailsMsg.newBuilder().setDetails(details).build()
+ val copy = SpecificData.get().deepCopy(wrapper.getSchema, wrapper)
+ copy.asInstanceOf[IndexedRecord].get(0).asInstanceOf[Type]
}
-}
+}
\ No newline at end of file
+++ /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.event.model
-package im
-
-import gr.grnet.aquarium.util._
-import gr.grnet.aquarium.util.date.MutableDateCalc
-
-/**
- * The model of any event sent from the `Identity Management` (IM) external system.
- *
- * By definition, this is the model agreed upon between Aquarium and IM.
- *
- * @author Christos KK Loverdos <loverdos@gmail.com>
- */
-
-trait IMEventModel extends ExternalEventModel {
- def clientID: String
-
- def isActive: Boolean
-
- def role: String
-
- def eventType: String
-
- def isStateActive = isActive
-
- def isStateSuspended = !isActive
-
- def isCreateUser = eventType.equalsIgnoreCase(IMEventModel.EventTypeNames.create)
-
- def isModifyUser = eventType.equalsIgnoreCase(IMEventModel.EventTypeNames.modify)
-
- def isAddCredits = eventType.equalsIgnoreCase(IMEventModel.EventTypeNames.addcredits)
-
- def userCreationMillisOption = if(isCreateUser) Some(this.occurredMillis) else None
-
- override def toDebugString = {
- "%s(userID=%s, id=%s, isActive=%s, role='%s', occurred=%s, type=%s)".format(
- shortClassNameOf(this),
- userID,
- id,
- isActive,
- role,
- new MutableDateCalc(occurredMillis).toString,
- eventType
- )
- }
-}
-
-object IMEventModel {
- trait NamesT extends ExternalEventModel.NamesT {
- final val clientID = "clientID"
- final val isActive = "isActive"
- final val role = "role"
- final val eventType = "eventType"
- }
-
- object Names extends NamesT
-
- trait EventTypeNamesT {
- final val create = "create"
- final val modify = "modify"
- final val addcredits = "addcredits"
- }
-
- object EventTypeNames extends EventTypeNamesT
-
- trait DetailsNamesT {
- final val credits = "credits"
- }
- object DetailsNames extends DetailsNamesT
-
-}
+++ /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.event.model
-package im
-
-import gr.grnet.aquarium.util.makeString
-import gr.grnet.aquarium.converter.{JsonTextFormat, StdConverters}
-
-
-/**
- *
- * @author Christos KK Loverdos <loverdos@gmail.com>
- */
-
-case class StdIMEvent(
- id: String, // The id at the sender side
- occurredMillis: Long, // When it occurred at the sender side
- receivedMillis: Long, // When it was received by Aquarium
- userID: String,
- clientID: String,
- isActive: Boolean,
- role: String,
- eventVersion: String,
- eventType: String,
- details: Map[String, String])
-extends IMEventModel {
- def withReceivedMillis(newReceivedMillis: Long) =
- this.copy(receivedMillis = newReceivedMillis)
-
- def withDetails(newDetails: Map[String, String], newOccurredMillis: Long) =
- this.copy(details = newDetails, occurredMillis = newOccurredMillis)
-}
-
-object StdIMEvent {
- final def fromJsonTextFormat(jsonTextFormat: JsonTextFormat): StdIMEvent = {
- StdConverters.AllConverters.convertEx[StdIMEvent](jsonTextFormat)
- }
-
- final def fromJsonString(json: String): StdIMEvent = {
- fromJsonTextFormat(JsonTextFormat(json))
- }
-
- final def fromJsonBytes(jsonBytes: Array[Byte]): StdIMEvent = {
- fromJsonString(makeString(jsonBytes))
- }
-
- final def fromOther(event: IMEventModel): StdIMEvent = {
- if(event.isInstanceOf[StdIMEvent]) event.asInstanceOf[StdIMEvent]
- else new StdIMEvent(
- event.id,
- event.occurredMillis,
- event.receivedMillis,
- event.userID,
- event.clientID,
- event.isActive,
- event.role,
- event.eventVersion,
- event.eventType,
- event.details
- )
- }
-
-}
\ No newline at end of file
+++ /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.event.model
-package resource
-
-import gr.grnet.aquarium.event.model.ExternalEventModel
-import gr.grnet.aquarium.util.date.MutableDateCalc
-import java.util.Date
-
-/**
- * The model of any resource event.
- *
- * @author Christos KK Loverdos <loverdos@gmail.com>
- */
-
-trait ResourceEventModel extends ExternalEventModel {
- /**
- * Identifies the client that sent this event.
- */
- def clientID: String
-
- /**
- * String representation of the resource type (e.g. "bndup", "vmtime").
- */
- def resource: String
-
- /**
- * String representation of the resource instance id
- */
- def instanceID: String
-
-
- /**
- * The resource value.
- */
- def value: Double
-
- def withDetails(newDetails: Map[String, String], newOccurredMillis: Long): ResourceEventModel
-
- def withDetailsAndValue(newDetails: Map[String, String], newValue: Double, newOccurredMillis: Long): ResourceEventModel
-
- def safeResource = if(resource eq null) "" else resource
- def safeInstanceID = if(instanceID eq null) "" else instanceID
-
- def safeResourceInstanceInfo = (safeResource, safeInstanceID)
-
- def occurredDate = new Date(occurredMillis)
-
- def isOccurredWithinMillis(fromMillis: Long, toMillis: Long): Boolean = {
- require(fromMillis <= toMillis, "fromMillis <= toMillis")
- fromMillis <= occurredMillis && occurredMillis <= toMillis
- }
-
- def isReceivedWithinMillis(fromMillis: Long, toMillis: Long): Boolean = {
- require(fromMillis <= toMillis, "fromMillis <= toMillis")
- fromMillis <= receivedMillis && receivedMillis <= toMillis
- }
-
- def isOccurredOrReceivedWithinMillis(fromMillis: Long, toMillis: Long): Boolean = {
- isOccurredWithinMillis(fromMillis, toMillis) ||
- isReceivedWithinMillis(fromMillis, toMillis)
- }
-
- def isOutOfSyncForBillingMonth(yearOfBillingMonth: Int, billingMonth: Int) = {
- val billingStartDateCalc = new MutableDateCalc(yearOfBillingMonth, billingMonth)
- val billingStartMillis = billingStartDateCalc.toMillis
- // NOTE: no need to `copy` the mutable `billingStartDateCalc` here because we use it once
- val billingStopMillis = billingStartDateCalc.goEndOfThisMonth.toMillis
-
- isOutOfSyncForBillingPeriod(billingStartMillis, billingStopMillis)
- }
-
- def isOutOfSyncForBillingPeriod(billingStartMillis: Long, billingStopMillis: Long): Boolean = {
- // Out of sync events are those that were received within the billing period
- // but actually occurred outside the billing period.
- isReceivedWithinMillis(billingStartMillis, billingStopMillis) &&
- !isOccurredWithinMillis(billingStartMillis, billingStopMillis)
- }
-
- override def toDebugString: String = {
- val instanceInfo = "%s::%s".format(resource, instanceID)
- val occurredFormatted = new MutableDateCalc(occurredMillis).toYYYYMMDDHHMMSS
- if(occurredMillis == receivedMillis) {
- "%sEVENT(%s, [%s], %s, %s, %s, %s, %s)".format(
- if(isSynthetic) "*" else "",
- id,
- occurredFormatted,
- value,
- instanceInfo,
- details,
- userID,
- clientID
- )
- } else {
- "%sEVENT(%s, [%s], [%s], %s, %s, %s, %s, %s)".format(
- if(isSynthetic) "*" else "",
- id,
- occurredFormatted,
- new MutableDateCalc(receivedMillis),
- value,
- instanceInfo,
- details,
- userID,
- clientID
- )
- }
- }
-
- /**
- * `Synthetic` means that Aquarium has manufactured this resource event for some purpose. For example, the implicitly
- * issued resource events at the end a a billing period.
- *
- * @return `true` iff this resource event is synthetic.
- */
- def isSynthetic = {
- details contains ResourceEventModel.Names.details_aquarium_is_synthetic
- }
-}
-
-object ResourceEventModel {
- /**
- * A `ResourceInstance` is the type of a specific resource instance and it is contains the name of the
- * [[gr.grnet.aquarium.policy.ResourceType]] and the instance `ID`.
- */
- type ResourceInstance = (String, String)
- type FullResourceTypeMap = Map[ResourceInstance, ResourceEventModel]
- type FullMutableResourceTypeMap = scala.collection.mutable.Map[ResourceInstance, ResourceEventModel]
-
- trait NamesT extends ExternalEventModel.NamesT {
- final val clientID = "clientID"
- final val resource = "resource"
- final val instanceID = "instanceID"
- final val value = "value"
-
- // This is set in the details map to indicate a synthetic resource event (ie not a real one).
- // Examples of synthetic resource events are those that are implicitly generated at the
- // end of the billing period (e.g. `OFF`s).
- final val details_aquarium_is_synthetic = "__aquarium_is_synthetic__"
-
- final val details_aquarium_is_implicit_end = "__aquarium_is_implicit_end__"
-
- final val details_aquarium_is_dummy_first = "__aquarium_is_dummy_first__"
-
- final val details_aquarium_is_realtime_virtual = "__aquarium_is_realtime_virtual__"
-
- final val details_aquarium_reference_event_id = "__aquarium_reference_event_id__"
-
- final val details_aquarium_reference_event_id_in_store = "__aquarium_reference_event_id_in_store__"
- }
-
- object Names extends NamesT
-
- def setAquariumSyntheticAndImplicitEnd(map: Map[String, String]): Map[String, String] = {
- map.
- updated(Names.details_aquarium_is_synthetic, "true").
- updated(Names.details_aquarium_is_implicit_end, "true")
- }
-
- def setAquariumSyntheticAndDummyFirst(map: Map[String, String]): Map[String, String] = {
- map.
- updated(Names.details_aquarium_is_synthetic, "true").
- updated(Names.details_aquarium_is_dummy_first, "true")
- }
-}
+++ /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.event.model
-package resource
-
-import gr.grnet.aquarium.util.makeString
-import gr.grnet.aquarium.converter.{JsonTextFormat, StdConverters}
-
-
-/**
- *
- * @author Christos KK Loverdos <loverdos@gmail.com>
- */
-
-case class StdResourceEvent(
- id: String,
- occurredMillis: Long,
- receivedMillis: Long,
- userID: String,
- clientID: String,
- resource: String,
- instanceID: String,
- value: Double,
- eventVersion: String,
- details: Map[String, String]
-) extends ResourceEventModel {
- def withReceivedMillis(newReceivedMillis: Long) =
- this.copy(receivedMillis = newReceivedMillis)
-
- def withDetails(newDetails: Map[String, String], newOccurredMillis: Long) =
- this.copy(details = newDetails, occurredMillis = newOccurredMillis)
-
- def withDetailsAndValue(newDetails: Map[String, String], newValue: Double, newOccurredMillis: Long) =
- this.copy(details = newDetails, value = newValue, occurredMillis = newOccurredMillis)
-}
-
-object StdResourceEvent {
- final def fromJsonTextFormat(jsonTextFormat: JsonTextFormat): StdResourceEvent = {
- StdConverters.AllConverters.convertEx[StdResourceEvent](jsonTextFormat)
- }
-
- final def fromJsonString(json: String): StdResourceEvent = {
- fromJsonTextFormat(JsonTextFormat(json))
- }
-
- final def fromJsonBytes(jsonBytes: Array[Byte]): StdResourceEvent = {
- fromJsonString(makeString(jsonBytes))
- }
-
- final def fromOther(event: ResourceEventModel): StdResourceEvent = {
- if(event.isInstanceOf[StdResourceEvent]) event.asInstanceOf[StdResourceEvent]
- else {
- import event._
- new StdResourceEvent(
- id,
- occurredMillis,
- receivedMillis,
- userID,
- clientID,
- resource,
- instanceID,
- value,
- event.eventVersion,
- event.details
- )
- }
-}
-}
\ No newline at end of file
* or implied, of GRNET S.A.
*/
-package gr.grnet.aquarium.event.model
-
-import gr.grnet.aquarium.util.makeBytes
-import gr.grnet.aquarium.util.shortClassNameOf
-import gr.grnet.aquarium.util.json.JsonSupport
-import gr.grnet.aquarium.util.xml.XmlSupport
-import gr.grnet.aquarium.util.date.MutableDateCalc
+package gr.grnet.aquarium.message
/**
- * The base model for all events coming from external systems.
+ * Provides constants for known values expected in message objects.
*
* @author Christos KK Loverdos <loverdos@gmail.com>
*/
+object MessageConstants {
+ final val EventVersion_1_0 = "1.0"
+ final val DefaultSelectorKey = "default"
-trait ExternalEventModel extends EventModel with JsonSupport with XmlSupport {
- /**
- * When it was received by Aquarium
- */
- def receivedMillis: Long
-
- def userID: String
+ final object DetailsKeys {
+ // This is set in the details map to indicate a synthetic resource event (ie not a real one).
+ // Examples of synthetic resource events are those that are implicitly generated at the
+ // end of the billing period (e.g. `OFF`s).
+ final val aquarium_is_synthetic = "__aquarium_is_synthetic__"
+ final val aquarium_is_implicit_end = "__aquarium_is_implicit_end__"
- def toBytes: Array[Byte] = makeBytes(toJsonString)
+ final val aquarium_is_dummy_first = "__aquarium_is_dummy_first__"
- def withReceivedMillis(newReceivedMillis: Long): ExternalEventModel
+ final val aquarium_is_realtime_virtual = "__aquarium_is_realtime_virtual__"
- def toDebugString = "%s(userID=%s, id=%s, occurred=%s)".format(
- shortClassNameOf(this),
- userID,
- id,
- new MutableDateCalc(occurredMillis).toString)
-}
+ final val aquarium_reference_event_id = "__aquarium_reference_event_id__"
-object ExternalEventModel {
- trait NamesT extends EventModel.NamesT {
- final val receivedMillis = "receivedMillis"
- final val userID = "userID"
+ final val aquarium_reference_event_id_in_store = "__aquarium_reference_event_id_in_store__"
}
- object Names extends NamesT
-}
\ No newline at end of file
+ final object IMEventMsg {
+ final object EventTypes {
+ final val create = "create"
+ final val modify = "modify"
+ }
+ }
+}
package gr.grnet.aquarium.message.avro
+import gr.grnet.aquarium.charging.state.UserStateBootstrap
+import gr.grnet.aquarium.computation.BillingMonthInfo
+import gr.grnet.aquarium.event.{CreditsModel, DetailsModel}
import gr.grnet.aquarium.message.avro.gen._
+import java.{util ⇒ ju}
+import org.apache.avro.generic.GenericData
import scala.collection.JavaConverters.mapAsJavaMapConverter
import scala.collection.JavaConverters.seqAsJavaListConverter
* @author Christos KK Loverdos <loverdos@gmail.com>
*/
object MessageFactory {
+ def anyValueMsgOfBoolean(x: Boolean) = {
+ val av = new AnyValueMsg
+ av.setAnyValue(x: java.lang.Boolean)
+ av
+ }
+
+ def anyValueMsgOfString(x: String) = {
+ val av = new AnyValueMsg
+ av.setAnyValue(x)
+ av
+ }
+
def newEffectiveUnitPriceMsg(unitPrice: Double, whenOpt: Option[CronSpecTupleMsg] = None) = {
EffectiveUnitPriceMsg.newBuilder().
setUnitPrice(unitPrice).
build()
}
- def newSelectorValueMsg(map: Map[CharSequence, SelectorValueMsg]): SelectorValueMsg = {
+ def newSelectorValueMsg(map: Map[String, SelectorValueMsg]): SelectorValueMsg = {
SelectorValueMsg.newBuilder().
setSelectorValue(map.asJava).
build()
}
- def newSelectorValueMsg(pairs: (CharSequence, SelectorValueMsg)*): SelectorValueMsg = {
+ def newSelectorValueMsg(pairs: (String, SelectorValueMsg)*): SelectorValueMsg = {
SelectorValueMsg.newBuilder().
setSelectorValue(Map(pairs:_*).asJava).
build()
}
- def newFullPriceTableMsg(perResource: (CharSequence, Map[CharSequence, SelectorValueMsg])*) = {
+ def newFullPriceTableMsg(perResource: (String, Map[String, SelectorValueMsg])*) = {
FullPriceTableMsg.newBuilder().
setPerResource(
Map((for((k, v) ← perResource) yield (k, v.asJava)):_*).asJava
build()
}
- def newRoleMappingMsg(map: Map[CharSequence, FullPriceTableMsg]): java.util.Map[CharSequence, FullPriceTableMsg] = {
+ def newRoleMappingMsg(map: Map[String, FullPriceTableMsg]): java.util.Map[String, FullPriceTableMsg] = {
map.asJava
}
- def newRoleMappingMsg(pairs: (CharSequence, FullPriceTableMsg)*): java.util.Map[CharSequence, FullPriceTableMsg] = {
+ def newRoleMappingMsg(pairs: (String, FullPriceTableMsg)*): java.util.Map[String, FullPriceTableMsg] = {
Map(pairs:_*).asJava
}
- def newResourceTypeMsg(name: CharSequence, unit: CharSequence, chargingBehavior: CharSequence) = {
+ def newResourceTypeMsg(name: String, unit: String, chargingBehavior: String) = {
ResourceTypeMsg.newBuilder().
setName(name).
setUnit(unit).
rts.asJava
}
- def newChargingBehaviorMsgs(cbs: CharSequence*) = {
- val ret = cbs.asJava
- println(cbs.toList)
- println("========")
- var i = 0
- while(i < ret.size()) {
- println(ret.get(i))
- i += 1
- }
+ def newChargingBehaviorMsgs(cbs: String*) = {
+ cbs.asJava
+ }
+
+ def newBooleanDetail(name: String, value: Boolean) = {
+ (name, anyValueMsgOfBoolean(value))
+ }
+
+ def newStringDetail(name: String, value: String) = {
+ (name, anyValueMsgOfString(value))
+ }
+
+ def newDetails(details: (String, AnyValueMsg)*): DetailsModel.Type = {
+ DetailsModel.fromScalaTuples(details:_*)
+ }
+
+ def newResourceEventMsg(
+ originalID: String,
+ occurredMillis: Long,
+ receivedMillis: Long,
+ userID: String,
+ clientID: String,
+ resource: String,
+ instanceID: String,
+ value: String,
+ eventVersion: String,
+ details: DetailsModel.Type = newDetails(),
+ inStoreID: String = null
+ ) = {
+ ResourceEventMsg.newBuilder().
+ setOriginalID(originalID).
+ setOccurredMillis(occurredMillis).
+ setReceivedMillis(receivedMillis).
+ setUserID(userID).
+ setClientID(clientID).
+ setResource(resource).
+ setInstanceID(instanceID).
+ setValue(value).
+ setEventVersion(eventVersion).
+ setDetails(details).
+ setInStoreID(inStoreID).
+ build()
+ }
+
+ def newIMEventMsg(
+ originalID: String,
+ occurredMillis: Long,
+ receivedMillis: Long,
+ userID: String,
+ clientID: String,
+ isActive: Boolean,
+ role: String,
+ eventVersion: String,
+ eventType: String,
+ details: DetailsModel.Type = newDetails()
+ ) = {
+ IMEventMsg.newBuilder().
+ setOriginalID(originalID).
+ setInStoreID(null).
+ setOccurredMillis(occurredMillis).
+ setReceivedMillis(receivedMillis).
+ setUserID(userID).
+ setClientID(clientID).
+ setIsActive(isActive).
+ setRole(role).
+ setEventVersion(eventVersion).
+ setEventType(eventType).
+ setDetails(details).
+ build()
+ }
+
+ def newWalletEntryMsg(
+ userID: String,
+ sumOfCreditsToSubtract: CreditsModel.Type,
+ oldTotalCredits: CreditsModel.Type,
+ newTotalCredits: CreditsModel.Type,
+ whenComputedMillis: Long,
+ referenceStartMillis: Long,
+ referenceStopMillis: Long,
+ billingYear: Int,
+ billingMonth: Int,
+ billingMonthDay: Int,
+ chargeslots: ju.List[ChargeslotMsg],
+ resourceEvents: ju.List[ResourceEventMsg],
+ resourceType: ResourceTypeMsg,
+ isSynthetic: Boolean
+ ): WalletEntryMsg = {
+ WalletEntryMsg.newBuilder().
+ setUserID(userID).
+ setSumOfCreditsToSubtract(CreditsModel.toTypeInMessage(sumOfCreditsToSubtract)).
+ setOldTotalCredits(CreditsModel.toTypeInMessage(oldTotalCredits)).
+ setNewTotalCredits(CreditsModel.toTypeInMessage(newTotalCredits)).
+ setWhenComputedMillis(whenComputedMillis).
+ setReferenceStartMillis(referenceStartMillis).
+ setReferenceStopMillis(referenceStopMillis).
+ setBillingYear(billingYear).
+ setBillingMonth(billingMonth).
+ setBillingMonthDay(billingMonthDay).
+ setChargeslots(chargeslots).
+ setResourceEvents(resourceEvents).
+ setResourceType(resourceType).
+ setIsSynthetic(isSynthetic).
+ build()
+ }
+
+ def newResourceInstanceChargingStateMsg(
+ details: DetailsModel.Type,
+ previousEvents: ju.List[ResourceEventMsg],
+ implicitlyIssuedStartEvents: ju.List[ResourceEventMsg],
+ oldAccumulatingAmount: Double,
+ accumulatingAmount: Double,
+ previousValue: Double,
+ currentValue: Double
+ ): ResourceInstanceChargingStateMsg = {
+
+ val msg = new ResourceInstanceChargingStateMsg
+ msg.setDetails(details)
+ msg.setPreviousEvents(previousEvents)
+ msg.setImplicitlyIssuedStartEvents(implicitlyIssuedStartEvents)
+ msg.setOldAccumulatingAmount(oldAccumulatingAmount)
+ msg.setAccumulatingAmount(accumulatingAmount)
+ msg.setPreviousValue(previousValue)
+ msg.setCurrentValue(currentValue)
+ msg
+ }
+
+ def newEmptyUserAgreementHistoryMsg() = {
+ val msg = new UserAgreementHistoryMsg
+ msg.setAgreements(new ju.ArrayList[UserAgreementMsg]())
+ msg
+ }
+
+ def newInitialUserAgreementHistoryMsg(initialAgreement: UserAgreementMsg) = {
+ val msg = new UserAgreementHistoryMsg
+ val list = new GenericData.Array[UserAgreementMsg](1, initialAgreement.getSchema)
+ list.add(initialAgreement)
+ msg.setAgreements(list)
+ msg
+ }
+
+ def newUserAgreementFromIMEventMsg(
+ imEvent: IMEventMsg,
+ id: String = MessageHelpers.UserAgreementMsgIDGenerator.nextUID()
+ ) = {
+
+ val msg = new UserAgreementMsg
+
+ msg.setId(id)
+ msg.setRelatedIMEventOriginalID(imEvent.getOriginalID)
+ msg.setRole(imEvent.getRole)
+ msg.setValidFromMillis(imEvent.getOccurredMillis)
+ msg.setValidToMillis(Long.MaxValue)
+ msg.setFullPriceTableRef(null) // get from current (= @imEvent.getOccurredMillis) policy
+
+ msg
+ }
+
+ def newWalletEntriesMsg(entries: ju.List[WalletEntryMsg] = new ju.ArrayList[WalletEntryMsg]()) = {
+ val msg = new WalletEntriesMsg
+ msg.setEntries(entries)
+ msg
+ }
+
+ def newDummyPolicyMsgAt(millis: Long) : PolicyMsg = {
+ PolicyMsg.newBuilder().
+ setOriginalID("").
+ setInStoreID(null).
+ setParentID(null).
+ setValidFromMillis(millis).
+ setValidToMillis(Long.MaxValue).
+ setChargingBehaviors(new ju.ArrayList[String]()).
+ setResourceTypes(new ju.ArrayList[ResourceTypeMsg]()).
+ setRoleMapping(new ju.HashMap[String, FullPriceTableMsg]()).
+ build()
+ }
+
+ def createInitialUserStateMsg(
+ usb: UserStateBootstrap,
+ occurredMillis: Long
+ ): UserStateMsg = {
+
+ val bmi = BillingMonthInfo.fromMillis(occurredMillis)
+ val msg = new UserStateMsg
- ret
+ msg.setUserID(usb.userID)
+ msg.setOccurredMillis(occurredMillis)
+ msg.setBillingYear(bmi.year)
+ msg.setBillingMonth(bmi.month)
+ msg.setBillingMonthDay(bmi.day)
+ msg.setTotalCredits(CreditsModel.toTypeInMessage(usb.initialCredits))
+ msg.setAgreementHistory(newInitialUserAgreementHistoryMsg(usb.initialAgreement.msg))
+ msg.setLatestUpdateMillis(occurredMillis)
+ msg.setInStoreID(null)
+ msg.setOriginalID("") // FIXME get a counter here
+
+ msg
}
+
}
--- /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.AquariumInternalError
+import gr.grnet.aquarium.event.DetailsModel
+import gr.grnet.aquarium.logic.accounting.dsl.Timeslot
+import gr.grnet.aquarium.message.MessageConstants
+import gr.grnet.aquarium.message.avro.gen.{WalletEntryMsg, EffectivePriceTableMsg, FullPriceTableMsg, ResourceInstanceChargingStateMsg, UserStateMsg, IMEventMsg, ResourceEventMsg}
+import gr.grnet.aquarium.policy.EffectivePriceTableModel
+import gr.grnet.aquarium.uid.UUIDGenerator
+import gr.grnet.aquarium.util.LogHelpers.Debug
+import gr.grnet.aquarium.util.shortNameOfType
+import java.util.{Map ⇒ JMap}
+import org.slf4j.Logger
+import scala.annotation.tailrec
+
+/**
+ * Provides helper methods related to messages.
+ *
+ * @author Christos KK Loverdos <loverdos@gmail.com>
+ */
+final object MessageHelpers {
+ final val UserAgreementMsgIDGenerator = UUIDGenerator
+
+ @inline final def isOccurredWithinMillis(
+ event: ResourceEventMsg,
+ fromMillis: Long,
+ toMillis: Long
+ ): Boolean = {
+ require(fromMillis <= toMillis, "fromMillis <= toMillis")
+ val eventOccurredMillis = event.getOccurredMillis
+ fromMillis <= eventOccurredMillis && eventOccurredMillis <= toMillis
+ }
+
+ @inline final def isReceivedWithinMillis(
+ event: ResourceEventMsg,
+ fromMillis: Long,
+ toMillis: Long
+ ): Boolean = {
+ require(fromMillis <= toMillis, "fromMillis <= toMillis")
+ val eventReceivedMillis = event.getReceivedMillis
+ fromMillis <= eventReceivedMillis && eventReceivedMillis <= toMillis
+ }
+
+ @inline final def isOutOfSyncForBillingPeriod(
+ event: ResourceEventMsg,
+ billingStartMillis: Long,
+ billingStopMillis: Long
+ ): Boolean = {
+
+ // Out of sync events are those that were received within the billing period
+ // but actually occurred outside the billing period.
+ isReceivedWithinMillis(event, billingStartMillis, billingStopMillis) &&
+ !isOccurredWithinMillis(event, billingStartMillis, billingStopMillis)
+ }
+
+ @inline final def isIMEventCreate(msg: IMEventMsg) = {
+ msg.getEventType().toLowerCase() == MessageConstants.IMEventMsg.EventTypes.create
+ }
+
+ @inline final def isIMEventModify(msg: IMEventMsg) = {
+ msg.getEventType().toLowerCase() == MessageConstants.IMEventMsg.EventTypes.modify
+ }
+
+ @inline final def findResourceType(msg: UserStateMsg, name: String) = {
+ msg.getResourceTypesMap.get(name) match {
+ case null ⇒ None
+ case resourceType ⇒ Some(resourceType)
+ }
+ }
+
+ final def setOnePreviousEvent(
+ resourceInstanceChargingState: ResourceInstanceChargingStateMsg,
+ msg: ResourceEventMsg
+ ) {
+ val previousEvents = resourceInstanceChargingState.getPreviousEvents
+ previousEvents.clear()
+ previousEvents.add(msg)
+ }
+
+ final def setAquariumSyntheticAndImplicitEnd(details: DetailsModel.Type) {
+ DetailsModel.setBoolean(details, MessageConstants.DetailsKeys.aquarium_is_synthetic, true)
+ DetailsModel.setBoolean(details, MessageConstants.DetailsKeys.aquarium_is_implicit_end, true)
+ }
+
+ /**
+ *
+ * See [[gr.grnet.aquarium.policy.FullPriceTableModel]]
+ */
+ final def effectivePriceTableOfSelectorForResource(
+ fullPriceTable: FullPriceTableMsg,
+ selectorPath: List[String],
+ resource: String,
+ logger: Logger
+ ): EffectivePriceTableMsg = {
+
+ // Most of the code is for exceptional cases, which we identify in detail.
+ @tailrec
+ def find(
+ partialSelectorPath: List[String],
+ partialSelectorData: Any // type SelectorValueMsg = ju.Map[String, SelectorValueMsg] | EffectivePriceTableMsg
+ ): EffectivePriceTableMsg = {
+
+ Debug(logger, "find: ")
+ Debug(logger, " partialSelectorPath = %s", partialSelectorPath.mkString("/"))
+ Debug(logger, " partialSelectorData = %s", partialSelectorData)
+
+ partialSelectorPath match {
+ case selector :: Nil ⇒
+ // One selector, meaning that the selectorData must be a Map[String, EffectivePriceTable]
+ partialSelectorData match {
+ case selectorMap: JMap[_,_] ⇒
+ // The selectorData is a map indeed
+ selectorMap.asInstanceOf[JMap[String, _]].get(selector) match {
+ case null ⇒
+ // The selectorData is a map but it does nto contain the selector
+ throw new AquariumInternalError(
+ "[AQU-SEL-002] Cannot select path %s for resource %s. Nothing found at partial selector path %s",
+ selectorPath.mkString("/"),
+ resource,
+ partialSelectorPath.mkString("/")
+ )
+
+ case selected: EffectivePriceTableMsg ⇒
+ // Yes, it is a map of the right type (OK, we assume keys are always Strings)
+ // (we only check the value type)
+ selected
+
+ case badSelected ⇒
+ // The selectorData is a map but the value is not of the required type
+ throw new AquariumInternalError(
+ "[AQU-SEL-001] Cannot select path %s for resource %s. Found %s instead of an %s at partial selector path %s",
+ selectorPath.mkString("/"),
+ resource,
+ badSelected,
+ shortNameOfType[EffectivePriceTableModel],
+ partialSelectorPath.mkString("/")
+ )
+
+ }
+
+
+ case badData ⇒
+ // The selectorData is not a map. So we have just one final selector but no map to select from.
+ throw new AquariumInternalError(
+ "[AQU-SEL-003] Cannot select path %s for resource %s. Found %s instead of a Map at partial selector path %s",
+ selectorPath.mkString("/"),
+ resource,
+ badData,
+ partialSelectorPath.mkString("/")
+ )
+ }
+
+ case selector :: selectorTail ⇒
+ // More than one selector in the path, meaning that the selectorData must be a Map[String, Map[String, SelectorValueMsg]]
+ partialSelectorData match {
+ case selectorMap: JMap[_,_] ⇒
+ // The selectorData is a map indeed
+ selectorMap.asInstanceOf[JMap[String,_]].get(selector) match {
+ case null ⇒
+ // The selectorData is a map but it does not contain the selector
+ throw new AquariumInternalError(
+ "[AQU-SEL-005] Cannot select path %s for resource %s. Nothing found at partial selector path %s",
+ selectorPath.mkString("/"),
+ resource,
+ partialSelectorPath.mkString("/")
+ )
+
+ case furtherSelectorMap: JMap[_,_] ⇒
+ // The selectorData is a map and we found the respective value for the selector to be a map.
+ find(selectorTail, furtherSelectorMap)
+
+ case furtherBad ⇒
+ // The selectorData is a map but the respective value is not a map, so that
+ // the selectorTail path cannot be used.
+ throw new AquariumInternalError(
+ "[AQU-SEL-004] Cannot select path %s for resource %s. Found %s instead of a Map at partial selector path %s",
+ selectorPath.mkString("/"),
+ resource,
+ furtherBad,
+ partialSelectorPath.mkString("/")
+ )
+
+ }
+
+ case badData ⇒
+ // The selectorData is not a Map. So we have more than one selectors but no map to select from.
+ throw new AquariumInternalError(
+ "[AQU-SEL-006] Cannot select path %s for resource %s. Found %s instead of a Map at partial selector path %s",
+ selectorPath.mkString("/"),
+ resource,
+ badData,
+ partialSelectorPath.mkString("/")
+ )
+ }
+
+ case Nil ⇒
+ throw new AquariumInternalError(
+ "[AQU-SEL-007] No selector path for resource %s".format(resource)
+ )
+
+ }
+ }
+
+ Debug(logger, "effectivePriceTableOfSelectorForResource:")
+ Debug(logger, " selectorPath = %s", selectorPath.mkString("/"))
+
+ val perResource = fullPriceTable.getPerResource
+ val selectorData = perResource.get(resource)
+ if(selectorData eq null) {
+ throw new AquariumInternalError(
+ "[AQU-SEL-007] Cannot select path %s for unknown resource %s",
+ selectorPath.mkString("/"),
+ resource
+ )
+ }
+
+ Debug(logger, " selectorData = %s", selectorData)
+ find(selectorPath, selectorData)
+ }
+
+ @inline final def referenceTimeslotOf(msg: WalletEntryMsg) = {
+ Timeslot(msg.getReferenceStartMillis, msg.getReferenceStopMillis)
+ }
+
+ @inline final def chargeslotCountOf(msg: WalletEntryMsg) = {
+ msg.getChargeslots.size()
+ }
+
+ final def currentResourceEventOf(msg: WalletEntryMsg): ResourceEventMsg = {
+ val resourceEvents = msg.getResourceEvents
+ resourceEvents.size() match {
+ case n if n >= 1 ⇒ resourceEvents.get(0)
+ case _ ⇒ throw new AquariumInternalError("No resource events in wallet entry")
+ }
+ }
+
+// final def splitEffectiveUnitPriceTimeslot(
+// effectiveUnitPrice: EffectiveUnitPriceMsg,
+// t: Timeslot
+// ): (List[Timeslot], List[Timeslot]) = {
+//
+// }
+}
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 gr.grnet.aquarium.charging.state.UserAgreementHistoryModel
+import gr.grnet.aquarium.charging.state.UserStateModel
+import gr.grnet.aquarium.message.avro.gen._
+import gr.grnet.aquarium.policy._
import scala.collection.JavaConverters.asScalaBufferConverter
import scala.collection.JavaConverters.mapAsScalaMapConverter
-import scala.collection.mutable
+import gr.grnet.aquarium.policy.ResourceType
+import gr.grnet.aquarium.policy.PolicyModel
+import gr.grnet.aquarium.charging.state.UserAgreementHistoryModel
+import gr.grnet.aquarium.policy.EffectivePriceTableModel
+import gr.grnet.aquarium.policy.CronSpec
+import gr.grnet.aquarium.policy.UserAgreementModel
+import gr.grnet.aquarium.policy.AdHocFullPriceTableRef
+import gr.grnet.aquarium.charging.state.UserStateModel
+import gr.grnet.aquarium.policy.EffectiveUnitPriceModel
/**
* 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] = {
+ def newOptionString(in: String): Option[String] = {
in match {
case null ⇒ None
- case some ⇒ Some(in.toString)
+ case some ⇒ Some(some)
}
}
+ // def scalaModelOfAnyValueMsg(msg: AnyValueMsg): Any = {
+ // def convert(x: Any): Any = x match {
+ // case null ⇒ null
+ // case int: Int ⇒ int
+ // case long: Long ⇒ long
+ // case boolean: Boolean ⇒ boolean
+ // case char: Char ⇒ char
+ // case charSeq: CharSequence ⇒ charSeq.toString
+ // case juList: ju.List[_] ⇒ juList.asScala.map(convert).toList
+ // case juMap: ju.Map[_, _] ⇒ juMap.asScala.map { case (k, v) ⇒ (convert(k), convert(v))}.toMap
+ // case default ⇒ default
+ // }
+ //
+ // convert(msg.getAnyValue)
+ // }
+
def newResourceType(msg: ResourceTypeMsg) = {
ResourceType(
- msg.getName().toString,
- msg.getUnit().toString,
- msg.getChargingBehaviorClass().toString
+ msg.getName(),
+ msg.getUnit(),
+ msg.getChargingBehaviorClass()
)
}
def newEffectiveUnitPrice(msg: EffectiveUnitPriceMsg) = {
- EffectiveUnitPrice(
+ EffectiveUnitPriceModel(
unitPrice = msg.getUnitPrice(),
when = msg.getWhen() match {
case null ⇒
case cronSpecTupleMsg ⇒
Some(
- CronSpec(cronSpecTupleMsg.getA.toString),
- CronSpec(cronSpecTupleMsg.getB.toString)
+ CronSpec(cronSpecTupleMsg.getA),
+ CronSpec(cronSpecTupleMsg.getB)
)
}
)
}
def newEffectivePriceTable(msg: EffectivePriceTableMsg) = {
- EffectivePriceTable(
+ EffectivePriceTableModel(
priceOverrides = msg.getPriceOverrides.asScala.map(newEffectiveUnitPrice).toList
)
}
newEffectivePriceTable(effectivePriceTableMsg)
case mapOfSelectorValueMsg: java.util.Map[_, _] ⇒
- mapOfSelectorValueMsg.asScala.map { case (k, v) ⇒
- (k.toString, newSelectorValue(v.asInstanceOf[SelectorValueMsg]))
+ 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) ⇒
+ FullPriceTableModel(msg)
+ }
+
+ def newRoleMapping(
+ roleMapping: java.util.Map[String, FullPriceTableMsg]
+ ): Map[String, FullPriceTableModel] = {
+
+ roleMapping.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
+ val v2 = newFullPriceTable(v)
(k2, v2)
- }.toSeq: _*)
+ }.toMap
+ }
+
+ def newPolicyModel(msg: PolicyMsg) = PolicyModel(msg)
+
+ def newUserAgreementModelFromIMEvent(
+ imEvent: IMEventMsg,
+ id: String = MessageHelpers.UserAgreementMsgIDGenerator.nextUID()
+ ) = {
+
+ UserAgreementModel(
+ MessageFactory.newUserAgreementFromIMEventMsg(imEvent, id),
+ PolicyDefinedFullPriceTableRef
)
}
- def newRoleMapping(
- roleMapping: java.util.Map[CharSequence, FullPriceTableMsg]
- ): mutable.Map[String, FullPriceTable] = {
+ def newUserAgreementModelFromIMEventMsg(
+ imEvent: IMEventMsg,
+ fullPriceTableRef: FullPriceTableRef,
+ id: String = MessageHelpers.UserAgreementMsgIDGenerator.nextUID()
+ ): UserAgreementModel = {
+ UserAgreementModel(
+ MessageFactory.newUserAgreementFromIMEventMsg(imEvent, id),
+ fullPriceTableRef
+ )
+ }
- roleMapping.asScala.map { case (k, v) ⇒
- val k2 = k.toString
- val v2 = newFullPriceTable(v)
+ def newUserAgreementModel(msg: UserAgreementMsg): UserAgreementModel = {
+ UserAgreementModel(
+ msg,
+ msg.getFullPriceTableRef match {
+ case null ⇒
+ PolicyDefinedFullPriceTableRef
- (k2, v2)
- }
+ case fullPriceTableMsg ⇒
+ AdHocFullPriceTableRef(newFullPriceTable(fullPriceTableMsg))
+ }
+ )
+ }
+
+ def newUserAgreementHistoryModel(msg: UserAgreementHistoryMsg): UserAgreementHistoryModel = {
+ UserAgreementHistoryModel(msg)
}
- 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
+ def newUserStateModel(msg: UserStateMsg): UserStateModel = {
+ UserStateModel(
+ msg,
+ newUserAgreementHistoryModel(msg.getAgreementHistory)
)
}
}
package gr.grnet.aquarium.message.avro
-import gr.grnet.aquarium.message.avro.gen.PolicyMsg
+import gr.grnet.aquarium.message.avro.gen.{UserStateMsg, IMEventMsg, ResourceEventMsg, PolicyMsg}
/**
*
object OrderingHelpers {
final val DefaultPolicyMsgOrdering = new Ordering[PolicyMsg] {
def compare(x: PolicyMsg, y: PolicyMsg): Int = {
- if(x.getValidFromMillis < y.getValidFromMillis) {
+ val x_getValidFromMillis = x.getValidFromMillis
+ val y_getValidFromMillis = y.getValidFromMillis
+
+ if(x_getValidFromMillis < y_getValidFromMillis) {
+ -1
+ }
+ else if (x_getValidFromMillis == y_getValidFromMillis) {
+ 0
+ } else {
+ 1
+ }
+ }
+ }
+
+ final val DefaultResourceEventMsgOrdering = new Ordering[ResourceEventMsg] {
+ def compare(x: ResourceEventMsg, y: ResourceEventMsg): Int = {
+ val x_getOccurredMillis = x.getOccurredMillis
+ val y_getOccurredMillis = y.getOccurredMillis
+
+ if(x_getOccurredMillis < y_getOccurredMillis) {
+ -1
+ }
+ else if (x_getOccurredMillis == y_getOccurredMillis) {
+ 0
+ } else {
+ 1
+ }
+ }
+ }
+
+ final val DefaultIMEventMsgOrdering = new Ordering[IMEventMsg] {
+ def compare(x: IMEventMsg, y: IMEventMsg): Int = {
+ val x_getOccurredMillis = x.getOccurredMillis
+ val y_getOccurredMillis = y.getOccurredMillis
+
+ if(x_getOccurredMillis < y_getOccurredMillis) {
+ -1
+ }
+ else if(x_getOccurredMillis == y_getOccurredMillis) {
+ 0
+ } else {
+ 1
+ }
+ }
+ }
+
+ final val DefaultUserStateMsgOrdering = new Ordering[UserStateMsg] {
+ def compare(x: UserStateMsg, y: UserStateMsg): Int = {
+ val x_getValidFromMillis = x.getAgreementHistory().getAgreements().get(0).getValidFromMillis
+ val y_getValidFromMillis = y.getAgreementHistory().getAgreements().get(0).getValidFromMillis
+
+ if(x_getValidFromMillis < y_getValidFromMillis) {
-1
}
- else if (x.getValidFromMillis == y.getValidFromMillis) {
+ else if(x_getValidFromMillis == y_getValidFromMillis) {
0
} else {
1
import gr.grnet.aquarium.logic.accounting.dsl.Timeslot
import gr.grnet.aquarium.message.avro.gen.PolicyMsg
-import gr.grnet.aquarium.message.avro.{DummyHelpers, OrderingHelpers}
+import gr.grnet.aquarium.message.avro.{MessageFactory, OrderingHelpers}
import gr.grnet.aquarium.store.PolicyStore
import gr.grnet.aquarium.util.Lock
import scala.collection.immutable
def loadSortedPoliciesWithin(fromMillis: Long, toMillis: Long): immutable.SortedMap[Timeslot, PolicyMsg] = {
immutable.SortedMap(_policies.
- from(DummyHelpers.dummyPolicyMsgAt(fromMillis)).
- to(DummyHelpers.dummyPolicyMsgAt(toMillis)).toSeq.
+ from(MessageFactory.newDummyPolicyMsgAt(fromMillis)).
+ to(MessageFactory.newDummyPolicyMsgAt(toMillis)).toSeq.
map(p ⇒ (Timeslot(p.getValidFromMillis, p.getValidToMillis), p)): _*
)
}
// 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(DummyHelpers.dummyPolicyMsgAt(atMillis)).lastOption
+ _policies.to(MessageFactory.newDummyPolicyMsgAt(atMillis)).lastOption
}
* @author Christos KK Loverdos <loverdos@gmail.com>
*/
-case class EffectivePriceTable(priceOverrides: List[EffectiveUnitPrice])
+case class EffectivePriceTableModel(
+ priceOverrides: List[EffectiveUnitPriceModel]
+)
* @author Prodromos Gerakios <pgerakios@grnet.gr>
*/
-case class EffectiveUnitPrice(unitPrice: Double, when: Option[(CronSpec,CronSpec)] = None) {
+case class EffectiveUnitPriceModel(
+ unitPrice: Double,
+ when: Option[(CronSpec, CronSpec)] = None
+) {
/* Split a timeslot T into two *sets* S and S2 consisting of timeslots such that
* (a) each element in S1,S2 is contained in T
package gr.grnet.aquarium.policy
import gr.grnet.aquarium.AquariumInternalError
-import gr.grnet.aquarium.util.shortNameOfType
+import gr.grnet.aquarium.message.avro.gen.FullPriceTableMsg
import gr.grnet.aquarium.util.LogHelpers.Debug
+import gr.grnet.aquarium.util.shortNameOfType
import org.slf4j.Logger
import scala.annotation.tailrec
+import scala.collection.JavaConverters.mapAsScalaMapConverter
+import gr.grnet.aquarium.message.avro.ModelFactory
+
/**
* A full price table provides detailed pricing information for all resource types.
*
- * @param perResource The key is some [[gr.grnet.aquarium.policy.ResourceType]]`.name`.
- * The value is a Map from selector to either an [[gr.grnet.aquarium.policy.EffectivePriceTable]]
- * or another Map (that designates another level of search path).
- * See `policy.json` for samples.
*
- *@author Christos KK Loverdos <loverdos@gmail.com>
+ * @author Christos KK Loverdos <loverdos@gmail.com>
*/
-case class FullPriceTable(
- perResource: Map[String /* The key is some ResourceType.name */,
- Map[String /* Use "default" for the simple cases */, Any]]
-) {
+case class FullPriceTableModel(msg: FullPriceTableMsg ) {
+ /**
+ * The key is some [[gr.grnet.aquarium.policy.ResourceType]]`.name`.
+ * The value is a Map from selector to either an [[gr.grnet.aquarium.policy.EffectivePriceTableModel]]
+ * or another Map (that designates another level of search path).
+ * See `policy.json` for samples.
+ */
+ val perResource: Map[String /* The key is some ResourceType.name */,
+ Map[String /* Use "default" for the simple cases */, Any]] = {
+ Map(msg.getPerResource().asScala.map { case (k, v) ⇒
+ val k2 = k
+ val v2 = v.asScala.map {
+ case (k, v) ⇒
+ (k, ModelFactory.newSelectorValue(v))
+ }.toMap // make immutable map
+
+ (k2, v2)
+ }.toSeq: _*)
+ }
def effectivePriceTableOfSelectorForResource(
selectorPath: List[String],
resource: String,
logger: Logger
- ): EffectivePriceTable = {
+ ): EffectivePriceTableModel = {
// Most of the code is for exceptional cases, which we identify in detail.
@tailrec
def find(
partialSelectorPath: List[String],
partialSelectorData: Any
- ): EffectivePriceTable = {
+ ): EffectivePriceTableModel = {
Debug(logger, "find: ")
Debug(logger, " partialSelectorPath = %s", partialSelectorPath.mkString("/"))
case selectorMap: Map[_,_] ⇒
// The selectorData is a map indeed
selectorMap.asInstanceOf[Map[String, _]].get(selector) match {
- case Some(selected: EffectivePriceTable) ⇒
+ case Some(selected: EffectivePriceTableModel) ⇒
// Yes, it is a map of the right type (OK, we assume keys are always Strings)
// (we only check the value type)
selected
selectorPath.mkString("/"),
resource,
badSelected,
- shortNameOfType[EffectivePriceTable],
+ shortNameOfType[EffectivePriceTableModel],
partialSelectorPath.mkString("/")
)
)
Debug(logger, "effectivePriceTableOfSelectorForResource:")
Debug(logger, " selectorPath = %s", selectorPath.mkString("/"))
- val selectorDataOpt = perResource.get(resource)
+ val selectorDataOpt = perResource.get(resource.toString)
if(selectorDataOpt.isEmpty) {
throw new AquariumInternalError("Unknown resource type '%s'", resource)
}
find(selectorPath, selectorData)
}
}
-
-object FullPriceTable {
- final val DefaultSelectorKey = "default"
-}
\ No newline at end of file
* Refers to an existing full price table that belongs to the given role. The role is implied from the user agreement
* that contains this instance and must be used to retrieve the exact full price table from the Aquarium policy.
*/
-case class PolicyDefinedFullPriceTableRef() extends FullPriceTableRef {
+case object PolicyDefinedFullPriceTableRef extends FullPriceTableRef {
def isAdHoc: Boolean = false
}
-case class AdHocFullPriceTableRef(adhocPriceTable: FullPriceTable) extends FullPriceTableRef {
+case class AdHocFullPriceTableRef(adhocPriceTable: FullPriceTableModel) extends FullPriceTableRef {
def isAdHoc: Boolean = true
}
package gr.grnet.aquarium.policy
-import gr.grnet.aquarium.{AquariumInternalError, Timespan}
+import gr.grnet.aquarium.message.avro.ModelFactory
+import gr.grnet.aquarium.message.avro.gen.{FullPriceTableMsg, PolicyMsg}
import gr.grnet.aquarium.util.json.JsonSupport
-import gr.grnet.aquarium.charging.ChargingBehavior
-import gr.grnet.aquarium.converter.{JsonTextFormat, StdConverters}
+import scala.collection.JavaConverters.asScalaBufferConverter
+import scala.collection.immutable
+import gr.grnet.aquarium.AquariumInternalError
/**
* A policy is the fundamental business-related configuration of Aquarium.
* @author Christos KK Loverdos <loverdos@gmail.com>
*/
-trait PolicyModel extends Ordered[PolicyModel] with JsonSupport {
- final def compare(that: PolicyModel): Int = {
- if(this.validFromMillis < that.validFromMillis) {
- -1
- } else if(this.validFromMillis == that.validFromMillis) {
- 0
- } else {
- 1
- }
- }
+case class PolicyModel(
+ msg: PolicyMsg
+) extends Ordered[PolicyModel] with JsonSupport {
- def originalID: String
-
- def parentID: Option[String]
-
- def inStoreID: Option[String]
-
- def validFromMillis: Long
- def validToMillis: Long
/**
- * The time period within which this policy is valid.
+ * Each role is mapped to a full price table.
*/
- def validityTimespan: Timespan = Timespan(validFromMillis, validToMillis)
+ val roleMapping = ModelFactory.newRoleMapping(msg.getRoleMapping)
/**
- * All known resource types for the policy's validity period.
+ * All known charging behaviors for the policy's validity period. These are the fully
+ * qualified class names that implement [[gr.grnet.aquarium.charging.ChargingBehavior]]<p/>
+ * Note than since a charging behavior is semantically attached to an implementation,
+ * a change in the set of known charging behaviors normally means a change in the
+ * implementation of Aquarium.
*/
- def resourceTypes: Set[ResourceType]
+ val chargingBehaviors = immutable.Set(msg.getChargingBehaviors().asScala.toSeq: _*)
/**
- * All known charging behaviors for the policy's validity period.<p/>
- *
- * Note than since a charging behavior is semantically attached to an implementation, a change in the set
- * of known charging behaviors normally means a change in the implementation of Aquarium.
+ * All known resource types for the policy's validity period.
*/
- def chargingBehaviors: Set[String/*ImplementationClassName*/]
+ val resourceTypes = immutable.Set(msg.getResourceTypes().asScala.map(ModelFactory.newResourceType).toSeq: _*)
- /**
- * Each role is mapped to a full price table.
- */
- def roleMapping: Map[String/*Role*/, FullPriceTable]
+ def validFromMillis = msg.getValidFromMillis: Long
+ def validToMillis = msg.getValidToMillis: Long
+
+ final def compare(that: PolicyModel): Int = {
+ if(this.validFromMillis < that.validFromMillis) {
+ -1
+ } else if(this.validFromMillis == that.validFromMillis) {
+ 0
+ } else {
+ 1
+ }
+ }
/**
* All the known roles for the policy's validity period.
* These names must be common between all communicating parties, i.e. the IM component that sends
- * [[gr.grnet.aquarium.event.model.im.IMEventModel]] events.
+ * [[gr.grnet.aquarium.message.avro.gen.IMEventMsg]] events.
*
* This is a derived set, from the keys of `roleMapping`
*/
- def roles: Set[String] = roleMapping.keySet
-
- def resourceTypesMap: Map[String, ResourceType] = Map(resourceTypes.map(rt ⇒ (rt.name, rt)).toSeq: _*)
-
- def resourceTypeByName(resource: String): Option[ResourceType] = resourceTypes.find(_.name == resource)
-}
-
-object PolicyModel {
- def fromJsonString(json: String): StdPolicy = {
- StdConverters.AllConverters.convertEx[StdPolicy](JsonTextFormat(json))
- }
+ val roles = roleMapping.keySet
- 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 = {
+ val resourceTypesMap = immutable.Map(resourceTypes.map(rt ⇒ (rt.name, rt)).toSeq: _*)
- StdPolicy(
- originalID,
- inStoreID,
- parentID,
- validFromMillis,
- validToMillis,
- resourceTypes,
- chargingBehaviors,
- roleMapping
- )
- }
+ def resourceTypeByName(resource: String) = resourceTypes.find(_.name == resource)
}
+++ /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.policy
-
-import gr.grnet.aquarium.Timespan
-
-/**
- *
- * @param validityPeriod The period when this price table is valid.
- * @param prices A map from resource to its unit price.
- */
-case class PolicyUnitPrices(validityPeriod: Timespan, prices: Map[String, Double]) {
-}
+++ /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.policy
-
-
-/**
- * Standard implementation of Aquarium policy model.
- *
- * @author Christos KK Loverdos <loverdos@gmail.com>
- */
-
-case class StdPolicy(
- originalID: String,
- inStoreID: Option[String],
- parentID: Option[String],
- validFromMillis: Long,
- validToMillis: Long,
- resourceTypes: Set[ResourceType],
- chargingBehaviors: Set[String],
- roleMapping: Map[String/* role name */, FullPriceTable]
-) extends PolicyModel
+++ /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.policy
-
-import gr.grnet.aquarium.Timespan
-
-/**
- *
- * @author Christos KK Loverdos <loverdos@gmail.com>
- */
-
-case class StdUserAgreement(
- id: String,
- relatedIMEventID: Option[String],
- validFromMillis: Long,
- validToMillis: Long,
- role: String,
- fullPriceTableRef: FullPriceTableRef
-) extends UserAgreementModel
package gr.grnet.aquarium.policy
-import gr.grnet.aquarium.{AquariumInternalError, Timespan}
-import gr.grnet.aquarium.charging.ChargingBehavior
+import gr.grnet.aquarium.AquariumInternalError
+import gr.grnet.aquarium.logic.accounting.dsl.Timeslot
+import gr.grnet.aquarium.message.avro.gen.UserAgreementMsg
/**
*
* @author Christos KK Loverdos <loverdos@gmail.com>
*/
-trait UserAgreementModel extends Ordered[UserAgreementModel] {
- /**
- * By convention, the id is the id of the IMEvent that made the agreement change.
- * @return
- */
- def id: String
+final case class UserAgreementModel(
+ msg: UserAgreementMsg,
+ fullPriceTableRef: FullPriceTableRef
+) extends Ordered[UserAgreementModel] {
- def relatedIMEventID: Option[String]
+ def userID = msg.getUserID
- def validityTimespan = Timespan(validFromMillis, validToMillis)
+ def timeslot = Timeslot(validFromMillis, validToMillis)
- def role: String
+ // By convention, the id is the id of the IMEvent that made the agreement change.
+ def id = msg.getId
- def fullPriceTableRef: FullPriceTableRef
+ def relatedIMEventID = msg.getRelatedIMEventOriginalID match {
+ case null ⇒ None
+ case x ⇒ Some(x)
+ }
- def timeslot = validityTimespan.toTimeslot
+ def validFromMillis = msg.getValidFromMillis
- def validFromMillis: Long
+ def validToMillis = msg.getValidToMillis
- def validToMillis: Long
+ def role = msg.getRole
def compare(that: UserAgreementModel): Int = {
if(this.validFromMillis < that.validFromMillis) {
}
}
- def computeFullPriceTable(policy: PolicyModel): FullPriceTable = {
+ def computeFullPriceTable(policy: PolicyModel): FullPriceTableModel = {
this.fullPriceTableRef match {
- case PolicyDefinedFullPriceTableRef() ⇒
+ case PolicyDefinedFullPriceTableRef ⇒
policy.roleMapping.get(role) match {
case Some(fullPriceTable) ⇒
fullPriceTable
+++ /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
-
-/**
- * Includes all the definitions for the aquarium policy-related entities.
- */
-package object policy {}
import org.jboss.netty.buffer.ChannelBuffers._
import org.jboss.netty.util.CharsetUtil._
import java.net.InetSocketAddress
-import java.util.concurrent.{Executors, TimeUnit}
+import java.util.concurrent.{TimeUnit}
import gr.grnet.aquarium.util.date.TimeHelpers
import org.joda.time.format.ISODateTimeFormat
import gr.grnet.aquarium.actor.message._
import com.ckkloverdos.resource.StreamResource
-import gr.grnet.aquarium.event.model.ExternalEventModel
import akka.util.{Timeout ⇒ ATimeout, Duration ⇒ ADuration}
import akka.dispatch.{Future ⇒ AFuture}
import gr.grnet.aquarium.util.json.JsonHelpers
import gr.grnet.aquarium.actor.message.GetUserBalanceRequest
import gr.grnet.aquarium.actor.message.GetUserWalletRequest
import gr.grnet.aquarium.logic.accounting.dsl.Timeslot
+import org.apache.avro.specific.SpecificRecord
+import gr.grnet.aquarium.message.avro.AvroHelpers
/**
*
}
}
- def eventInfoResponse[E <: ExternalEventModel](
+ def eventInfoResponse[R <: SpecificRecord](
eventID: String,
- getter: String ⇒ Option[E]
+ getter: String ⇒ Option[R]
): TFuture[THttpResponse] = {
getter(eventID) match {
case Some(event) ⇒
- stringResponseOK(event.toJsonString, APPLICATION_JSON)
+ stringResponseOK(AvroHelpers.jsonStringOfSpecificRecord(event), APPLICATION_JSON)
case None ⇒
statusResponse(NOT_FOUND)
import gr.grnet.aquarium.util.json.JsonSupport
/**
- * The service that is responsible to handle `RabbitMQ` connecrivity.
+ * The service that is responsible to handle `RabbitMQ` connectivity.
*
* @author Christos KK Loverdos <loverdos@gmail.com>
*/
package gr.grnet.aquarium.store
-import gr.grnet.aquarium.event.model.im.IMEventModel
-import gr.grnet.aquarium.util.makeString
+import gr.grnet.aquarium.message.avro.gen.IMEventMsg
/**
* Store for external user events
* @author Georgios Gousios <gousiosg@gmail.com>
*/
trait IMEventStore {
- def createIMEventFromJson(json: String): IMEventModel
-
- def createIMEventFromJsonBytes(jsonBytes: Array[Byte]) = {
- createIMEventFromJson(makeString(jsonBytes))
- }
-
- def createIMEventFromOther(event: IMEventModel): IMEventModel
-
def pingIMEventStore(): Unit
/**
* Insert a new event into the store.
*/
- def insertIMEvent(event: IMEventModel): IMEventModel
+ def insertIMEvent(event: IMEventMsg): IMEventMsg
/**
* Find an event by its ID
*/
- def findIMEventByID(id: String): Option[IMEventModel]
+ def findIMEventByID(id: String): Option[IMEventMsg]
/**
* Find the `CREATE` even for the given user. Note that there must be only one such event.
*/
- def findCreateIMEventByUserID(userID: String): Option[IMEventModel]
-
- def findLatestIMEventByUserID(userID: String): Option[IMEventModel]
+ def findCreateIMEventByUserID(userID: String): Option[IMEventMsg]
/**
* Scans events for the given user, sorted by `occurredMillis` in ascending order and runs them through
*
* Any exception is propagated to the caller. The underlying DB resources are properly disposed in any case.
*/
- def foreachIMEventInOccurrenceOrder(userID: String)(f: IMEventModel ⇒ Unit): Unit
+ def foreachIMEventInOccurrenceOrder(userID: String)(f: IMEventMsg ⇒ Unit): Unit
}
\ No newline at end of file
package gr.grnet.aquarium.store
import gr.grnet.aquarium.Aquarium
-import java.io.{FileOutputStream, File}
-import gr.grnet.aquarium.util.{Loggable, stringOfStackTrace, makeBytes, UTF_8_Charset}
+import gr.grnet.aquarium.message.avro.gen.{IMEventMsg, ResourceEventMsg}
import gr.grnet.aquarium.util.date.{TimeHelpers, MutableDateCalc}
-import gr.grnet.aquarium.event.model.im.IMEventModel
-import gr.grnet.aquarium.event.model.resource.ResourceEventModel
+import gr.grnet.aquarium.util.{Loggable, stringOfStackTrace, makeBytes, UTF_8_Charset}
+import java.io.{FileOutputStream, File}
/**
* This is used whenever the property `events.store.folder` is setup in aquarium configuration.
object LocalFSEventStore extends Loggable {
private[this] final val NewLine = makeBytes("\n", UTF_8_Charset) // super-fluous!
- private[this] def writeToFile(file: File,
- dataHeader: String,
- data: Array[Byte],
- dataFooter: String,
- appendString: Option[String] = None): Unit = {
+ private[this] def writeToFile(
+ file: File,
+ dataHeader: String,
+ data: Array[Byte],
+ dataFooter: String,
+ appendString: Option[String] = None
+ ): Unit = {
+
val out = new FileOutputStream(file)
out.write(makeBytes(dataHeader, UTF_8_Charset))
folder
}
- private[this] def writeJson(tag: String,
- folder: File,
- jsonPayload: Array[Byte],
- occurredString: String,
- extraName: Option[String],
- isParsed: Boolean,
- appendString: Option[String]): Unit = {
+ private[this] def writeJson(
+ tag: String,
+ folder: File,
+ jsonPayload: Array[Byte],
+ occurredString: String,
+ extraName: Option[String],
+ isParsed: Boolean,
+ appendString: Option[String]
+ ): Unit = {
+
val file = new File(
folder,
"%s-%s%s.%s.json".format(
}
}
- def storeResourceEvent(aquarium: Aquarium, event: ResourceEventModel, initialPayload: Array[Byte]): Unit = {
+ def storeResourceEvent(aquarium: Aquarium, event: ResourceEventMsg, initialPayload: Array[Byte]): Unit = {
if(!aquarium.saveResourceEventsToEventsStoreFolder) {
return
}
require(event ne null, "Resource event must be not null")
for(root <- aquarium.eventsStoreFolder) {
- val occurredMDC = new MutableDateCalc(event.occurredMillis)
+ val occurredMDC = new MutableDateCalc(event.getOccurredMillis)
val occurredString = occurredMDC.toFilename_YYYYMMDDHHMMSSSSS
val rcEventsFolder = createResourceEventsFolder(root)
initialPayload,
occurredString,
Some("[%s]-[%s]-[%s]-[%s]".format(
- event.id,
- event.userID,
- event.resource,
- event.instanceID)),
+ event.getOriginalID,
+ event.getUserID,
+ event.getResource,
+ event.getInstanceID)),
true,
None
)
}
}
- def storeIMEvent(aquarium: Aquarium, event: IMEventModel, initialPayload: Array[Byte]): Unit = {
+ def storeIMEvent(aquarium: Aquarium, event: IMEventMsg, initialPayload: Array[Byte]): Unit = {
if(!aquarium.saveIMEventsToEventsStoreFolder) {
return
}
require(event ne null, "IM event must be not null")
for(root <- aquarium.eventsStoreFolder) {
- val occurredMDC = new MutableDateCalc(event.occurredMillis)
+ val occurredMDC = new MutableDateCalc(event.getOccurredMillis)
val occurredString = occurredMDC.toFilename_YYYYMMDDHHMMSSSSS
val imEventsFolder = createIMEventsFolder(root)
imEventsFolder,
initialPayload,
occurredString,
- Some("[%s]-[%s]".format(event.id, event.userID)),
+ Some("[%s]-[%s]".format(event.getOriginalID, event.getUserID)),
true,
None
)
package gr.grnet.aquarium.store
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}
+import gr.grnet.aquarium.message.avro.ModelFactory
/**
* Provides helper methods for the policy store.
package gr.grnet.aquarium.store
-import gr.grnet.aquarium.event.model.resource.ResourceEventModel
import gr.grnet.aquarium.AquariumInternalError
+import gr.grnet.aquarium.message.avro.gen.ResourceEventMsg
/**
* An abstraction for Aquarium `ResourceEvent` stores.
* @author Georgios Gousios <gousiosg@gmail.com>.
*/
trait ResourceEventStore {
- def createResourceEventFromOther(event: ResourceEventModel): ResourceEventModel
-
- def clearResourceEvents(): Unit = {
- // This method is implemented only in MemStoreProvider.
- throw new AquariumInternalError("Unsupported operation")
- }
-
def pingResourceEventStore(): Unit
- def insertResourceEvent(event: ResourceEventModel): ResourceEventModel
-
- def findResourceEventByID(id: String): Option[ResourceEventModel]
+ def insertResourceEvent(event: ResourceEventMsg): ResourceEventMsg
- def findResourceEventsByUserID(userID: String)(sortWith: Option[(ResourceEventModel, ResourceEventModel) ⇒ Boolean]): List[ResourceEventModel]
+ def findResourceEventByID(id: String): Option[ResourceEventMsg]
/**
* Counts and returns the number of "out of sync" events for a billing period.
userID: String,
startMillis: Long,
stopMillis: Long
- )(f: ResourceEventModel ⇒ Unit): Unit
+ )(f: ResourceEventMsg ⇒ Unit): Unit
}
\ No newline at end of file
package gr.grnet.aquarium.store
import gr.grnet.aquarium.computation.BillingMonthInfo
-import gr.grnet.aquarium.charging.state.UserStateModel
+import gr.grnet.aquarium.message.avro.gen.UserStateMsg
/**
* A store for user state snapshots.
*
- * This is used to hold snapshots of [[gr.grnet.aquarium.charging.state.UserStateModel]].
+ * This is used to hold snapshots of [[gr.grnet.aquarium.message.avro.gen.UserStateMsg]].
*
* @author Christos KK Loverdos <loverdos@gmail.com>
*/
trait UserStateStore {
- def createUserStateFromOther(userState: UserStateModel): UserStateModel
-
/**
* Stores a user state.
*/
- def insertUserState(userState: UserStateModel): UserStateModel
+ def insertUserState(userState: UserStateMsg): UserStateMsg
/**
* Finds a state by user ID
*/
- def findUserStateByUserID(userID: String): Option[UserStateModel]
+ def findUserStateByUserID(userID: String): Option[UserStateMsg]
/**
* Finds the most up-to-date user state for the particular billing period.
*/
- def findLatestUserStateForFullMonthBilling(userID: String, bmi: BillingMonthInfo): Option[UserStateModel]
+ def findLatestUserStateForFullMonthBilling(userID: String, bmi: BillingMonthInfo): Option[UserStateMsg]
}
\ No newline at end of file
package gr.grnet.aquarium.store.memory
+import collection.immutable
+import collection.immutable.SortedMap
import com.ckkloverdos.props.Props
-import gr.grnet.aquarium.store._
-import scala.collection.JavaConversions._
-import collection.mutable.ConcurrentMap
-import java.util.concurrent.ConcurrentHashMap
import gr.grnet.aquarium.Configurable
-import gr.grnet.aquarium.event.model.im.{StdIMEvent, IMEventModel}
-import gr.grnet.aquarium.event.model.resource.{StdResourceEvent, ResourceEventModel}
-import gr.grnet.aquarium.util.{Loggable, Tags}
import gr.grnet.aquarium.computation.BillingMonthInfo
-import gr.grnet.aquarium.policy.{PolicyModel, StdPolicy}
-import collection.immutable.SortedMap
import gr.grnet.aquarium.logic.accounting.dsl.Timeslot
-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}
+import gr.grnet.aquarium.message.avro.gen.{UserStateMsg, IMEventMsg, ResourceEventMsg, PolicyMsg}
+import gr.grnet.aquarium.message.avro.{MessageFactory, MessageHelpers, OrderingHelpers}
+import gr.grnet.aquarium.store._
+import gr.grnet.aquarium.util.{Loggable, Tags}
/**
* An implementation of various stores that persists parts in memory.
with IMEventStore
with Loggable {
- private[this] var _userStates = List[UserStateModel]()
+ private[this] var _userStates = immutable.TreeSet[UserStateMsg]()(OrderingHelpers.DefaultUserStateMsgOrdering)
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]()
-
+ private[this] var _resourceEvents = immutable.TreeSet[ResourceEventMsg]()(OrderingHelpers.DefaultResourceEventMsgOrdering)
+ private[this] var _imEvents = immutable.TreeSet[IMEventMsg]()(OrderingHelpers.DefaultIMEventMsgOrdering)
def propertyPrefix = None
val map = Map(
Tags.UserStateTag -> _userStates.size,
Tags.ResourceEventTag -> _resourceEvents.size,
- Tags.IMEventTag -> imEventById.size,
+ Tags.IMEventTag -> _imEvents.size,
"PolicyEntry" -> _policies.size
)
//+ UserStateStore
- def createUserStateFromOther(model: UserStateModel): UserStateModel = {
- logger.info("createUserStateFromOther(%s)".format(model))
-
- if(model.isInstanceOf[StdUserState]) {
- model.asInstanceOf[StdUserState]
- }
- else {
- new StdUserState(
- model.id,
- model.parentIDInStore,
- model.userID,
- model.occurredMillis,
- model.latestResourceEventOccurredMillis,
- model.totalCredits,
- model.isFullBillingMonth,
- model.billingYear,
- model.billingMonth,
- model.stateOfResources,
- model.billingPeriodOutOfSyncResourceEventsCounter,
- model.agreementHistory,
- model.walletEntries
- )
- }
- }
-
- def insertUserState(userState: UserStateModel): UserStateModel = {
- val localUserState = createUserStateFromOther(userState)
- _userStates ::= localUserState
- localUserState
+ def insertUserState(event: UserStateMsg) = {
+ event.setInStoreID(event.getOriginalID)
+ _userStates += event
+ event
}
def findUserStateByUserID(userID: String) = {
- _userStates.find(_.userID == userID)
+ _userStates.find(_.getUserID == userID)
}
- def findLatestUserStateForFullMonthBilling(userID: String, bmi: BillingMonthInfo): Option[UserStateModel] = {
- val goodOnes = _userStates.filter { userState ⇒
- userState.userID == userID &&
- userState.isFullBillingMonth &&
- userState.billingYear == bmi.year &&
- userState.billingMonth == bmi.month
- }
-
- goodOnes.sortWith {
- case (us1, us2) ⇒
- us1.occurredMillis > us2.occurredMillis
- } match {
- case head :: _ ⇒
- Some(head)
- case _ ⇒
- None
- }
+ def findLatestUserStateForFullMonthBilling(userID: String, bmi: BillingMonthInfo) = {
+ _userStates.filter { userState ⇒
+ userState.getUserID == userID &&
+ userState.getIsFullBillingMonth &&
+ userState.getBillingYear == bmi.year &&
+ userState.getBillingMonth == bmi.month
+ }.lastOption
}
//- UserStateStore
//+ ResourceEventStore
- def createResourceEventFromOther(event: ResourceEventModel): ResourceEventModel = {
- if(event.isInstanceOf[MemResourceEvent]) event.asInstanceOf[MemResourceEvent]
- else {
- import event._
- new StdResourceEvent(
- id,
- occurredMillis,
- receivedMillis,
- userID,
- clientID,
- resource,
- instanceID,
- value,
- eventVersion,
- details
- ): MemResourceEvent
- }
- }
-
- override def clearResourceEvents() = {
- _resourceEvents = Nil
- }
-
def pingResourceEventStore(): Unit = {
// We are always live and kicking...
}
- def insertResourceEvent(event: ResourceEventModel) = {
- val localEvent = createResourceEventFromOther(event)
- _resourceEvents ::= localEvent
- localEvent
+ def insertResourceEvent(event: ResourceEventMsg) = {
+ event.setInStoreID(event.getOriginalID)
+ _resourceEvents += event
+ event
}
def findResourceEventByID(id: String) = {
- _resourceEvents.find(ev ⇒ ev.id == id)
- }
-
- def findResourceEventsByUserID(userId: String)
- (sortWith: Option[(ResourceEventModel, ResourceEventModel) => Boolean]): List[ResourceEventModel] = {
- val byUserId = _resourceEvents.filter(_.userID == userId).toArray
- val sorted = sortWith match {
- case Some(sorter) ⇒
- byUserId.sortWith(sorter)
- case None ⇒
- byUserId
- }
-
- sorted.toList
+ _resourceEvents.find(_.getOriginalID == id)
}
def countOutOfSyncResourceEventsForBillingPeriod(userID: String, startMillis: Long, stopMillis: Long): Long = {
_resourceEvents.filter { case ev ⇒
- ev.userID == userID &&
+ ev.getUserID == userID &&
// out of sync events are those that were received in the billing month but occurred in previous (or next?)
// months
- ev.isOutOfSyncForBillingPeriod(startMillis, stopMillis)
+ MessageHelpers.isOutOfSyncForBillingPeriod(ev, startMillis, stopMillis)
}.size.toLong
}
//- ResourceEventStore
userID: String,
startMillis: Long,
stopMillis: Long
- )(f: ResourceEventModel ⇒ Unit): Unit = {
+ )(f: ResourceEventMsg ⇒ Unit): Unit = {
_resourceEvents.filter { case ev ⇒
- ev.userID == userID &&
- ev.isOccurredWithinMillis(startMillis, stopMillis)
+ ev.getUserID == userID &&
+ MessageHelpers.isOccurredWithinMillis(ev, startMillis, stopMillis)
}.foreach(f)
}
//+ IMEventStore
- def createIMEventFromJson(json: String) = {
- StdIMEvent.fromJsonString(json)
- }
-
- def createIMEventFromOther(event: IMEventModel) = {
- StdIMEvent.fromOther(event)
- }
-
def pingIMEventStore(): Unit = {
}
- def insertIMEvent(event: IMEventModel) = {
- val localEvent = createIMEventFromOther(event)
- imEventById += (event.id -> localEvent)
- localEvent
+ def insertIMEvent(event: IMEventMsg) = {
+ event.setInStoreID(event.getOriginalID)
+ _imEvents += event
+ event
}
- def findIMEventByID(id: String) = imEventById.get(id)
+ def findIMEventByID(id: String) = {
+ _imEvents.find(_.getOriginalID == id)
+ }
/**
* Find the `CREATE` even for the given user. Note that there must be only one such event.
*/
- def findCreateIMEventByUserID(userID: String): Option[IMEventModel] = {
- imEventById.valuesIterator.filter { e ⇒
- e.userID == userID && e.isCreateUser
- }.toList.sortWith { case (e1, e2) ⇒
- e1.occurredMillis < e2.occurredMillis
- } headOption
- }
-
- def findLatestIMEventByUserID(userID: String): Option[IMEventModel] = {
- imEventById.valuesIterator.filter(_.userID == userID).toList.sortWith {
- case (us1, us2) ⇒
- us1.occurredMillis > us2.occurredMillis
- } headOption
+ def findCreateIMEventByUserID(userID: String) = {
+ _imEvents.find { event ⇒
+ event.getUserID() == userID && MessageHelpers.isIMEventCreate(event)
+ }
}
/**
*
* Any exception is propagated to the caller. The underlying DB resources are properly disposed in any case.
*/
- def foreachIMEventInOccurrenceOrder(userID: String)(f: (IMEventModel) => Unit) = {
- imEventById.valuesIterator.filter(_.userID == userID).toSeq.sortWith {
- case (ev1, ev2) ⇒ ev1.occurredMillis <= ev2.occurredMillis
- } foreach(f)
+ def foreachIMEventInOccurrenceOrder(userID: String)(f: (IMEventMsg) ⇒ Unit) = {
+ for {
+ msg <- _imEvents
+ } {
+ f(msg)
+ }
}
//- IMEventStore
//+ PolicyStore
def insertPolicy(policy: PolicyMsg): PolicyMsg = synchronized {
+ policy.setInStoreID(policy.getOriginalID)
_policies += policy
-
policy
}
def loadPolicyAt(atMillis: Long): Option[PolicyMsg] = synchronized {
- _policies.to(DummyHelpers.dummyPolicyMsgAt(atMillis)).lastOption
+ _policies.to(MessageFactory.newDummyPolicyMsgAt(atMillis)).lastOption
}
def loadSortedPoliciesWithin(fromMillis: Long, toMillis: Long): SortedMap[Timeslot, PolicyMsg] = {
immutable.SortedMap(_policies.
- from(DummyHelpers.dummyPolicyMsgAt(fromMillis)).
- to(DummyHelpers.dummyPolicyMsgAt(toMillis)).toSeq.
+ from(MessageFactory.newDummyPolicyMsgAt(fromMillis)).
+ to(MessageFactory.newDummyPolicyMsgAt(toMillis)).toSeq.
map(p ⇒ (Timeslot(p.getValidFromMillis, p.getValidToMillis), p)): _*
)
}
}
//- PolicyStore
}
-
-object MemStoreProvider {
- final def isLocalIMEvent(event: IMEventModel) = event match {
- case _: MemIMEvent ⇒ true
- case _ ⇒ false
- }
-}
\ No newline at end of file
+++ /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.store
-
-import gr.grnet.aquarium.event.model.im.StdIMEvent
-import gr.grnet.aquarium.event.model.resource.StdResourceEvent
-
-package object memory {
- type MemIMEvent = StdIMEvent
- type MemResourceEvent = StdResourceEvent
-}
+++ /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.store.mongodb
-
-import gr.grnet.aquarium.event.model.ExternalEventModel
-
-/**
- *
- * @author Christos KK Loverdos <loverdos@gmail.com>
- */
-
-trait MongoDBEventModel extends ExternalEventModel {
- def _id: String
-
- override def idInStore: Option[String] = Option(_id)
-}
+++ /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.store.mongodb
-
-import gr.grnet.aquarium.converter.{JsonTextFormat, StdConverters}
-import gr.grnet.aquarium.util._
-import com.mongodb.DBObject
-import com.mongodb.util.JSON
-import gr.grnet.aquarium.event.model.im.IMEventModel
-import gr.grnet.aquarium.util.date.MutableDateCalc
-
-
-/**
- *
- * @author Christos KK Loverdos <loverdos@gmail.com>
- */
-
-case class MongoDBIMEvent(
- id: String,
- occurredMillis: Long,
- receivedMillis: Long,
- userID: String,
- clientID: String,
- isActive: Boolean,
- role: String,
- eventVersion: String,
- eventType: String,
- details: Map[String, String],
- _id: String
-) extends IMEventModel with MongoDBEventModel {
-
- def withReceivedMillis(newReceivedMillis: Long) =
- this.copy(receivedMillis = newReceivedMillis)
-
- def withDetails(newDetails: Map[String, String], newOccurredMillis: Long) =
- this.copy(details = newDetails, occurredMillis = newOccurredMillis)
-
- override def toString = {
- "%s(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)".format(
- shortClassNameOf(this),
- id,
- new MutableDateCalc(occurredMillis).toString,
- new MutableDateCalc(receivedMillis).toString,
- userID,
- clientID,
- isActive,
- role,
- eventVersion,
- eventType,
- details,
- _id
- )
- }
-}
-
-object MongoDBIMEvent {
- final def fromJsonString(json: String): MongoDBIMEvent = {
- StdConverters.AllConverters.convertEx[MongoDBIMEvent](JsonTextFormat(json))
- }
-
- final def fromJsonBytes(jsonBytes: Array[Byte]): MongoDBIMEvent = {
- fromJsonString(makeString(jsonBytes))
- }
-
- final def fromDBObject(dbObject: DBObject): MongoDBIMEvent = {
- fromJsonString(JSON.serialize(dbObject))
- }
-
- final def fromOther(event: IMEventModel, _id: String): MongoDBIMEvent = {
- MongoDBIMEvent(
- event.id,
- event.occurredMillis,
- event.receivedMillis,
- event.userID,
- event.clientID,
- event.isActive,
- event.role,
- event.eventVersion,
- event.eventType,
- event.details,
- _id
- )
- }
-}
\ No newline at end of file
+++ /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.store.mongodb
-
-import com.mongodb.DBObject
-
-import gr.grnet.aquarium.util.makeString
-import gr.grnet.aquarium.converter.{StdConverters, JsonTextFormat}
-import com.mongodb.util.JSON
-import gr.grnet.aquarium.event.model.resource.ResourceEventModel
-
-/**
- * A [[gr.grnet.aquarium.event.model.resource.ResourceEventModel]] as represented for MongoDB.
- *
- * @author Christos KK Loverdos <loverdos@gmail.com>
- */
-
-case class MongoDBResourceEvent(
- id: String,
- occurredMillis: Long,
- receivedMillis: Long,
- userID: String,
- clientID: String,
- resource: String,
- instanceID: String,
- value: Double,
- eventVersion: String,
- details: Map[String, String],
- _id: String
-) extends ResourceEventModel with MongoDBEventModel {
-
- def withReceivedMillis(newReceivedMillis: Long) =
- this.copy(receivedMillis = newReceivedMillis)
-
- def withDetails(newDetails: Map[String, String], newOccurredMillis: Long) =
- this.copy(details = newDetails, occurredMillis = newOccurredMillis)
-
- def withDetailsAndValue(newDetails: Map[String, String], newValue: Double, newOccurredMillis: Long) =
- this.copy(details = newDetails, value = newValue, occurredMillis = newOccurredMillis)
-}
-
-object MongoDBResourceEvent {
- final def fromJsonString(json: String): MongoDBResourceEvent = {
- StdConverters.AllConverters.convertEx[MongoDBResourceEvent](JsonTextFormat(json))
- }
-
- final def fromJsonBytes(bytes: Array[Byte]): MongoDBResourceEvent = {
- fromJsonString(makeString(bytes))
- }
-
- final def fromDBObject(dbObject: DBObject): MongoDBResourceEvent = {
- fromJsonString(JSON.serialize(dbObject))
- }
-
-
- final def fromOther(rcEvent: ResourceEventModel, _id: String): MongoDBResourceEvent = {
- import rcEvent._
-
- MongoDBResourceEvent(
- id,
- occurredMillis,
- receivedMillis,
- userID,
- clientID,
- resource,
- instanceID,
- value,
- eventVersion,
- details,
- _id
- )
- }
-}
\ No newline at end of file
package gr.grnet.aquarium.store.mongodb
-import com.mongodb.util.JSON
-import gr.grnet.aquarium.util.json.JsonSupport
-import collection.mutable.ListBuffer
-import gr.grnet.aquarium.event.model.im.IMEventModel
-import gr.grnet.aquarium.event.model.im.IMEventModel.{Names ⇒ IMEventNames}
-import gr.grnet.aquarium.event.model.resource.ResourceEventModel
-import gr.grnet.aquarium.event.model.resource.ResourceEventModel.{Names ⇒ ResourceEventNames}
-import gr.grnet.aquarium.store._
+import collection.immutable
import com.mongodb._
-import org.bson.types.ObjectId
-import gr.grnet.aquarium.util._
-import gr.grnet.aquarium.converter.StdConverters
-import gr.grnet.aquarium.event.model.ExternalEventModel
import gr.grnet.aquarium.computation.BillingMonthInfo
-import gr.grnet.aquarium.policy.PolicyModel
-import gr.grnet.aquarium.{Aquarium, AquariumException}
-import scala.collection.immutable.{TreeMap, SortedMap}
+import gr.grnet.aquarium.converter.StdConverters
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}
+import gr.grnet.aquarium.message.MessageConstants
+import gr.grnet.aquarium.message.avro.gen.{UserStateMsg, IMEventMsg, ResourceEventMsg, PolicyMsg}
+import gr.grnet.aquarium.message.avro.{MessageFactory, OrderingHelpers, AvroHelpers}
+import gr.grnet.aquarium.store._
+import gr.grnet.aquarium.util._
+import gr.grnet.aquarium.util.json.JsonSupport
+import gr.grnet.aquarium.{Aquarium, AquariumException}
+import org.apache.avro.specific.SpecificRecord
+import org.bson.types.ObjectId
/**
* Mongodb implementation of the various aquarium stores.
with PolicyStore
with Loggable {
- private[store] lazy val resourceEvents = getCollection(MongoDBStore.RESOURCE_EVENTS_COLLECTION)
- private[store] lazy val userStates = getCollection(MongoDBStore.USER_STATES_COLLECTION)
- private[store] lazy val imEvents = getCollection(MongoDBStore.IM_EVENTS_COLLECTION)
- private[store] lazy val policies = getCollection(MongoDBStore.POLICY_COLLECTION)
+ private[store] lazy val resourceEvents = getCollection(MongoDBStore.ResourceEventCollection)
+ private[store] lazy val userStates = getCollection(MongoDBStore.UserStateCollection)
+ private[store] lazy val imEvents = getCollection(MongoDBStore.IMEventCollection)
+ private[store] lazy val policies = getCollection(MongoDBStore.PolicyCollection)
private[this] def getCollection(name: String): DBCollection = {
val db = mongo.getDB(database)
}
//+ResourceEventStore
- def createResourceEventFromOther(event: ResourceEventModel): ResourceEventModel = {
- MongoDBResourceEvent.fromOther(event, null)
- }
-
def pingResourceEventStore(): Unit = synchronized {
MongoDBStore.ping(mongo)
}
- def insertResourceEvent(event: ResourceEventModel) = {
- val localEvent = MongoDBResourceEvent.fromOther(event, new ObjectId().toStringMongod)
- MongoDBStore.insertObject(localEvent, resourceEvents, MongoDBStore.jsonSupportToDBObject)
- localEvent
- }
+ def insertResourceEvent(event: ResourceEventMsg) = {
+ val mongoID = new ObjectId()
+ event.setInStoreID(mongoID.toStringMongod)
- def findResourceEventByID(id: String): Option[ResourceEventModel] = {
- MongoDBStore.findBy(ResourceEventNames.id, id, resourceEvents, MongoDBResourceEvent.fromDBObject)
- }
+ val dbObject = new BasicDBObjectBuilder().
+ add(MongoDBStore.JsonNames._id, mongoID).
+ add(MongoDBStore.JsonNames.payload, AvroHelpers.bytesOfSpecificRecord(event)).
+ add(MongoDBStore.JsonNames.userID, event.getUserID).
+ add(MongoDBStore.JsonNames.occurredMillis, event.getOccurredMillis).
+ add(MongoDBStore.JsonNames.receivedMillis, event.getReceivedMillis).
+ get()
- def findResourceEventsByUserID(userId: String)
- (sortWith: Option[(ResourceEventModel, ResourceEventModel) => Boolean]): List[ResourceEventModel] = {
- val query = new BasicDBObject(ResourceEventNames.userID, userId)
+ MongoDBStore.insertDBObject(dbObject, resourceEvents)
+ event
+ }
- MongoDBStore.runQuery(query, resourceEvents)(MongoDBResourceEvent.fromDBObject)(sortWith)
+ def findResourceEventByID(id: String): Option[ResourceEventMsg] = {
+ val dbObjectOpt = MongoDBStore.findOneByAttribute(resourceEvents, MongoDBStore.JsonNames.id, id)
+ for {
+ dbObject ← dbObjectOpt
+ payload = dbObject.get(MongoDBStore.JsonNames.payload)
+ msg = AvroHelpers.specificRecordOfBytes(payload.asInstanceOf[Array[Byte]], new ResourceEventMsg)
+ } yield msg
}
def countOutOfSyncResourceEventsForBillingPeriod(userID: String, startMillis: Long, stopMillis: Long): Long = {
val query = new BasicDBObjectBuilder().
- add(ResourceEventModel.Names.userID, userID).
+ add(MongoDBStore.JsonNames.userID, userID).
// received within the period
- add(ResourceEventModel.Names.receivedMillis, new BasicDBObject("$gte", startMillis)).
- add(ResourceEventModel.Names.receivedMillis, new BasicDBObject("$lte", stopMillis)).
+ add(MongoDBStore.JsonNames.receivedMillis, new BasicDBObject("$gte", startMillis)).
+ add(MongoDBStore.JsonNames.receivedMillis, new BasicDBObject("$lte", stopMillis)).
// occurred outside the period
add("$or", {
val dbList = new BasicDBList()
- dbList.add(0, new BasicDBObject(ResourceEventModel.Names.occurredMillis, new BasicDBObject("$lt", startMillis)))
- dbList.add(1, new BasicDBObject(ResourceEventModel.Names.occurredMillis, new BasicDBObject("$gt", stopMillis)))
+ dbList.add(0, new BasicDBObject(MongoDBStore.JsonNames.occurredMillis, new BasicDBObject("$lt", startMillis)))
+ dbList.add(1, new BasicDBObject(MongoDBStore.JsonNames.occurredMillis, new BasicDBObject("$gt", stopMillis)))
dbList
}).
get()
userID: String,
startMillis: Long,
stopMillis: Long
- )(f: ResourceEventModel ⇒ Unit): Unit = {
+ )(f: ResourceEventMsg ⇒ Unit): Unit = {
val query = new BasicDBObjectBuilder().
- add(ResourceEventModel.Names.userID, userID).
- add(ResourceEventModel.Names.occurredMillis, new BasicDBObject("$gte", startMillis)).
- add(ResourceEventModel.Names.occurredMillis, new BasicDBObject("$lte", stopMillis)).
+ add(MongoDBStore.JsonNames.userID, userID).
+ add(MongoDBStore.JsonNames.occurredMillis, new BasicDBObject("$gte", startMillis)).
+ add(MongoDBStore.JsonNames.occurredMillis, new BasicDBObject("$lte", stopMillis)).
get()
- val sorter = new BasicDBObject(ResourceEventModel.Names.occurredMillis, 1)
+ val sorter = new BasicDBObject(MongoDBStore.JsonNames.occurredMillis, 1)
val cursor = resourceEvents.find(query).sort(sorter)
withCloseable(cursor) { cursor ⇒
while(cursor.hasNext) {
val nextDBObject = cursor.next()
- val nextEvent = MongoDBResourceEvent.fromDBObject(nextDBObject)
+ val payload = nextDBObject.get(MongoDBStore.JsonNames.payload).asInstanceOf[Array[Byte]]
+ val nextEvent = AvroHelpers.specificRecordOfBytes(payload, new ResourceEventMsg)
f(nextEvent)
}
//-ResourceEventStore
//+ UserStateStore
- def findUserStateByUserID(userID: String): Option[UserStateModel] = {
- val query = new BasicDBObject(UserStateModel.Names.userID, userID)
- val cursor = userStates find query
-
- MongoDBStore.firstResultIfExists(cursor, MongoDBStore.dbObjectToUserState)
+ def findUserStateByUserID(userID: String) = {
+ val dbObjectOpt = MongoDBStore.findOneByAttribute(userStates, MongoDBStore.JsonNames.userID, userID)
+ for {
+ dbObject <- dbObjectOpt
+ payload = dbObject.get(MongoDBStore.JsonNames.payload).asInstanceOf[Array[Byte]]
+ msg = AvroHelpers.specificRecordOfBytes(payload, new UserStateMsg)
+ } yield {
+ msg
+ }
}
- def findLatestUserStateForFullMonthBilling(userID: String, bmi: BillingMonthInfo): Option[UserStateModel] = {
+ def findLatestUserStateForFullMonthBilling(userID: String, bmi: BillingMonthInfo) = {
val query = new BasicDBObjectBuilder().
- add(UserStateModel.Names.userID, userID).
- add(UserStateModel.Names.isFullBillingMonth, true).
- add(UserStateModel.Names.billingYear, bmi.year).
- add(UserStateModel.Names.billingMonth, bmi.month).
+ add(MongoDBStore.JsonNames.userID, userID).
+ add(MongoDBStore.JsonNames.isFullBillingMonth, true).
+ add(MongoDBStore.JsonNames.billingYear, bmi.year).
+ add(MongoDBStore.JsonNames.billingMonth, bmi.month).
get()
// Descending order, so that the latest comes first
- val sorter = new BasicDBObject(UserStateModel.Names.occurredMillis, -1)
+ val sorter = new BasicDBObject(MongoDBStore.JsonNames.occurredMillis, -1)
val cursor = userStates.find(query).sort(sorter)
- MongoDBStore.firstResultIfExists(cursor, MongoDBStore.dbObjectToUserState)
- }
-
- def createUserStateFromOther(userState: UserStateModel) = {
- MongoDBUserState.fromOther(userState, new ObjectId().toStringMongod)
+ withCloseable(cursor) { cursor ⇒
+ MongoDBStore.findNextPayloadRecord(cursor, new UserStateMsg)
+ }
}
/**
* Stores a user state.
*/
- def insertUserState(userState: UserStateModel): UserStateModel = {
- val localUserState = createUserStateFromOther(userState)
- MongoDBStore.insertObject(localUserState, userStates, MongoDBStore.jsonSupportToDBObject)
- }
- //- UserStateStore
+ def insertUserState(event: UserStateMsg)= {
+ val mongoID = new ObjectId()
+ event.setInStoreID(mongoID.toStringMongod)
- //+IMEventStore
- def createIMEventFromJson(json: String) = {
- MongoDBStore.createIMEventFromJson(json)
- }
+ val dbObject = new BasicDBObjectBuilder().
+ add(MongoDBStore.JsonNames._id, mongoID).
+ add(MongoDBStore.JsonNames.payload, AvroHelpers.bytesOfSpecificRecord(event)).
+ add(MongoDBStore.JsonNames.userID, event.getUserID).
+ add(MongoDBStore.JsonNames.occurredMillis, event.getOccurredMillis).
+ add(MongoDBStore.JsonNames.isFullBillingMonth, event.getIsFullBillingMonth).
+ add(MongoDBStore.JsonNames.billingYear, event.getBillingYear).
+ add(MongoDBStore.JsonNames.billingMonth, event.getBillingMonth).
+ add(MongoDBStore.JsonNames.billingMonthDay, event.getBillingMonthDay).
+ get()
- def createIMEventFromOther(event: IMEventModel) = {
- MongoDBStore.createIMEventFromOther(event)
+ MongoDBStore.insertDBObject(dbObject, userStates)
+ event
}
+ //- UserStateStore
+ //+IMEventStore
def pingIMEventStore(): Unit = {
MongoDBStore.ping(mongo)
}
- def insertIMEvent(event: IMEventModel): IMEventModel = {
- val localEvent = MongoDBIMEvent.fromOther(event, new ObjectId().toStringMongod)
- MongoDBStore.insertObject(localEvent, imEvents, MongoDBStore.jsonSupportToDBObject)
- localEvent
+ def insertIMEvent(event: IMEventMsg) = {
+ val mongoID = new ObjectId()
+ event.setInStoreID(mongoID.toStringMongod)
+
+ val dbObject = new BasicDBObjectBuilder().
+ add(MongoDBStore.JsonNames._id, mongoID).
+ add(MongoDBStore.JsonNames.payload, AvroHelpers.bytesOfSpecificRecord(event)).
+ add(MongoDBStore.JsonNames.userID, event.getUserID).
+ add(MongoDBStore.JsonNames.eventType, event.getEventType().toLowerCase).
+ add(MongoDBStore.JsonNames.occurredMillis, event.getOccurredMillis).
+ add(MongoDBStore.JsonNames.receivedMillis, event.getReceivedMillis).
+ get()
+
+ MongoDBStore.insertDBObject(dbObject, imEvents)
+ event
}
- def findIMEventByID(id: String): Option[IMEventModel] = {
- MongoDBStore.findBy(IMEventNames.id, id, imEvents, MongoDBIMEvent.fromDBObject)
+ def findIMEventByID(id: String) = {
+ val dbObjectOpt = MongoDBStore.findOneByAttribute(imEvents, MongoDBStore.JsonNames.id, id)
+ for {
+ dbObject ← dbObjectOpt
+ payload = dbObject.get(MongoDBStore.JsonNames.payload).asInstanceOf[Array[Byte]]
+ msg = AvroHelpers.specificRecordOfBytes(payload, new IMEventMsg)
+ } yield {
+ msg
+ }
}
/**
* Find the `CREATE` even for the given user. Note that there must be only one such event.
*/
- def findCreateIMEventByUserID(userID: String): Option[IMEventModel] = {
+ def findCreateIMEventByUserID(userID: String) = {
val query = new BasicDBObjectBuilder().
- add(IMEventNames.userID, userID).
- add(IMEventNames.eventType, IMEventModel.EventTypeNames.create).get()
+ add(MongoDBStore.JsonNames.userID, userID).
+ add(MongoDBStore.JsonNames.eventType, MessageConstants.IMEventMsg.EventTypes.create).get()
// Normally one such event is allowed ...
- val cursor = imEvents.find(query).sort(new BasicDBObject(IMEventNames.occurredMillis, 1))
-
- MongoDBStore.firstResultIfExists(cursor, MongoDBIMEvent.fromDBObject)
- }
+ val cursor = imEvents.find(query).sort(new BasicDBObject(MongoDBStore.JsonNames.occurredMillis, 1))
- def findLatestIMEventByUserID(userID: String): Option[IMEventModel] = {
- val query = new BasicDBObject(IMEventNames.userID, userID)
- val cursor = imEvents.find(query).sort(new BasicDBObject(IMEventNames.occurredMillis, -1))
+ val dbObjectOpt = withCloseable(cursor) { cursor ⇒
+ if(cursor.hasNext) {
+ Some(cursor.next())
+ } else {
+ None
+ }
+ }
- MongoDBStore.firstResultIfExists(cursor, MongoDBIMEvent.fromDBObject)
+ for {
+ dbObject <- dbObjectOpt
+ payload = dbObject.get(MongoDBStore.JsonNames.payload).asInstanceOf[Array[Byte]]
+ msg = AvroHelpers.specificRecordOfBytes(payload, new IMEventMsg)
+ } yield {
+ msg
+ }
}
/**
*
* Any exception is propagated to the caller. The underlying DB resources are properly disposed in any case.
*/
- def foreachIMEventInOccurrenceOrder(userID: String)(f: (IMEventModel) => Unit) = {
- val query = new BasicDBObject(IMEventNames.userID, userID)
- val cursor = imEvents.find(query).sort(new BasicDBObject(IMEventNames.occurredMillis, 1))
+ def foreachIMEventInOccurrenceOrder(userID: String)(f: (IMEventMsg) ⇒ Unit) = {
+ val query = new BasicDBObject(MongoDBStore.JsonNames.userID, userID)
+ val cursor = imEvents.find(query).sort(new BasicDBObject(MongoDBStore.JsonNames.occurredMillis, 1))
withCloseable(cursor) { cursor ⇒
while(cursor.hasNext) {
- val model = MongoDBIMEvent.fromDBObject(cursor.next())
- f(model)
+ val dbObject = cursor.next()
+ val payload = dbObject.get(MongoDBStore.JsonNames.payload).asInstanceOf[Array[Byte]]
+ val msg = AvroHelpers.specificRecordOfBytes(payload, new IMEventMsg)
+
+ f(msg)
}
}
}
// FIXME Inefficient
var _policies = immutable.TreeSet[PolicyMsg]()(OrderingHelpers.DefaultPolicyMsgOrdering)
foreachPolicy(_policies += _)
- _policies.to(DummyHelpers.dummyPolicyMsgAt(atMillis)).lastOption
+ _policies.to(MessageFactory.newDummyPolicyMsgAt(atMillis)).lastOption
}
def loadSortedPoliciesWithin(fromMillis: Long, toMillis: Long): immutable.SortedMap[Timeslot, PolicyMsg] = {
foreachPolicy(_policies += _)
immutable.SortedMap(_policies.
- from(DummyHelpers.dummyPolicyMsgAt(fromMillis)).
- to(DummyHelpers.dummyPolicyMsgAt(toMillis)).toSeq.
+ from(MessageFactory.newDummyPolicyMsgAt(fromMillis)).
+ to(MessageFactory.newDummyPolicyMsgAt(toMillis)).toSeq.
map(p ⇒ (Timeslot(p.getValidFromMillis, p.getValidToMillis), p)): _*
)
}
}
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"
- }
-
- /**
- * Collection holding the [[gr.grnet.aquarium.event.model.resource.ResourceEventModel]]s.
- *
- * Resource events are coming from all systems handling billable resources.
- */
- final val RESOURCE_EVENTS_COLLECTION = "resevents"
+ final val JsonNames = gr.grnet.aquarium.util.json.JsonNames
- /**
- * Collection holding the snapshots of [[gr.grnet.aquarium.charging.state.UserStateModel]].
- *
- * [[gr.grnet.aquarium.charging.state.UserStateModel]] is held internally within
- * [[gr.grnet.aquarium.actor.service.user.UserActor]]s.
- */
- final val USER_STATES_COLLECTION = "userstates"
+ final val ResourceEventCollection = "resevents"
- /**
- * Collection holding [[gr.grnet.aquarium.event.model.im.IMEventModel]]s.
- *
- * User events are coming from the IM module (external).
- */
- final val IM_EVENTS_COLLECTION = "imevents"
+ final val UserStateCollection = "userstates"
- /**
- * Collection holding [[gr.grnet.aquarium.policy.PolicyModel]]s.
- */
- final val POLICY_COLLECTION = "policies"
+ final val IMEventCollection = "imevents"
- def dbObjectToUserState(dbObj: DBObject): MongoDBUserState = {
- MongoDBUserState.fromJSONString(JSON.serialize(dbObj))
- }
+ final val PolicyCollection = "policies"
def firstResultIfExists[A](cursor: DBCursor, f: DBObject ⇒ A): Option[A] = {
withCloseable(cursor) { cursor ⇒
mongo.isLocked
}
- def findBy[A >: Null <: AnyRef](name: String,
- value: String,
- collection: DBCollection,
- deserializer: (DBObject) => A) : Option[A] = {
- val query = new BasicDBObject(name, value)
- val cursor = collection find query
-
- withCloseable(cursor) { cursor ⇒
- if(cursor.hasNext)
- Some(deserializer apply cursor.next)
- else
- None
+ def findOneByAttribute(
+ collection: DBCollection,
+ attributeName: String,
+ attributeValue: String,
+ sortByOpt: Option[DBObject] = None
+ ): Option[DBObject] = {
+ val query = new BasicDBObject(attributeName, attributeValue)
+ val cursor = sortByOpt match {
+ case None ⇒ collection find query
+ case Some(sortBy) ⇒ collection find query sort sortBy
}
- }
-
- def runQuery[A <: ExternalEventModel](query: DBObject, collection: DBCollection, orderBy: DBObject = null)
- (deserializer: (DBObject) => A)
- (sortWith: Option[(A, A) => Boolean]): List[A] = {
- val cursor0 = collection find query
- val cursor = if(orderBy ne null) {
- cursor0 sort orderBy
- } else {
- cursor0
- } // I really know that docs say that it is the same cursor.
-
- if(!cursor.hasNext) {
- cursor.close()
- Nil
- } else {
- val buff = new ListBuffer[A]()
-
- while(cursor.hasNext) {
- buff += deserializer apply cursor.next
- }
-
- cursor.close()
-
- sortWith match {
- case Some(sorter) => buff.toList.sortWith(sorter)
- case None => buff.toList
- }
+ withCloseable(cursor) { cursor ⇒
+ if(cursor.hasNext) Some(cursor.next()) else None
}
}
- def insertObject[A <: AnyRef](obj: A, collection: DBCollection, serializer: A ⇒ DBObject) : A = {
- collection.insert(serializer apply obj, WriteConcern.JOURNAL_SAFE)
- obj
- }
-
def insertDBObject(dbObj: DBObject, collection: DBCollection) {
collection.insert(dbObj, WriteConcern.JOURNAL_SAFE)
}
- def jsonSupportToDBObject(jsonSupport: JsonSupport) = {
- StdConverters.AllConverters.convertEx[DBObject](jsonSupport)
- }
-
- final def isLocalIMEvent(event: IMEventModel) = event match {
- case _: MongoDBIMEvent ⇒ true
- case _ ⇒ false
- }
-
- final def createIMEventFromJson(json: String) = {
- MongoDBIMEvent.fromJsonString(json)
- }
-
- final def createIMEventFromOther(event: IMEventModel) = {
- MongoDBIMEvent.fromOther(event, new ObjectId().toStringMongod)
+ def findNextPayloadRecord[R <: SpecificRecord](cursor: DBCursor, fresh: R): Option[R] = {
+ for {
+ dbObject <- if(cursor.hasNext) Some(cursor.next()) else None
+ payload = dbObject.get(MongoDBStore.JsonNames.payload).asInstanceOf[Array[Byte]]
+ msg = AvroHelpers.specificRecordOfBytes(payload, fresh)
+ } yield {
+ msg
+ }
}
- final def createIMEventFromJsonBytes(jsonBytes: Array[Byte]) = {
- MongoDBIMEvent.fromJsonBytes(jsonBytes)
+ def jsonSupportToDBObject(jsonSupport: JsonSupport) = {
+ StdConverters.AllConverters.convertEx[DBObject](jsonSupport)
}
}
+++ /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.store.mongodb
-
-import gr.grnet.aquarium.charging.state.{ResourcesChargingState, UserStateModelSkeleton, AgreementHistory, UserStateModel}
-import gr.grnet.aquarium.charging.wallet.WalletEntry
-import gr.grnet.aquarium.converter.{JsonTextFormat, StdConverters}
-
-/**
- *
- * @author Christos KK Loverdos <loverdos@gmail.com>
- */
-
-case class MongoDBUserState(
- _id: String,
- parentIDInStore: Option[String],
- userID: String,
- occurredMillis: Long,
- latestResourceEventOccurredMillis: Long,
- totalCredits: Double,
- isFullBillingMonth: Boolean,
- billingYear: Int,
- billingMonth: Int,
- stateOfResources: Map[String, ResourcesChargingState],
- billingPeriodOutOfSyncResourceEventsCounter: Long,
- agreementHistory: AgreementHistory,
- walletEntries: List[WalletEntry]
-) extends UserStateModelSkeleton {
-
- def id = _id
-}
-
-object MongoDBUserState {
- def fromJSONString(json: String): MongoDBUserState = {
- StdConverters.AllConverters.convertEx[MongoDBUserState](JsonTextFormat(json))
- }
-
- def fromOther(model: UserStateModel, _id: String): MongoDBUserState = {
- MongoDBUserState(
- _id,
- model.parentIDInStore,
- model.userID,
- model.occurredMillis,
- model.latestResourceEventOccurredMillis,
- model.totalCredits,
- model.isFullBillingMonth,
- model.billingYear,
- model.billingMonth,
- model.stateOfResources,
- model.billingPeriodOutOfSyncResourceEventsCounter,
- model.agreementHistory,
- model.walletEntries
- )
- }
-}
\ No newline at end of file
+++ /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.util
-
-/**
- * Marker trait for all configuration models.
- *
- * A configuration model is the OO representation of some configuration.
- * The configuration itself can be originally provided in some other format e.g. in a `.properties` or an `.xml` file.
- *
- * @author Christos KK Loverdos <loverdos@gmail.com>.
- */
-trait ConfModel {
- /**
- * Validate this instance and return the list of errors
- */
- def validateConfModel: List[ConfModel.ConfModelError]
-}
-
-object ConfModel {
- type ConfModelError = String
-
- /**
- * Given a map of validation checks and their respective errors return the list of errors for those checks that fail.
- */
- def applyValidations(checks: (() => Boolean, String)*): List[ConfModelError] = {
- checks collect {
- case (check, error) if(!check()) => error
- } toList
- }
-}
\ No newline at end of file
package gr.grnet.aquarium.util.json
import java.io.{ByteArrayOutputStream, OutputStream}
-import org.codehaus.jackson.{JsonParser, JsonEncoding, JsonFactory, JsonGenerator}
import org.codehaus.jackson.map.ObjectMapper
+import org.codehaus.jackson.{JsonEncoding, JsonFactory, JsonGenerator}
/**
*
* or implied, of GRNET S.A.
*/
-package gr.grnet.aquarium.charging.state
-
-import gr.grnet.aquarium.event.model.resource.ResourceEventModel
+package gr.grnet.aquarium.util.json
/**
*
* @author Christos KK Loverdos <loverdos@gmail.com>
*/
-trait ResourceInstanceChargingStateModel {
- def details: scala.collection.Map[String, Any]
-
- def previousEvents: List[ResourceEventModel]
-
- // the implicitly issued resource event at the beginning of the billing period.
- def implicitlyIssuedStartEvents: List[ResourceEventModel]
-
- // Always the new accumulating amount
- def accumulatingAmount: Double
-
- def oldAccumulatingAmount: Double
-
- def previousValue: Double
-
- def currentValue: Double
+object JsonNames {
+ final val billingMonth = "billingMonth"
+ final val billingMonthDay = "billingMonthDay"
+ final val billingYear = "billingYear"
+ final val isFullBillingMonth = "isFullBillingMonth"
+ final val eventType = "eventType"
+ final val userID = "userID"
+ final val id = "id"
+ final val payload = "payload"
+ final val _id = "_id"
+ final val occurredMillis = "occurredMillis"
+ final val receivedMillis = "receivedMillis"
+ final val validFromMillis = "validFromMillis"
+ final val validToMillis = "validToMillis"
}
-package gr.grnet.aquarium
-
-import com.ckkloverdos.resource.FileStreamResource
-import converter.StdConverters
-import event.model.im.StdIMEvent
-import event.model.resource.StdResourceEvent
-import java.io.{InputStreamReader, BufferedReader, File}
-import com.ckkloverdos.props.Props
-import store.memory.MemStoreProvider
-import java.util.concurrent.atomic.AtomicLong
-import java.text.SimpleDateFormat
-import java.net.{URLConnection, URL}
-import util.Loggable
-
/*
* Copyright 2011-2012 GRNET S.A. All rights reserved.
*
* or implied, of GRNET S.A.
*/
+package gr.grnet.aquarium
+
+import com.ckkloverdos.props.Props
+import com.ckkloverdos.resource.FileStreamResource
+import converter.StdConverters
+import gr.grnet.aquarium.message.avro.{AvroHelpers, MessageFactory}
+import java.io.{InputStreamReader, BufferedReader, File}
+import java.net.URL
+import java.text.SimpleDateFormat
+import java.util.concurrent.atomic.AtomicLong
+import util.Loggable
+
/*
* @author Prodromos Gerakios <pgerakios@grnet.gr>
val role = "default"
val eventVersion = "1.0"
val eventType = "create"
- (new StdIMEvent(id,occurredMillis,receivedMillis,userID,
- clientID,isActive,role,eventVersion,eventType,
- Map()).toJsonString,mid)
+
+ val msg = MessageFactory.newIMEventMsg(id,occurredMillis,receivedMillis,userID, clientID, isActive,role,eventVersion,eventType)
+ val json = AvroHelpers.jsonStringOfSpecificRecord(msg)
+ (json, mid)
}
private [this] def addCredits(date:DATE,uid:UID,amount:Long) : JSON = {
val userID = "user%d@grnet.gr".format(uid)
val clientID = "astakos"
val isActive = false
- val role = "default"
val eventVersion = "1.0"
- val eventType = "addcredits"
- new StdIMEvent(id,occurredMillis,receivedMillis,userID,
- clientID,isActive,role,eventVersion,eventType,
- Map("credits" -> amount.toString)).toJsonString
+ val resource = "addcredits"
+ val instanceID = "addcredits"
+
+ val msg = MessageFactory.newResourceEventMsg(id, occurredMillis, receivedMillis, userID, clientID, resource, instanceID, amount.toString, eventVersion)
+ val json = AvroHelpers.jsonStringOfSpecificRecord(msg)
+ json
}
private [this] def makePithos(date:DATE,uid:UID,path:String,
val resource ="diskspace"
val instanceID = "1"
val eventVersion = "1.0"
- val details = Map("action" -> "object %s".format(action),
- "total" -> "0.0",
- "user" -> userID,
- "path" -> path)
- new StdResourceEvent(id,occurredMillis,receivedMillis,userID,clientID,
- resource,instanceID,value,eventVersion,details).toJsonString
+ val details = MessageFactory.newDetails(
+ MessageFactory.newStringDetail("action", "object %s".format(action)),
+ MessageFactory.newStringDetail("total", "0.0"),
+ MessageFactory.newStringDetail("user", userID),
+ MessageFactory.newStringDetail("path", path)
+ )
+
+ val msg = MessageFactory.newResourceEventMsg(id, occurredMillis, receivedMillis, userID, clientID, resource, instanceID, value.toString, eventVersion, details)
+ val json = AvroHelpers.jsonStringOfSpecificRecord(msg)
+ json
}
private[this] def sendCreate(date:DATE) : UID = {
+++ /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.charging.state
-
-import org.junit.Test
-import gr.grnet.aquarium.util.date.TimeHelpers
-import gr.grnet.aquarium.computation.BillingMonthInfo
-
-/**
- *
- * @author Christos KK Loverdos <loverdos@gmail.com>
- */
-class StdUserStateTest {
- @Test
- def testJson() {
- val now = TimeHelpers.nowMillis()
- val bmi = BillingMonthInfo.fromMillis(now)
- val state = StdUserState(
- "id-1", None, "user@grnet.gr",
- now, 0, 1000.0, false,
- bmi.year, bmi.month,
- Map(),
- 0L,
- AgreementHistory.Empty,
- Nil
- )
-
- val json = state.toJsonString
- println(json)
- val obj = StdUserState.fromJsonString(json)
-
- assert(state == obj)
- }
-}
+++ /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.converter
-
-import net.liftweb.json._
-import org.junit.{Assert, Test}
-import gr.grnet.aquarium.AquariumException
-import gr.grnet.aquarium.converter.StdConverters.{AllConverters ⇒ Converters}
-import com.mongodb.DBObject
-import gr.grnet.aquarium.store.memory._
-import gr.grnet.aquarium.util.json.JsonSupport
-import gr.grnet.aquarium.util.Loggable
-
-/**
- *
- * @author Christos KK Loverdos <loverdos@gmail.com>
- */
-
-case class Foo(map: Map[Int, Int])
-
-object FooSerializer extends Serializer[Foo] {
- val FooClass = classOf[Foo]
-
- def deserialize(implicit format: Formats): PartialFunction[(TypeInfo, JValue), Foo] = {
- case (TypeInfo(FooClass, _), jValue) ⇒
- var _map: Map[Int, Int] = Map()
- jValue match {
- case JObject(List(JField("map", JArray(pairs)))) ⇒
- for(pair <- pairs) {
- pair match {
- case JObject(List(JField("k", JInt(k)), JField("v", JInt(v)))) ⇒
- pair
- _map = _map.updated(k.intValue(), v.intValue())
- case _ ⇒
- throw new AquariumException(
- "While deserializing a %s from %s".format(
- gr.grnet.aquarium.util.shortNameOfClass(classOf[Foo]),
- jValue))
- }
- }
-
- case _ ⇒
- throw new AquariumException(
- "While deserializing a %s from %s".format(
- gr.grnet.aquarium.util.shortNameOfClass(classOf[Foo]),
- jValue))
- }
- Foo(_map)
-
- case other ⇒
- throw new AquariumException(
- "While desiariling a %s from %s".format(
- gr.grnet.aquarium.util.shortNameOfClass(classOf[Foo]),
- other))
- }
-
- def serialize(implicit format: Formats): PartialFunction[Any, JValue] = {
- case Foo(map) ⇒
- val kvs = for {
- (k, v) <- map
- } yield JObject(
- List(
- JField("k", JInt(k)),
- JField("v", JInt(v))
- )
- )
-
- JObject(List(JField("map", JArray(kvs.toList))))
- }
-}
-
-class ConverterTest extends Loggable {
- implicit val Formats = JsonConversions.Formats + FooSerializer
-
- final val jsonIMEvent = """
- {
- "clientID": 3,
- "details": {},
- "eventType": "modify",
- "eventVersion": "1",
- "id": "e6b209c23894098f9b70f08315a97c7753e29ecc",
- "isActive": false,
- "occurredMillis": 1333369801087,
- "receivedMillis": 1333369801087,
- "role": "default",
- "userID": "spapagian@grnet.gr"
- }
- """
-
- @Test
- def testJSONMapConversion: Unit = {
- val foo = Foo(Map(1 -> 1, 2 -> 2, 3 -> 3))
- val foo2 = JsonConversions.jsonToObject[Foo](JsonConversions.anyToJson(foo))
-
- Assert.assertEquals(foo, foo2)
- }
-
- @Test
- def testJsonText2Pretty: Unit = {
- val json = """{
- "x" : 1,
- "y" : { "a": true, "b": []},
- "z" : "once upon a time in the west"
- }"""
-
- val pretty = Converters.convertEx[PrettyJsonTextFormat](json)
- }
-
- @Test
- def testJsonText2Compact: Unit = {
- val json = """{
- "x" : 1,
- "y" : { "a": true, "b": []},
- "z" : "once upon a time in the west"
- }"""
-
- val compact = Converters.convertEx[CompactJsonTextFormat](json)
- }
-
- @Test
- def testJsonText: Unit = {
- val json = """{"x":1,"y":2}"""
-
- val pretty = Converters.convertEx[PrettyJsonTextFormat](json)
- val compact = Converters.convertEx[CompactJsonTextFormat](json)
- val jValueOfPretty = Converters.convertEx[JValue](pretty)
- val jValueOfCompact = Converters.convertEx[JValue](compact)
-
- Assert.assertEquals(jValueOfPretty, jValueOfCompact)
- }
-
- @Test
- def testJsonToIMEvent: Unit = {
- Converters.convertEx[MemIMEvent](JsonTextFormat(jsonIMEvent))
- }
-
- @Test
- def testJsonSupportToDBObject: Unit = {
- val jsonSupport: JsonSupport = Converters.convertEx[MemIMEvent](JsonTextFormat(jsonIMEvent))
-
- logger.debug("===============")
- Converters.convertEx[DBObject](jsonSupport)
- }
-}
+++ /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.event.model
-
-import org.junit.Test
-import gr.grnet.aquarium.event.model.resource.StdResourceEvent
-
-/**
- *
- * @author Christos KK Loverdos <loverdos@gmail.com>
- */
-
-class StdResourceEventTest {
- @Test
- def testJson() {
- val rc = StdResourceEvent("id-2", 1000L, 1000L, "luv@g.com", "pithos", "disk", "/disk1", 1.0, "1.0", Map())
- val json = rc.toJsonString
- val obj = StdResourceEvent.fromJsonString(json)
-
- assert(rc == obj)
- }
-}
package gr.grnet.aquarium.message.avro.gen
import java.io.ByteArrayOutputStream
-import org.apache.avro.io.{EncoderFactory, Encoder, JsonEncoder}
-import org.apache.avro.specific.SpecificDatumWriter
-import org.junit.{Assert, Test}
import java.util
+import org.apache.avro.io.EncoderFactory
+import org.apache.avro.specific.SpecificDatumWriter
import org.codehaus.jackson.{JsonEncoding, JsonFactory}
+import org.junit.{Assert, Test}
/**
*
setOccurredMillis(1000L).
setUserID("foouser").
setValue("123.32").
- setDetails(new util.HashMap[CharSequence, AnyValueMsg]()).
+ setDetails(new util.HashMap[String, AnyValueMsg]()).
build()
val schema = rcEvent.getSchema
import org.junit.Test
import java.util
import gr.grnet.aquarium.logic.accounting.dsl.Timeslot
-import gr.grnet.aquarium.policy.{EffectiveUnitPrice, CronSpec}
+import gr.grnet.aquarium.policy.{EffectiveUnitPriceModel, CronSpec}
/*
* Copyright 2011-2012 GRNET S.A. All rights reserved.
*/
class EffectiveUnitPriceTest extends TestMethods {
- private type EFU = EffectiveUnitPrice
+ private type EFU = EffectiveUnitPriceModel
private type Intervals = List[Timeslot]
private val printScreen = false
{cronEnd0=new CronSpec(cronEnd);cronEnd0}))
val ts=Timeslot(start,end)
if(printScreen) Console.err.println("Timeslot: " + ts)
- val efu = new EffectiveUnitPrice(v,opt)
+ val efu = new EffectiveUnitPriceModel(v,opt)
val (l1,l2) = efu.splitTimeslot(ts)
noOverlap(l1,l2)
singleT(ts,l1,l2)