private static FeedPolicyEntity initializeBasicPolicy() { Map<String, String> policyParams = new HashMap<>(); policyParams.put(FeedPolicyAccessor.ELASTIC, Boolean.toString(false)); String description = "Basic"; return new FeedPolicyEntity(MetadataConstants.METADATA_DATAVERSE_NAME, "Basic", description, policyParams); }
private static FeedPolicyEntity initializeAdvancedFTSpillPolicy() { Map<String, String> policyParams = new HashMap<>(); policyParams.put(FeedPolicyAccessor.ELASTIC, Boolean.toString(false)); policyParams.put(FeedPolicyAccessor.FLOWCONTROL_ENABLED, Boolean.toString(true)); policyParams.put(FeedPolicyAccessor.SPILL_TO_DISK_ON_CONGESTION, "" + Boolean.TRUE); policyParams.put(FeedPolicyAccessor.MAX_SPILL_SIZE_ON_DISK, "" + Long.toString(FeedPolicyAccessor.NO_LIMIT)); String description = "FlowControl 100% Spill during congestion"; return new FeedPolicyEntity(MetadataConstants.METADATA_DATAVERSE_NAME, "Spill", description, policyParams); }
private static FeedPolicyEntity initializeAdvancedFTElasticPolicy() { Map<String, String> policyParams = new HashMap<>(); policyParams.put(FeedPolicyAccessor.ELASTIC, Boolean.toString(true)); policyParams.put(FeedPolicyAccessor.FLOWCONTROL_ENABLED, Boolean.toString(true)); policyParams.put(FeedPolicyAccessor.LOGGING_STATISTICS, Boolean.toString(true)); String description = "Basic Monitored Fault-Tolerant Elastic"; return new FeedPolicyEntity(MetadataConstants.METADATA_DATAVERSE_NAME, "AdvancedFT_Elastic", description, policyParams); }
private static FeedPolicyEntity initializeAdvancedFTDiscardPolicy() { Map<String, String> policyParams = new HashMap<>(); policyParams.put(FeedPolicyAccessor.ELASTIC, Boolean.toString(false)); policyParams.put(FeedPolicyAccessor.FLOWCONTROL_ENABLED, Boolean.toString(true)); policyParams.put(FeedPolicyAccessor.MAX_SPILL_SIZE_ON_DISK, Boolean.toString(false)); policyParams.put(FeedPolicyAccessor.MAX_FRACTION_DISCARD, "100"); policyParams.put(FeedPolicyAccessor.LOGGING_STATISTICS, Boolean.toString(true)); String description = "FlowControl 100% Discard during congestion"; return new FeedPolicyEntity(MetadataConstants.METADATA_DATAVERSE_NAME, "Discard", description, policyParams); }
private FeedPolicyEntity createFeedPolicyFromARecord(ARecord feedPolicyRecord) { FeedPolicyEntity feedPolicy = null; String dataverseName = ((AString) feedPolicyRecord .getValueByPos(MetadataRecordTypes.FEED_POLICY_ARECORD_DATAVERSE_NAME_FIELD_INDEX)).getStringValue(); String policyName = ((AString) feedPolicyRecord .getValueByPos(MetadataRecordTypes.FEED_POLICY_ARECORD_POLICY_NAME_FIELD_INDEX)).getStringValue(); String description = ((AString) feedPolicyRecord .getValueByPos(MetadataRecordTypes.FEED_POLICY_ARECORD_DESCRIPTION_FIELD_INDEX)).getStringValue(); IACursor cursor = ((AUnorderedList) feedPolicyRecord .getValueByPos(MetadataRecordTypes.FEED_POLICY_ARECORD_PROPERTIES_FIELD_INDEX)).getCursor(); Map<String, String> policyParamters = new HashMap<>(); String key; String value; while (cursor.next()) { ARecord field = (ARecord) cursor.get(); key = ((AString) field.getValueByPos(MetadataRecordTypes.PROPERTIES_NAME_FIELD_INDEX)).getStringValue(); value = ((AString) field.getValueByPos(MetadataRecordTypes.PROPERTIES_VALUE_FIELD_INDEX)).getStringValue(); policyParamters.put(key, value); } feedPolicy = new FeedPolicyEntity(dataverseName, policyName, description, policyParamters); return feedPolicy; }
newPolicy = new FeedPolicyEntity(dataverse, policy, description, policyProperties); } else { Properties prop = new Properties(); newPolicy = new FeedPolicyEntity(dataverse, policy, description, policyProperties);