Class PublishedConfiguration
java.lang.Object
org.apache.hadoop.yarn.service.utils.PublishedConfiguration
JSON-serializable description of a published key-val configuration.
The values themselves are not serialized in the external view; they have
to be served up by the far end
-
Field Summary
FieldsModifier and TypeFieldDescriptionlong -
Constructor Summary
ConstructorsConstructorDescriptionPublishedConfiguration(String description) build an empty published configurationBuild a configuration from the entriesPublishedConfiguration(String description, Iterable<Map.Entry<String, String>> keysource, org.apache.hadoop.conf.Configuration valuesource) Build a published configuration, using the keys from keysource, but resolving the values from the value source, via Configuration.get() -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.hadoop.conf.ConfigurationConvert to Hadoop XMLasJson()Return the values as json stringConvert values to propertieslongbooleanisEmpty()Is the configuration empty.voidSet the values from an iterable (this includes a Hadoop Configuration and Java properties object).voidsetUpdated(long updated) This makes a copy without the nested content -so is suitable for returning as part of the list of a parent's valuestoString()
-
Field Details
-
description
-
updated
public long updated -
updatedTime
-
entries
-
-
Constructor Details
-
PublishedConfiguration
public PublishedConfiguration() -
PublishedConfiguration
build an empty published configuration- Parameters:
description- configuration description
-
PublishedConfiguration
Build a configuration from the entries- Parameters:
description- configuration descriptionentries- entries to put
-
PublishedConfiguration
public PublishedConfiguration(String description, Iterable<Map.Entry<String, String>> keysource, org.apache.hadoop.conf.Configuration valuesource) Build a published configuration, using the keys from keysource, but resolving the values from the value source, via Configuration.get()- Parameters:
description- configuration descriptionkeysource- source of keysvaluesource- source of values
-
-
Method Details
-
isEmpty
public boolean isEmpty()Is the configuration empty. This means either that it has not been given any values, or it is stripped down copy set down over the wire.- Returns:
- true if it is empty
-
setUpdated
public void setUpdated(long updated) -
getUpdated
public long getUpdated() -
putValues
Set the values from an iterable (this includes a Hadoop Configuration and Java properties object). Any existing value set is discarded- Parameters:
entries- entries to put
-
asConfiguration
public org.apache.hadoop.conf.Configuration asConfiguration()Convert to Hadoop XML- Returns:
- the configuration as a Hadoop Configuratin
-
asConfigurationXML
- Throws:
IOException
-
asProperties
Convert values to properties- Returns:
- a property file
-
asJson
Return the values as json string- Returns:
- the JSON representation
- Throws:
IOException- marshalling failure
-
shallowCopy
This makes a copy without the nested content -so is suitable for returning as part of the list of a parent's values- Returns:
- the copy
-
toString
-