Merge branch 'master' of ../controller
[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 org.eclipse.jdt.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 centralized place for model
17  * storage and creation of {@link SchemaContext} instances.
18  */
19 @Beta
20 public interface SchemaRepository {
21     /**
22      * Returns {@link SchemaContextFactory} with supplied configuration.
23      *
24      * @param config configuration of schema context factory.
25      * @return schema context factory.
26      */
27     @NonNull EffectiveModelContextFactory createEffectiveModelContextFactory(
28             @NonNull SchemaContextFactoryConfiguration config);
29
30     /**
31      * Returns {@link SchemaContextFactory} with {@link SchemaContextFactoryConfiguration#getDefault()}.
32      *
33      * @return schema context factory.
34      */
35     default @NonNull EffectiveModelContextFactory createEffectiveModelContextFactory() {
36         return createEffectiveModelContextFactory(SchemaContextFactoryConfiguration.getDefault());
37     }
38
39     <T extends SchemaSourceRepresentation> @NonNull ListenableFuture<T> getSchemaSource(@NonNull SourceIdentifier id,
40             @NonNull Class<T> represetation);
41 }