Rework parser infrastructure to support partial message processing
[bgpcep.git] / pcep / impl / src / main / java / org / opendaylight / protocol / pcep / impl / message / PCEPNotificationMessageParser.java
index 248869dcf91814f154c28a0d45854ed21857e7b0..068e25a91d296de35ca2d3d064dccd4e84b90843 100644 (file)
@@ -72,20 +72,15 @@ public class PCEPNotificationMessageParser extends AbstractMessageParser {
        }
 
        @Override
-       public Message parseMessage(final byte[] buffer) throws PCEPDeserializerException, PCEPDocumentedException {
-               if (buffer == null || buffer.length == 0) {
-                       throw new PCEPDeserializerException("Notification message cannot be empty.");
-               }
-               final List<Object> objs = parseObjects(buffer);
-
-               return validate(objs);
-       }
-
-       public Message validate(final List<Object> objects) throws PCEPDeserializerException {
+       protected Message validate(final List<Object> objects, final List<Message> errors) throws PCEPDeserializerException {
                if (objects == null) {
                        throw new IllegalArgumentException("Passed list can't be null.");
                }
 
+               if (objects.isEmpty()) {
+                       throw new PCEPDeserializerException("Notification message cannot be empty.");
+               }
+
                final PCEPErrorMapping maping = PCEPErrorMapping.getInstance();
 
                final List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcntf.message.pcntf.message.Notifications> compositeNotifications = Lists.newArrayList();