c9caeccadbb66e9c6e4c50907b12d602d6333a19
[netconf.git] / restconf / restconf-nb-bierman02 / src / main / java / org / opendaylight / restconf / base / services / impl / RestconfSchemaServiceImpl.java
1 /*
2  * Copyright (c) 2016 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 package org.opendaylight.restconf.base.services.impl;
9
10 import org.opendaylight.restconf.base.services.api.RestconfSchemaService;
11 import org.opendaylight.restconf.common.references.SchemaContextRef;
12 import org.opendaylight.restconf.common.schema.SchemaExportContext;
13 import org.opendaylight.restconf.handlers.DOMMountPointServiceHandler;
14 import org.opendaylight.restconf.handlers.SchemaContextHandler;
15 import org.opendaylight.restconf.utils.parser.ParserIdentifier;
16 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
17
18 /**
19  * Implementation of {@link RestconfSchemaService}.
20  *
21  * @deprecated move to splitted module restconf-nb-rfc8040
22  */
23 @Deprecated
24 public class RestconfSchemaServiceImpl implements RestconfSchemaService {
25
26     private final SchemaContextHandler schemaContextHandler;
27     private final DOMMountPointServiceHandler domMountPointServiceHandler;
28
29     /**
30      * Set {@link SchemaContextHandler} for getting actual {@link SchemaContext}
31      * .
32      *
33      * @param schemaContextHandler
34      *             handling schema context
35      * @param domMountPointServiceHandler
36      *             handling dom mount point service
37      */
38     public RestconfSchemaServiceImpl(final SchemaContextHandler schemaContextHandler,
39             final DOMMountPointServiceHandler domMountPointServiceHandler) {
40         this.schemaContextHandler = schemaContextHandler;
41         this.domMountPointServiceHandler = domMountPointServiceHandler;
42     }
43
44     @Override
45     public SchemaExportContext getSchema(final String identifier) {
46         final SchemaContextRef schemaContextRef = new SchemaContextRef(this.schemaContextHandler.get());
47         return ParserIdentifier.toSchemaExportContextFromIdentifier(schemaContextRef.get(), identifier,
48                 this.domMountPointServiceHandler.get());
49     }
50 }