ec153e3ef1471442a99549ab33524216c5d46b13
[bgpcep.git] / bgp / topology-provider-config / src / main / java / org / opendaylight / controller / config / yang / bgp / topology / provider / Ipv6ReachabilityTopologyBuilderModule.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 /**
9  * Generated file
10
11  * Generated from: yang module name: config-bgp-topology-provider  yang module local name: bgp-reachability-ipv6
12  * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
13  * Generated at: Tue Nov 19 15:13:57 CET 2013
14  *
15  * Do not modify this file unless it is present under src/main directory
16  */
17 package org.opendaylight.controller.config.yang.bgp.topology.provider;
18
19 import org.opendaylight.bgpcep.bgp.topology.provider.Ipv6ReachabilityTopologyBuilder;
20 import org.opendaylight.bgpcep.topology.DefaultTopologyReference;
21 import org.opendaylight.controller.config.api.JmxAttributeValidationException;
22 import org.opendaylight.controller.sal.binding.api.data.DataChangeListener;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.rib.Tables;
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.Ipv6AddressFamily;
25 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.UnicastSubsequentAddressFamily;
26 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology;
27 import org.opendaylight.yangtools.concepts.ListenerRegistration;
28 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
29 import org.slf4j.Logger;
30 import org.slf4j.LoggerFactory;
31
32 /**
33  *
34  */
35 public final class Ipv6ReachabilityTopologyBuilderModule extends org.opendaylight.controller.config.yang.bgp.topology.provider.AbstractIpv6ReachabilityTopologyBuilderModule
36 {
37         private static final Logger LOG = LoggerFactory.getLogger(Ipv6ReachabilityTopologyBuilderModule.class);
38
39         public Ipv6ReachabilityTopologyBuilderModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
40                 super(identifier, dependencyResolver);
41         }
42
43         public Ipv6ReachabilityTopologyBuilderModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, final Ipv6ReachabilityTopologyBuilderModule oldModule, final java.lang.AutoCloseable oldInstance) {
44                 super(identifier, dependencyResolver, oldModule, oldInstance);
45         }
46
47         @Override
48         public void validate(){
49                 super.validate();
50                 JmxAttributeValidationException.checkNotNull(getTopologyId(),
51                                 "is not set.", topologyIdJmxAttribute);
52         }
53
54         @Override
55         public java.lang.AutoCloseable createInstance() {
56                 final Ipv6ReachabilityTopologyBuilder b = new Ipv6ReachabilityTopologyBuilder(getDataProviderDependency(), getLocalRibDependency(), getTopologyId());
57                 final InstanceIdentifier<Tables> i = b.tableInstanceIdentifier(Ipv6AddressFamily.class, UnicastSubsequentAddressFamily.class);
58                 final ListenerRegistration<DataChangeListener> r = getDataProviderDependency().registerDataChangeListener(i, b);
59                 LOG.debug("Registered listener {} on {} (topology {})", b, i, b.getInstanceIdentifier());
60
61                 final class TopologyReferenceAutocloseable extends DefaultTopologyReference implements AutoCloseable {
62                         public TopologyReferenceAutocloseable(final InstanceIdentifier<Topology> instanceIdentifier) {
63                                 super(instanceIdentifier);
64                         }
65
66                         @Override
67                         public void close() throws Exception {
68                                 try {
69                                         r.close();
70                                 } finally {
71                                         b.close();
72                                 }
73                         }
74                 }
75
76                 return new TopologyReferenceAutocloseable(b.getInstanceIdentifier());
77         }
78 }