Promote SchemaSourceRepresentation
[yangtools.git] / yang / yang-repo-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 org.eclipse.jdt.annotation.NonNull;
13 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
14 import org.opendaylight.yangtools.yang.model.api.source.SourceIdentifier;
15 import org.opendaylight.yangtools.yang.model.api.source.SourceRepresentation;
16
17 /**
18  * Interface exposed by repository implementations. A schema repository is a logically centralized place for model
19  * storage and creation of {@link EffectiveModelContext} instances.
20  */
21 @Beta
22 public interface SchemaRepository {
23     /**
24      * Returns {@link EffectiveModelContextFactory} with supplied configuration.
25      *
26      * @param config configuration of schema context factory.
27      * @return schema context factory.
28      */
29     @NonNull EffectiveModelContextFactory createEffectiveModelContextFactory(
30             @NonNull SchemaContextFactoryConfiguration config);
31
32     /**
33      * Returns {@link EffectiveModelContextFactory} with {@link SchemaContextFactoryConfiguration#getDefault()}.
34      *
35      * @return schema context factory.
36      */
37     default @NonNull EffectiveModelContextFactory createEffectiveModelContextFactory() {
38         return createEffectiveModelContextFactory(SchemaContextFactoryConfiguration.getDefault());
39     }
40
41     <T extends SourceRepresentation> @NonNull ListenableFuture<T> getSchemaSource(@NonNull SourceIdentifier id,
42             @NonNull Class<T> represetation);
43 }