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.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;
19 public final class SingletonProviderContext implements ProviderContext {
20 private static final class Holder {
21 private static final ProviderContext INSTANCE;
24 final ProviderContext pc = new SingletonProviderContext();
25 new ActivatorImpl().start(pc);
30 private final AddressFamilyRegistry afiReg = new SimpleAddressFamilyRegistry();
31 private final AttributeRegistry attrReg = new SimpleAttributeRegistry();
32 private final CapabilityRegistry capReg = new SimpleCapabilityRegistry();
33 private final MessageRegistry msgReg = new SimpleMessageRegistry();
34 private final NlriRegistry nlriReg;
35 private final ParameterRegistry paramReg = new SimpleParameterRegistry();
36 private final SubsequentAddressFamilyRegistry safiReg= new SimpleSubsequentAddressFamilyRegistry();
38 private SingletonProviderContext() {
39 nlriReg = new SimpleNlriRegistry(afiReg, safiReg);
42 public static ProviderContext getInstance() {
43 return Holder.INSTANCE;
47 public AddressFamilyRegistry getAddressFamilyRegistry() {
52 public AttributeRegistry getAttributeRegistry() {
57 public CapabilityRegistry getCapabilityRegistry() {
62 public MessageRegistry getMessageRegistry() {
67 public NlriRegistry getNlriRegistry() {
72 public ParameterRegistry getParameterRegistry() {
77 public SubsequentAddressFamilyRegistry getSubsequentAddressFamilyRegistry() {