BUG-1605: Fix yang-binding interfaces 88/10188/6
authorRobert Varga <rovarga@cisco.com>
Fri, 22 Aug 2014 17:42:23 +0000 (19:42 +0200)
committerRobert Varga <rovarga@cisco.com>
Fri, 22 Aug 2014 21:45:09 +0000 (23:45 +0200)
This is the frontend piece visible from Binding world. The
implementation relies of the data.api mechanics, so it needs to be
prepared first.

Change-Id: I4694f74e993bbfa9c84578dee04fdd49b87453b7
Signed-off-by: Robert Varga <rovarga@cisco.com>
code-generator/binding-data-codec/src/main/java/org/opendaylight/yangtools/binding/data/codec/impl/BindingNormalizedNodeCodecRegistry.java
code-generator/binding-data-codec/src/main/java/org/opendaylight/yangtools/binding/data/codec/impl/BindingToNormalizedStreamWriter.java
code-generator/binding-data-codec/src/main/java/org/opendaylight/yangtools/binding/data/codec/util/AugmentableDispatchSerializer.java
code-generator/binding-data-codec/src/main/java/org/opendaylight/yangtools/binding/data/codec/util/ChoiceDispatchSerializer.java
yang/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/BindingStreamEventWriter.java
yang/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/DataObjectSerializer.java
yang/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/DataObjectSerializerImplementation.java

index 3a29713d0e390b6858e495e4501500c64709e7b3..9b772bd9dc0f344503d2e3a53c3d98bffef117a6 100644 (file)
@@ -13,11 +13,14 @@ import com.google.common.base.Preconditions;
 import com.google.common.cache.CacheBuilder;
 import com.google.common.cache.CacheLoader;
 import com.google.common.cache.LoadingCache;
+
+import java.io.IOException;
 import java.util.AbstractMap.SimpleEntry;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
+
 import org.opendaylight.yangtools.binding.data.codec.api.BindingNormalizedNodeSerializer;
 import org.opendaylight.yangtools.binding.data.codec.api.BindingNormalizedNodeWriterFactory;
 import org.opendaylight.yangtools.binding.data.codec.gen.impl.DataObjectSerializerGenerator;
@@ -39,8 +42,11 @@ import org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListNode;
 import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter;
 import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNormalizedNodeStreamWriter;
 import org.opendaylight.yangtools.yang.data.impl.schema.NormalizedNodeResult;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class BindingNormalizedNodeCodecRegistry implements DataObjectSerializerRegistry, BindingNormalizedNodeWriterFactory, BindingNormalizedNodeSerializer {
+    private static final Logger LOG = LoggerFactory.getLogger(BindingNormalizedNodeCodecRegistry.class);
 
     private final DataObjectSerializerGenerator generator;
     private final LoadingCache<Class<? extends DataObject>, DataObjectSerializer> serializers;
@@ -87,8 +93,13 @@ public class BindingNormalizedNodeCodecRegistry implements DataObjectSerializerR
         // We create Binding Stream Writer wchich translates from Binding to Normalized Nodes
         Entry<YangInstanceIdentifier, BindingStreamEventWriter> writeCtx = codecContext.newWriter(path, domWriter);
 
-        // We get serializer which reads binding data and uses Binding To NOrmalized Node writer to write result
-        getSerializer(path.getTargetType()).serialize(data, writeCtx.getValue());
+        // We get serializer which reads binding data and uses Binding To Normalized Node writer to write result
+        try {
+            getSerializer(path.getTargetType()).serialize(data, writeCtx.getValue());
+        } catch (IOException e) {
+            LOG.error("Unexpected failure while serializing path {} data {}", path, data, e);
+            throw new IllegalStateException("Failed to create normalized node", e);
+        }
         return new SimpleEntry<YangInstanceIdentifier,NormalizedNode<?,?>>(writeCtx.getKey(),result.getResult());
     }
 
@@ -176,7 +187,7 @@ public class BindingNormalizedNodeCodecRegistry implements DataObjectSerializerR
         }
 
         @Override
-        public void serialize(final DataObject obj, final BindingStreamEventWriter stream) {
+        public void serialize(final DataObject obj, final BindingStreamEventWriter stream) throws IOException {
             delegate.serialize(BindingNormalizedNodeCodecRegistry.this, obj, stream);
         }
     }
index 3aa60c94e5dd5fd86faddf0f82e5120436a5783a..3c9a960eacea9c8c46b3e4456db604ae2544fb78 100644 (file)
@@ -9,6 +9,7 @@ package org.opendaylight.yangtools.binding.data.codec.impl;
 
 import com.google.common.base.Preconditions;
 
+import java.io.IOException;
 import java.util.AbstractMap;
 import java.util.ArrayDeque;
 import java.util.Deque;
@@ -82,7 +83,7 @@ class BindingToNormalizedStreamWriter implements BindingStreamEventWriter, Deleg
     }
 
     @Override
-    public void endNode() {
+    public void endNode() throws IOException {
         NodeCodecContext left = schema.pop();
         // NormalizedNode writer does not have entry into case, but into choice
         // so for leaving case, we do not emit endNode.
@@ -108,26 +109,26 @@ class BindingToNormalizedStreamWriter implements BindingStreamEventWriter, Deleg
     }
 
     @Override
-    public void leafNode(final String localName, final Object value) throws IllegalArgumentException {
+    public void leafNode(final String localName, final Object value) throws IOException, IllegalArgumentException {
         Entry<NodeIdentifier, Object> dom = serializeLeaf(localName, value);
         getDelegate().leafNode(dom.getKey(), dom.getValue());
     };
 
     @Override
-    public void anyxmlNode(final String name, final Object value) throws IllegalArgumentException {
+    public void anyxmlNode(final String name, final Object value) throws IOException, IllegalArgumentException {
         Entry<NodeIdentifier, Object> dom = serializeLeaf(name, value);
         getDelegate().anyxmlNode(dom.getKey(), dom.getValue());
     }
 
     @Override
-    public void leafSetEntryNode(final Object value) throws IllegalArgumentException {
+    public void leafSetEntryNode(final Object value) throws IOException, IllegalArgumentException {
         LeafNodeCodecContext ctx = (LeafNodeCodecContext) current();
         getDelegate().leafSetEntryNode(ctx.getValueCodec().serialize(value));
     }
 
     @Override
     public void startAugmentationNode(final Class<? extends Augmentation<?>> augmentationType)
-            throws IllegalArgumentException {
+            throws IOException, IllegalArgumentException {
         getDelegate().startAugmentationNode(enter(augmentationType, AugmentationIdentifier.class));
     }
 
@@ -139,23 +140,23 @@ class BindingToNormalizedStreamWriter implements BindingStreamEventWriter, Deleg
 
     @Override
     public void startChoiceNode(final Class<? extends DataContainer> type, final int childSizeHint)
-            throws IllegalArgumentException {
+            throws IOException, IllegalArgumentException {
         getDelegate().startChoiceNode(enter(type, NodeIdentifier.class), childSizeHint);
     }
 
     @Override
     public void startContainerNode(final Class<? extends DataObject> object, final int childSizeHint)
-            throws IllegalArgumentException {
+            throws IOException, IllegalArgumentException {
         getDelegate().startContainerNode(enter(object, NodeIdentifier.class), childSizeHint);
     }
 
     @Override
-    public void startLeafSet(final String localName, final int childSizeHint) throws IllegalArgumentException {
+    public void startLeafSet(final String localName, final int childSizeHint) throws IOException, IllegalArgumentException {
         getDelegate().startLeafSet(enter(localName, NodeIdentifier.class), childSizeHint);
     };
 
     @Override
-    public void startMapEntryNode(final Identifier<?> key, final int childSizeHint) throws IllegalArgumentException {
+    public void startMapEntryNode(final Identifier<?> key, final int childSizeHint) throws IOException, IllegalArgumentException {
         duplicateSchemaEnter();
         NodeIdentifierWithPredicates identifier = ((ListNodeCodecContext) current()).serialize(key);
         getDelegate().startMapEntryNode(identifier, childSizeHint);
@@ -163,25 +164,32 @@ class BindingToNormalizedStreamWriter implements BindingStreamEventWriter, Deleg
 
     @Override
     public <T extends DataObject & Identifiable<?>> void startMapNode(final Class<T> mapEntryType,
-            final int childSizeHint) throws IllegalArgumentException {
+            final int childSizeHint) throws IOException, IllegalArgumentException {
         getDelegate().startMapNode(enter(mapEntryType, NodeIdentifier.class), childSizeHint);
     };
 
     @Override
     public <T extends DataObject & Identifiable<?>> void startOrderedMapNode(final Class<T> mapEntryType,
-            final int childSizeHint) throws IllegalArgumentException {
+            final int childSizeHint) throws IOException, IllegalArgumentException {
         getDelegate().startOrderedMapNode(enter(mapEntryType, NodeIdentifier.class), childSizeHint);
     };
 
     @Override
     public void startUnkeyedList(final Class<? extends DataObject> obj, final int childSizeHint)
-            throws IllegalArgumentException {
+            throws IOException, IllegalArgumentException {
         getDelegate().startUnkeyedList(enter(obj, NodeIdentifier.class), childSizeHint);
     };
 
     @Override
-    public void startUnkeyedListItem(final int childSizeHint) throws IllegalStateException {
+    public void startUnkeyedListItem(final int childSizeHint) throws IllegalStateException, IOException {
         getDelegate().startUnkeyedListItem(duplicateSchemaEnter(), childSizeHint);
     }
 
+    @Override
+    public void flush() throws IOException {
+    }
+
+    @Override
+    public void close() throws IOException {
+    }
 }
index 548a998dfffec626a1001d10c0d2d8efbfdff962..38b4e8b211e00cb181e246623928dff4b2de32b6 100644 (file)
@@ -9,6 +9,7 @@ package org.opendaylight.yangtools.binding.data.codec.util;
 
 import com.google.common.base.Preconditions;
 
+import java.io.IOException;
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Proxy;
 import java.util.Collections;
@@ -38,7 +39,7 @@ public class AugmentableDispatchSerializer implements DataObjectSerializerImplem
 
     @Override
     public void serialize(final DataObjectSerializerRegistry reg, final DataObject obj,
-            final BindingStreamEventWriter stream) {
+            final BindingStreamEventWriter stream) throws IOException {
         if (obj instanceof Augmentable<?>) {
             final Map<Class<? extends Augmentation<?>>, Augmentation<?>> augmentations;
             if (reg instanceof AugmentationReader) {
@@ -64,7 +65,7 @@ public class AugmentableDispatchSerializer implements DataObjectSerializerImplem
 
     @SuppressWarnings("rawtypes")
     private void emitAugmentation(final Class type, final Augmentation<?> value, final BindingStreamEventWriter stream,
-            final DataObjectSerializerRegistry registry) {
+            final DataObjectSerializerRegistry registry) throws IOException {
         Preconditions.checkArgument(value instanceof DataObject);
         @SuppressWarnings("unchecked")
         DataObjectSerializer serializer = registry.getSerializer(type);
index 84ebc68e6dcaf1567e454f4038e66164bba9463b..5671ed52d73c307b1a366078ff339fd097238f05 100644 (file)
@@ -9,6 +9,8 @@ package org.opendaylight.yangtools.binding.data.codec.util;
 
 import com.google.common.base.Preconditions;
 
+import java.io.IOException;
+
 import org.opendaylight.yangtools.yang.binding.BindingStreamEventWriter;
 import org.opendaylight.yangtools.yang.binding.DataContainer;
 import org.opendaylight.yangtools.yang.binding.DataObject;
@@ -36,7 +38,7 @@ public class ChoiceDispatchSerializer implements DataObjectSerializerImplementat
 
     @SuppressWarnings("unchecked")
     @Override
-    public void serialize(final DataObjectSerializerRegistry reg, final DataObject obj, final BindingStreamEventWriter stream) {
+    public void serialize(final DataObjectSerializerRegistry reg, final DataObject obj, final BindingStreamEventWriter stream) throws IOException {
         @SuppressWarnings("rawtypes")
         Class cazeClass = obj.getImplementedInterface();
         stream.startChoiceNode(choiceClass, BindingStreamEventWriter.UNKNOWN_SIZE);
index 0428ee2c2e73123cdb247a03a6279bca3deaed6f..97b42f37ce53d8256600d5ef2602fe03013278ba 100644 (file)
@@ -7,6 +7,10 @@
  */
 package org.opendaylight.yangtools.yang.binding;
 
+import java.io.Closeable;
+import java.io.Flushable;
+import java.io.IOException;
+
 
 /**
  * Event Stream Writer for Binding Representation
@@ -31,33 +35,33 @@ package org.opendaylight.yangtools.yang.binding;
  * and finished using {@link #endNode()}.</li>
  *
  * <li><code>UnkeyedList</code> - Unkeyed list represent list without keys,
- * unkeyed list start is emmited using {@link #startUnkeyedList(Class, int)} list
- * end is emmited using {@link #endNode()}. Each list item is emmited using
+ * unkeyed list start is emitted using {@link #startUnkeyedList(Class, int)} list
+ * end is emitted using {@link #endNode()}. Each list item is emitted using
  * {@link #startUnkeyedListItem()} and ended using {@link #endNode()}.</li>
  * </ul>
  *
  * <li><code>leaf</code> - Leaf node event is emitted using
- * {@link #leafNode(String, Object)}. {@link #endNode()} MUST be not emmited for
+ * {@link #leafNode(String, Object)}. {@link #endNode()} MUST be not emitted for
  * leaf node.</li>
  *
  * <li><code>leaf-list</code> - Leaf list start is emitted using
  * {@link #startLeafSet(String, int)}. Leaf list end is emitted using
- * {@link #endNode()}. Leaf list entries are emmited using
+ * {@link #endNode()}. Leaf list entries are emitted using
  * {@link #leafSetEntryNode(Object).
  *
  * <li><code>anyxml - Anyxml node event is emitted using
- * {@link #leafNode(String, Object)}. {@link #endNode()} MUST be not emmited
+ * {@link #leafNode(String, Object)}. {@link #endNode()} MUST be not emitted
  * for anyxml node.</code></li>
  *
  *
- * <li><code>choice</code> Choice node event is emmited by
+ * <li><code>choice</code> Choice node event is emitted by
  * {@link #startChoiceNode(Class, int)} event and must be immediately followed by
- * {@link #startCase(Class, int)} event. Choice node is finished by emitting
+ * {@link #startCase(Class, int)} event. Choice node is finished by emitting an
  * {@link #endNode()} event.</li>
  *
  * <li>
  * <code>case</code> - Case node may be emitted only inside choice node by
- * invoking {@link #startCase(Class, int)}. Case node is finished be emitting
+ * invoking {@link #startCase(Class, int)}. Case node is finished be emitting an
  * {@link #endNode()} event.</li>
  *
  * <li>
@@ -82,11 +86,11 @@ package org.opendaylight.yangtools.yang.binding;
  *
  *
  */
-public interface BindingStreamEventWriter {
+public interface BindingStreamEventWriter extends Closeable, Flushable {
 
     /**
      * Methods in this interface allow users to hint the underlying
-     * implementation about the sizing of container-like constructurs
+     * implementation about the sizing of container-like constructors
      * (leafLists, containers, etc.). These hints may be taken into account by a
      * particular implementation to improve performance, but clients are not
      * required to provide hints. This constant should be used by clients who
@@ -117,8 +121,9 @@ public interface BindingStreamEventWriter {
      * @throws IllegalStateException
      *             If node was emitted inside <code>map</code>,
      *             <code>choice</code> <code>unkeyed list</code> node.
+     * @throws IOException if an underlying IO error occurs
      */
-    void leafNode(String localName, Object value) throws IllegalArgumentException;
+    void leafNode(String localName, Object value) throws IOException, IllegalArgumentException;
 
     /**
      *
@@ -142,8 +147,9 @@ public interface BindingStreamEventWriter {
      * @throws IllegalStateException
      *             If node was emitted inside <code>map</code>,
      *             <code>choice</code> <code>unkeyed list</code> node.
+     * @throws IOException if an underlying IO error occurs
      */
-    void startLeafSet(String localName, int childSizeHint) throws IllegalArgumentException;
+    void startLeafSet(String localName, int childSizeHint) throws IOException, IllegalArgumentException;
 
     /**
      * Emits a leaf set entry node
@@ -154,8 +160,9 @@ public interface BindingStreamEventWriter {
      *             If emitted leaf node has invalid value.
      * @throws IllegalStateException
      *             If node was emitted outside <code>leaf set</code> node.
+     * @throws IOException if an underlying IO error occurs
      */
-    void leafSetEntryNode(Object value) throws IllegalArgumentException;
+    void leafSetEntryNode(Object value) throws IOException, IllegalArgumentException;
 
     /**
      *
@@ -190,8 +197,9 @@ public interface BindingStreamEventWriter {
      * @throws IllegalStateException
      *             If node was emitted inside <code>map</code>,
      *             <code>choice</code> <code>unkeyed list</code> node.
+     * @throws IOException if an underlying IO error occurs
      */
-    void startContainerNode(Class<? extends DataObject> container, int childSizeHint) throws IllegalArgumentException;
+    void startContainerNode(Class<? extends DataObject> container, int childSizeHint) throws IOException, IllegalArgumentException;
 
     /**
      *
@@ -216,8 +224,9 @@ public interface BindingStreamEventWriter {
      * @throws IllegalStateException
      *             If node was emitted inside <code>map</code>,
      *             <code>choice</code> <code>unkeyed list</code> node.
+     * @throws IOException if an underlying IO error occurs
      */
-    void startUnkeyedList(Class<? extends DataObject> localName, int childSizeHint) throws IllegalArgumentException;
+    void startUnkeyedList(Class<? extends DataObject> localName, int childSizeHint) throws IOException, IllegalArgumentException;
 
     /**
      * Emits start of new unkeyed list item.
@@ -246,8 +255,9 @@ public interface BindingStreamEventWriter {
      *            events than count.
      * @throws IllegalStateException
      *             If node was emitted outside <code>unkeyed list</code> node.
+     * @throws IOException if an underlying IO error occurs
      */
-    void startUnkeyedListItem(int childSizeHint) throws IllegalStateException;
+    void startUnkeyedListItem(int childSizeHint) throws IOException, IllegalStateException;
 
     /**
      *
@@ -269,34 +279,35 @@ public interface BindingStreamEventWriter {
      * @throws IllegalStateException
      *             If node was emitted inside <code>map</code>,
      *             <code>choice</code> <code>unkeyed list</code> node.
+     * @throws IOException if an underlying IO error occurs
      */
     <T extends DataObject & Identifiable<?>> void startMapNode(Class<T> mapEntryType, int childSizeHint)
-            throws IllegalArgumentException;
-
+            throws IOException, IllegalArgumentException;
 
     /**
-    *
-    * Emits start of ordered map node event.
-    *
-    * <p>
-    * End of map node event is emitted by invoking {@link #endNode()}. Valid
-    * subevents is only {@link #startMapEntryNode(Identifier, int)}. All other methods will
-    * throw {@link IllegalArgumentException}.
-    *
-    * @param mapEntryType
-    *            Class of list item, which has defined key.
-    * @param childSizeHint
-    *            Non-negative count of expected direct child nodes or
-    *            {@link #UNKNOWN_SIZE} if count is unknown. This is only hint
-    *            and should not fail writing of child events, if there are more
-    *            events than count.
-    * @throws IllegalArgumentException
-    * @throws IllegalStateException
-    *             If node was emitted inside <code>map</code>,
-    *             <code>choice</code> <code>unkeyed list</code> node.
-    */
-   <T extends DataObject & Identifiable<?>> void startOrderedMapNode(Class<T> mapEntryType, int childSizeHint)
-           throws IllegalArgumentException;
+     *
+     * Emits start of ordered map node event.
+     *
+     * <p>
+     * End of map node event is emitted by invoking {@link #endNode()}. Valid
+     * subevents is only {@link #startMapEntryNode(Identifier, int)}. All other methods will
+     * throw {@link IllegalArgumentException}.
+     *
+     * @param mapEntryType
+     *            Class of list item, which has defined key.
+     * @param childSizeHint
+     *            Non-negative count of expected direct child nodes or
+     *            {@link #UNKNOWN_SIZE} if count is unknown. This is only hint
+     *            and should not fail writing of child events, if there are more
+     *            events than count.
+     * @throws IllegalArgumentException
+     * @throws IllegalStateException
+     *             If node was emitted inside <code>map</code>,
+     *             <code>choice</code> <code>unkeyed list</code> node.
+     * @throws IOException if an underlying IO error occurs
+     */
+    <T extends DataObject & Identifiable<?>> void startOrderedMapNode(Class<T> mapEntryType, int childSizeHint)
+           throws IOException, IllegalArgumentException;
 
     /**
      *
@@ -330,8 +341,9 @@ public interface BindingStreamEventWriter {
      *             If key contains incorrect value.
      * @throws IllegalStateException
      *             If node was emitted outside <code>map entry</code> node.
+     * @throws IOException if an underlying IO error occurs
      */
-    void startMapEntryNode(Identifier<?> keyValues, int childSizeHint) throws IllegalArgumentException;
+    void startMapEntryNode(Identifier<?> keyValues, int childSizeHint) throws IOException, IllegalArgumentException;
 
     /**
      * Emits start of choice node.
@@ -353,8 +365,9 @@ public interface BindingStreamEventWriter {
      * @throws IllegalStateException
      *             If node was emitted inside <code>map</code>, <code>choice
      *             </code> <code>unkeyed list</code> node.
+     * @throws IOException if an underlying IO error occurs
      */
-    void startChoiceNode(Class<? extends DataContainer> choice, int childSizeHint) throws IllegalArgumentException;
+    void startChoiceNode(Class<? extends DataContainer> choice, int childSizeHint) throws IOException, IllegalArgumentException;
 
     /**
      *
@@ -374,8 +387,9 @@ public interface BindingStreamEventWriter {
      *
      * @param name
      * @throws IllegalArgumentException
+     * @throws IOException if an underlying IO error occurs
      */
-    void startCase(Class<? extends DataObject> caze, int childSizeHint) throws IllegalArgumentException;
+    void startCase(Class<? extends DataObject> caze, int childSizeHint) throws IOException, IllegalArgumentException;
 
     /**
      * Emits start of augmentation node.
@@ -407,8 +421,9 @@ public interface BindingStreamEventWriter {
      *            Local names of all valid children defined by augmentation.
      * @throws IllegalArgumentException
      *             If augmentation is invalid in current context.
+     * @throws IOException if an underlying IO error occurs
      */
-    void startAugmentationNode(Class<? extends Augmentation<?>> augmentationType) throws IllegalArgumentException;
+    void startAugmentationNode(Class<? extends Augmentation<?>> augmentationType) throws IOException, IllegalArgumentException;
 
     /**
      * Emits anyxml node event.
@@ -419,13 +434,21 @@ public interface BindingStreamEventWriter {
      * @throws IllegalStateException
      *             If node was emitted inside <code>map</code>,
      *             <code>choice</code> <code>unkeyed list</code> node.
+     * @throws IOException if an underlying IO error occurs
      */
-    void anyxmlNode(String name, Object value) throws IllegalArgumentException;
+    void anyxmlNode(String name, Object value) throws IOException, IllegalArgumentException;
 
     /**
      * Emits end event for node.
      *
      * @throws IllegalStateException If there is no open node.
+     * @throws IOException if an underlying IO error occurs
      */
-    void endNode() throws IllegalStateException;
+    void endNode() throws IOException, IllegalStateException;
+
+    @Override
+    void flush() throws IOException;
+
+    @Override
+    void close() throws IOException;
 }
index 90d9cc2cae857986c3d01f06e3dd2966761aa631..faa7056e0f6e7858412234c5b299374061bd1b29 100644 (file)
@@ -7,24 +7,19 @@
  */
 package org.opendaylight.yangtools.yang.binding;
 
+import java.io.IOException;
+
 /**
- *
- * Serializer which writes DataObject to supplied stream event writer.
- *
- *
+ * A serializer which writes DataObject to supplied stream event writer.
  */
 public interface DataObjectSerializer {
-
     /**
-     *
      * Writes stream events representing object to supplied stream
-
      *
      * @param obj
      *            Source of stream events
      * @param stream
      *            Stream to which events should be written.
      */
-    void serialize(DataObject obj, BindingStreamEventWriter stream);
-
+    void serialize(DataObject obj, BindingStreamEventWriter stream) throws IOException;
 }
index 7aedc47d6f00a59e6652e4373ea86f3a1409ef7d..4c9b3c816ab15e2019138e6feb466af0c6475d66 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.yangtools.yang.binding;
 
+import java.io.IOException;
+
 /**
  * SPI-level contract for implementations of {@link DataObjectSerializer}.
  * The contract is kept between implementation of {@link DataObjectSerializerRegistry},
@@ -14,7 +16,7 @@ package org.opendaylight.yangtools.yang.binding;
  *
  * FIXME: this interface needs to be moved into .spi, but due to classpath funkyness
  *        of OSGi, that change has to be carefully orchestrated to ensure proper imports
- *        exist in all generated pacakges. One avenue how to achieve that is to move
+ *        exist in all generated packages. One avenue how to achieve that is to move
  *        {@link YangModuleInfo} and modify code generator to add a static field
  *        to all generated classes which will point to the per-model YangModuleInfo
  *        (currently all users of it have to walk the package hierarchy, so that
@@ -22,7 +24,6 @@ package org.opendaylight.yangtools.yang.binding;
  *
  */
 public interface DataObjectSerializerImplementation {
-
     /**
      *
      * Writes stream events for supplied data object to provided stream.
@@ -32,6 +33,5 @@ public interface DataObjectSerializerImplementation {
      * their events.
      *
      */
-    void serialize(DataObjectSerializerRegistry reg,DataObject obj, BindingStreamEventWriter stream);
-
+    void serialize(DataObjectSerializerRegistry reg,DataObject obj, BindingStreamEventWriter stream) throws IOException;
 }