com.caseystella.analytics.extractor.DataPointExtractorConfig Maven / Gradle / Ivy
/**
* Copyright (C) 2016 Hurence ([email protected])
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.caseystella.analytics.extractor;
import com.caseystella.analytics.converters.*;
import com.caseystella.analytics.converters.primitive.PrimitiveConverter;
import com.caseystella.analytics.util.JSONUtil;
import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class DataPointExtractorConfig implements Serializable {
public static class Measurement implements Serializable {
private String source;
private List sourceFields;
private String timestampField;
private TimestampConverter timestampConverter = new PrimitiveConverter.PrimitiveTimestampConverter();
private Map timestampConverterConfig;
private String measurementField;
private MeasurementConverter measurementConverter = new PrimitiveConverter.PrimitiveMeasurementConverter();
private Map measurementConverterConfig;
private List metadataFields = new ArrayList<>();
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
public List getSourceFields() {
return sourceFields;
}
public void setSourceFields(List sourceField) {
this.sourceFields = sourceField;
}
public String getTimestampField() {
return timestampField;
}
public void setTimestampField(String timestampField) {
this.timestampField = timestampField;
}
public TimestampConverter getTimestampConverter() {
return timestampConverter;
}
public void setTimestampConverter(String timestampConverter) throws IllegalAccessException, InstantiationException, ClassNotFoundException {
this.timestampConverter = Converters.getTimestampConverter(timestampConverter);
}
public Map getTimestampConverterConfig() {
return timestampConverterConfig;
}
public void setTimestampConverterConfig(Map timestampConverterConfig) {
this.timestampConverterConfig = timestampConverterConfig;
}
public String getMeasurementField() {
return measurementField;
}
public void setMeasurementField(String measurementField) {
this.measurementField = measurementField;
}
public MeasurementConverter getMeasurementConverter() {
return measurementConverter;
}
public void setMeasurementConverter(String measurementConverter) throws IllegalAccessException, InstantiationException, ClassNotFoundException {
this.measurementConverter = Converters.getMeasurementConverter(measurementConverter);
}
public Map getMeasurementConverterConfig() {
return measurementConverterConfig;
}
public void setMeasurementConverterConfig(Map measurementConverterConfig) {
this.measurementConverterConfig = measurementConverterConfig;
}
public List getMetadataFields() {
return metadataFields;
}
public void setMetadataFields(List metadataFields) {
this.metadataFields = metadataFields;
}
}
private MappingConverter keyConverter = new NOOP();
private Map keyConverterConfig;
private MappingConverter valueConverter;
private Map valueConverterConfig;
private List measurements;
public MappingConverter getKeyConverter() {
return keyConverter;
}
public void setKeyConverter(String keyConverter) throws IllegalAccessException, InstantiationException, ClassNotFoundException {
this.keyConverter = Converters.getMappingConverter(keyConverter);
}
public Map getKeyConverterConfig() {
return keyConverterConfig;
}
public void setKeyConverterConfig(Map keyConverterConfig) {
this.keyConverterConfig = keyConverterConfig;
}
public MappingConverter getValueConverter() {
return valueConverter;
}
public void setValueConverter(String valueConverter) throws IllegalAccessException, InstantiationException, ClassNotFoundException {
this.valueConverter = Converters.getMappingConverter(valueConverter);
}
public Map getValueConverterConfig() {
return valueConverterConfig;
}
public void setValueConverterConfig(Map valueConverterConfig) {
this.valueConverterConfig = valueConverterConfig;
}
public List getMeasurements() {
return measurements;
}
public void setMeasurements(List measurements) {
this.measurements = measurements;
}
public static DataPointExtractorConfig load(String configStr) throws IOException {
return JSONUtil.INSTANCE.load(configStr, DataPointExtractorConfig.class);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy