public AttributeMappingStrategy<?, ? extends OpenType<?>> prepareStrategy(AttributeIfc attributeIfc) {
if(attributeIfc instanceof DependencyAttribute) {
- serviceNameOfDepAttr = ((DependencyAttribute)attributeIfc).getDependency().getSie().getQName().getLocalName();
namespaceOfDepAttr = ((DependencyAttribute)attributeIfc).getDependency().getSie().getQName().getNamespace().toString();
} else if (attributeIfc instanceof ListDependenciesAttribute) {
- serviceNameOfDepAttr = ((ListDependenciesAttribute)attributeIfc).getDependency().getSie().getQName().getLocalName();
namespaceOfDepAttr = ((ListDependenciesAttribute)attributeIfc).getDependency().getSie().getQName().getNamespace().toString();
}
return new UnionCompositeAttributeMappingStrategy(compositeType, innerStrategies, attributeMapping);
}
- private String serviceNameOfDepAttr;
private String namespaceOfDepAttr;
@Override
protected AttributeMappingStrategy<?, ? extends OpenType<?>> caseDependencyAttribute(
SimpleType<?> openType) {
- return new ObjectNameAttributeMappingStrategy(openType,
- serviceNameOfDepAttr, namespaceOfDepAttr);
+ return new ObjectNameAttributeMappingStrategy(openType, namespaceOfDepAttr);
}
@Override
import javax.management.openmbean.SimpleType;
import org.opendaylight.controller.config.api.jmx.ObjectNameUtil;
import org.opendaylight.controller.netconf.confignetconfconnector.util.Util;
+import org.opendaylight.yangtools.yang.common.QName;
public class ObjectNameAttributeMappingStrategy extends
AbstractAttributeMappingStrategy<ObjectNameAttributeMappingStrategy.MappedDependency, SimpleType<?>> {
- private final String serviceName;
private final String namespace;
- public ObjectNameAttributeMappingStrategy(SimpleType<?> openType, String serviceName, String namespace) {
+ public ObjectNameAttributeMappingStrategy(SimpleType<?> openType, String namespace) {
super(openType);
- this.serviceName = serviceName;
this.namespace = namespace;
}
String refName = ObjectNameUtil.getReferenceName(on);
- return Optional.of(new MappedDependency(namespace, serviceName, refName));
+ //we want to use the exact service name that was configured in xml so services that are referencing it can be resolved
+ return Optional.of(new MappedDependency(namespace,
+ QName.create(ObjectNameUtil.getServiceQName(on)).getLocalName(), refName));
}
public static class MappedDependency {