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.nb.rfc8040.rests.services.impl;
10 import static java.util.Objects.requireNonNull;
12 import javax.ws.rs.Path;
13 import org.opendaylight.mdsal.dom.api.DOMMountPointService;
14 import org.opendaylight.mdsal.dom.api.DOMYangTextSourceProvider;
15 import org.opendaylight.restconf.common.schema.SchemaExportContext;
16 import org.opendaylight.restconf.nb.rfc8040.handlers.SchemaContextHandler;
17 import org.opendaylight.restconf.nb.rfc8040.rests.services.api.RestconfSchemaService;
18 import org.opendaylight.restconf.nb.rfc8040.utils.parser.ParserIdentifier;
19 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
22 * Implementation of {@link RestconfSchemaService}.
25 public class RestconfSchemaServiceImpl implements RestconfSchemaService {
26 private final SchemaContextHandler schemaContextHandler;
27 private final DOMMountPointService mountPointService;
28 private final DOMYangTextSourceProvider sourceProvider;
31 * Set {@link SchemaContextHandler} for getting actual {@link SchemaContext}.
33 * @param schemaContextHandler handling schema context
34 * @param mountPointService dom mount point service
36 public RestconfSchemaServiceImpl(final SchemaContextHandler schemaContextHandler,
37 final DOMMountPointService mountPointService,
38 final DOMYangTextSourceProvider sourceProvider) {
39 this.schemaContextHandler = requireNonNull(schemaContextHandler);
40 this.mountPointService = requireNonNull(mountPointService);
41 this.sourceProvider = requireNonNull(sourceProvider);
45 public SchemaExportContext getSchema(final String identifier) {
46 return ParserIdentifier.toSchemaExportContextFromIdentifier(schemaContextHandler.get(), identifier,
47 mountPointService, sourceProvider);