BUG-997: Evolve the SchemaRegistry concepts
[yangtools.git] / yang / yang-model-api / src / main / java / org / opendaylight / yangtools / yang / model / repo / spi / SchemaSourceRegistry.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/eplv10.html
7  */
8 package org.opendaylight.yangtools.yang.model.repo.spi;
9
10 import com.google.common.annotations.Beta;
11
12 import org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceRepresentation;
13 import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
14
15 /**
16  * Registry of all potentially available schema sources. Processes capable of
17  * dynamic schema discovery, such as OSGi registry scanners, NETCONF clients
18  * (with NETCONF monitoring extension) and similar can register
19  * {@link SchemaSourceProvider} instances which would then acquire the schema
20  * source.
21  */
22 @Beta
23 public interface SchemaSourceRegistry {
24     /**
25      * Register a new schema source which is potentially available from a provider.
26      * A registration does not guarantee that a subsequent call to
27      * {@link SchemaSourceProvider#getSource(SourceIdentifier)} will succeed.
28      *
29      * @param provider Resolver which can potentially resolve the identifier
30      * @param source Schema source details
31      * @return A registration handle. Invoking {@link SchemaSourceRegistration#close()}
32      *         will cancel the registration.
33      */
34     <T extends SchemaSourceRepresentation> SchemaSourceRegistration<T> registerSchemaSource(SchemaSourceProvider<? super T> provider, PotentialSchemaSource<T> source);
35
36     /**
37      * Register a schema source listener. The listener will be notified as new
38      * sources and their representations become available, subject to the provided
39      * filter.
40      *
41      * @param listener Schema source listener
42      * @return A registration handle. Invoking {@link SchemaListenerRegistration#close()}
43      *         will cancel the registration.
44      */
45     SchemaListenerRegistration registerSchemaSourceListener(SchemaSourceListener listener);
46 }