Bug 2231 - Secure transport for PCEP
[bgpcep.git] / pcep / impl / src / main / java / org / opendaylight / controller / config / yang / pcep / impl / PCEPDispatcherImplModule.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: pcep-impl  yang module local name: pcep-dispatcher-impl
12  * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
13  * Generated at: Wed Nov 06 13:16:39 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.pcep.impl;
18
19 import org.opendaylight.controller.config.api.JmxAttributeValidationException;
20 import org.opendaylight.protocol.pcep.impl.DefaultPCEPSessionNegotiatorFactory;
21 import org.opendaylight.protocol.pcep.impl.PCEPDispatcherImpl;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.Open;
23
24 /**
25  *
26  */
27 public final class PCEPDispatcherImplModule extends org.opendaylight.controller.config.yang.pcep.impl.AbstractPCEPDispatcherImplModule {
28
29     private static final String VALUE_IS_NOT_SET = "value is not set.";
30     private static final String KEYSTORE = "keystore";
31     private static final String TRUSTSTORE = "truststore";
32     private static final String PASSWORD = " password ";
33     private static final String LOCATION = " location ";
34     private static final String TYPE = " type ";
35     private static final String PATH_TYPE = " path" + TYPE;
36
37     public PCEPDispatcherImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier name,
38             final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
39         super(name, dependencyResolver);
40     }
41
42     public PCEPDispatcherImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier name,
43             final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, final PCEPDispatcherImplModule oldModule,
44             final java.lang.AutoCloseable oldInstance) {
45         super(name, dependencyResolver, oldModule, oldInstance);
46     }
47
48     @Override
49     public void validate() {
50         super.validate();
51         JmxAttributeValidationException.checkNotNull(getMaxUnknownMessages(), VALUE_IS_NOT_SET, maxUnknownMessagesJmxAttribute);
52         JmxAttributeValidationException.checkCondition(getMaxUnknownMessages() > 0, "Parameter 'maxUnknownMessages' "
53                 + "must be greater than 0", maxUnknownMessagesJmxAttribute);
54         if (getTls() != null) {
55             JmxAttributeValidationException.checkNotNull(getTls().getCertificatePassword(), "certificate" + PASSWORD + VALUE_IS_NOT_SET, tlsJmxAttribute);
56             JmxAttributeValidationException.checkNotNull(getTls().getKeystore(), KEYSTORE + LOCATION + VALUE_IS_NOT_SET, tlsJmxAttribute);
57             JmxAttributeValidationException.checkNotNull(getTls().getKeystorePassword(), KEYSTORE + PASSWORD + VALUE_IS_NOT_SET, tlsJmxAttribute);
58             JmxAttributeValidationException.checkNotNull(getTls().getKeystorePathType(), KEYSTORE + PATH_TYPE + VALUE_IS_NOT_SET, tlsJmxAttribute);
59             JmxAttributeValidationException.checkNotNull(getTls().getKeystoreType(), KEYSTORE + TYPE + VALUE_IS_NOT_SET, tlsJmxAttribute);
60             JmxAttributeValidationException.checkNotNull(getTls().getTruststore(), TRUSTSTORE + LOCATION + VALUE_IS_NOT_SET, tlsJmxAttribute);
61             JmxAttributeValidationException.checkNotNull(getTls().getTruststorePassword(), TRUSTSTORE + PASSWORD + VALUE_IS_NOT_SET, tlsJmxAttribute);
62             JmxAttributeValidationException.checkNotNull(getTls().getTruststorePathType(), TRUSTSTORE + PATH_TYPE + VALUE_IS_NOT_SET, tlsJmxAttribute);
63             JmxAttributeValidationException.checkNotNull(getTls().getTruststoreType(), TRUSTSTORE + TYPE + VALUE_IS_NOT_SET, tlsJmxAttribute);
64         }
65     }
66
67     @Override
68     public java.lang.AutoCloseable createInstance() {
69         Open localPrefs = getPcepSessionProposalFactoryDependency().getSessionProposal(null, 0);
70         DefaultPCEPSessionNegotiatorFactory negFactory = new DefaultPCEPSessionNegotiatorFactory(localPrefs, getMaxUnknownMessages(), getTls());
71
72         return new PCEPDispatcherImpl(getPcepExtensionsDependency().getMessageHandlerRegistry(), negFactory, getBossGroupDependency(), getWorkerGroupDependency(), getMd5ChannelFactoryDependency(), getMd5ServerChannelFactoryDependency());
73     }
74 }