Class PublishedConfiguration

java.lang.Object
org.apache.hadoop.yarn.service.utils.PublishedConfiguration

public class PublishedConfiguration extends Object
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 Details

    • description

      public String description
    • updated

      public long updated
    • updatedTime

      public String updatedTime
    • entries

      public Map<String,String> entries
  • Constructor Details

    • PublishedConfiguration

      public PublishedConfiguration()
    • PublishedConfiguration

      public PublishedConfiguration(String description)
      build an empty published configuration
      Parameters:
      description - configuration description
    • PublishedConfiguration

      public PublishedConfiguration(String description, Iterable<Map.Entry<String,String>> entries)
      Build a configuration from the entries
      Parameters:
      description - configuration description
      entries - 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 description
      keysource - source of keys
      valuesource - 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

      public void putValues(Iterable<Map.Entry<String,String>> entries)
      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

      public String asConfigurationXML() throws IOException
      Throws:
      IOException
    • asProperties

      public Properties asProperties()
      Convert values to properties
      Returns:
      a property file
    • asJson

      public String asJson() throws IOException
      Return the values as json string
      Returns:
      the JSON representation
      Throws:
      IOException - marshalling failure
    • shallowCopy

      public PublishedConfiguration 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

      public String toString()
      Overrides:
      toString in class Object