Class ProtoTranslatorFactory

java.lang.Object
org.apache.hadoop.yarn.csi.translator.ProtoTranslatorFactory

public final class ProtoTranslatorFactory extends Object
Factory class to get desired proto transformer instance.
  • Method Details

    • getTranslator

      public static <A, B> ProtoTranslator<A,B> getTranslator(Class<A> yarnProto, Class<B> csiProto)
      Get a ProtoTranslator based on the given input message types. If the type is not supported, a IllegalArgumentException will be thrown. When adding more transformers to this factory class, note each transformer works exactly for one message to another (and vice versa). For each type of the message, make sure there is a corresponding unit test added, such as TestValidateVolumeCapabilitiesRequest.
      Type Parameters:
      A - yarn proto message
      B - CSI proto message
      Parameters:
      yarnProto - yarn proto message
      csiProto - CSI proto message
      Returns:
      a proto message transformer that transforms YARN internal proto message to CSI
      Throws:
      IllegalArgumentException - when given types are not supported