a9c45960c41012e85601614982e31b5288a154fb
[groupbasedpolicy.git] / ui-backend / src / main / java / org / opendaylight / controller / config / yang / config / ui_backend / impl / UiBackendModule.java
1 /*
2  * Copyright (c) 2015 Cisco Systems, Inc. and others. 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.ui_backend.impl;
10
11 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
12 import org.opendaylight.groupbasedpolicy.ui.backend.UiBackendServiceImpl;
13 import org.slf4j.Logger;
14 import org.slf4j.LoggerFactory;
15
16 import com.google.common.base.Preconditions;
17
18 public class UiBackendModule extends org.opendaylight.controller.config.yang.config.ui_backend.impl.AbstractUiBackendModule {
19
20     private static final Logger LOG = LoggerFactory.getLogger(UiBackendModule.class);
21
22     public UiBackendModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
23         super(identifier, dependencyResolver);
24     }
25
26     public UiBackendModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.controller.config.yang.config.ui_backend.impl.UiBackendModule oldModule, java.lang.AutoCloseable oldInstance) {
27         super(identifier, dependencyResolver, oldModule, oldInstance);
28     }
29
30     @Override
31     public void customValidation() {
32         // add custom validation form module attributes here.
33     }
34
35     @Override
36     public java.lang.AutoCloseable createInstance() {
37         DataBroker dataProvider = Preconditions.checkNotNull(getDataBrokerDependency());
38         final UiBackendServiceImpl pgnApplicationService = new UiBackendServiceImpl(dataProvider,
39                 getRpcRegistryDependency());
40         LOG.info("ui-backend started.");
41
42         return new AutoCloseable() {
43
44             @Override
45             public void close() throws Exception {
46                 pgnApplicationService.close();
47             }
48         };
49     }
50
51 }