Add copyright headers to sal-rest-connector
[netconf.git] / opendaylight / netconf / netconf-topology / src / main / java / org / opendaylight / controller / config / yang / netconf / topology / shared / schema / repository / SchemaRepositoryImplModule.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.netconf.topology.shared.schema.repository;
10
11 import org.opendaylight.netconf.topology.SchemaRepositoryProvider;
12 import org.opendaylight.yangtools.yang.parser.repo.SharedSchemaRepository;
13
14 public class SchemaRepositoryImplModule extends org.opendaylight.controller.config.yang.netconf.topology.shared.schema.repository.AbstractSchemaRepositoryImplModule {
15     public SchemaRepositoryImplModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
16         super(identifier, dependencyResolver);
17     }
18
19     public SchemaRepositoryImplModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.controller.config.yang.netconf.topology.shared.schema.repository.SchemaRepositoryImplModule oldModule, java.lang.AutoCloseable oldInstance) {
20         super(identifier, dependencyResolver, oldModule, oldInstance);
21     }
22
23     @Override
24     public void customValidation() {
25         // add custom validation form module attributes here.
26     }
27
28     @Override
29     public java.lang.AutoCloseable createInstance() {
30         return new SchemaRepositoryProviderAutoCloseAble(this);
31     }
32
33     private static class SchemaRepositoryProviderAutoCloseAble implements SchemaRepositoryProvider, AutoCloseable {
34
35         private final SharedSchemaRepository schemaRepository;
36
37         public SchemaRepositoryProviderAutoCloseAble(SchemaRepositoryImplModule module) {
38             schemaRepository = new SharedSchemaRepository(module.getIdentifier().getInstanceName());
39         }
40
41         @Override
42         public void close() throws Exception {
43             //NOOP
44         }
45
46         @Override
47         public SharedSchemaRepository getSharedSchemaRepository() {
48             return schemaRepository;
49         }
50     }
51 }