2 * Copyright (c) 2014 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.yangtools.yang.model.repo.api;
10 import com.google.common.annotations.Beta;
11 import com.google.common.util.concurrent.ListenableFuture;
12 import java.util.Collection;
14 import javax.annotation.Nonnull;
15 import org.opendaylight.yangtools.yang.common.QName;
16 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
19 * An asynchronous factory for building {@link SchemaContext} instances based on
20 * a specification of what {@link SourceIdentifier}s are required and dynamic
21 * recursive resolution.
24 public interface SchemaContextFactory {
26 * Create a new schema context containing specified sources, pulling in any
27 * dependencies they may have.
29 * @param requiredSources
30 * a collection of sources which are required to be present
31 * @return A checked future, which will produce a schema context, or fail
32 * with an explanation why the creation of the schema context
35 default ListenableFuture<SchemaContext> createSchemaContext(
36 @Nonnull final Collection<SourceIdentifier> requiredSources) {
37 return createSchemaContext(requiredSources, StatementParserMode.DEFAULT_MODE);
41 * Create a new schema context containing specified sources, pulling in any
42 * dependencies they may have.
44 * @param requiredSources
45 * a collection of sources which are required to be present
46 * @param statementParserMode
47 * mode of statement parser
48 * @return A checked future, which will produce a schema context, or fail
49 * with an explanation why the creation of the schema context
52 default ListenableFuture<SchemaContext> createSchemaContext(
53 final Collection<SourceIdentifier> requiredSources, final StatementParserMode statementParserMode) {
54 return createSchemaContext(requiredSources, statementParserMode, null);
58 * Create a new schema context containing specified sources, pulling in any
59 * dependencies they may have.
61 * @param requiredSources
62 * a collection of sources which are required to be present
63 * @param supportedFeatures
64 * set of supported features based on which all if-feature statements in the
65 * parsed yang models are resolved
66 * @return A checked future, which will produce a schema context, or fail
67 * with an explanation why the creation of the schema context
70 default ListenableFuture<SchemaContext> createSchemaContext(
71 @Nonnull final Collection<SourceIdentifier> requiredSources, final Set<QName> supportedFeatures) {
72 return createSchemaContext(requiredSources, StatementParserMode.DEFAULT_MODE, supportedFeatures);
76 * Create a new schema context containing specified sources, pulling in any
77 * dependencies they may have.
79 * @param requiredSources
80 * a collection of sources which are required to be present
81 * @param statementParserMode
82 * mode of statement parser
83 * @param supportedFeatures
84 * set of supported features based on which all if-feature statements in the
85 * parsed yang models are resolved
86 * @return A checked future, which will produce a schema context, or fail
87 * with an explanation why the creation of the schema context
90 ListenableFuture<SchemaContext> createSchemaContext(Collection<SourceIdentifier> requiredSources,
91 StatementParserMode statementParserMode, Set<QName> supportedFeatures);