2 * Copyright 2015, CableLabs
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.controller.config.yang.config.pcmm_service.impl;
10 import org.opendaylight.controller.org.pcmm.api.PcmmService;
11 import org.opendaylight.controller.org.pcmm.impl.PcmmServiceImpl;
12 //import org.opendaylight.yang.gen.v1.urn.opendaylight.packetcable.service.rev140120.PacketcableServiceService;
13 import org.opendaylight.yangtools.concepts.Registration;
15 public class PcmmServiceModule
17 org.opendaylight.controller.config.yang.config.pcmm_service.impl.AbstractPcmmServiceModule {
18 public PcmmServiceModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
19 super(identifier, dependencyResolver);
22 public PcmmServiceModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.controller.config.yang.config.pcmm_service.impl.PcmmServiceModule oldModule, java.lang.AutoCloseable oldInstance) {
23 super(identifier, dependencyResolver, oldModule, oldInstance);
27 public void customValidation() {
28 // add custom validation form module attributes here.
32 public java.lang.AutoCloseable createInstance() {
33 // PacketcableServiceService packetcableServiceService =
34 // getRpcRegistryDependency().getRpcService(PacketcableServiceService.class);
35 final PcmmService pcmmService = new PcmmServiceImpl();
36 final Registration pcmmListenerReg = getNotificationServiceDependency().registerNotificationListener(pcmmService);
37 final PcmmServiceRuntimeRegistration runtimeReg = getRootRuntimeBeanRegistratorWrapper().register(pcmmService);
38 return new AutoCloseablePcmmService(pcmmListenerReg, runtimeReg);
41 class AutoCloseablePcmmService extends PcmmServiceImpl implements
44 private PcmmServiceRuntimeRegistration runtimeReg;
45 private Registration pcmmListenerReg;
47 public AutoCloseablePcmmService(Registration pcmmListenerReg, PcmmServiceRuntimeRegistration runtimeReg) {
49 this.runtimeReg = runtimeReg;
50 this.pcmmListenerReg = pcmmListenerReg;
54 public void close() throws Exception {
55 pcmmListenerReg.close();