2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.protocol.bgp.parser.impl;
10 import org.opendaylight.protocol.bgp.parser.BGPDocumentedException;
11 import org.opendaylight.protocol.bgp.parser.BGPMessageFactory;
12 import org.opendaylight.protocol.bgp.parser.BGPParsingException;
13 import org.opendaylight.protocol.bgp.parser.spi.MessageRegistry;
14 import org.opendaylight.yangtools.yang.binding.Notification;
16 import com.google.common.base.Preconditions;
18 public final class BGPMessageFactoryImpl implements BGPMessageFactory {
19 private final MessageRegistry registry;
21 public BGPMessageFactoryImpl(final MessageRegistry registry) {
22 this.registry = Preconditions.checkNotNull(registry);
27 * @see org.opendaylight.protocol.bgp.parser.BGPMessageParser#parse(byte[])
30 public Notification parse(final byte[] bytes) throws BGPParsingException, BGPDocumentedException {
31 return this.registry.parseMessage(bytes);
35 public byte[] put(final Notification msg) {
36 return this.registry.serializeMessage(msg);