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.spi.osgi;
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.BGPExtensionConsumerContext;
13 import org.opendaylight.protocol.bgp.parser.spi.CapabilityRegistry;
14 import org.opendaylight.protocol.bgp.parser.spi.MessageRegistry;
15 import org.opendaylight.protocol.bgp.parser.spi.NlriRegistry;
16 import org.opendaylight.protocol.bgp.parser.spi.ParameterRegistry;
17 import org.opendaylight.protocol.bgp.parser.spi.SubsequentAddressFamilyRegistry;
18 import org.opendaylight.protocol.concepts.AbstractRegistration;
19 import org.osgi.framework.BundleContext;
20 import org.osgi.framework.ServiceRegistration;
22 import com.google.common.base.Preconditions;
24 class OSGiBGPExtensionConsumerContext implements BGPExtensionConsumerContext {
25 protected final BundleContext bundleContext;
27 OSGiBGPExtensionConsumerContext(final BundleContext context) {
28 this.bundleContext = Preconditions.checkNotNull(context);
31 protected <T> AutoCloseable register(final Class<T> clazz, final T object) {
32 final ServiceRegistration<T> reg = bundleContext.registerService(clazz, object, null);
34 return new AbstractRegistration() {
36 protected void removeRegistration() {
42 public BundleContext getBundleContext() {
47 public AddressFamilyRegistry getAddressFamilyRegistry() {
48 // TODO Auto-generated method stub
53 public AttributeRegistry getAttributeRegistry() {
54 // TODO Auto-generated method stub
59 public CapabilityRegistry getCapabilityRegistry() {
60 // TODO Auto-generated method stub
65 public MessageRegistry getMessageRegistry() {
66 // TODO Auto-generated method stub
71 public NlriRegistry getNlriRegistry() {
72 // TODO Auto-generated method stub
77 public ParameterRegistry getParameterRegistry() {
78 // TODO Auto-generated method stub
83 public SubsequentAddressFamilyRegistry getSubsequentAddressFamilyRegistry() {
84 // TODO Auto-generated method stub