Promote SchemaSourceRepresentation
[yangtools.git] / yang / yang-repo-spi / 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/epl-v10.html
7  */
8 package org.opendaylight.yangtools.yang.model.repo.spi;
9
10 import com.google.common.annotations.Beta;
11 import org.eclipse.jdt.annotation.NonNullByDefault;
12 import org.opendaylight.yangtools.yang.model.api.source.SourceRepresentation;
13
14 /**
15  * Listener on {@link SourceRepresentation} lifecycle.
16  */
17 @Beta
18 @NonNullByDefault
19 public interface SchemaSourceListener {
20     /**
21      * Invoked when the registry sees a concrete source. This callback is typically used by cache-type listeners, who
22      * intercept the source, store it locally and announce themselves as a provider of that particular schema source.
23      *
24      * @param source Schema source
25      */
26     void schemaSourceEncountered(SourceRepresentation source);
27
28     /**
29      * Invoked when a new schema source is registered by a provider. This call
30      * callback, along with {@link #schemaSourceUnregistered(PotentialSchemaSource)}
31      * is typically used by transformer-type listeners, who intercept the registration
32      * if the advertised representation matches their input type and register
33      * themselves as a potential provider of the same source in their output
34      * representation type.
35      *
36      * @param sources Newly available sources
37      */
38     void schemaSourceRegistered(Iterable<PotentialSchemaSource<?>> sources);
39
40     /**
41      * Invoked when a schema source is unregistered.
42      *
43      * @param source Schema source representation
44      */
45     void schemaSourceUnregistered(PotentialSchemaSource<?> source);
46 }