Code Review
/
controller.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Bug 2517: Catch RuntimeExceptions thrown from the DCL in DataChangeListener
[controller.git]
/
opendaylight
/
md-sal
/
sal-rest-connector
/
src
/
main
/
java
/
org
/
opendaylight
/
controller
/
sal
/
restconf
/
impl
/
RestCodec.java
diff --git
a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/RestCodec.java
b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/RestCodec.java
index ff90dd8439582969d8db755c2ae08f4e91129cc5..ceac03e3d97eccabca05633652179ce1bb3acb1c 100644
(file)
--- a/
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/RestCodec.java
+++ b/
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/RestCodec.java
@@
-12,7
+12,7
@@
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.opendaylight.controller.
sal.core.api.mount.MountInstance
;
+import org.opendaylight.controller.
md.sal.dom.api.DOMMountPoint
;
import org.opendaylight.controller.sal.rest.impl.RestUtil;
import org.opendaylight.controller.sal.restconf.impl.IdentityValuesDTO.IdentityValue;
import org.opendaylight.controller.sal.restconf.impl.IdentityValuesDTO.Predicate;
import org.opendaylight.controller.sal.rest.impl.RestUtil;
import org.opendaylight.controller.sal.restconf.impl.IdentityValuesDTO.IdentityValue;
import org.opendaylight.controller.sal.restconf.impl.IdentityValuesDTO.Predicate;
@@
-47,7
+47,7
@@
public class RestCodec {
}
public static final Codec<Object, Object> from(final TypeDefinition<?> typeDefinition,
}
public static final Codec<Object, Object> from(final TypeDefinition<?> typeDefinition,
- final
MountInstance
mountPoint) {
+ final
DOMMountPoint
mountPoint) {
return new ObjectCodec(typeDefinition, mountPoint);
}
return new ObjectCodec(typeDefinition, mountPoint);
}
@@
-62,7
+62,7
@@
public class RestCodec {
private final TypeDefinition<?> type;
private final TypeDefinition<?> type;
- private ObjectCodec(final TypeDefinition<?> typeDefinition, final
MountInstance
mountPoint) {
+ private ObjectCodec(final TypeDefinition<?> typeDefinition, final
DOMMountPoint
mountPoint) {
type = RestUtil.resolveBaseTypeFrom(typeDefinition);
if (type instanceof IdentityrefTypeDefinition) {
identityrefCodec = new IdentityrefCodecImpl(mountPoint);
type = RestUtil.resolveBaseTypeFrom(typeDefinition);
if (type instanceof IdentityrefTypeDefinition) {
identityrefCodec = new IdentityrefCodecImpl(mountPoint);
@@
-88,11
+88,6
@@
public class RestCodec {
"Value is not instance of IdentityrefTypeDefinition but is {}. Therefore NULL is used as translation of - {}",
input == null ? "null" : input.getClass(), String.valueOf(input));
return null;
"Value is not instance of IdentityrefTypeDefinition but is {}. Therefore NULL is used as translation of - {}",
input == null ? "null" : input.getClass(), String.valueOf(input));
return null;
- } else if (type instanceof LeafrefTypeDefinition) {
- if (input instanceof IdentityValuesDTO) {
- return LEAFREF_DEFAULT_CODEC.deserialize(((IdentityValuesDTO) input).getOriginValue());
- }
- return LEAFREF_DEFAULT_CODEC.deserialize(input);
} else if (type instanceof InstanceIdentifierTypeDefinition) {
if (input instanceof IdentityValuesDTO) {
return instanceIdentifier.deserialize(input);
} else if (type instanceof InstanceIdentifierTypeDefinition) {
if (input instanceof IdentityValuesDTO) {
return instanceIdentifier.deserialize(input);
@@
-158,9
+153,9
@@
public class RestCodec {
private final Logger logger = LoggerFactory.getLogger(IdentityrefCodecImpl.class);
private final Logger logger = LoggerFactory.getLogger(IdentityrefCodecImpl.class);
- private final
MountInstance
mountPoint;
+ private final
DOMMountPoint
mountPoint;
- public IdentityrefCodecImpl(final
MountInstance
mountPoint) {
+ public IdentityrefCodecImpl(final
DOMMountPoint
mountPoint) {
this.mountPoint = mountPoint;
}
this.mountPoint = mountPoint;
}
@@
-200,9
+195,9
@@
public class RestCodec {
public static class InstanceIdentifierCodecImpl implements InstanceIdentifierCodec<IdentityValuesDTO> {
private final Logger logger = LoggerFactory.getLogger(InstanceIdentifierCodecImpl.class);
public static class InstanceIdentifierCodecImpl implements InstanceIdentifierCodec<IdentityValuesDTO> {
private final Logger logger = LoggerFactory.getLogger(InstanceIdentifierCodecImpl.class);
- private final
MountInstance
mountPoint;
+ private final
DOMMountPoint
mountPoint;
- public InstanceIdentifierCodecImpl(final
MountInstance
mountPoint) {
+ public InstanceIdentifierCodecImpl(final
DOMMountPoint
mountPoint) {
this.mountPoint = mountPoint;
}
this.mountPoint = mountPoint;
}
@@
-232,7
+227,7
@@
public class RestCodec {
IdentityValue valueWithNamespace = data.getValuesWithNamespaces().get(0);
Module module = getModuleByNamespace(valueWithNamespace.getNamespace(), mountPoint);
if (module == null) {
IdentityValue valueWithNamespace = data.getValuesWithNamespaces().get(0);
Module module = getModuleByNamespace(valueWithNamespace.getNamespace(), mountPoint);
if (module == null) {
- logger.info("Module by namespace '{}' of first node in instance-identi
e
fier was not found.",
+ logger.info("Module by namespace '{}' of first node in instance-identifier was not found.",
valueWithNamespace.getNamespace());
logger.info("Instance-identifier will be translated as NULL for data - {}",
String.valueOf(valueWithNamespace.getValue()));
valueWithNamespace.getNamespace());
logger.info("Instance-identifier will be translated as NULL for data - {}",
String.valueOf(valueWithNamespace.getValue()));
@@
-244,7
+239,7
@@
public class RestCodec {
for (int i = 0; i < identities.size(); i++) {
IdentityValue identityValue = identities.get(i);
URI validNamespace = resolveValidNamespace(identityValue.getNamespace(), mountPoint);
for (int i = 0; i < identities.size(); i++) {
IdentityValue identityValue = identities.get(i);
URI validNamespace = resolveValidNamespace(identityValue.getNamespace(), mountPoint);
- DataSchemaNode node = ControllerContext.
getInstance().
findInstanceDataChildByNameAndNamespace(
+ DataSchemaNode node = ControllerContext.findInstanceDataChildByNameAndNamespace(
parentContainer, identityValue.getValue(), validNamespace);
if (node == null) {
logger.info("'{}' node was not found in {}", identityValue, parentContainer.getChildNodes());
parentContainer, identityValue.getValue(), validNamespace);
if (node == null) {
logger.info("'{}' node was not found in {}", identityValue, parentContainer.getChildNodes());
@@
-271,7
+266,7
@@
public class RestCodec {
Map<QName, Object> predicatesMap = new HashMap<>();
for (Predicate predicate : identityValue.getPredicates()) {
validNamespace = resolveValidNamespace(predicate.getName().getNamespace(), mountPoint);
Map<QName, Object> predicatesMap = new HashMap<>();
for (Predicate predicate : identityValue.getPredicates()) {
validNamespace = resolveValidNamespace(predicate.getName().getNamespace(), mountPoint);
- DataSchemaNode listKey = ControllerContext
.getInstance()
+ DataSchemaNode listKey = ControllerContext
.findInstanceDataChildByNameAndNamespace(listNode, predicate.getName().getValue(),
validNamespace);
predicatesMap.put(listKey.getQName(), predicate.getValue());
.findInstanceDataChildByNameAndNamespace(listNode, predicate.getName().getValue(),
validNamespace);
predicatesMap.put(listKey.getQName(), predicate.getValue());
@@
-286,7
+281,7
@@
public class RestCodec {
}
result.add(pathArgument);
if (i < identities.size() - 1) { // last element in instance-identifier can be other than
}
result.add(pathArgument);
if (i < identities.size() - 1) { // last element in instance-identifier can be other than
-
// DataNodeContainer
+ // DataNodeContainer
if (node instanceof DataNodeContainer) {
parentContainer = (DataNodeContainer) node;
} else {
if (node instanceof DataNodeContainer) {
parentContainer = (DataNodeContainer) node;
} else {
@@
-318,7
+313,7
@@
public class RestCodec {
}
}
}
}
- private static Module getModuleByNamespace(final String namespace, final
MountInstance
mountPoint) {
+ private static Module getModuleByNamespace(final String namespace, final
DOMMountPoint
mountPoint) {
URI validNamespace = resolveValidNamespace(namespace, mountPoint);
Module module = null;
URI validNamespace = resolveValidNamespace(namespace, mountPoint);
Module module = null;
@@
-334,7
+329,7
@@
public class RestCodec {
return module;
}
return module;
}
- private static URI resolveValidNamespace(final String namespace, final
MountInstance
mountPoint) {
+ private static URI resolveValidNamespace(final String namespace, final
DOMMountPoint
mountPoint) {
URI validNamespace;
if (mountPoint != null) {
validNamespace = ControllerContext.getInstance().findNamespaceByModuleName(mountPoint, namespace);
URI validNamespace;
if (mountPoint != null) {
validNamespace = ControllerContext.getInstance().findNamespaceByModuleName(mountPoint, namespace);