Class JsonLabel
- java.lang.Object
-
- gov.nasa.pds.imaging.generate.label.JsonLabel
-
- All Implemented Interfaces:
PDSContext
,PDSObjectContext
,PDSObject
public class JsonLabel extends Object implements PDSObject
-
-
Field Summary
Fields Modifier and Type Field Description static String
CONTEXT
ContextUtil
ctxtUtil
-
Constructor Summary
Constructors Constructor Description JsonLabel()
Empty Constructor, set everything later onJsonLabel(com.fasterxml.jackson.databind.JsonNode jsonNode)
Constructor Construct the Jsonlabel using a DOM object from somewhere else the JsonNode was created smewhere elseJsonLabel(String filePath)
Constructor the filePath will read and parsed as json
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
get(String key)
Retrieves the value for the specified keyString
getContext()
Returns the variable to be used in the Velocity Template Engine to map to this object.String
getFilePath()
ImageInputStream
getImageInputStream()
Long
getImageStartByte()
List
getList(String key)
List<String>
getPDSObjectNames()
Added per request from mcayanan in order to be able to loop through the PDS Objects that can be found in the labelString
getReaderFormat()
String
getUnits(String key)
void
parseJson(String jsonString)
parseJson Parse a json String and load it into the flatLabel.void
setFilePath(String filePath)
void
setImageInputStream(ImageInputStream iis)
void
setImageStartByte(Long x)
void
setIncludePaths(List<String> i)
Set the paths to search for files referenced by pointers.void
setJsonFilename(String s)
void
setJsonString(String s)
void
setMappings()
void
setParameters(PDSObject pdsObject)
void
setParserType(ParserType type)
void
setReaderFormat(String format)
String
toString()
-
-
-
Field Detail
-
CONTEXT
public static String CONTEXT
-
ctxtUtil
public ContextUtil ctxtUtil
-
-
Constructor Detail
-
JsonLabel
public JsonLabel()
Empty Constructor, set everything later on
-
JsonLabel
public JsonLabel(com.fasterxml.jackson.databind.JsonNode jsonNode)
Constructor Construct the Jsonlabel using a DOM object from somewhere else the JsonNode was created smewhere else- Parameters:
JsonNode
-
-
JsonLabel
public JsonLabel(String filePath)
Constructor the filePath will read and parsed as json- Parameters:
filePath
-
-
-
Method Detail
-
get
public final Object get(String key)
Retrieves the value for the specified key- Specified by:
get
in interfacePDSObjectContext
- Parameters:
key
-- Returns:
- value for key
-
getContext
public final String getContext()
Returns the variable to be used in the Velocity Template Engine to map to this object.- Specified by:
getContext
in interfacePDSContext
-
getFilePath
public final String getFilePath()
- Specified by:
getFilePath
in interfacePDSObject
-
setFilePath
public void setFilePath(String filePath)
- Specified by:
setFilePath
in interfacePDSObject
-
getList
public final List getList(String key) throws TemplateException
- Specified by:
getList
in interfacePDSObject
- Throws:
TemplateException
-
getUnits
public final String getUnits(String key)
- Specified by:
getUnits
in interfacePDSObjectContext
-
setParameters
public final void setParameters(PDSObject pdsObject)
- Specified by:
setParameters
in interfacePDSObjectContext
-
setImageInputStream
public void setImageInputStream(ImageInputStream iis)
-
getImageInputStream
public ImageInputStream getImageInputStream()
- Specified by:
getImageInputStream
in interfacePDSObject
-
setReaderFormat
public void setReaderFormat(String format)
- Specified by:
setReaderFormat
in interfacePDSObject
-
getReaderFormat
public String getReaderFormat()
- Specified by:
getReaderFormat
in interfacePDSObject
-
setImageStartByte
public void setImageStartByte(Long x)
-
getImageStartByte
public Long getImageStartByte()
- Specified by:
getImageStartByte
in interfacePDSObject
-
setMappings
public void setMappings() throws IOException
- Specified by:
setMappings
in interfacePDSObjectContext
- Throws:
IOException
-
getPDSObjectNames
public final List<String> getPDSObjectNames()
Added per request from mcayanan in order to be able to loop through the PDS Objects that can be found in the label- Returns:
-
setJsonFilename
public void setJsonFilename(String s)
-
setJsonString
public void setJsonString(String s)
-
setParserType
public void setParserType(ParserType type)
-
setIncludePaths
public void setIncludePaths(List<String> i)
Set the paths to search for files referenced by pointers.Default is to always look first in the same directory as the label, then search specified directories.
- Parameters:
i
- List of paths
-
parseJson
public void parseJson(String jsonString)
parseJson Parse a json String and load it into the flatLabel. The contents of the json will be used in exactly the same way as a PDS or vicar label When this JsonLabel is set into the context the velocity template prefix associated with it is set- Parameters:
jsonString
-
-
-