0886a53141bc3464bad7f666e62c809f63372fe1
[bgpcep.git] / bgp / rib-impl / src / main / java / org / opendaylight / protocol / bgp / rib / impl / BGPConnectionImpl.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.protocol.bgp.rib.impl;
9
10 import java.net.InetSocketAddress;
11
12 import org.opendaylight.protocol.bgp.parser.BGPSessionListener;
13 import org.opendaylight.protocol.bgp.rib.impl.spi.BGPConnection;
14 import org.opendaylight.protocol.bgp.rib.impl.spi.BGPSessionPreferences;
15 import org.opendaylight.protocol.bgp.rib.impl.spi.BGPSessionProposalChecker;
16
17
18 /**
19  * Implementation of {@link BGPConnection}.
20  */
21 public class BGPConnectionImpl implements BGPConnection {
22
23         private final InetSocketAddress address;
24
25         private final BGPSessionListener listener;
26
27         private final BGPSessionPreferences proposal;
28
29         private final BGPSessionProposalChecker checker;
30
31         /**
32          * Merges together BGP specific connection attributes.
33          * 
34          * @param address inet socket address
35          * @param listener bgp session listener
36          * @param proposal bgp session preferences
37          * @param checker bgp session proposal checker
38          */
39         public BGPConnectionImpl(final InetSocketAddress address, final BGPSessionListener listener, final BGPSessionPreferences proposal,
40                         final BGPSessionProposalChecker checker) {
41                 super();
42                 this.address = address;
43                 this.listener = listener;
44                 this.proposal = proposal;
45                 this.checker = checker;
46         }
47
48         @Override
49         public InetSocketAddress getPeerAddress() {
50                 return this.address;
51         }
52
53         @Override
54         public BGPSessionListener getListener() {
55                 return this.listener;
56         }
57
58         @Override
59         public BGPSessionPreferences getProposal() {
60                 return this.proposal;
61         }
62
63         @Override
64         public BGPSessionProposalChecker getProposalChecker() {
65                 return this.checker;
66         }
67 }