Package gov.nasa.pds.tools.util
Class LabelUtil
- java.lang.Object
- 
- gov.nasa.pds.tools.util.LabelUtil
 
- 
 public class LabelUtil extends Object Class that keep track of different Information Model (IM) versions found when parsing labels and report a WARNING if multiple versions of the Information Model (IM) are found.
- 
- 
Field SummaryFields Modifier and Type Field Description static StringCONTEXT_AREA_INVESTIGATION_AREA_REFERENCEstatic StringCONTEXT_AREA_OBSERVATION_SYSTEM_COMPONENT_REFERENCEstatic StringCONTEXT_AREA_TARGET_IDENTIFICATION_REFERENCEstatic StringLID_REFERENCEstatic StringLIDVID_REFERENCE
 - 
Constructor SummaryConstructors Constructor Description LabelUtil()
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static ArrayList<String>getIdentifiersCommon(DOMSource source, URL context, String[] tagsList, String searchPathName)Common function to retrieve values either from logical_identifier or lid_reference/lidvid_reference tags.static StringgetIMVersion(DOMSource source, URL context)Get the Information Model (IM) version of the label (as a DOMSource)static ArrayList<String>getInformationModelVersions()Returns the list of IMs registered so far.static StringgetLauncherURIName()Get the name of the executable of validate.static ArrayList<String>getLidVidReferences(DOMSource source, URL context)Get the LIDVID references in the label (as a DOMSource)static StringgetLocation()Get the location of the label currently processing.static ArrayList<String>getLogicalIdentifiers(DOMSource source, URL context)Get the local identifiers the label (as a DOMSource)static voidhardResetInformationModelVersions()Reset Information Model Versions List to zero size.static voidreduceInformationModelVersions()Reduce Information Model Versions List to just one if it contains more than one elementsstatic voidregisterIMVersion(String informationModelVersion)Register the Information Model (IM) version.static voidreportIfMoreThanOneVersion(String validationRule)Report a WARNING if the number of unique IM versions are more than one.static voidreset()Reset all list(s) and variables back to their default states.static voidsetLauncherURIName(String launcherURIName)Set the name of the executable of validate.static voidsetLocation(String location)Set the location of the label currently processing.static voidsetReport(Report report)Set the report to log status of labels or WARNING messages.
 
- 
- 
- 
Field Detail- 
LIDVID_REFERENCEpublic static String LIDVID_REFERENCE 
 - 
LID_REFERENCEpublic static String LID_REFERENCE 
 - 
CONTEXT_AREA_TARGET_IDENTIFICATION_REFERENCEpublic static String CONTEXT_AREA_TARGET_IDENTIFICATION_REFERENCE 
 - 
CONTEXT_AREA_OBSERVATION_SYSTEM_COMPONENT_REFERENCEpublic static String CONTEXT_AREA_OBSERVATION_SYSTEM_COMPONENT_REFERENCE 
 - 
CONTEXT_AREA_INVESTIGATION_AREA_REFERENCEpublic static String CONTEXT_AREA_INVESTIGATION_AREA_REFERENCE 
 
- 
 - 
Method Detail- 
reduceInformationModelVersionspublic static void reduceInformationModelVersions() Reduce Information Model Versions List to just one if it contains more than one elements- Parameters:
- None-
 
 - 
hardResetInformationModelVersionspublic static void hardResetInformationModelVersions() Reset Information Model Versions List to zero size.- Parameters:
- None-
 
 - 
resetpublic static void reset() Reset all list(s) and variables back to their default states.- Parameters:
- None-
 
 - 
setLauncherURINamepublic static void setLauncherURIName(String launcherURIName) Set the name of the executable of validate.- Parameters:
- launcherURIName- The name of the executable of validate.
 
 - 
getLauncherURINamepublic static String getLauncherURIName() Get the name of the executable of validate.- Parameters:
- None-
- Returns:
- The name of the executable of validate.
 
 - 
setReportpublic static void setReport(Report report) Set the report to log status of labels or WARNING messages.- Parameters:
- report- The Report object.
 
 - 
registerIMVersionpublic static void registerIMVersion(String informationModelVersion) Register the Information Model (IM) version.- Parameters:
- informationModelVersion- The version of the IM to register, e.g. 1.12.0.0, 1.10.0.0
 
 - 
getInformationModelVersionspublic static ArrayList<String> getInformationModelVersions() Returns the list of IMs registered so far.- Returns:
- informationModelVersions the list of IMs registered: {1.12.0.0, 1.10.0.0}
 
 - 
setLocationpublic static void setLocation(String location) Set the location of the label currently processing.- Parameters:
- location- informationModelVersion The version of the IM to register, e.g. 1.12.0.0, 1.10.0.0
 
 - 
getLocationpublic static String getLocation() Get the location of the label currently processing.- Returns:
- location of the label currently processing.
 
 - 
getIMVersionpublic static String getIMVersion(DOMSource source, URL context) Get the Information Model (IM) version of the label (as a DOMSource)- Parameters:
- source- The content of context as a DOMSource. # @param context The location of the label being parsed from
- Returns:
- informationModelVersion the version of the IM
 
 - 
getIdentifiersCommonpublic static ArrayList<String> getIdentifiersCommon(DOMSource source, URL context, String[] tagsList, String searchPathName) Common function to retrieve values either from logical_identifier or lid_reference/lidvid_reference tags. Note that because a node for logical_identifier can have a version id in another tag, they both must be check before combining them together to . Due the fact that this function can be called by multiple threads and indirectly mutates container util.Utility.cachedTargets, it is necessary to add 'synchronized' to make sure that it does not happen.- Parameters:
- source-
- context-
- tagsList-
- searchPathName-
- Returns:
 
 - 
getLidVidReferencespublic static ArrayList<String> getLidVidReferences(DOMSource source, URL context) Get the LIDVID references in the label (as a DOMSource)- Parameters:
- source- The content of context as a DOMSource. # @param context The location of the label being parsed from.
- Returns:
- lidOrLidVidReference The LID or LIDVID referenced in this label.
 
 - 
getLogicalIdentifierspublic static ArrayList<String> getLogicalIdentifiers(DOMSource source, URL context) Get the local identifiers the label (as a DOMSource)- Parameters:
- source- The content of context as a DOMSource. # @param context The location of the label being parsed from.
- Returns:
- logicalIdentifiers A list of logical identifiers in this label.
 
 - 
reportIfMoreThanOneVersionpublic static void reportIfMoreThanOneVersion(String validationRule) Report a WARNING if the number of unique IM versions are more than one.- Parameters:
- validationRule- The rule of the validation, e.g. pds4.label, pds4.bundle. This value can be null since a rule is is not required within validate module.
 
 
- 
 
-