BUG-997: Evolve the SchemaRegistry concepts
[yangtools.git] / yang / yang-model-api / src / main / java / org / opendaylight / yangtools / yang / model / repo / spi / SchemaSourceListener.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 java.util.EventListener;
13
14 import org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceRepresentation;
15
16 /**
17  * Listener for schema source lifecycle events.
18  */
19 @Beta
20 public interface SchemaSourceListener extends EventListener {
21     /**
22      * Invoked when the registry sees a concrete source. This callback is typically
23      * used by cache-type listeners, who intercept the source, store it locally and
24      * announce themselves as a provider of that particular schema source.
25      *
26      * @param source Schema source
27      */
28     void schemaSourceEncountered(SchemaSourceRepresentation source);
29
30     /**
31      * Invoked when a new schema source is registered by a provider. This call
32      * callback, along with {@link #schemaSourceUnregistered(PotentialSchemaSource)}
33      * is typically used by transformer-type listeners, who intercept the registration
34      * if the advertised representation matches their input type and register
35      * themselves as a potential provider of the same source in their output
36      * representation type.
37      *
38      * @param sources Newly available sources
39      */
40     void schemaSourceRegistered(Iterable<PotentialSchemaSource<?>> sources);
41
42     /**
43      * Invoked when a schema source is unregistered.
44      *
45      * @param source Schema source representation
46      */
47     void schemaSourceUnregistered(PotentialSchemaSource<?> source);
48 }