+ public DatastoreContextIntrospector(final DatastoreContext context,
+ final BindingNormalizedNodeSerializer bindingSerializer) {
+ final QName qname = BindingReflections.findQName(DataStorePropertiesContainer.class);
+ final DataStorePropertiesContainer defaultPropsContainer = (DataStorePropertiesContainer)
+ bindingSerializer.fromNormalizedNode(bindingSerializer.toYangInstanceIdentifier(
+ InstanceIdentifier.builder(DataStorePropertiesContainer.class).build()),
+ ImmutableNodes.containerNode(qname)).getValue();
+
+ final Builder builder = DatastoreContext.newBuilderFrom(context);
+ for (Entry<String, Entry<Class<?>, Method>> entry: DATA_STORE_PROP_INFO.entrySet()) {
+ Object value;
+ try {
+ value = entry.getValue().getValue().invoke(defaultPropsContainer);
+ } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
+ LOG.error("Error obtaining default value for property {}", entry.getKey(), e);
+ value = null;
+ }
+
+ if (value != null) {
+ convertValueAndInvokeSetter(entry.getKey(), value, builder);
+ }
+ }
+
+ this.context = builder.build();