Class ClaraYaml
java.lang.Object
org.jlab.utils.ClaraYaml
Read a CLARA YAML file, convert it to JSON (because that's what COATJAVA
uses elsewhere), and provide the same filtering that CLARA does when it
presents a service its EngineData.
- Author:
- baltzell
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.json.JSONObject
Get the service's configuration as presented by CLARA.static org.json.JSONObject
Emulate the way CLARA parses the full YAML and presents it in EngineData.static String
Convert short (base)name into absolute path, for "stock" schema.static void
List
<org.json.JSONObject> services()
Get a list of services.void
setSchemaDirectory
(String dir) Set the schema_dir directory.final void
Set the schema_dir, assuming it's currently the short (basename) of a "stock" schema, but only if it doesn't already look like an absolute path.void
show()
Print it to the screen, nicely.void
showFiltered
(String serviceName) Print the service's configuration as presented by CLARA.boolean
valid()
Whether it parsed ok.
-
Constructor Details
-
ClaraYaml
-
-
Method Details
-
valid
public boolean valid()Whether it parsed ok.- Returns:
-
show
public void show()Print it to the screen, nicely. -
showFiltered
Print the service's configuration as presented by CLARA.- Parameters:
serviceName
-
-
services
-
schemaDirectory
-
getSchemaDirectory
-
setSchemaDirectory
Set the schema_dir directory.- Parameters:
dir
- path to schema_dir directory
-
setStockSchemaDirectory
public final void setStockSchemaDirectory()Set the schema_dir, assuming it's currently the short (basename) of a "stock" schema, but only if it doesn't already look like an absolute path. -
getStockSchemaDirectory
-
filter
Get the service's configuration as presented by CLARA.- Parameters:
serviceName
-- Returns:
- json object
-
filter
Emulate the way CLARA parses the full YAML and presents it in EngineData. The "global" and "service" subsections in the "configuration" section get squashed into one namespace, and service-specific keys override any globals of the same name.- Parameters:
claraJson
- the full CLARA YAML contentsserviceName
- the name of the service in CLARA YAML (not class name)- Returns:
- data in the format the given CLARA service would see
-
main
-