java.lang.Object
org.apache.hadoop.yarn.server.resourcemanager.webapp.jsonprovider.ClassSerialisationConfig

public class ClassSerialisationConfig extends Object
Configuration holder for class serialization setup used by the ResourceManager web services layer.

This class manages two categories of data transfer objects (DTOs):

  • Wrapped classes – classes whose JSON representation includes a root wrapper element.
  • Unwrapped classes – classes whose JSON representation omits a root wrapper element.

The configuration is initialized with a default list of constant classes and may optionally include user-defined classes loaded from configuration properties:

  • yarn.http.webapp.custom.dao.classes
  • yarn.http.webapp.custom.unwrapped.dao.classes

This configuration is primarily used to control JSON serialization behavior in MOXy providers when serializing REST API objects.

Example:

If we have a class like:


 @XmlRootElement(name = "foo-class")
 class Foo {
   String a;
   String b;
 }
 

and the class is present in the wrapped classes list, it will be marshalled as:


 {
   "foo-class": {
     "a": "...",
     "b": "..."
   }
 }
 

or if the class is present in the unwrapped classes list, it will be marshalled as:


 {
   "a": "...",
   "b": "..."
 }
 
  • Constructor Details

    • ClassSerialisationConfig

      public ClassSerialisationConfig()
      Default constructor.
    • ClassSerialisationConfig

      @Inject public ClassSerialisationConfig(@Named("conf") org.apache.hadoop.conf.Configuration conf)
      Constructs a new ClassSerialisationConfig instance and initializes the sets of wrapped and unwrapped classes used for JSON serialization.
      Parameters:
      conf - the Hadoop Configuration instance (typically injected via dependency injection) used to load optional custom class definitions
  • Method Details

    • getWrappedClasses

      public Set<Class<?>> getWrappedClasses()
      Returns the set of classes whose JSON representation should include a root element.

      These classes are used by MOXy JSON providers to determine which data transfer objects (DTOs) should be wrapped with a root element when serialized.

      Returns:
      an unmodifiable Set of wrapped classes
    • getUnWrappedClasses

      public Set<Class<?>> getUnWrappedClasses()
      Returns the set of classes whose JSON representation should omit the root element.

      These classes are used by MOXy JSON providers to determine which data transfer objects (DTOs) should be serialized without a root element in the JSON output.

      Returns:
      an unmodifiable Set of unwrapped classes