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.base.services.impl;
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;
19 * Implementation of {@link RestconfSchemaService}.
22 public class RestconfSchemaServiceImpl implements RestconfSchemaService {
24 private final SchemaContextHandler schemaContextHandler;
25 private final DOMMountPointServiceHandler domMountPointServiceHandler;
28 * Set {@link SchemaContextHandler} for getting actual {@link SchemaContext}
31 * @param schemaContextHandler
32 * handling schema context
33 * @param domMountPointServiceHandler
34 * handling dom mount point service
36 public RestconfSchemaServiceImpl(final SchemaContextHandler schemaContextHandler,
37 final DOMMountPointServiceHandler domMountPointServiceHandler) {
38 this.schemaContextHandler = schemaContextHandler;
39 this.domMountPointServiceHandler = domMountPointServiceHandler;
43 public SchemaExportContext getSchema(final String identifier) {
44 final SchemaContextRef schemaContextRef = new SchemaContextRef(this.schemaContextHandler.get());
45 return ParserIdentifier.toSchemaExportContextFromIdentifier(schemaContextRef.get(), identifier,
46 this.domMountPointServiceHandler.get());