Package gov.nasa.pds.registry.common.dd
Class LddUtils
java.lang.Object
gov.nasa.pds.registry.common.dd.LddUtils
Simple methods to work with PDS LDD JSON files (data dictionary files).
- Author:
- karpenko
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringGet JSON LDD URL from XSD locationstatic StringgetLddNamespace(File lddFile) Extract LDD namespace.static FilegetPds2EsDataTypeCfgFile(String homeEnvVar) Get default PDS to Elasticsearch data type mapping configuration file.static InstantlddDateToIsoInstant(String dateStr) Convert LDD date, e.g., "Wed Dec 23 10:16:28 EST 2020" to ISO Instant format, e.g., "2020-12-23T15:16:28Z".static StringlddDateToIsoInstantString(String dateStr) Convert LDD date, e.g., "Wed Dec 23 10:16:28 EST 2020" to ISO Instant format, e.g., "2020-12-23T15:16:28Z".listLddNamespaces(File lddFile) Parse JSON LDD file and list all namespacesstatic DateparseLddDate(String dateStr) static DateparseLddDate(String dateStr, String handleLeapSecondNotation)
-
Constructor Details
-
LddUtils
public LddUtils()
-
-
Method Details
-
getPds2EsDataTypeCfgFile
Get default PDS to Elasticsearch data type mapping configuration file.- Parameters:
homeEnvVar- Home environment variable name, such as "HARVEST_HOME".- Returns:
- File pointing to default configuration file.
- Throws:
Exception- an exception
-
parseLddDate
- Throws:
ParseException
-
parseLddDate
public static Date parseLddDate(String dateStr, @Nonnull String handleLeapSecondNotation) throws ParseException - Throws:
ParseException
-
lddDateToIsoInstantString
Convert LDD date, e.g., "Wed Dec 23 10:16:28 EST 2020" to ISO Instant format, e.g., "2020-12-23T15:16:28Z".- Parameters:
dateStr- LDD date string from PDS LDD JSON file.- Returns:
- ISO Instant formatted date
- Throws:
Exception- an exception
-
lddDateToIsoInstant
Convert LDD date, e.g., "Wed Dec 23 10:16:28 EST 2020" to ISO Instant format, e.g., "2020-12-23T15:16:28Z".- Parameters:
dateStr- LDD date string from PDS LDD JSON file.- Returns:
- ISO Instant formatted date
- Throws:
Exception- an exception
-
listLddNamespaces
Parse JSON LDD file and list all namespaces- Parameters:
lddFile- JSON LDD file- Returns:
- a set of namespaces
- Throws:
Exception- an exception
-
getLddNamespace
Extract LDD namespace. If there are more than one namespace, throw an exception.- Parameters:
lddFile- JSON LDD file- Returns:
- namespace (e.g., 'pds')
- Throws:
Exception- an exception
-
getJsonLddUrlFromXsd
Get JSON LDD URL from XSD location- Parameters:
uri- XSD location URL- Returns:
- JSON LDD URL
- Throws:
Exception- an exception
-