Class ProtoTranslatorFactory
java.lang.Object
org.apache.hadoop.yarn.csi.translator.ProtoTranslatorFactory
Factory class to get desired proto transformer instance.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <A,B> ProtoTranslator<A, B> getTranslator(Class<A> yarnProto, Class<B> csiProto) Get aProtoTranslatorbased on the given input message types.
-
Method Details
-
getTranslator
Get aProtoTranslatorbased 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 messageB- CSI proto message- Parameters:
yarnProto- yarn proto messagecsiProto- CSI proto message- Returns:
- a proto message transformer that transforms YARN internal proto message to CSI
- Throws:
IllegalArgumentException- when given types are not supported
-