BUG-997: Evolve the SchemaRegistry concepts
[yangtools.git] / yang / yang-model-api / src / main / java / org / opendaylight / yangtools / yang / model / repo / api / SchemaSourceRepresentation.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.api;
9
10 import com.google.common.annotations.Beta;
11
12 import org.opendaylight.yangtools.concepts.Identifiable;
13 import org.opendaylight.yangtools.concepts.Immutable;
14
15 /**
16  * Common interface for schema source representations.
17  *
18  * A schema source is an atomic piece of the overall schema context. In YANG terms,
19  * a schema source is semantically equivalent to a single YANG text file, be it a
20  * module or a submodule.
21  *
22  * A schema source can exist in various forms, which we call representations. Again,
23  * in YANG terms, each representation is semantically equivalent, but from
24  * implementation perspective certain operations on a schema source may require it
25  * to be first transformed into a particular representation before they can be
26  * applied. Such transformations are affected via instances of
27  * {@link SchemaSourceTransformation}.
28  *
29  * Typical examples of a schema source representation include:
30  * <ul>
31  * <li>a {@link java.lang.String} - textual representation of source code
32  * <li>a {@link java.io.InputStream} - input stream containing source code
33  * <li>a {@link com.google.common.io.ByteSource} - source for input streams
34  * containing source code
35  * <li>Parsed abstract syntax tree (AST), which is the result of a syntactic parser
36  *
37  * Implementations of this interface expected to comply with the {@link Immutable}
38  * contract.
39  */
40 @Beta
41 public interface SchemaSourceRepresentation extends Identifiable<SourceIdentifier>, Immutable {
42     /**
43      * {@inheritDoc}
44      */
45     @Override
46     SourceIdentifier getIdentifier();
47
48     /**
49      * Return the concrete representation type.
50      *
51      * @return The type of representation.
52      */
53     Class<? extends SchemaSourceRepresentation> getType();
54 }