/*
 * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
 * and is available at http://www.eclipse.org/legal/epl-v10.html
 */
/**
 * Generated file

 * Generated from: yang module name: pcep-impl  yang module local name: pcep-session-proposal-factory-impl
 * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
 * Generated at: Wed Nov 06 13:16:39 CET 2013
 *
 * Do not modify this file unless it is present under src/main directory
 */
package org.opendaylight.controller.config.yang.pcep.impl;

import java.net.InetSocketAddress;

import org.opendaylight.controller.config.api.JmxAttributeValidationException;
import org.opendaylight.protocol.pcep.PCEPSessionProposalFactory;
import org.opendaylight.protocol.pcep.ietf.initiated00.Stateful07SessionProposalFactory;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.Open;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 *
 */
public final class PCEPSessionProposalFactoryImplModule extends
		org.opendaylight.controller.config.yang.pcep.impl.AbstractPCEPSessionProposalFactoryImplModule {

	private static final Logger LOG = LoggerFactory.getLogger(PCEPSessionProposalFactoryImplModule.class);

	public PCEPSessionProposalFactoryImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier name,
			final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
		super(name, dependencyResolver);
	}

	public PCEPSessionProposalFactoryImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier name,
			final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
			final PCEPSessionProposalFactoryImplModule oldModule, final java.lang.AutoCloseable oldInstance) {
		super(name, dependencyResolver, oldModule, oldInstance);
	}

	@Override
	public void validate() {
		super.validate();
		JmxAttributeValidationException.checkNotNull(getActive(), "value is not set.", this.activeJmxAttribute);
		JmxAttributeValidationException.checkNotNull(getInitiated(), "value is not set.", this.initiatedJmxAttribute);
		JmxAttributeValidationException.checkNotNull(getDeadTimerValue(), "value is not set.", this.deadTimerValueJmxAttribute);
		JmxAttributeValidationException.checkNotNull(getKeepAliveTimerValue(), "value is not set.", this.keepAliveTimerValueJmxAttribute);
		if (getKeepAliveTimerValue() != 0) {
			JmxAttributeValidationException.checkCondition(getKeepAliveTimerValue() >= 1, "minimum value is 1.",
					this.keepAliveTimerValueJmxAttribute);
			if (getDeadTimerValue() != 0 && (getDeadTimerValue() / getKeepAliveTimerValue() != 4)) {
				LOG.warn("DeadTimerValue should be 4 times greater than KeepAliveTimerValue");
			}
		}
		if (getActive() && !getStateful()) {
			setStateful(true);
		}
		JmxAttributeValidationException.checkNotNull(getStateful(), "value is not set.", this.statefulJmxAttribute);
	}

	@Override
	public java.lang.AutoCloseable createInstance() {
		final Stateful07SessionProposalFactory inner = new Stateful07SessionProposalFactory(getDeadTimerValue(), getKeepAliveTimerValue(), getStateful(), getActive(), getInitiated());
		return new PCEPSessionProposalFactoryCloseable(inner);
	}

	private static final class PCEPSessionProposalFactoryCloseable implements PCEPSessionProposalFactory, AutoCloseable {

		private final Stateful07SessionProposalFactory inner;

		public PCEPSessionProposalFactoryCloseable(final Stateful07SessionProposalFactory inner) {
			this.inner = inner;
		}

		@Override
		public void close() throws Exception {
		}

		@Override
		public Open getSessionProposal(final InetSocketAddress inetSocketAddress, final int i) {
			return this.inner.getSessionProposal(inetSocketAddress, i);
		}
	}
}

@@ -934,19 +934,18 @@
 etf.
-initiated00
+stateful02
 .Sta
@@ -942,33 +942,33 @@
 eful02.Stateful0
-7
+2
 SessionProposalF
@@ -3185,33 +3185,33 @@
 %09final Stateful0
-7
+2
 SessionProposalF
@@ -3230,33 +3230,33 @@
  = new Stateful0
-7
+2
 SessionProposalF
@@ -3552,33 +3552,33 @@
  final Stateful0
-7
+2
 SessionProposalF
@@ -3656,9 +3656,9 @@
 ful0
-7
+2
 Sess

Set proposal to default stateful02 session proposal.