/* * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ package org.opendaylight.restconf.rest.impl.services; import org.opendaylight.netconf.md.sal.rest.schema.SchemaExportContext; import org.opendaylight.restconf.rest.api.schema.context.SchemaContextHandler; import org.opendaylight.restconf.rest.api.services.schema.RestconfSchemaService; import org.opendaylight.restconf.utils.parser.ParserIdentifier; import org.opendaylight.yangtools.yang.model.api.SchemaContext; /** * Implementation of {@link RestconfSchemaService}. * */ public class RestconfSchemaServiceImpl implements RestconfSchemaService { private final SchemaContextHandler schemaContextHandler; /** * Set {@link SchemaContextHandler} for getting actual {@link SchemaContext} * . * * @param schemaContextHandler * - handling schema context */ public RestconfSchemaServiceImpl(final SchemaContextHandler schemaContextHandler) { this.schemaContextHandler = schemaContextHandler; } @Override public SchemaExportContext getSchema(final String identifier) { final SchemaContextRef schemaContextRef = new SchemaContextRef(this.schemaContextHandler.getSchemaContext()); return ParserIdentifier.toSchemaExportContextFromIdentifier(schemaContextRef.get(), identifier); } }