Package org.vast.swe
Class SWEHelper
java.lang.Object
org.vast.swe.SWEHelper
- Direct Known Subclasses:
SMLHelper
,VectorHelper
Helper class for creating common data structures and encodings and browsing a data component tree.
- Since:
- Feb 26, 2015
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Unit
static final Unit
static final Unit
static final Unit
static final SWEFactory
static final Unit
static final Unit
protected SWEFactory
static final Unit
static final String
static final Unit
static final Unit
static final Unit
static final Unit
static final Unit
static final Unit
protected UnitParserUCUM
static final Unit
static final Unit
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a SWE helper with the default factorySWEHelper
(SWEFactory fac) Create a SWE helper with the provided factory -
Method Summary
Modifier and TypeMethodDescriptionstatic void
assignBinaryEncoding
(DataComponent dataComponents, BinaryEncoding encoding) Assigns binary components and blocks definitions to the actual data component.void
Checks that the given unit is compatible with a base unitvoid
Checks that the given unit is compatible with a base unitvoid
Checks that the given unit is compatible with a base unitstatic DataStreamParser
createDataParser
(DataEncoding encoding) Helper method to instantiate the proper parser for the given encodingstatic DataStreamWriter
createDataWriter
(DataEncoding encoding) Helper method to instantiate the proper writer for the given encodingstatic DataEncoding
ensureXmlCompatible
(DataEncoding encoding) Ajusts encoding settings to ensures that data produced with the encoding can be embedded in XML (e.g.static DataComponent
findComponent
(DataComponent parent, IComponentFilter filter) Finds the first component in the tree matching the given filterstatic DataComponent
findComponentByDefinition
(DataComponent parent, String defUri) Finds a component in the component tree using its definitionstatic DataComponent
findComponentByName
(DataComponent parent, String name) Finds a component in the component tree using its name (property name)static DataComponent
findComponentByPath
(DataComponent parent, String path) Finds a component in a component tree using a pathstatic DataComponent
findComponentByPath
(DataComponent parent, String[] path) Finds a component in a component tree using a pathstatic String
Generate a definition URI resolving to CF standard names dictionary See https://cfconventions.org/standard-names.html for registered termsstatic String
getComponentPath
(DataComponent component) Computes the path of the component from the root of the data structurestatic String
getDBpediaUri
(String propName) Generate a definition URI resolving to DBPedia ontology See https://lookup.dbpedia.org/ to searcg for registered termsstatic BinaryEncoding
getDefaultBinaryEncoding
(DataComponent dataComponents) Get default binary encoding for the given component tree.
Data types used will be ones specified in each scalar component.static DataEncoding
getDefaultEncoding
(DataComponent dataComponents) Gets the default encoding for the given data structure.
This uses BinaryEncoding if data structure contains a large array and TextEncoding otherwise.static String
getEpsgUri
(int epsgCode) static String
getPropertyUri
(String propName) Generate a definition URI resolving to SensorML ontology.static String
getQudtUri
(String propName) Generate a definition URI resolving to QUDT quantity kinds ontology.static DataComponent
getRootComponent
(DataComponent component) Find the root component of the data structure that this component belongs tostatic ScalarIndexer
getTimeStampIndexer
(DataComponent parent) Retrieves an indexer for the first time stamp component found in the parent structureDeprecated.Deprecated.Deprecated.Deprecated.Deprecated.Deprecated.newBinaryEncoding
(ByteOrder byteOrder, ByteEncoding byteEncoding) Creates a binary encoding with the specified optionsDeprecated.newBoolean
(String definition, String label, String description) Deprecated.UsecreateBoolean()
Deprecated.UsecreateCategory()
newCategory
(String definition, String label, String description, String codeSpace) Deprecated.UsecreateCategory()
Deprecated.newCount()
Deprecated.UsecreateCount()
Deprecated.UsecreateCount()
Deprecated.UsecreateCount()
Deprecated.UsecreateCount()
Deprecated.newCountRange
(DataType dataType) Deprecated.Deprecated.UsecreateArray()
newDataArray
(int arraySize) Deprecated.UsecreateArray()
newDataArray
(Count sizeComponent, String eltName, DataComponent elementType) Deprecated.UsecreateArray()
Deprecated.UsecreateChoice()
Deprecated.UsecreateRecord()
newDataRecord
(int recordSize) Deprecated.UsecreateRecord()
Deprecated.Use#createDataStream()
newDataStream
(DataComponent dataDescription, DataEncoding dataEncoding) Deprecated.useSWEBuilders
classDeprecated.static OgcProperty<Serializable>
newLinkProperty
(String href) static OgcProperty<Serializable>
newLinkProperty
(String name, String href) static OgcProperty<Serializable>
newLinkProperty
(String name, String href, String role) Deprecated.UsecreateMatrix()
newMatrix
(int arraySize) Deprecated.UsecreateMatrix()
Deprecated.Deprecated.newPhenomenonTimeIsoUTC
(String label, String description) Deprecated.Deprecated.UsecreateQuantity()
newQuantity
(String definition, String label, String description, String uom) Deprecated.UsecreateQuantity()
Deprecated.UsecreateQuantity()
newQuantity
(DataType dataType) Deprecated.UsecreateQuantity()
Deprecated.newQuantityRange
(DataType dataType) Deprecated.newRgbImage
(int width, int height, DataType dataType) Deprecated.Deprecated.useSWEBuilders
classnewText()
Deprecated.UsecreateText()
Deprecated.UsecreateText()
newTextEncoding
(String tokenSep, String blockSep) Creates a text encoding with the specified separators.
Since no escaping is supported, it is up to the programmer to make sure that separator characters are not present within the encoded data.newTime()
Deprecated.UsecreateTime()
Deprecated.UsecreateTime()
newTime
(String definition, String label, String description, String uom, String timeRef, DataType dataType) Deprecated.UsecreateTime()
Deprecated.UsecreateTime()
newTimeIsoUTC
(String definition, String label, String description) Deprecated.UsecreateTime()
Deprecated.newTimeRange
(DataType dataType) Deprecated.Deprecated.Deprecated.newTimeStampOnBoardClock
(String uomCode, String timeRef) Deprecated.UsecreateTime()
Deprecated.Deprecated.UsecreateVector()
Deprecated.UsecreateVector()
wrapWithTimeStamp
(Time timeStamp, DataComponent... subComponents) Deprecated.UsecreateRecord()
andcreateTime()
wrapWithTimeStampUTC
(DataComponent... subComponents) Deprecated.UsecreateRecord()
andcreateTime()
-
Field Details
-
DEFAULT_SWE_FACTORY
-
PATH_SEPARATOR
- See Also:
-
MASS_UNIT
-
TIME_UNIT
-
DISTANCE_UNIT
-
SPEED_UNIT
-
ACCEL_UNIT
-
ANGLE_UNIT
-
ANGULAR_SPEED_UNIT
-
TEMP_UNIT
-
SURFACE_UNIT
-
VOLUME_UNIT
-
VOLTAGE_UNIT
-
CURRENT_UNIT
-
POWER_UNIT
-
ENERGY_UNIT
-
UNITLESS
-
fac
-
uomParser
-
-
Constructor Details
-
SWEHelper
public SWEHelper()Create a SWE helper with the default factory -
SWEHelper
Create a SWE helper with the provided factory- Parameters:
fac
- SWE component factory
-
-
Method Details
-
getEpsgUri
- Parameters:
epsgCode
-- Returns:
- the CRS URI for the given EPSG integer code
-
getPropertyUri
Generate a definition URI resolving to SensorML ontology. See http://sensorml.com/ont/ for registered terms- Parameters:
propName
- Property name to append to base URI- Returns:
- The complete definition URI
-
getQudtUri
Generate a definition URI resolving to QUDT quantity kinds ontology. See http://www.qudt.org/doc/DOC_VOCAB-QUANTITY-KINDS.html for registered quantities- Parameters:
propName
- Property name to append to base URI- Returns:
- The complete definition URI
-
getCfUri
Generate a definition URI resolving to CF standard names dictionary See https://cfconventions.org/standard-names.html for registered terms- Parameters:
propName
- Property name to append to base URI- Returns:
- The complete definition URI
-
getDBpediaUri
Generate a definition URI resolving to DBPedia ontology See https://lookup.dbpedia.org/ to searcg for registered terms- Parameters:
propName
- Property name to append to base URI- Returns:
- The complete definition URI
-
checkUom
Checks that the given unit is compatible with a base unit- Parameters:
uom
- UCUM code of unit to checkbaseUnit
- UCUM code of base unit
-
checkUom
Checks that the given unit is compatible with a base unit- Parameters:
uom
- UCUM code of uom to checkbaseUnit
- Unit object representing base unit
-
checkUom
Checks that the given unit is compatible with a base unit- Parameters:
uom
- Unit object representing uom to checkbaseUnit
- Unit object representing base unit
-
newLinkProperty
-
newLinkProperty
-
newLinkProperty
-
createBoolean
- Returns:
- A builder to create a new Boolean component
-
createCategory
- Returns:
- A builder to create a new Category component
-
createCategoryRange
- Returns:
- A builder to create a new CategoryRange component
-
createCount
- Returns:
- A builder to create a new Count component
-
createCountRange
- Returns:
- A builder to create a new CountRange component
-
createQuantity
- Returns:
- A builder to create a new Quantity component
-
createQuantityRange
- Returns:
- A builder to create a new QuantityRange component
-
createTime
- Returns:
- A builder to create a new Time component
-
createTimeRange
- Returns:
- A builder to create a new TimeRange component
-
createText
- Returns:
- A builder to create a new Boolean component
-
createRecord
- Returns:
- A builder to create a new DataRecord component
-
createVector
- Parameters:
fac
- Factory to use to create the component objects- Returns:
- A builder to create a new Vector component
-
createChoice
- Returns:
- A builder to create a new DataChoice component
-
createArray
- Returns:
- A builder to create a new DataArray component
-
createMatrix
- Returns:
- A builder to create a new Matrix component
-
createGeometry
- Returns:
- A builder to create a new Geometry component
-
newTextEncoding
Creates a text encoding with the specified separators.
Since no escaping is supported, it is up to the programmer to make sure that separator characters are not present within the encoded data.- Parameters:
tokenSep
- separator used between tokensblockSep
- separator used to delimit complete tuples- Returns:
- the configured TextEncoding instance
-
newBinaryEncoding
Creates a binary encoding with the specified options- Parameters:
byteOrder
- byte ordering (endianness) of the byte streambyteEncoding
- byte encoding used (raw or base64)- Returns:
- the BinaryEncoding instance (not that it is not fully configured since data types of all fields have to be specified)
-
createDataParser
Helper method to instantiate the proper parser for the given encoding- Parameters:
encoding
-- Returns:
- instance of parser capable of handling the given encoding
-
createDataWriter
Helper method to instantiate the proper writer for the given encoding- Parameters:
encoding
-- Returns:
- instance of writer capable of handling the given encoding
-
getDefaultEncoding
Gets the default encoding for the given data structure.
This uses BinaryEncoding if data structure contains a large array and TextEncoding otherwise.- Parameters:
dataComponents
-- Returns:
- an appropriately configured encoding
-
getDefaultBinaryEncoding
Get default binary encoding for the given component tree.
Data types used will be ones specified in each scalar component.- Parameters:
dataComponents
- component whose children will be mapped to encoding options- Returns:
- binary encoding instance pre-configured for the component
-
ensureXmlCompatible
Ajusts encoding settings to ensures that data produced with the encoding can be embedded in XML (e.g. for binary encoding this enforces base64)- Parameters:
encoding
-- Returns:
- copy of encoding, reconfigured appropriately
-
assignBinaryEncoding
public static void assignBinaryEncoding(DataComponent dataComponents, BinaryEncoding encoding) throws CDMException Assigns binary components and blocks definitions to the actual data component. This sets the encodingInfo attribute of the component so it can be used to generate specialized datablocks. For scalars, it also sets the default data type so it is the same as in the encoded stream.- Parameters:
dataComponents
-encoding
-- Throws:
CDMException
-
findComponent
Finds the first component in the tree matching the given filter- Parameters:
parent
- component from which to start the searchfilter
- component filter instance (must not be null)- Returns:
- the first component matching the filter
-
findComponentByName
Finds a component in the component tree using its name (property name)- Parameters:
parent
- component from which to start the searchname
- component name to look for- Returns:
- the first component with the specified name
-
findComponentByDefinition
Finds a component in the component tree using its definition- Parameters:
parent
- component from which to start the searchdefUri
- definition URI to look for- Returns:
- the first component with the specified definition
-
findComponentByPath
public static DataComponent findComponentByPath(DataComponent parent, String path) throws CDMException Finds a component in a component tree using a path- Parameters:
parent
- component from which to start the searchpath
- desired path as a String composed of component names separated by "/" characters- Returns:
- the component with the given path
- Throws:
CDMException
- if the specified path is incorrect
-
findComponentByPath
public static DataComponent findComponentByPath(DataComponent parent, String[] path) throws CDMException Finds a component in a component tree using a path- Parameters:
parent
- component from which to start the searchpath
- desired path as a String array containing a sequence of component names- Returns:
- the component with the given path
- Throws:
CDMException
- if the specified path is incorrect
-
getComponentPath
Computes the path of the component from the root of the data structure- Parameters:
component
-- Returns:
- A '/' separated path of component names
-
getRootComponent
Find the root component of the data structure that this component belongs to- Parameters:
component
-- Returns:
- the root component
-
getTimeStampIndexer
Retrieves an indexer for the first time stamp component found in the parent structure- Parameters:
parent
-- Returns:
- indexer instance for the time stamp component or null if no time stamp could be found
-
newBoolean
Deprecated.UsecreateBoolean()
-
newText
Deprecated.UsecreateText()
-
newCount
@Deprecated public Count newCount(String definition, String label, String description, DataType dataType) Deprecated.UsecreateCount()
-
newCount
Deprecated.UsecreateCount()
-
newCategory
@Deprecated public Category newCategory(String definition, String label, String description, String codeSpace) Deprecated.UsecreateCategory()
-
newQuantity
@Deprecated public Quantity newQuantity(String definition, String label, String description, String uom, DataType dataType) Deprecated.UsecreateQuantity()
-
newQuantity
@Deprecated public Quantity newQuantity(String definition, String label, String description, String uom) Deprecated.UsecreateQuantity()
-
newTime
@Deprecated public Time newTime(String definition, String label, String description, String uom, String timeRef, DataType dataType) Deprecated.UsecreateTime()
-
newTime
@Deprecated public Time newTime(String definition, String label, String description, String uom, String timeRef) Deprecated.UsecreateTime()
-
newTimeIsoUTC
Deprecated.UsecreateTime()
-
newTimeStampIsoUTC
Deprecated. -
newTimeStampIsoGPS
Deprecated. -
newPhenomenonTimeIsoUTC
Deprecated. -
newTimeStampOnBoardClock
Deprecated.UsecreateTime()
-
wrapWithTimeStamp
Deprecated.UsecreateRecord()
andcreateTime()
-
wrapWithTimeStampUTC
Deprecated.UsecreateRecord()
andcreateTime()
-
newSystemIdComponent
Deprecated.useSWEBuilders
classCreates a component for carrying system ID (e.g. station ID, sensor ID, device ID, etc...)- Returns:
- new Text instance
-
newVector
@Deprecated public Vector newVector(String def, String crs, String[] names, String[] labels, String[] uoms, String[] axes) Deprecated.UsecreateVector()
-
newDataArray
@Deprecated public DataArray newDataArray(Count sizeComponent, String eltName, DataComponent elementType) Deprecated.UsecreateArray()
-
newRgbImage
Deprecated. -
newDataStream
@Deprecated public DataStream newDataStream(DataComponent dataDescription, DataEncoding dataEncoding) Deprecated.useSWEBuilders
classCreates a data stream description with given description and encoding- Parameters:
dataDescription
- description of each stream elementdataEncoding
- data encoding spec- Returns:
- the new DataStream object
-
newDataRecord
Deprecated.UsecreateRecord()
-
newDataRecord
Deprecated.UsecreateRecord()
-
newVector
Deprecated.UsecreateVector()
-
newDataArray
Deprecated.UsecreateArray()
-
newDataArray
Deprecated.UsecreateArray()
-
newMatrix
Deprecated.UsecreateMatrix()
-
newMatrix
Deprecated.UsecreateMatrix()
-
newDataChoice
Deprecated.UsecreateChoice()
-
newDataStream
Deprecated.Use#createDataStream()
-
newBoolean
Deprecated.UsecreateBoolean()
-
newText
Deprecated.UsecreateText()
-
newCount
Deprecated.UsecreateCount()
-
newCount
Deprecated.UsecreateCount()
-
newCountRange
Deprecated. -
newCountRange
Deprecated. -
newCategory
Deprecated.UsecreateCategory()
-
newCategoryRange
Deprecated. -
newQuantity
Deprecated.UsecreateQuantity()
-
newQuantity
Deprecated.UsecreateQuantity()
-
newQuantityRange
Deprecated. -
newQuantityRange
Deprecated. -
newTime
Deprecated.UsecreateTime()
-
newTime
Deprecated.UsecreateTime()
-
newTimeRange
Deprecated. -
newTimeRange
Deprecated. -
newNilValues
Deprecated. -
newAllowedTokens
Deprecated. -
newAllowedValues
Deprecated. -
newAllowedTimes
Deprecated. -
newUnitReference
Deprecated. -
newNilValue
Deprecated. -
newXMLEncoding
-
newTextEncoding
-
newBinaryBlock
Deprecated. -
newBinaryEncoding
Deprecated. -
newBinaryComponent
Deprecated. -
newEncodedValuesProperty
Deprecated.
-
createBoolean()