Merge "Identify topology reference as such"
[bgpcep.git] / pcep / impl-config / src / main / java / org / opendaylight / controller / config / yang / pcep / impl / PCEPSessionProposalFactoryImplModule.java
1 /**
2  * Generated file
3
4  * Generated from: yang module name: pcep-impl  yang module local name: pcep-session-proposal-factory-impl
5  * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
6  * Generated at: Wed Nov 06 13:16:39 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.pcep.impl;
11
12 import java.net.InetSocketAddress;
13
14 import org.opendaylight.controller.config.api.JmxAttributeValidationException;
15 import org.opendaylight.protocol.pcep.PCEPSessionProposalFactory;
16 import org.opendaylight.protocol.pcep.impl.PCEPSessionProposalFactoryImpl;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.Open;
18 import org.slf4j.Logger;
19 import org.slf4j.LoggerFactory;
20
21 /**
22  *
23  */
24 public final class PCEPSessionProposalFactoryImplModule extends
25                 org.opendaylight.controller.config.yang.pcep.impl.AbstractPCEPSessionProposalFactoryImplModule {
26
27         private static final Logger LOG = LoggerFactory.getLogger(PCEPSessionProposalFactoryImplModule.class);
28
29         public PCEPSessionProposalFactoryImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier name,
30                         final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
31                 super(name, dependencyResolver);
32         }
33
34         public PCEPSessionProposalFactoryImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier name,
35                         final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
36                         final PCEPSessionProposalFactoryImplModule oldModule, final java.lang.AutoCloseable oldInstance) {
37                 super(name, dependencyResolver, oldModule, oldInstance);
38         }
39
40         @Override
41         public void validate() {
42                 super.validate();
43                 JmxAttributeValidationException.checkNotNull(getActive(), "value is not set.", this.activeJmxAttribute);
44                 JmxAttributeValidationException.checkNotNull(getVersioned(), "value is not set.", this.versionedJmxAttribute);
45                 JmxAttributeValidationException.checkNotNull(getInitiated(), "value is not set.", this.initiatedJmxAttribute);
46                 JmxAttributeValidationException.checkNotNull(getDeadTimerValue(), "value is not set.", this.deadTimerValueJmxAttribute);
47                 JmxAttributeValidationException.checkNotNull(getKeepAliveTimerValue(), "value is not set.", this.keepAliveTimerValueJmxAttribute);
48                 if (getKeepAliveTimerValue() != 0) {
49                         JmxAttributeValidationException.checkCondition(getKeepAliveTimerValue() >= 1, "minimum value is 1.",
50                                         this.keepAliveTimerValueJmxAttribute);
51                         if (getDeadTimerValue() != 0 && (getDeadTimerValue() / getKeepAliveTimerValue() != 4)) {
52                                 LOG.warn("DeadTimerValue should be 4 times greater than KeepAliveTimerValue");
53                         }
54                 }
55                 if ((getActive() || getVersioned()) && !getStateful()) {
56                         setStateful(true);
57                 }
58                 JmxAttributeValidationException.checkNotNull(getStateful(), "value is not set.", this.statefulJmxAttribute);
59         }
60
61         @Override
62         public java.lang.AutoCloseable createInstance() {
63                 final PCEPSessionProposalFactoryImpl inner = new PCEPSessionProposalFactoryImpl(getDeadTimerValue(), getKeepAliveTimerValue(), getStateful(), getActive(), getVersioned(), getInitiated());
64                 return new PCEPSessionProposalFactoryCloseable(inner);
65         }
66
67         private static final class PCEPSessionProposalFactoryCloseable implements PCEPSessionProposalFactory, AutoCloseable {
68
69                 private final PCEPSessionProposalFactoryImpl inner;
70
71                 public PCEPSessionProposalFactoryCloseable(final PCEPSessionProposalFactoryImpl inner) {
72                         this.inner = inner;
73                 }
74
75                 @Override
76                 public void close() throws Exception {
77                 }
78
79                 @Override
80                 public Open getSessionProposal(final InetSocketAddress inetSocketAddress, final int i) {
81                         return this.inner.getSessionProposal(inetSocketAddress, i);
82                 }
83         }
84 }