Merge changes I9afed602,Id8b701a4
[bgpcep.git] / bgp / parser-impl / src / main / java / org / opendaylight / protocol / bgp / parser / impl / SingletonProviderContext.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.parser.impl;
9
10 import org.opendaylight.protocol.bgp.parser.spi.AddressFamilyRegistry;
11 import org.opendaylight.protocol.bgp.parser.spi.AttributeRegistry;
12 import org.opendaylight.protocol.bgp.parser.spi.CapabilityRegistry;
13 import org.opendaylight.protocol.bgp.parser.spi.MessageRegistry;
14 import org.opendaylight.protocol.bgp.parser.spi.NlriRegistry;
15 import org.opendaylight.protocol.bgp.parser.spi.ParameterRegistry;
16 import org.opendaylight.protocol.bgp.parser.spi.ProviderContext;
17 import org.opendaylight.protocol.bgp.parser.spi.SubsequentAddressFamilyRegistry;
18
19 public final class SingletonProviderContext implements ProviderContext {
20         private static final class Holder {
21                 private static final ProviderContext INSTANCE = new SingletonProviderContext();
22         }
23
24         private SingletonProviderContext() {
25
26         }
27
28         public static ProviderContext getInstance() {
29                 return Holder.INSTANCE;
30         }
31
32         @Override
33         public AddressFamilyRegistry getAddressFamilyRegistry() {
34                 return SimpleAddressFamilyRegistry.getInstance();
35         }
36
37         @Override
38         public AttributeRegistry getAttributeRegistry() {
39                 return SimpleAttributeRegistry.getInstance();
40         }
41
42         @Override
43         public CapabilityRegistry getCapabilityRegistry() {
44                 return SimpleCapabilityRegistry.getInstance();
45         }
46
47         @Override
48         public MessageRegistry getMessageRegistry() {
49                 return SimpleMessageRegistry.getInstance();
50         }
51
52         @Override
53         public NlriRegistry getNlriRegistry() {
54                 return SimpleNlriRegistry.getInstance();
55         }
56
57         @Override
58         public ParameterRegistry getParameterRegistry() {
59                 return SimpleParameterRegistry.getInstance();
60         }
61
62         @Override
63         public SubsequentAddressFamilyRegistry getSubsequentAddressFamilyRegistry() {
64                 return SimpleSubsequentAddressFamilyRegistry.getInstance();
65         }
66 }