Merge "BugFix : Changes to get ping between two hosts to work"
[controller.git] / opendaylight / config / shutdown-impl / src / main / java / org / opendaylight / controller / config / yang / shutdown / impl / ShutdownModule.java
1 /**
2  * Generated file
3
4  * Generated from: yang module name: shutdown-impl  yang module local name: shutdown
5  * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
6  * Generated at: Wed Dec 18 14:02:06 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.shutdown.impl;
11
12 import org.opendaylight.controller.config.api.DependencyResolver;
13 import org.opendaylight.controller.config.api.JmxAttributeValidationException;
14 import org.opendaylight.controller.config.api.ModuleIdentifier;
15 import org.osgi.framework.Bundle;
16
17 public final class ShutdownModule extends AbstractShutdownModule {
18     private final Bundle systemBundle;
19     private final ShutdownModule nullableOldModule;
20
21     public ShutdownModule(ModuleIdentifier identifier, Bundle systemBundle) {
22         super(identifier, null);
23         singletonCheck(identifier);
24         this.systemBundle = systemBundle;
25         this.nullableOldModule = null;
26     }
27
28     public ShutdownModule(ModuleIdentifier identifier, ShutdownModule oldModule, java.lang.AutoCloseable oldInstance,
29                           Bundle systemBundle) {
30         super(identifier, null, oldModule, oldInstance);
31         singletonCheck(identifier);
32         this.systemBundle = systemBundle;
33         this.nullableOldModule = oldModule;
34     }
35
36     private static void singletonCheck(ModuleIdentifier identifier) {
37         if (AbstractShutdownModuleFactory.NAME.equals(identifier.getInstanceName()) == false) {
38             throw new IllegalArgumentException("Singleton enforcement failed. Expected instance name " + AbstractShutdownModuleFactory.NAME);
39         }
40     }
41
42     @Deprecated // needed for generated code
43     public ShutdownModule(ModuleIdentifier identifier, DependencyResolver dependencyResolver, ShutdownModule oldModule,
44                           AutoCloseable oldInstance) {
45         super(identifier, dependencyResolver, oldModule, oldInstance);
46         throw new UnsupportedOperationException();
47     }
48
49     @Deprecated // needed for generated code
50     public ShutdownModule(ModuleIdentifier identifier, DependencyResolver dependencyResolver) {
51         super(identifier, dependencyResolver);
52         throw new UnsupportedOperationException();
53     }
54
55     @Override
56     public String getSecret() {
57         throw new UnsupportedOperationException();
58     }
59
60     @Override
61     public String getOldSecret() {
62         throw new UnsupportedOperationException();
63     }
64
65     String getActualSecret() {
66         return super.getSecret();
67     }
68
69     String getActualOldSecret() {
70         return super.getOldSecret();
71     }
72
73     @Override
74     protected void customValidation() {
75         JmxAttributeValidationException.checkNotNull(super.getOldSecret(), oldSecretJmxAttribute);
76         JmxAttributeValidationException.checkNotNull(super.getSecret(), secretJmxAttribute);
77         if (nullableOldModule != null) {
78             // if nothing changed, remain valid
79             boolean sameAsOldModule = isSame(nullableOldModule);
80             if (sameAsOldModule == false) {
81                 boolean valid = getActualOldSecret().equals(nullableOldModule.getActualSecret());
82                 JmxAttributeValidationException.checkCondition(valid, "Invalid old secret", oldSecretJmxAttribute);
83             }
84         }
85     }
86
87     @Override
88     public java.lang.AutoCloseable createInstance() {
89         return new ShutdownServiceImpl(getActualSecret(), systemBundle, getRootRuntimeBeanRegistratorWrapper());
90     }
91 }