4 * Generated from: yang module name: toaster-consumer-impl yang module local name: toaster-consumer-impl
5 * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
6 * Generated at: Wed Feb 05 11:31:30 CET 2014
8 * Do not modify this file unless it is present under src/main directory
10 package org.opendaylight.controller.config.yang.config.toaster_consumer.impl;
12 import org.opendaylight.controller.sal.binding.api.NotificationListener;
13 import org.opendaylight.controller.sample.toaster.provider.api.ToastConsumer;
14 import org.opendaylight.controller.sample.toaster.provider.impl.ToastConsumerImpl;
15 import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.ToastDone;
16 import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.ToastType;
17 import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.ToasterService;
18 import org.opendaylight.yangtools.concepts.Registration;
23 public final class ToasterConsumerModule extends org.opendaylight.controller.config.yang.config.toaster_consumer.impl.AbstractToasterConsumerModule
26 public ToasterConsumerModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
27 super(identifier, dependencyResolver);
30 public ToasterConsumerModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
31 ToasterConsumerModule oldModule, java.lang.AutoCloseable oldInstance) {
33 super(identifier, dependencyResolver, oldModule, oldInstance);
37 protected void customValidation(){
38 // No need to validate dependencies, since all dependencies have mandatory true flag in yang
39 // config-subsystem will perform the validation
43 public java.lang.AutoCloseable createInstance() {
44 ToasterService toasterService = getRpcRegistryDependency().getRpcService(ToasterService.class);
46 final ToastConsumerImpl consumer = new ToastConsumerImpl(toasterService);
47 final Registration<NotificationListener<ToastDone>> notificationRegistration = getNotificationServiceDependency()
48 .registerNotificationListener(ToastDone.class, consumer);
50 final ToasterConsumerRuntimeRegistration runtimeRegistration = getRootRuntimeBeanRegistratorWrapper().register(consumer);
52 final class AutoCloseableToastConsumer implements AutoCloseable, ToastConsumer {
55 public void close() throws Exception {
56 runtimeRegistration.close();
57 notificationRegistration.close();
61 public boolean createToast(Class<? extends ToastType> type, int doneness) {
62 return consumer.createToast(type, doneness);
66 return new AutoCloseableToastConsumer();