use of org.opendaylight.controller.config.facade.xml.rpc.ModuleRpcs in project controller by opendaylight.
the class RpcFacade method fromXml.
public OperationExecution fromXml(final XmlElement xml) throws DocumentedException {
final String namespace;
namespace = xml.getNamespace();
final XmlElement contextInstanceElement = xml.getOnlyChildElement(CONTEXT_INSTANCE);
final String operationName = xml.getName();
final RuntimeRpcElementResolved id = RuntimeRpcElementResolved.fromXpath(contextInstanceElement.getTextContent(), operationName, namespace);
final Rpcs rpcs = mapRpcs();
final ModuleRpcs rpcMapping = rpcs.getRpcMapping(id);
final InstanceRuntimeRpc instanceRuntimeRpc = rpcMapping.getRpc(id.getRuntimeBeanName(), operationName);
// TODO move to Rpcs after xpath attribute is redesigned
final ObjectName on = id.getObjectName(rpcMapping);
Map<String, AttributeConfigElement> attributes = instanceRuntimeRpc.fromXml(xml);
attributes = sortAttributes(attributes, xml);
return new OperationExecution(on, instanceRuntimeRpc.getName(), attributes, instanceRuntimeRpc.getReturnType(), namespace);
}
use of org.opendaylight.controller.config.facade.xml.rpc.ModuleRpcs in project controller by opendaylight.
the class RpcFacade method mapRpcs.
public Rpcs mapRpcs() {
final Map<String, Map<String, ModuleRpcs>> map = new HashMap<>();
for (final Map.Entry<String, Map<String, ModuleMXBeanEntry>> namespaceToModuleEntry : yangStoreService.getModuleMXBeanEntryMap().entrySet()) {
Map<String, ModuleRpcs> namespaceToModules = map.computeIfAbsent(namespaceToModuleEntry.getKey(), k -> new HashMap<>());
for (final Map.Entry<String, ModuleMXBeanEntry> moduleEntry : namespaceToModuleEntry.getValue().entrySet()) {
ModuleRpcs rpcMapping = namespaceToModules.computeIfAbsent(moduleEntry.getKey(), k -> new ModuleRpcs(yangStoreService.getEnumResolver()));
final ModuleMXBeanEntry entry = moduleEntry.getValue();
for (final RuntimeBeanEntry runtimeEntry : entry.getRuntimeBeans()) {
rpcMapping.addNameMapping(runtimeEntry);
for (final RuntimeBeanEntry.Rpc rpc : runtimeEntry.getRpcs()) {
rpcMapping.addRpc(runtimeEntry, rpc);
}
}
}
}
return new Rpcs(map);
}
Aggregations