Package edu.sc.seis.sod.source
Class AbstractCSVSource
java.lang.Object
edu.sc.seis.sod.source.AbstractSource
edu.sc.seis.sod.source.AbstractCSVSource
- All Implemented Interfaces:
Source
- Direct Known Subclasses:
CSVNetworkSource
public abstract class AbstractCSVSource extends AbstractSource
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
csvFilename
static java.time.Instant
DEFAULT_END
static java.time.Instant
DEFAULT_TIME
static java.lang.String
DEPTH
static java.lang.String
DEPTH_UNITS
static java.lang.String
ELEVATION
static java.lang.String
ELEVATION_UNITS
static java.lang.String
FE_GEO_REGION
static java.lang.String
FE_REGION
static java.lang.String
FE_REGION_TYPE
static java.lang.String
FE_SEIS_REGION
static java.lang.String
LATITUDE
static java.lang.String
LONGITUDE
static java.lang.String
NAME
static java.lang.String
UNKNOWN
Fields inherited from class edu.sc.seis.sod.source.AbstractSource
name, NAME_ELEMENT, RETRIES_ELEMENT
-
Constructor Summary
Constructors Constructor Description AbstractCSVSource(java.lang.String name)
AbstractCSVSource(org.w3c.dom.Element config, java.lang.String defaultName)
-
Method Summary
Modifier and Type Method Description java.lang.String
concatenateValidFields()
abstract java.lang.String[]
getFields()
boolean
isValidField(java.lang.String field)
static double
loadDouble(java.util.List<java.lang.String> headers, com.csvreader.CsvReader csvReader, java.lang.String headerName, double defaultValue)
static float
loadFloat(java.util.List<java.lang.String> headers, com.csvreader.CsvReader csvReader, java.lang.String headerName, float defaultValue)
static java.lang.String
loadString(java.util.List<java.lang.String> headers, com.csvreader.CsvReader csvReader, java.lang.String headerName, java.lang.String defaultValue)
static java.time.Instant
loadTime(java.util.List<java.lang.String> headers, com.csvreader.CsvReader csvReader, java.lang.String headerName, java.time.Instant defaultTime)
static edu.sc.seis.sod.model.common.UnitImpl
loadUnit(java.util.List<java.lang.String> headers, com.csvreader.CsvReader csvReader, java.lang.String headerName, edu.sc.seis.sod.model.common.UnitImpl defaultUnit)
java.util.List<java.lang.String>
validateHeaders(com.csvreader.CsvReader csvReader)
Methods inherited from class edu.sc.seis.sod.source.AbstractSource
appendToName, getName, getRetries, getRetryStrategy, setRetryStrategy
-
Field Details
-
LONGITUDE
public static final java.lang.String LONGITUDE- See Also:
- Constant Field Values
-
LATITUDE
public static final java.lang.String LATITUDE- See Also:
- Constant Field Values
-
ELEVATION
public static final java.lang.String ELEVATION- See Also:
- Constant Field Values
-
DEPTH
public static final java.lang.String DEPTH- See Also:
- Constant Field Values
-
NAME
public static final java.lang.String NAME- See Also:
- Constant Field Values
-
FE_SEIS_REGION
public static final java.lang.String FE_SEIS_REGION- See Also:
- Constant Field Values
-
FE_GEO_REGION
public static final java.lang.String FE_GEO_REGION- See Also:
- Constant Field Values
-
FE_REGION
public static final java.lang.String FE_REGION- See Also:
- Constant Field Values
-
FE_REGION_TYPE
public static final java.lang.String FE_REGION_TYPE- See Also:
- Constant Field Values
-
DEPTH_UNITS
public static final java.lang.String DEPTH_UNITS- See Also:
- Constant Field Values
-
ELEVATION_UNITS
public static final java.lang.String ELEVATION_UNITS- See Also:
- Constant Field Values
-
UNKNOWN
public static final java.lang.String UNKNOWN- See Also:
- Constant Field Values
-
DEFAULT_TIME
public static final java.time.Instant DEFAULT_TIME -
DEFAULT_END
public static final java.time.Instant DEFAULT_END -
csvFilename
protected java.lang.String csvFilename
-
-
Constructor Details
-
AbstractCSVSource
public AbstractCSVSource(org.w3c.dom.Element config, java.lang.String defaultName) -
AbstractCSVSource
public AbstractCSVSource(java.lang.String name)
-
-
Method Details
-
getFields
public abstract java.lang.String[] getFields() -
isValidField
public boolean isValidField(java.lang.String field) -
concatenateValidFields
public java.lang.String concatenateValidFields() -
validateHeaders
public java.util.List<java.lang.String> validateHeaders(com.csvreader.CsvReader csvReader) throws java.io.IOException, java.io.FileNotFoundException, ConfigurationException- Throws:
java.io.IOException
java.io.FileNotFoundException
ConfigurationException
-
loadFloat
public static float loadFloat(java.util.List<java.lang.String> headers, com.csvreader.CsvReader csvReader, java.lang.String headerName, float defaultValue) throws UserConfigurationException, java.io.IOException- Throws:
UserConfigurationException
java.io.IOException
-
loadDouble
public static double loadDouble(java.util.List<java.lang.String> headers, com.csvreader.CsvReader csvReader, java.lang.String headerName, double defaultValue) throws UserConfigurationException, java.io.IOException- Throws:
UserConfigurationException
java.io.IOException
-
loadString
public static java.lang.String loadString(java.util.List<java.lang.String> headers, com.csvreader.CsvReader csvReader, java.lang.String headerName, java.lang.String defaultValue) throws UserConfigurationException, java.io.IOException- Throws:
UserConfigurationException
java.io.IOException
-
loadUnit
public static edu.sc.seis.sod.model.common.UnitImpl loadUnit(java.util.List<java.lang.String> headers, com.csvreader.CsvReader csvReader, java.lang.String headerName, edu.sc.seis.sod.model.common.UnitImpl defaultUnit) throws UserConfigurationException, java.io.IOException- Throws:
UserConfigurationException
java.io.IOException
-
loadTime
public static java.time.Instant loadTime(java.util.List<java.lang.String> headers, com.csvreader.CsvReader csvReader, java.lang.String headerName, java.time.Instant defaultTime) throws UserConfigurationException, java.io.IOException- Throws:
UserConfigurationException
java.io.IOException
-