BUG 6396 groupbasedpolicy project migration to blueprint
[groupbasedpolicy.git] / groupbasedpolicy / src / main / java / org / opendaylight / controller / config / yang / config / groupbasedpolicy / EpRendererAugmentationRegistryImplModule.java
1 /*
2  * Copyright (c) 2015 Cisco Systems, Inc.  All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.controller.config.yang.config.groupbasedpolicy;
10
11 import org.opendaylight.controller.config.api.osgi.WaitingServiceTracker;
12 import org.opendaylight.groupbasedpolicy.api.EpRendererAugmentation;
13 import org.opendaylight.groupbasedpolicy.api.EpRendererAugmentationRegistry;
14 import org.osgi.framework.BundleContext;
15 import org.slf4j.Logger;
16 import org.slf4j.LoggerFactory;
17
18 public class EpRendererAugmentationRegistryImplModule extends org.opendaylight.controller.config.yang.config.groupbasedpolicy.AbstractEpRendererAugmentationRegistryImplModule {
19
20     private static final Logger LOG = LoggerFactory.getLogger(EpRendererAugmentationRegistryImplModule.class);
21     private BundleContext bundleContext;
22
23     public EpRendererAugmentationRegistryImplModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
24         super(identifier, dependencyResolver);
25     }
26
27     public EpRendererAugmentationRegistryImplModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.controller.config.yang.config.groupbasedpolicy.EpRendererAugmentationRegistryImplModule oldModule, java.lang.AutoCloseable oldInstance) {
28         super(identifier, dependencyResolver, oldModule, oldInstance);
29     }
30
31     @Override
32     public void customValidation() {
33         // add custom validation form module attributes here.
34     }
35
36     @Override
37     public java.lang.AutoCloseable createInstance() {
38         final WaitingServiceTracker<EpRendererAugmentationRegistry> tracker = WaitingServiceTracker.create(
39                 EpRendererAugmentationRegistry.class, bundleContext);
40         final EpRendererAugmentationRegistry service = tracker.waitForService(WaitingServiceTracker.FIVE_MINUTES);
41
42         final class Instance implements EpRendererAugmentationRegistry, AutoCloseable {
43             @Override
44             public void close() {
45                 tracker.close();
46             }
47
48             @Override
49             public void register(EpRendererAugmentation epRendererAugmentation) {
50                 service.register(epRendererAugmentation);
51             }
52
53             @Override
54             public void unregister(EpRendererAugmentation epRendererAugmentation) {
55                 service.unregister(epRendererAugmentation);
56             }
57         }
58
59         return new Instance();
60     }
61
62     void setBundleContext(BundleContext bundleContext) {
63         this.bundleContext = bundleContext;
64     }
65 }