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
11 * Generated from: yang module name: bgp-rib-impl yang module local name: rib-impl
12 * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
13 * Generated at: Wed Nov 06 13:02:32 CET 2013
15 * Do not modify this file unless it is present under src/main directory
17 package org.opendaylight.controller.config.yang.bgp.rib.impl;
19 import java.util.Hashtable;
20 import org.opendaylight.controller.config.api.JmxAttributeValidationException;
21 import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
22 import org.opendaylight.controller.sal.core.api.model.SchemaService;
23 import org.opendaylight.protocol.bgp.rib.impl.RIBImpl;
24 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
25 import org.opendaylight.yangtools.sal.binding.generator.impl.GeneratedClassLoadingStrategy;
26 import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
27 import org.osgi.framework.BundleContext;
32 public final class RIBImplModule extends org.opendaylight.controller.config.yang.bgp.rib.impl.AbstractRIBImplModule {
34 private static final String IS_NOT_SET = "is not set.";
35 private BundleContext bundleContext;
37 public RIBImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier name,
38 final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
39 super(name, dependencyResolver);
42 public RIBImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier name,
43 final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, final RIBImplModule oldModule,
44 final java.lang.AutoCloseable oldInstance) {
45 super(name, dependencyResolver, oldModule, oldInstance);
49 public void customValidation() {
50 JmxAttributeValidationException.checkNotNull(getExtensions(), IS_NOT_SET, extensionsJmxAttribute);
51 JmxAttributeValidationException.checkNotNull(getRibId(), IS_NOT_SET, ribIdJmxAttribute);
52 JmxAttributeValidationException.checkNotNull(getLocalAs(), IS_NOT_SET, localAsJmxAttribute);
53 JmxAttributeValidationException.checkNotNull(getBgpRibId(), IS_NOT_SET, bgpRibIdJmxAttribute);
54 JmxAttributeValidationException.checkNotNull(getTcpReconnectStrategy(), IS_NOT_SET, tcpReconnectStrategyJmxAttribute);
55 JmxAttributeValidationException.checkNotNull(getSessionReconnectStrategy(), IS_NOT_SET, sessionReconnectStrategyJmxAttribute);
56 JmxAttributeValidationException.checkNotNull(getLocalTable(), IS_NOT_SET, localTableJmxAttribute);
60 public java.lang.AutoCloseable createInstance() {
61 RIBImpl rib = new RIBImpl(getRibId(), new AsNumber(getLocalAs()), getBgpRibId(), getClusterId(), getExtensionsDependency(),
62 getBgpDispatcherDependency(), getTcpReconnectStrategyDependency(), getCodecTreeFactoryDependency(), getSessionReconnectStrategyDependency(),
63 getDataProviderDependency(), getDomDataProviderDependency(), getLocalTableDependency(), classLoadingStrategy());
64 registerSchemaContextListener(rib);
68 private GeneratedClassLoadingStrategy classLoadingStrategy() {
69 return getExtensionsDependency().getClassLoadingStrategy();
72 private void registerSchemaContextListener(RIBImpl rib) {
73 DOMDataBroker domBroker = getDomDataProviderDependency();
74 if(domBroker instanceof SchemaService) {
75 ((SchemaService) domBroker).registerSchemaContextListener(rib);
77 // FIXME:Get bundle context and register global schema service from bundle
79 bundleContext.registerService(SchemaContextListener.class, rib, new Hashtable<String,String>());
83 public void setBundleContext(BundleContext bundleContext) {
84 this.bundleContext = bundleContext;