YANGTOOLS-812: Add SchemaContextFactory control of deviations
[yangtools.git] / yang / yang-model-api / src / main / java / org / opendaylight / yangtools / yang / model / repo / api / SchemaRepository.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.yangtools.yang.model.repo.api;
9
10 import com.google.common.annotations.Beta;
11 import com.google.common.util.concurrent.ListenableFuture;
12 import javax.annotation.Nonnull;
13 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
14
15 /**
16  * Interface exposed by repository implementations. A schema repository is a logically
17  * centralized place for model storage and creation of {@link SchemaContext} instances.
18  */
19 @Beta
20 public interface SchemaRepository {
21     /**
22      * Instantiate a new {@link SchemaContextFactory}, which will filter
23      * available schema sources using the provided filter.
24      *
25      * @param filter
26      *            Filter which acts as the gating function before a schema
27      *            source is considered by the factory for inclusion in the
28      *            {@link SchemaContext} it produces.
29      * @return A new schema context factory.
30      * @deprecated Use
31      *             {@link #createSchemaContextFactory(SchemaContextFactoryConfiguration)}
32      *             instead.
33      */
34     @Deprecated
35     SchemaContextFactory createSchemaContextFactory(@Nonnull SchemaSourceFilter filter);
36
37     /**
38      * Returns {@link SchemaContextFactory} with supplied configuration.
39      *
40      * @param config
41      *            configuration of schema context factory.
42      * @return schema context factory.
43      */
44     SchemaContextFactory createSchemaContextFactory(@Nonnull SchemaContextFactoryConfiguration config);
45
46     <T extends SchemaSourceRepresentation> ListenableFuture<T> getSchemaSource(@Nonnull SourceIdentifier id,
47             @Nonnull Class<T> represetation);
48 }