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.kitchen_service.impl;
12 import org.opendaylight.controller.config.yang.config.kitchen_service.impl.AbstractKitchenServiceModule;
13 import org.opendaylight.controller.sample.kitchen.api.EggsType;
14 import org.opendaylight.controller.sample.kitchen.api.KitchenService;
15 import org.opendaylight.controller.sample.kitchen.impl.KitchenServiceImpl;
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;
19 import org.opendaylight.yangtools.yang.binding.NotificationListener;
20 import org.slf4j.Logger;
21 import org.slf4j.LoggerFactory;
26 public final class KitchenServiceModule extends AbstractKitchenServiceModule {
27 private static final Logger log = LoggerFactory.getLogger(KitchenServiceModule.class);
29 public KitchenServiceModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
30 super(identifier, dependencyResolver);
33 public KitchenServiceModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
34 KitchenServiceModule oldModule, java.lang.AutoCloseable oldInstance) {
36 super(identifier, dependencyResolver, oldModule, oldInstance);
40 protected void customValidation(){
41 // No need to validate dependencies, since all dependencies have mandatory true flag in yang
42 // config-subsystem will perform the validation
46 public java.lang.AutoCloseable createInstance() {
47 ToasterService toasterService = getRpcRegistryDependency().getRpcService(ToasterService.class);
49 final KitchenServiceImpl kitchenService = new KitchenServiceImpl(toasterService);
51 final Registration<NotificationListener> toasterListenerReg =
52 getNotificationServiceDependency().registerNotificationListener( kitchenService );
54 final KitchenServiceRuntimeRegistration runtimeReg =
55 getRootRuntimeBeanRegistratorWrapper().register( kitchenService );
57 final class AutoCloseableKitchenService implements KitchenService, AutoCloseable {
60 public void close() throws Exception {
61 toasterListenerReg.close();
63 log.info("Toaster consumer (instance {}) torn down.", this);
67 public boolean makeBreakfast( EggsType eggs, Class<? extends ToastType> toast, int toastDoneness ) {
68 return kitchenService.makeBreakfast( eggs, toast, toastDoneness );
72 AutoCloseable ret = new AutoCloseableKitchenService();
73 log.info("KitchenService (instance {}) initialized.", ret );