Add copyright headers to sal-rest-connector
[netconf.git] / opendaylight / restconf / sal-rest-connector / src / main / java / org / opendaylight / controller / config / yang / md / sal / rest / connector / RestConnectorModule.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.md.sal.rest.connector;
10
11 import org.opendaylight.netconf.sal.restconf.impl.RestconfProviderImpl;
12
13
14 public class RestConnectorModule extends org.opendaylight.controller.config.yang.md.sal.rest.connector.AbstractRestConnectorModule {
15
16     private static RestConnectorRuntimeRegistration runtimeRegistration;
17
18     public RestConnectorModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
19         super(identifier, dependencyResolver);
20     }
21
22     public RestConnectorModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.controller.config.yang.md.sal.rest.connector.RestConnectorModule oldModule, java.lang.AutoCloseable oldInstance) {
23         super(identifier, dependencyResolver, oldModule, oldInstance);
24     }
25
26     @Override
27     public void customValidation() {
28         // add custom validation form module attributes here.
29     }
30
31     @Override
32     public java.lang.AutoCloseable createInstance() {
33         // Create an instance of our provider
34         RestconfProviderImpl instance = new RestconfProviderImpl();
35         // Set its port
36         instance.setWebsocketPort(getWebsocketPort());
37         // Register it with the Broker
38         getDomBrokerDependency().registerProvider(instance);
39
40         if(runtimeRegistration != null){
41             runtimeRegistration.close();
42         }
43
44         runtimeRegistration =
45             getRootRuntimeBeanRegistratorWrapper().register(instance);
46
47         return instance;
48     }
49 }
50