use of org.opendaylight.openflowplugin.extension.api.BundleMessageDataInjector in project openflowplugin by opendaylight.
the class SalExperimenterMessageServiceImpl method buildRequest.
@Override
protected OfHeader buildRequest(Xid xid, SendExperimenterInput input) throws ServiceException {
final TypeVersionKey key = new TypeVersionKey(input.getExperimenterMessageOfChoice().getImplementedInterface(), getVersion());
final ConverterMessageToOFJava<ExperimenterMessageOfChoice, ExperimenterDataOfChoice> messageConverter = extensionConverterProvider.getMessageConverter(key);
if (messageConverter == null) {
throw new ServiceException(new ConverterNotFoundException(key.toString()));
}
final ExperimenterInputBuilder experimenterInputBld;
if (messageConverter instanceof BundleMessageDataInjector) {
((BundleMessageDataInjector) messageConverter).setNode(input.getNode());
((BundleMessageDataInjector) messageConverter).setXid(xid.getValue());
}
try {
experimenterInputBld = new ExperimenterInputBuilder().setExperimenter(messageConverter.getExperimenterId()).setExpType(messageConverter.getType()).setExperimenterDataOfChoice(messageConverter.convert(input.getExperimenterMessageOfChoice())).setVersion(getVersion()).setXid(xid.getValue());
} catch (ConversionException e) {
throw new ServiceException(e);
}
return experimenterInputBld.build();
}
Aggregations