Do not rely on deprecated classes directly
[bgpcep.git] / bgp / rib-impl-config / src / main / java / org / opendaylight / controller / config / yang / bgp / rib / impl / BGPMessageFactoryImplModule.java
1 /**
2  * Generated file
3
4  * Generated from: yang module name: bgp-rib-impl  yang module local name: bgp-message-factory-impl
5  * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
6  * Generated at: Wed Nov 06 13:02:31 CET 2013
7  *
8  * Do not modify this file unless it is present under src/main directory
9  */
10 package org.opendaylight.controller.config.yang.bgp.rib.impl;
11
12 import org.opendaylight.protocol.bgp.parser.BGPDocumentedException;
13 import org.opendaylight.protocol.bgp.parser.BGPMessageFactory;
14 import org.opendaylight.protocol.bgp.parser.BGPParsingException;
15 import org.opendaylight.protocol.bgp.parser.impl.BGPMessageFactoryImpl;
16 import org.opendaylight.yangtools.yang.binding.Notification;
17
18 /**
19  *
20  */
21 public final class BGPMessageFactoryImplModule
22 extends
23 org.opendaylight.controller.config.yang.bgp.rib.impl.AbstractBGPMessageFactoryImplModule {
24
25         public BGPMessageFactoryImplModule(
26                         final org.opendaylight.controller.config.api.ModuleIdentifier name,
27                         final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
28                 super(name, dependencyResolver);
29         }
30
31         public BGPMessageFactoryImplModule(
32                         final org.opendaylight.controller.config.api.ModuleIdentifier name,
33                         final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
34                         final BGPMessageFactoryImplModule oldModule,
35                         final java.lang.AutoCloseable oldInstance) {
36                 super(name, dependencyResolver, oldModule, oldInstance);
37         }
38
39         @Override
40         public void validate() {
41                 super.validate();
42                 // Add custom validation for module attributes here.
43         }
44
45         @Override
46         public java.lang.AutoCloseable createInstance() {
47                 try {
48                         return new BGPMessageFactoryCloseable(new BGPMessageFactoryImpl(
49                                         getBgpExtensionsDependency().getMessageRegistry()));
50                 } catch (Exception e) {
51                         throw new RuntimeException("Failed to create consumer context.", e);
52                 }
53         }
54
55         private static class BGPMessageFactoryCloseable implements
56         BGPMessageFactory, AutoCloseable {
57                 private final BGPMessageFactoryImpl inner;
58
59                 public BGPMessageFactoryCloseable(
60                                 final BGPMessageFactoryImpl bgpMessageFactory) {
61                         this.inner = bgpMessageFactory;
62                 }
63
64                 @Override
65                 public void close() throws Exception {
66                         // NOOP
67                 }
68
69                 @Override
70                 public Notification parse(final byte[] bytes) throws BGPParsingException, BGPDocumentedException {
71                         return inner.parse(bytes);
72                 }
73
74                 @Override
75                 public byte[] put(final Notification bgpMessage) {
76                         return inner.put(bgpMessage);
77                 }
78         }
79 }