2 * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.restconf.rest.impl.services;
10 import org.opendaylight.netconf.md.sal.rest.schema.SchemaExportContext;
11 import org.opendaylight.restconf.rest.api.schema.context.SchemaContextHandler;
12 import org.opendaylight.restconf.rest.api.services.schema.RestconfSchemaService;
13 import org.opendaylight.restconf.utils.parser.ParserIdentifier;
14 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
17 * Implementation of {@link RestconfSchemaService}.
20 public class RestconfSchemaServiceImpl implements RestconfSchemaService {
22 private final SchemaContextHandler schemaContextHandler;
25 * Set {@link SchemaContextHandler} for getting actual {@link SchemaContext}
28 * @param schemaContextHandler
29 * - handling schema context
31 public RestconfSchemaServiceImpl(final SchemaContextHandler schemaContextHandler) {
32 this.schemaContextHandler = schemaContextHandler;
36 public SchemaExportContext getSchema(final String identifier) {
37 final SchemaContextRef schemaContextRef = new SchemaContextRef(this.schemaContextHandler.getSchemaContext());
38 return ParserIdentifier.toSchemaExportContextFromIdentifier(schemaContextRef.get(), identifier);