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
8 * Do not modify this file unless it is present under src/main directory
10 package org.opendaylight.controller.config.yang.shutdown.impl;
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;
17 public final class ShutdownModule extends AbstractShutdownModule {
18 private final Bundle systemBundle;
19 private final ShutdownModule nullableOldModule;
21 public ShutdownModule(ModuleIdentifier identifier, Bundle systemBundle) {
22 super(identifier, null);
23 singletonCheck(identifier);
24 this.systemBundle = systemBundle;
25 this.nullableOldModule = null;
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;
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);
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();
49 @Deprecated // needed for generated code
50 public ShutdownModule(ModuleIdentifier identifier, DependencyResolver dependencyResolver) {
51 super(identifier, dependencyResolver);
52 throw new UnsupportedOperationException();
56 public String getSecret() {
57 throw new UnsupportedOperationException();
61 public String getOldSecret() {
62 throw new UnsupportedOperationException();
65 String getActualSecret() {
66 return super.getSecret();
69 String getActualOldSecret() {
70 return super.getOldSecret();
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);
88 public java.lang.AutoCloseable createInstance() {
89 return new ShutdownServiceImpl(getActualSecret(), systemBundle, getRootRuntimeBeanRegistratorWrapper());