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.sample.kitchen.api.EggsType;
13 import org.opendaylight.controller.sample.kitchen.api.KitchenService;
14 import org.opendaylight.controller.sample.kitchen.impl.KitchenServiceImpl;
15 import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.ToastType;
16 import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.ToasterService;
17 import org.opendaylight.yangtools.concepts.Registration;
18 import org.opendaylight.yangtools.yang.binding.NotificationListener;
19 import org.slf4j.Logger;
20 import org.slf4j.LoggerFactory;
25 public final class KitchenServiceModule extends AbstractKitchenServiceModule {
26 private static final Logger log = LoggerFactory.getLogger(KitchenServiceModule.class);
28 public KitchenServiceModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
29 super(identifier, dependencyResolver);
32 public KitchenServiceModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
33 final KitchenServiceModule oldModule, final java.lang.AutoCloseable oldInstance) {
35 super(identifier, dependencyResolver, oldModule, oldInstance);
39 protected void customValidation(){
40 // No need to validate dependencies, since all dependencies have mandatory true flag in yang
41 // config-subsystem will perform the validation
45 public java.lang.AutoCloseable createInstance() {
46 ToasterService toasterService = getRpcRegistryDependency().getRpcService(ToasterService.class);
48 final KitchenServiceImpl kitchenService = new KitchenServiceImpl(toasterService);
50 final Registration<NotificationListener> toasterListenerReg =
51 getNotificationServiceDependency().registerNotificationListener( kitchenService );
53 final KitchenServiceRuntimeRegistration runtimeReg =
54 getRootRuntimeBeanRegistratorWrapper().register( kitchenService );
56 final class AutoCloseableKitchenService implements KitchenService, AutoCloseable {
59 public void close() throws Exception {
60 toasterListenerReg.close();
62 log.info("Toaster consumer (instance {}) torn down.", this);
66 public boolean makeBreakfast( final EggsType eggs, final Class<? extends ToastType> toast, final int toastDoneness ) {
67 return kitchenService.makeBreakfast( eggs, toast, toastDoneness );
71 AutoCloseable ret = new AutoCloseableKitchenService();
72 log.info("KitchenService (instance {}) initialized.", ret );