/* * 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.base.services.impl; import org.opendaylight.netconf.md.sal.rest.schema.SchemaExportContext; import org.opendaylight.restconf.base.services.api.RestconfSchemaService; import org.opendaylight.restconf.common.references.SchemaContextRef; import org.opendaylight.restconf.handlers.DOMMountPointServiceHandler; import org.opendaylight.restconf.handlers.SchemaContextHandler; 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; private final DOMMountPointServiceHandler domMountPointServiceHandler; /** * Set {@link SchemaContextHandler} for getting actual {@link SchemaContext} * . * * @param schemaContextHandler * handling schema context * @param domMountPointServiceHandler * handling dom mount point service */ public RestconfSchemaServiceImpl(final SchemaContextHandler schemaContextHandler, final DOMMountPointServiceHandler domMountPointServiceHandler) { this.schemaContextHandler = schemaContextHandler; this.domMountPointServiceHandler = domMountPointServiceHandler; } @Override public SchemaExportContext getSchema(final String identifier) { final SchemaContextRef schemaContextRef = new SchemaContextRef(this.schemaContextHandler.get()); return ParserIdentifier.toSchemaExportContextFromIdentifier(schemaContextRef.get(), identifier, this.domMountPointServiceHandler.get()); } }