Bug 2366 - Effective statements impl for new yang parser. 38/18038/12
authorGregor Zatko <gzatko@cisco.com>
Wed, 15 Apr 2015 10:45:19 +0000 (12:45 +0200)
committerGregor Zatko <gzatko@cisco.com>
Wed, 15 Apr 2015 10:45:19 +0000 (12:45 +0200)
- added implementation of effective statements and integration to
  yang-model-api
- added implementation and tests of augment declared statement and AugmentUtils

Change-Id: Ifc39ce971cd3efd5bb00f3f4f25dbd791ee65c38
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
Signed-off-by: Gregor Zatko <gzatko@cisco.com>
133 files changed:
yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/InputStatement.java
yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/OutputStatement.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/spi/meta/StmtContext.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/reactor/ModifierImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/reactor/RootStatementContext.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/reactor/StatementContextBase.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/reactor/SubstatementContext.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/AnyxmlStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/ArgumentStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/AugmentStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/AugmentUtils.java [new file with mode: 0644]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/BaseStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/BelongsToStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/BitStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/CaseStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/ChoiceStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/ConfigStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/ContactStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/DefaultStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/DeviateStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/DeviationStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/EnumStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/ErrorAppTagStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/ErrorMessageStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/ExtensionStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/FeatureStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/IdentityStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/IfFeatureStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/ImportStatementDefinition.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/IncludeStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/InputStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/KeyStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/LeafListStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/LeafStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/LengthStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/ListStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/MandatoryStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/MaxElementsStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/MinElementsStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/ModuleStatementSupport.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/MustStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/NotificationStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/OrderedByStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/OrganizationStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/OutputStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/PatternStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/PositionStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/RangeStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/RefineStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/RequireInstanceStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/RevisionDateStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/RevisionStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/RpcStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/StatusStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/UnitsStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/UsesStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/Utils.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/ValueStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/WhenStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/YangVersionStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/YinElementStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/AbstractEffectiveDocumentedDataNodeContainer.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/AbstractEffectiveDocumentedNode.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/AbstractEffectiveSchemaContext.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/AnyXmlEffectiveStatementImpl.java [new file with mode: 0644]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/ArgumentEffectiveStatementImpl.java [new file with mode: 0644]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/AugmentEffectiveStatementImpl.java [new file with mode: 0644]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/BaseEffectiveStatementImpl.java [new file with mode: 0644]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/BelongsEffectiveToStatementImpl.java [new file with mode: 0644]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/BitEffectiveStatementImpl.java [new file with mode: 0644]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/CaseEffectiveStatementImpl.java [new file with mode: 0644]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/ChoiceEffectiveStatementImpl.java [new file with mode: 0644]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/ConfigEffectiveStatementImpl.java [new file with mode: 0644]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/ContactEffectiveStatementImpl.java [new file with mode: 0644]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/ContainerEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/DefaultEffectiveStatementImpl.java [new file with mode: 0644]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/DescriptionEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/DeviateEffectiveStatementImpl.java [new file with mode: 0644]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/DeviationEffectiveStatementImpl.java [new file with mode: 0644]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/EffectiveSchemaContext.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/EnumEffectiveStatementImpl.java [new file with mode: 0644]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/ErrorAppTagEffectiveStatementImpl.java [new file with mode: 0644]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/ErrorMessageEffectiveStatementImpl.java [new file with mode: 0644]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/ExtensionEffectiveStatementImpl.java [new file with mode: 0644]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/FeatureEffectiveStatementImpl.java [new file with mode: 0644]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/FractionDigitsEffectiveStatementImpl.java [new file with mode: 0644]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/GroupingEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/IdentityEffectiveStatementImpl.java [new file with mode: 0644]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/IfFeatureEffectiveStatementImpl.java [new file with mode: 0644]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/ImportEffectiveStatementImpl.java [new file with mode: 0644]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/IncludeEffectiveStatementImpl.java [new file with mode: 0644]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/InputEffectiveStatementImpl.java [new file with mode: 0644]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/KeyEffectiveStatementImpl.java [new file with mode: 0644]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/LeafEffectiveStatementImpl.java [new file with mode: 0644]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/LeafListEffectiveStatementImpl.java [new file with mode: 0644]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/LengthEffectiveStatementImpl.java [new file with mode: 0644]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/ListEffectiveStatementImpl.java [new file with mode: 0644]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/MandatoryEffectiveStatementImpl.java [new file with mode: 0644]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/MaxElementsEffectiveStatementImpl.java [new file with mode: 0644]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/MinElementsEffectiveStatementImpl.java [new file with mode: 0644]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/ModuleEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/MustEffectiveStatementImpl.java [new file with mode: 0644]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/NotificationEffectiveStatementImpl.java [new file with mode: 0644]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/OrderedByEffectiveStatementImpl.java [new file with mode: 0644]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/OrganizationEffectiveStatementImpl.java [new file with mode: 0644]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/OutputEffectiveStatementImpl.java [new file with mode: 0644]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/PatternEffectiveStatementImpl.java [new file with mode: 0644]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/PositionEffectiveStatementImpl.java [new file with mode: 0644]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/RangeEffectiveStatementImpl.java [new file with mode: 0644]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/RefineEffectiveStatementImpl.java [new file with mode: 0644]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/RequireInstanceEffectiveStatementImpl.java [new file with mode: 0644]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/RevisionDateEffectiveStatementImpl.java [new file with mode: 0644]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/RevisionEffectiveStatementImpl.java [new file with mode: 0644]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/RpcEffectiveStatementImpl.java [new file with mode: 0644]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/StatusEffectiveStatementImpl.java [new file with mode: 0644]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/SubmoduleEffectiveStatementImpl.java [new file with mode: 0644]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/UnitsEffectiveStatementImpl.java [new file with mode: 0644]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/UsesEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/ValueEffectiveStatementImpl.java [new file with mode: 0644]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/WhenEffectiveStatementImpl.java [new file with mode: 0644]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/YangVersionEffectiveStatementImpl.java [new file with mode: 0644]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/YinElementEffectiveStatementImpl.java [new file with mode: 0644]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/effective/build/test/EffectiveBuildTest.java
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/AugmentProcessTest.java [new file with mode: 0644]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/AugmentSimplestTest.java [new file with mode: 0644]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/YangFileStmtTest.java
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/augment/AugmentTest.java
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/augment/TestAugmentSource.java
yang/yang-parser-impl/src/test/resources/model/subfoo.yang
yang/yang-parser-impl/src/test/resources/semantic-statement-parser/augmented.yang [new file with mode: 0644]
yang/yang-parser-impl/src/test/resources/semantic-statement-parser/root.yang [new file with mode: 0644]
yang/yang-parser-impl/src/test/resources/stmt-test/effective-build/aug-root.yang [new file with mode: 0644]
yang/yang-parser-impl/src/test/resources/stmt-test/effective-build/augmented.yang [new file with mode: 0644]

index 81122afa813052983a942348e9abae1708907662..84426b35511e9f4303414454f2f3dfbe5751cff8 100644 (file)
@@ -7,8 +7,10 @@
  */
 package org.opendaylight.yangtools.yang.model.api.stmt;
 
+import org.opendaylight.yangtools.yang.common.QName;
+
 import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
 
-public interface InputStatement  extends DeclaredStatement<Void>, DataDefinitionContainer.WithReusableDefinitions {
+public interface InputStatement  extends DeclaredStatement<QName>, DataDefinitionContainer.WithReusableDefinitions {
 
 }
index b8ff5c7010602d442aea5759e58156030df56477..efe895103f386e9de85ef7f5f9f7d87463dc4b3a 100644 (file)
@@ -7,8 +7,10 @@
  */
 package org.opendaylight.yangtools.yang.model.api.stmt;
 
+import org.opendaylight.yangtools.yang.common.QName;
+
 import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
 
-public interface OutputStatement extends DeclaredStatement<Void>, DataDefinitionContainer.WithReusableDefinitions {
+public interface OutputStatement extends DeclaredStatement<QName>, DataDefinitionContainer.WithReusableDefinitions {
 
 }
index 514d283e2e5d4f809dc4d1509ba0d51314b0af56..43e2014e32164c5a48bdb4b24e3009eae6646d16 100644 (file)
@@ -7,8 +7,9 @@
  */
 package org.opendaylight.yangtools.yang.parser.spi.meta;
 
-import java.util.Map;
+import java.util.List;
 
+import java.util.Map;
 import org.opendaylight.yangtools.yang.common.QNameModule;
 import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
 import org.opendaylight.yangtools.yang.parser.stmt.reactor.StatementContextBase;
@@ -37,6 +38,8 @@ public interface StmtContext<A,D extends DeclaredStatement<A>, E extends Effecti
 
     @Nullable A getStatementArgument();
 
+    @Nullable List<Object> getArgumentsFromRoot();
+
     //<K,VT, V extends VT,N extends IdentifierNamespace<K, V>>
     //       <K, VT, V extends VT ,N extends IdentifierNamespace<K, V>> VT getFromNamespace(Class<N> type, K key)
     @Nonnull <K,V,N extends IdentifierNamespace<K, V>> V getFromNamespace(Class<N> type, K key) throws NamespaceNotAvailableException;
@@ -68,7 +71,7 @@ public interface StmtContext<A,D extends DeclaredStatement<A>, E extends Effecti
 
         ModelActionBuilder newInferenceAction(ModelProcessingPhase phase);
 
-        <K,KT extends K, N extends StatementNamespace<K, ?, ?>> void addContext(Class<N> namepsace, KT key,
+        <K,KT extends K, N extends StatementNamespace<K, ?, ?>> void addContext(Class<N> namespace, KT key,
                 StmtContext<?, ?, ?> stmt);
 
     }
index 8c22b734a983eed12e4cf405d797307e08d395a1..638952cf3dc44241d0479ede263f6dc16569e693 100644 (file)
@@ -125,7 +125,7 @@ class ModifierImpl implements ModelActionBuilder {
         try {
             PhaseFinished<C> phaseFin = new PhaseFinished<C>();
             addReq(phaseFin);
-            contextImpl(context).addPhaseCompletedListener(FULL_DECLARATION,phaseFin);
+            contextImpl(context).addPhaseCompletedListener(phase,phaseFin);
             return phaseFin;
         } catch (SourceException e) {
             throw shouldNotHappenProbablyBug(e);
index 18509213a7cf2168fb827ae0dbfbb0c6fe884d82..f5bf42e66df19f6f4e4e71ae329c11e67d8dc925 100644 (file)
@@ -7,6 +7,9 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.reactor;
 
+import java.util.List;
+
+import java.util.LinkedList;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.common.QNameModule;
 import java.util.Collection;
@@ -21,6 +24,7 @@ class RootStatementContext<A, D extends DeclaredStatement<A>, E extends Effectiv
 
     private final SourceSpecificContext sourceContext;
     private final A argument;
+    private LinkedList<?> linkedList;
 
     RootStatementContext(ContextBuilder<A, D, E> builder,
             SourceSpecificContext sourceContext) throws SourceException {
@@ -101,4 +105,11 @@ class RootStatementContext<A, D extends DeclaredStatement<A>, E extends Effectiv
         return copy;
     }
 
+    @Override
+    public List<Object> getArgumentsFromRoot() {
+        LinkedList<Object> argumentList = new LinkedList<Object>();
+        argumentList.add(argument);
+        return argumentList;
+    }
+
 }
index 0f55001b5f2bdec373f003f9e39bcc659809b4cf..94f29a3cca5af98f830cc9697f2af775d6a662cd 100644 (file)
@@ -350,7 +350,7 @@ public abstract class StatementContextBase<A, D extends DeclaredStatement<A>, E
 
     @Override
     public <K,KT extends K, N extends StatementNamespace<K, ?, ?>> void addContext(
-            Class<N> namepsace, KT key, StmtContext<?, ?, ?> stmt) {
-        addContextToNamespace(namepsace,(K) key, stmt);
+            Class<N> namespace, KT key, StmtContext<?, ?, ?> stmt) {
+        addContextToNamespace(namespace,(K) key, stmt);
     }
 }
index d0c35df46e38dea87e18d0f14a2d3b79d67df411..29cac6ead5da3f4ab38db09a453b014ec8c5d547 100644 (file)
@@ -7,8 +7,9 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.reactor;
 
-import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.GroupingUtils;
+import java.util.List;
 
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.GroupingUtils;
 import org.opendaylight.yangtools.yang.common.QNameModule;
 import java.util.Collection;
 import org.opendaylight.yangtools.yang.common.QName;
@@ -109,4 +110,13 @@ class SubstatementContext<A,D extends DeclaredStatement<A>, E extends EffectiveS
         StatementContextBase<A,D,E> copy = new SubstatementContext<A,D,E>(this,newQNameModule, newParent);
         return copy;
     }
+
+    @Override
+    public List<Object> getArgumentsFromRoot() {
+        List<Object> argumentsFromRoot = parent.getArgumentsFromRoot();
+        argumentsFromRoot.add(argument);
+        return argumentsFromRoot;
+    }
+
+
 }
index e069c3f66b9164355605d7d83a227d5d191934ba..33d753797c375802a92f5b9532e65f32ccad51f8 100644 (file)
@@ -7,8 +7,9 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
 
-import org.opendaylight.yangtools.yang.model.api.stmt.MandatoryStatement;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.AnyXmlEffectiveStatementImpl;
 
+import org.opendaylight.yangtools.yang.model.api.stmt.MandatoryStatement;
 import java.util.Collection;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
@@ -49,7 +50,7 @@ public class AnyxmlStatementImpl extends AbstractDeclaredStatement<QName> implem
 
         @Override
         public EffectiveStatement<QName,AnyxmlStatement> createEffective(StmtContext<QName,AnyxmlStatement,EffectiveStatement<QName,AnyxmlStatement>> ctx) {
-           throw new UnsupportedOperationException();
+           return new AnyXmlEffectiveStatementImpl(ctx);
         }
 
     }
index 3d1c0fa160bc32437184c68eb5e72329bf84e84d..8930d9c941a00860decd0910e928a80316c25eb0 100644 (file)
@@ -7,8 +7,9 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
 
-import org.opendaylight.yangtools.yang.model.api.stmt.YinElementStatement;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.ArgumentEffectiveStatementImpl;
 
+import org.opendaylight.yangtools.yang.model.api.stmt.YinElementStatement;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
@@ -47,7 +48,7 @@ public class ArgumentStatementImpl extends AbstractDeclaredStatement<QName>
         @Override
         public EffectiveStatement<QName, ArgumentStatement> createEffective(
                 StmtContext<QName, ArgumentStatement, EffectiveStatement<QName, ArgumentStatement>> ctx) {
-            throw new UnsupportedOperationException();
+            return new ArgumentEffectiveStatementImpl(ctx);
         }
 
     }
index 926a39b278f7aa7354080d875dc7f1737008f454..8eabcb68ebf0e11ff7e255b3b99ed3c8c4b1780a 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
 
+import static org.opendaylight.yangtools.yang.parser.spi.meta.ModelProcessingPhase.EFFECTIVE_MODEL;
+
 import java.util.Collection;
 
 import javax.annotation.Nonnull;
@@ -18,8 +20,13 @@ import org.opendaylight.yangtools.yang.model.api.stmt.DataDefinitionStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier;
 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractDeclaredStatement;
 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
+import org.opendaylight.yangtools.yang.parser.spi.meta.InferenceException;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ModelActionBuilder;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ModelProcessingPhase;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
+import org.opendaylight.yangtools.yang.parser.stmt.reactor.StatementContextBase;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.AugmentEffectiveStatementImpl;
 
 public class AugmentStatementImpl extends AbstractDeclaredStatement<SchemaNodeIdentifier> implements AugmentStatement {
 
@@ -37,7 +44,7 @@ public class AugmentStatementImpl extends AbstractDeclaredStatement<SchemaNodeId
 
         @Override
         public SchemaNodeIdentifier parseArgumentValue(StmtContext<?, ?, ?> ctx, String value) throws SourceException {
-            return SchemaNodeIdentifier.create(Utils.parseAugmentPath(ctx, value), Utils.isXPathAbsolute(value));
+            return SchemaNodeIdentifier.create(AugmentUtils.parseAugmentPath(ctx, value), Utils.isXPathAbsolute(value));
         }
 
         @Override
@@ -48,7 +55,43 @@ public class AugmentStatementImpl extends AbstractDeclaredStatement<SchemaNodeId
         @Override
         public EffectiveStatement<SchemaNodeIdentifier, AugmentStatement> createEffective(
                 StmtContext<SchemaNodeIdentifier, AugmentStatement, EffectiveStatement<SchemaNodeIdentifier, AugmentStatement>> ctx) {
-            throw new UnsupportedOperationException();
+            return new AugmentEffectiveStatementImpl(ctx);
+        }
+
+        @Override
+        public void onFullDefinitionDeclared(
+                final StmtContext.Mutable<SchemaNodeIdentifier, AugmentStatement, EffectiveStatement<SchemaNodeIdentifier, AugmentStatement>> augmentNode)
+                throws SourceException {
+
+            final ModelActionBuilder augmentAction = augmentNode.newInferenceAction(EFFECTIVE_MODEL);
+            final ModelActionBuilder.Prerequisite<StmtContext<SchemaNodeIdentifier, AugmentStatement, EffectiveStatement<SchemaNodeIdentifier, AugmentStatement>>> sourceCtxPrereq = augmentAction
+                    .requiresCtx(augmentNode, ModelProcessingPhase.FULL_DECLARATION);
+
+            augmentAction.apply(new ModelActionBuilder.InferenceAction() {
+
+                @Override
+                public void apply() throws InferenceException {
+
+                    final StatementContextBase<?, ?, ?> augmentTargetCtx = AugmentUtils
+                            .getAugmentTargetCtx(augmentNode);
+                    StatementContextBase<?, ?, ?> augmentSourceCtx = (StatementContextBase<?, ?, ?>) sourceCtxPrereq
+                            .get();
+
+                    try {
+                        AugmentUtils.copyFromSourceToTarget(augmentSourceCtx, augmentTargetCtx);
+                    } catch (SourceException e) {
+                        e.printStackTrace();
+                    }
+                }
+
+                @Override
+                public void prerequisiteFailed(final Collection<? extends ModelActionBuilder.Prerequisite<?>> failed)
+                        throws InferenceException {
+                    if (failed.contains(augmentAction)) {
+                        throw new InferenceException("Augment action failed", augmentNode.getStatementSourceReference());
+                    }
+                }
+            });
         }
     }
 
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/AugmentUtils.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/AugmentUtils.java
new file mode 100644 (file)
index 0000000..66cfd1d
--- /dev/null
@@ -0,0 +1,150 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * <p/>
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
+
+import java.util.Collection;
+import java.util.HashSet;
+
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.common.QNameModule;
+import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
+import org.opendaylight.yangtools.yang.model.api.stmt.AugmentStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier;
+import org.opendaylight.yangtools.yang.parser.spi.NamespaceToModule;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext.Mutable;
+import org.opendaylight.yangtools.yang.parser.spi.source.ModuleNameToModuleQName;
+import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
+import org.opendaylight.yangtools.yang.parser.stmt.reactor.StatementContextBase;
+
+public class AugmentUtils {
+
+    private static final String REGEX_PATH_REL1 = "\\.\\.?\\s*/(.+)";
+    private static final String REGEX_PATH_REL2 = "//.*";
+
+    public static Iterable<QName> parseAugmentPath(StmtContext<?, ?, ?> ctx, String path) {
+
+        if (path.matches(REGEX_PATH_REL1) || path.matches(REGEX_PATH_REL2)) {
+            throw new IllegalArgumentException(
+                    "An argument for augment can be only absolute path; or descendant if used in uses");
+        }
+
+        return Utils.parseXPath(ctx, path);
+    }
+
+    public static void copyFromSourceToTarget(StatementContextBase<?, ?, ?> sourceCtx,
+            StatementContextBase<?, ?, ?> targetCtx) throws SourceException {
+
+        QNameModule newQNameModule = getNewQNameModule(targetCtx, sourceCtx);
+        copyDeclaredStmts(sourceCtx, targetCtx, newQNameModule);
+        copyEffectiveStmts(sourceCtx, targetCtx, newQNameModule);
+
+    }
+
+    public static void copyDeclaredStmts(StatementContextBase<?, ?, ?> sourceCtx,
+            StatementContextBase<?, ?, ?> targetCtx, QNameModule newQNameModule) throws SourceException {
+        Collection<? extends StatementContextBase<?, ?, ?>> declaredSubstatements = sourceCtx.declaredSubstatements();
+        for (StatementContextBase<?, ?, ?> originalStmtCtx : declaredSubstatements) {
+            if (needToCopyByAugment(originalStmtCtx)) {
+                StatementContextBase<?, ?, ?> copy = originalStmtCtx.createCopy(newQNameModule, targetCtx);
+                targetCtx.addEffectiveSubstatement(copy);
+            } else if (isReusedByAugment(originalStmtCtx)) {
+                targetCtx.addEffectiveSubstatement(originalStmtCtx);
+            }
+        }
+    }
+
+    public static void copyEffectiveStmts(StatementContextBase<?, ?, ?> sourceCtx,
+            StatementContextBase<?, ?, ?> targetCtx, QNameModule newQNameModule) throws SourceException {
+        Collection<? extends StatementContextBase<?, ?, ?>> effectiveSubstatements = sourceCtx.effectiveSubstatements();
+        for (StatementContextBase<?, ?, ?> originalStmtCtx : effectiveSubstatements) {
+            if (needToCopyByAugment(originalStmtCtx)) {
+                StatementContextBase<?, ?, ?> copy = originalStmtCtx.createCopy(newQNameModule, targetCtx);
+                targetCtx.addEffectiveSubstatement(copy);
+            } else if (isReusedByAugment(originalStmtCtx)) {
+                targetCtx.addEffectiveSubstatement(originalStmtCtx);
+            }
+        }
+    }
+
+    public static QNameModule getNewQNameModule(StatementContextBase<?, ?, ?> targetCtx,
+            StatementContextBase<?, ?, ?> sourceCtx) {
+        Object targetStmtArgument = targetCtx.getStatementArgument();
+
+        final StatementContextBase<?, ?, ?> root = sourceCtx.getRoot();
+        final String moduleName = (String) root.getStatementArgument();
+        final QNameModule sourceQNameModule = root.getFromNamespace(ModuleNameToModuleQName.class, moduleName);
+
+        if (targetStmtArgument instanceof QName) {
+            QName targetQName = (QName) targetStmtArgument;
+            QNameModule targetQNameModule = targetQName.getModule();
+
+            if (targetQNameModule.equals(sourceQNameModule))
+                return null;
+            else
+                return targetQNameModule;
+        } else
+            return null;
+    }
+
+    public static boolean needToCopyByAugment(StmtContext<?, ?, ?> stmtContext) {
+
+        HashSet<StatementDefinition> noCopyDefSet = new HashSet<>();
+        noCopyDefSet.add(Rfc6020Mapping.USES);
+
+        StatementDefinition def = stmtContext.getPublicDefinition();
+        if (noCopyDefSet.contains(def))
+            return false;
+        else
+            return true;
+    }
+
+    public static boolean isReusedByAugment(StmtContext<?, ?, ?> stmtContext) {
+
+        HashSet<StatementDefinition> reusedDefSet = new HashSet<>();
+        reusedDefSet.add(Rfc6020Mapping.TYPEDEF);
+
+        StatementDefinition def = stmtContext.getPublicDefinition();
+        if (reusedDefSet.contains(def))
+            return true;
+        else
+            return false;
+    }
+
+    public static StatementContextBase<?, ?, ?> getAugmentTargetCtx(
+            final Mutable<SchemaNodeIdentifier, AugmentStatement, EffectiveStatement<SchemaNodeIdentifier, AugmentStatement>> augmentNode) {
+
+        final SchemaNodeIdentifier augmentTargetPath = augmentNode.getStatementArgument();
+
+        QNameModule module;
+        if (augmentTargetPath != null) {
+            module = augmentTargetPath.getPathFromRoot().iterator().next().getModule();
+        } else {
+            throw new IllegalArgumentException(
+                    "Augment argument null, something bad happened in some of previous parsing phases");
+        }
+
+        StatementContextBase<?, ?, ?> rootStatementCtx = (StatementContextBase<?, ?, ?>) augmentNode.getFromNamespace(
+                NamespaceToModule.class, module);
+
+        final StatementContextBase<?, ?, ?> augmentTargetCtx = Utils.findCtxOfNodeInRoot(rootStatementCtx,
+                augmentTargetPath);
+
+        if (augmentTargetCtx == null) {
+
+            throw new NullPointerException(String.format(
+                    "Augment path %s not found in target model so its resulting context is null",
+                    augmentNode.rawStatementArgument()));
+
+        }
+
+        return augmentTargetCtx;
+    }
+}
index b2bd11d73ef605c19e09ea7dae8f49230abde297..5460fd238f66e6fb42674069392f8d24e0527d23 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
 
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.BaseEffectiveStatementImpl;
+
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
@@ -44,7 +46,7 @@ public class BaseStatementImpl extends AbstractDeclaredStatement<QName>
         @Override
         public EffectiveStatement<QName, BaseStatement> createEffective(
                 StmtContext<QName, BaseStatement, EffectiveStatement<QName, BaseStatement>> ctx) {
-            throw new UnsupportedOperationException();
+            return new BaseEffectiveStatementImpl(ctx);
         }
 
     }
index 276da9667df769d188d7e3a019f590b2a9d46784..ea73c8d34194ef5d7d1581e34da4ed4c546ea451 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
 
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.BelongsEffectiveToStatementImpl;
+
 import org.opendaylight.yangtools.yang.model.api.stmt.PrefixStatement;
 import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
@@ -45,7 +47,7 @@ public class BelongsToStatementImpl extends AbstractDeclaredStatement<String>
         @Override
         public EffectiveStatement<String, BelongsToStatement> createEffective(
                 StmtContext<String, BelongsToStatement, EffectiveStatement<String, BelongsToStatement>> ctx) {
-            throw new UnsupportedOperationException();
+            return new BelongsEffectiveToStatementImpl(ctx);
         }
 
     }
index 6080528ef413012b1026d3ca1bf0ce96d875db0a..93e227ac00c80ac80a8398f336b8b4e783a155e5 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
 
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.BitEffectiveStatementImpl;
+
 import org.opendaylight.yangtools.yang.model.api.stmt.DescriptionStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.PositionStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.ReferenceStatement;
@@ -48,7 +50,7 @@ public class BitStatementImpl extends AbstractDeclaredStatement<String>
         @Override
         public EffectiveStatement<String, BitStatement> createEffective(
                 StmtContext<String, BitStatement, EffectiveStatement<String, BitStatement>> ctx) {
-            throw new UnsupportedOperationException();
+            return new BitEffectiveStatementImpl(ctx);
         }
 
     }
index a6e29b2b3c952062a3bac492b682f1a2142a27bd..316013160333f79d9b925299ca0ed70ec0513cf4 100644 (file)
@@ -7,6 +7,9 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
 
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.CaseEffectiveStatementImpl;
+
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.PresenceEffectiveStatementImpl;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
@@ -21,7 +24,6 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractDeclaredStatement
 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
-
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 import java.util.Collection;
@@ -51,7 +53,7 @@ public class CaseStatementImpl extends AbstractDeclaredStatement<QName> implemen
 
         @Override public EffectiveStatement<QName, CaseStatement> createEffective(
                 StmtContext<QName, CaseStatement, EffectiveStatement<QName, CaseStatement>> ctx) {
-            throw new UnsupportedOperationException();
+            return new CaseEffectiveStatementImpl(ctx);
         }
     }
 
index 3feee1f1953362a61d3ca4eb82b50e7a57e2aa53..28c7f52371eb45823912e5b1b4922b4df95aa302 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
 
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.ChoiceEffectiveStatementImpl;
+
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
@@ -24,7 +26,6 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractDeclaredStatement
 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
-
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 import java.util.Collection;
@@ -59,7 +60,7 @@ public class ChoiceStatementImpl extends AbstractDeclaredStatement<QName>
         @Override
         public EffectiveStatement<QName, ChoiceStatement> createEffective(
                 StmtContext<QName, ChoiceStatement, EffectiveStatement<QName, ChoiceStatement>> ctx) {
-            throw new UnsupportedOperationException();
+            return new ChoiceEffectiveStatementImpl(ctx);
         }
     }
 
index b25f9751e7e9ac3ec63f0c502f1d5feef794608c..d7f1f0a1700fe4b55da0d19f82a8a071008f9eab 100644 (file)
@@ -7,6 +7,8 @@
 */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
 
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.ConfigEffectiveStatementImpl;
+
 import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.ConfigStatement;
@@ -14,7 +16,6 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractDeclaredStatement
 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
-
 import javax.annotation.Nonnull;
 
 public class ConfigStatementImpl extends AbstractDeclaredStatement<Boolean> implements ConfigStatement {
@@ -40,7 +41,7 @@ public class ConfigStatementImpl extends AbstractDeclaredStatement<Boolean> impl
         }
 
         @Override public EffectiveStatement<Boolean, ConfigStatement> createEffective(StmtContext<Boolean, ConfigStatement, EffectiveStatement<Boolean, ConfigStatement>> ctx) {
-            throw new UnsupportedOperationException();
+            return new ConfigEffectiveStatementImpl(ctx);
         }
     }
 
index e3ef013af40c9f62e94cad6e8ac154ee82093831..eca9c5b9ec448c31d3e28c9e522064749f38fb73 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
 
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.ContactEffectiveStatementImpl;
+
 import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.ContactStatement;
@@ -14,7 +16,6 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractDeclaredStatement
 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
-
 import javax.annotation.Nonnull;
 
 public class ContactStatementImpl extends AbstractDeclaredStatement<String> implements ContactStatement{
@@ -41,7 +42,7 @@ public class ContactStatementImpl extends AbstractDeclaredStatement<String> impl
 
         @Override
         public EffectiveStatement<String, ContactStatement> createEffective(StmtContext<String, ContactStatement, EffectiveStatement<String, ContactStatement>> ctx) {
-            throw new UnsupportedOperationException();
+            return new ContactEffectiveStatementImpl(ctx);
         }
     }
 
index 95aadef07d166b0d4915b45d37e88c314206d71e..dbf650af418d731f473ac9683d8042552280a555 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
 
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.DefaultEffectiveStatementImpl;
+
 import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.DefaultStatement;
@@ -14,7 +16,6 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractDeclaredStatement
 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
-
 import javax.annotation.Nonnull;
 
 public class DefaultStatementImpl extends AbstractDeclaredStatement<String> implements
@@ -43,7 +44,7 @@ public class DefaultStatementImpl extends AbstractDeclaredStatement<String> impl
 
         @Override public EffectiveStatement<String, DefaultStatement> createEffective(
                 StmtContext<String, DefaultStatement, EffectiveStatement<String, DefaultStatement>> ctx) {
-            throw new UnsupportedOperationException();
+            return new DefaultEffectiveStatementImpl(ctx);
         }
     }
 
index b47dc797bb702f4fff898e3fc30a89e1efb72364..56755e411c02d4a821a22706c820b8adfe69bfff 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
 
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.DeviateEffectiveStatementImpl;
+
 import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.DeviateStatement;
@@ -14,7 +16,6 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractDeclaredStatement
 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
-
 import javax.annotation.Nonnull;
 
 public class DeviateStatementImpl extends AbstractDeclaredStatement<String> implements DeviateStatement {
@@ -42,7 +43,7 @@ public class DeviateStatementImpl extends AbstractDeclaredStatement<String> impl
 
         @Override public EffectiveStatement<String, DeviateStatement> createEffective(
                 StmtContext<String, DeviateStatement, EffectiveStatement<String, DeviateStatement>> ctx) {
-            throw new UnsupportedOperationException();
+            return new DeviateEffectiveStatementImpl(ctx);
         }
     }
 
index 4d6b4331e3a7218ef7c0d5af1e522f8d62d14b9b..8dea301b7145163b3dab5827f5f5ff9f1378af0b 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
 
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.DeviationEffectiveStatementImpl;
+
 import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.DeviationStatement;
@@ -15,7 +17,6 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractDeclaredStatement
 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
-
 import javax.annotation.Nonnull;
 
 public class DeviationStatementImpl extends AbstractDeclaredStatement<SchemaNodeIdentifier> implements DeviationStatement {
@@ -43,7 +44,7 @@ public class DeviationStatementImpl extends AbstractDeclaredStatement<SchemaNode
 
         @Override public EffectiveStatement<SchemaNodeIdentifier, DeviationStatement> createEffective(
                 StmtContext<SchemaNodeIdentifier, DeviationStatement, EffectiveStatement<SchemaNodeIdentifier, DeviationStatement>> ctx) {
-            throw new UnsupportedOperationException();
+            return new DeviationEffectiveStatementImpl(ctx);
         }
     }
 
index a5558a5aa54343b065a47829ea782ee1917ee42a..3fa1b1ce7f303e8e00c191d101cafbe12d6493c1 100644 (file)
@@ -7,8 +7,9 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
 
-import org.opendaylight.yangtools.yang.model.api.stmt.ValueStatement;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.EnumEffectiveStatementImpl;
 
+import org.opendaylight.yangtools.yang.model.api.stmt.ValueStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.DescriptionStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.ReferenceStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.StatusStatement;
@@ -49,7 +50,7 @@ public class EnumStatementImpl extends AbstractDeclaredStatement<String>
         @Override
         public EffectiveStatement<String, EnumStatement> createEffective(
                 StmtContext<String, EnumStatement, EffectiveStatement<String, EnumStatement>> ctx) {
-            throw new UnsupportedOperationException();
+            return new EnumEffectiveStatementImpl(ctx);
         }
 
     }
index 4e1c9ab08325173133fd0fd0f4fe3a79c1bab0b3..7db9c97909272cd21a5679faf7b4750fda8bc8c6 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
 
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.ErrorAppTagEffectiveStatementImpl;
+
 import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.ErrorAppTagStatement;
@@ -44,7 +46,7 @@ public class ErrorAppTagStatementImpl extends AbstractDeclaredStatement<String>
         @Override
         public EffectiveStatement<String, ErrorAppTagStatement> createEffective(
                 StmtContext<String, ErrorAppTagStatement, EffectiveStatement<String, ErrorAppTagStatement>> ctx) {
-            throw new UnsupportedOperationException();
+            return new ErrorAppTagEffectiveStatementImpl(ctx);
         }
 
     }
index 4ad3f499feb6fc1ad4ab25bda3408abb662eb17a..7769180f097dd39d5bfb7525a3f58987cf376c52 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
 
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.ErrorMessageEffectiveStatementImpl;
+
 import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.ErrorMessageStatement;
@@ -44,7 +46,7 @@ public class ErrorMessageStatementImpl extends
         @Override
         public EffectiveStatement<String, ErrorMessageStatement> createEffective(
                 StmtContext<String, ErrorMessageStatement, EffectiveStatement<String, ErrorMessageStatement>> ctx) {
-            throw new UnsupportedOperationException();
+            return new ErrorMessageEffectiveStatementImpl(ctx);
         }
 
     }
index 65ae9e4d3cacfc0e433eb3cf858845532b55423b..2e9c54ffdd57abdf1be777a57ddc3719311f86c4 100644 (file)
@@ -7,8 +7,9 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
 
-import org.opendaylight.yangtools.yang.model.api.stmt.ArgumentStatement;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.ExtensionEffectiveStatementImpl;
 
+import org.opendaylight.yangtools.yang.model.api.stmt.ArgumentStatement;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
@@ -44,7 +45,7 @@ public class ExtensionStatementImpl extends AbstractDeclaredStatement<QName> imp
 
         @Override
         public EffectiveStatement<QName,ExtensionStatement> createEffective(StmtContext<QName,ExtensionStatement,EffectiveStatement<QName,ExtensionStatement>> ctx) {
-           throw new UnsupportedOperationException();
+           return new ExtensionEffectiveStatementImpl(ctx);
         }
 
     }
index 3034662c01ec1a6f53a9ed2ac2a278d8cf513666..c59ea619b55e129fd029aaa079307a54b539bb28 100644 (file)
@@ -7,9 +7,10 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
 
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.FeatureEffectiveStatementImpl;
+
 import java.util.Collection;
 import org.opendaylight.yangtools.yang.model.api.stmt.IfFeatureStatement;
-
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
@@ -51,7 +52,7 @@ public class FeatureStatementImpl extends AbstractDeclaredStatement<QName>
         @Override
         public EffectiveStatement<QName, FeatureStatement> createEffective(
                 StmtContext<QName, FeatureStatement, EffectiveStatement<QName, FeatureStatement>> ctx) {
-            throw new UnsupportedOperationException();
+            return new FeatureEffectiveStatementImpl(ctx);
         }
 
     }
index c5ea40ccaac4e11acab01b2e254045fe313e95d9..092cc411e3a5bc64fa0c7c7c0e4ea4bf983fd16b 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
 
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.IdentityEffectiveStatementImpl;
+
 import org.opendaylight.yangtools.yang.model.api.stmt.BaseStatement;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
@@ -49,7 +51,7 @@ public class IdentityStatementImpl extends AbstractDeclaredStatement<QName>
         @Override
         public EffectiveStatement<QName, IdentityStatement> createEffective(
                 StmtContext<QName, IdentityStatement, EffectiveStatement<QName, IdentityStatement>> ctx) {
-            throw new UnsupportedOperationException();
+            return new IdentityEffectiveStatementImpl(ctx);
         }
 
     }
index 42c5e1ee5700900e7fc03ef03b92cacf23726f4a..4b2e434203464e16f98722938aaababea4973307 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
 
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.IfFeatureEffectiveStatementImpl;
+
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
@@ -45,7 +47,7 @@ public class IfFeatureStatementImpl extends AbstractDeclaredStatement<QName>
         @Override
         public EffectiveStatement<QName, IfFeatureStatement> createEffective(
                 StmtContext<QName, IfFeatureStatement, EffectiveStatement<QName, IfFeatureStatement>> ctx) {
-            throw new UnsupportedOperationException();
+            return new IfFeatureEffectiveStatementImpl(ctx);
         }
 
     }
index 2f9eb15799a1de0b1631ed5d3a78d46427d2d21b..01451c92d4c7335639eb71227770f7665cec3fa2 100644 (file)
@@ -9,6 +9,9 @@ package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
 
 import static org.opendaylight.yangtools.yang.parser.spi.meta.ModelProcessingPhase.SOURCE_LINKAGE;
 import static org.opendaylight.yangtools.yang.parser.spi.meta.StmtContextUtils.firstAttributeOf;
+
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.ImportEffectiveStatementImpl;
+
 import org.opendaylight.yangtools.yang.parser.spi.source.ImpPrefixToModuleIdentifier;
 import org.opendaylight.yangtools.yang.model.api.stmt.PrefixStatement;
 import com.google.common.base.Optional;
@@ -53,7 +56,7 @@ public class ImportStatementDefinition extends
     @Override
     public EffectiveStatement<String, ImportStatement> createEffective(
             StmtContext<String, ImportStatement, EffectiveStatement<String, ImportStatement>> ctx) {
-        throw new UnsupportedOperationException();
+        return new ImportEffectiveStatementImpl(ctx);
     }
 
     @Override
index 5305e3ba67b52f9929fc838d9b0b370524946e68..4b425c33e161b5c5653e9d53280ac4024bbc8adc 100644 (file)
@@ -10,11 +10,12 @@ package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
 import static org.opendaylight.yangtools.yang.parser.spi.meta.ModelProcessingPhase.SOURCE_LINKAGE;
 import static org.opendaylight.yangtools.yang.parser.spi.meta.StmtContextUtils.firstAttributeOf;
 
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.IncludeEffectiveStatementImpl;
+
 import java.net.URI;
 import java.text.ParseException;
 import java.util.Collection;
 import java.util.Date;
-
 import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil;
 import org.opendaylight.yangtools.yang.model.api.ModuleIdentifier;
 import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
@@ -33,7 +34,6 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.ModelActionBuilder.Prereq
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext.Mutable;
 import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
-
 import com.google.common.base.Optional;
 
 public class IncludeStatementImpl extends AbstractDeclaredStatement<String> implements IncludeStatement {
@@ -62,7 +62,7 @@ public class IncludeStatementImpl extends AbstractDeclaredStatement<String> impl
         @Override
         public EffectiveStatement<String, IncludeStatement> createEffective(
                 StmtContext<String, IncludeStatement, EffectiveStatement<String, IncludeStatement>> ctx) {
-            throw new UnsupportedOperationException();
+            return new IncludeEffectiveStatementImpl(ctx);
         }
 
         @Override
index 14a739154710a39be119d1f8f7ea01f2f96381b1..e0b7189a3fc1c0c6d9a535063b1bf4f6155af321 100644 (file)
@@ -7,6 +7,9 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
 
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.InputEffectiveStatementImpl;
+
+import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
 import java.util.Collection;
 import org.opendaylight.yangtools.yang.model.api.stmt.DataDefinitionStatement;
@@ -19,38 +22,38 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractDeclaredStatement
 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
-public class InputStatementImpl extends AbstractDeclaredStatement<Void>
+public class InputStatementImpl extends AbstractDeclaredStatement<QName>
         implements InputStatement {
 
-    protected InputStatementImpl(
-            StmtContext<Void, InputStatement, ?> context) {
+    protected InputStatementImpl(StmtContext<QName, InputStatement, ?> context) {
         super(context);
     }
 
     public static class Definition
             extends
-            AbstractStatementSupport<Void, InputStatement, EffectiveStatement<Void, InputStatement>> {
+            AbstractStatementSupport<QName, InputStatement, EffectiveStatement<QName, InputStatement>> {
 
         public Definition() {
             super(Rfc6020Mapping.INPUT);
         }
 
         @Override
-        public Void parseArgumentValue(StmtContext<?, ?, ?> ctx, String value)
+        public QName parseArgumentValue(StmtContext<?, ?, ?> ctx, String value)
                 throws SourceException {
-            return null;
+            value = "input";
+            return Utils.qNameFromArgument(ctx, value);
         }
 
         @Override
         public InputStatement createDeclared(
-                StmtContext<Void, InputStatement, ?> ctx) {
+                StmtContext<QName, InputStatement, ?> ctx) {
             return new InputStatementImpl(ctx);
         }
 
         @Override
-        public EffectiveStatement<Void, InputStatement> createEffective(
-                StmtContext<Void, InputStatement, EffectiveStatement<Void, InputStatement>> ctx) {
-            throw new UnsupportedOperationException();
+        public EffectiveStatement<QName, InputStatement> createEffective(
+                StmtContext<QName, InputStatement, EffectiveStatement<QName, InputStatement>> ctx) {
+            return new InputEffectiveStatementImpl(ctx);
         }
 
     }
@@ -70,4 +73,3 @@ public class InputStatementImpl extends AbstractDeclaredStatement<Void>
         return allDeclared(DataDefinitionStatement.class);
     }
 }
-
index f80e0cd8c38d5ceab1a5a6489127e9bb373b410e..d0ec799c514233305b5cc72386eee444bcb9a693 100644 (file)
@@ -7,11 +7,12 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
 
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.KeyEffectiveStatementImpl;
+
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
-
 import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.KeyStatement;
@@ -20,7 +21,6 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractDeclaredStatement
 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
-
 import com.google.common.base.Splitter;
 
 public class KeyStatementImpl extends AbstractDeclaredStatement<Collection<SchemaNodeIdentifier>> implements
@@ -72,7 +72,7 @@ public class KeyStatementImpl extends AbstractDeclaredStatement<Collection<Schem
         @Override
         public EffectiveStatement<Collection<SchemaNodeIdentifier>, KeyStatement> createEffective(
                 StmtContext<Collection<SchemaNodeIdentifier>, KeyStatement, EffectiveStatement<Collection<SchemaNodeIdentifier>, KeyStatement>> ctx) {
-            throw new UnsupportedOperationException();
+            return new KeyEffectiveStatementImpl(ctx);
         }
     }
 
index 032e1b9ade8f42ba522806cd87e34d446076e10d..06de848b2fc32cd8a47a5d21e2ee91d10f0384c5 100644 (file)
@@ -7,9 +7,10 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
 
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.LeafListEffectiveStatementImpl;
+
 import org.opendaylight.yangtools.yang.model.api.stmt.TypeStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.UnitsStatement;
-
 import org.opendaylight.yangtools.yang.model.api.stmt.MaxElementsStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.MinElementsStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.MustStatement;
@@ -63,7 +64,7 @@ public class LeafListStatementImpl extends AbstractDeclaredStatement<QName>
         @Override
         public EffectiveStatement<QName, LeafListStatement> createEffective(
                 StmtContext<QName, LeafListStatement, EffectiveStatement<QName, LeafListStatement>> ctx) {
-            throw new UnsupportedOperationException();
+            return new LeafListEffectiveStatementImpl(ctx);
         }
     }
 
index 4e06178ec10c93933890ac8913365346ecc1f6c2..9a9b88297b3afd10178d5a2dd43024f3d85201e4 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
 
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.LeafEffectiveStatementImpl;
+
 import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
@@ -26,7 +28,6 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractDeclaredStatement
 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
-
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 import java.util.Collection;
@@ -55,7 +56,7 @@ public class LeafStatementImpl extends AbstractDeclaredStatement<QName> implemen
 
         @Override public EffectiveStatement<QName, LeafStatement> createEffective(
                 StmtContext<QName, LeafStatement, EffectiveStatement<QName, LeafStatement>> ctx) {
-            throw new UnsupportedOperationException();
+            return new LeafEffectiveStatementImpl(ctx);
         }
     }
 
index bf959f8a4cca4ebce4e380ff7d76080151c97aa3..1c698397c2121e55fbb1f70f08ace12638297818 100644 (file)
@@ -7,11 +7,12 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
 
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.LengthEffectiveStatementImpl;
+
 import org.opendaylight.yangtools.yang.model.api.stmt.DescriptionStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.ErrorAppTagStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.ErrorMessageStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.ReferenceStatement;
-
 import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.LengthStatement;
@@ -49,7 +50,7 @@ public class LengthStatementImpl extends AbstractDeclaredStatement<String>
         @Override
         public EffectiveStatement<String, LengthStatement> createEffective(
                 StmtContext<String, LengthStatement, EffectiveStatement<String, LengthStatement>> ctx) {
-            throw new UnsupportedOperationException();
+            return new LengthEffectiveStatementImpl(ctx);
         }
 
     }
index 3279abc8ff323d3d44dc275cf3daf4866eec3703..f7249730393fa2ae9e14f00f4e65f054bd61fecc 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
 
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.ListEffectiveStatementImpl;
+
 import org.opendaylight.yangtools.yang.model.api.stmt.DataDefinitionStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.GroupingStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.KeyStatement;
@@ -16,7 +18,6 @@ import org.opendaylight.yangtools.yang.model.api.stmt.MustStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.OrderedByStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.TypedefStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.UniqueStatement;
-
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
@@ -65,7 +66,7 @@ public class ListStatementImpl extends AbstractDeclaredStatement<QName>
         @Override
         public EffectiveStatement<QName, ListStatement> createEffective(
                 StmtContext<QName, ListStatement, EffectiveStatement<QName, ListStatement>> ctx) {
-            throw new UnsupportedOperationException();
+            return new ListEffectiveStatementImpl(ctx);
         }
     }
 
index fd9331f9220baf7ef5de53be490c82afa2295175..d2b30d071b83a5b097eae06e20b4465470cccdfc 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
 
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.MandatoryEffectiveStatementImpl;
+
 import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.MandatoryStatement;
@@ -14,7 +16,6 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractDeclaredStatement
 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
-
 import javax.annotation.Nonnull;
 
 public class MandatoryStatementImpl extends AbstractDeclaredStatement<Boolean> implements
@@ -43,7 +44,7 @@ public class MandatoryStatementImpl extends AbstractDeclaredStatement<Boolean> i
 
         @Override public EffectiveStatement<Boolean, MandatoryStatement> createEffective(
                 StmtContext<Boolean, MandatoryStatement, EffectiveStatement<Boolean, MandatoryStatement>> ctx) {
-            throw new UnsupportedOperationException();
+            return new MandatoryEffectiveStatementImpl(ctx);
         }
     }
 
index ed0f27e3b6ec35855334aeb5e50bbfc0ce5e4730..d9be7536882b13b043a00684cb7882e75c3f5034 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
 
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.MaxElementsEffectiveStatementImpl;
+
 import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.MaxElementsStatement;
@@ -44,7 +46,7 @@ public class MaxElementsStatementImpl extends AbstractDeclaredStatement<String>
         @Override
         public EffectiveStatement<String, MaxElementsStatement> createEffective(
                 StmtContext<String, MaxElementsStatement, EffectiveStatement<String, MaxElementsStatement>> ctx) {
-            throw new UnsupportedOperationException();
+            return new MaxElementsEffectiveStatementImpl(ctx);
         }
 
     }
index b0b1ab033a234e3c71413a9d7fac54e3b24a3ed2..bb66ed69e54df705bdc5523f1d14df869a80ed53 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
 
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.MinElementsEffectiveStatementImpl;
+
 import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.MinElementsStatement;
@@ -44,7 +46,7 @@ public class MinElementsStatementImpl extends AbstractDeclaredStatement<String>
         @Override
         public EffectiveStatement<String, MinElementsStatement> createEffective(
                 StmtContext<String, MinElementsStatement, EffectiveStatement<String, MinElementsStatement>> ctx) {
-            throw new UnsupportedOperationException();
+            return new MinElementsEffectiveStatementImpl(ctx);
         }
 
     }
index fb2eb3892400813439605c6ac6287c6bb24f376f..3324b876e2c09bd5c810f71d23f0780f531002e7 100644 (file)
@@ -36,10 +36,11 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext.Mutable;
 import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
 
-public class ModuleStatementSupport
-        extends
+public class ModuleStatementSupport extends
         AbstractStatementSupport<String, ModuleStatement, EffectiveStatement<String, ModuleStatement>> {
 
+    private QNameModule qNameModule;
+
     public ModuleStatementSupport() {
         super(Rfc6020Mapping.MODULE);
     }
@@ -50,8 +51,7 @@ public class ModuleStatementSupport
     }
 
     @Override
-    public ModuleStatement createDeclared(
-            StmtContext<String, ModuleStatement, ?> ctx) {
+    public ModuleStatement createDeclared(StmtContext<String, ModuleStatement, ?> ctx) {
         return new ModuleStatementImpl(ctx);
     }
 
@@ -62,34 +62,29 @@ public class ModuleStatementSupport
     }
 
     @Override
-    public void onLinkageDeclared(
-            Mutable<String, ModuleStatement, EffectiveStatement<String, ModuleStatement>> stmt)
+    public void onLinkageDeclared(Mutable<String, ModuleStatement, EffectiveStatement<String, ModuleStatement>> stmt)
             throws InferenceException, SourceException {
 
-        Optional<URI> moduleNs = Optional.fromNullable(firstAttributeOf(
-                stmt.declaredSubstatements(), NamespaceStatement.class));
+        Optional<URI> moduleNs = Optional.fromNullable(firstAttributeOf(stmt.declaredSubstatements(),
+                NamespaceStatement.class));
         if (!moduleNs.isPresent()) {
-            throw new IllegalArgumentException("Namespace of the module ["
-                    + stmt.getStatementArgument() + "] is missing.");
+            throw new IllegalArgumentException("Namespace of the module [" + stmt.getStatementArgument()
+                    + "] is missing.");
         }
 
-        Optional<Date> revisionDate = Optional.fromNullable(firstAttributeOf(
-                stmt.declaredSubstatements(), RevisionStatement.class));
+        Optional<Date> revisionDate = Optional.fromNullable(firstAttributeOf(stmt.declaredSubstatements(),
+                RevisionStatement.class));
 
-        QNameModule qNameModule = QNameModule.create(moduleNs.get(),
-                revisionDate.orNull());
-        ModuleIdentifier moduleIdentifier = new ModuleIdentifierImpl(
-                stmt.getStatementArgument(), Optional.<URI> absent(),
-                revisionDate);
+        qNameModule = QNameModule.create(moduleNs.get(), revisionDate.orNull());
+        ModuleIdentifier moduleIdentifier = new ModuleIdentifierImpl(stmt.getStatementArgument(),
+                Optional.<URI> absent(), revisionDate);
 
         stmt.addContext(ModuleNamespace.class, moduleIdentifier, stmt);
         stmt.addContext(NamespaceToModule.class, qNameModule, stmt);
 
-        String modulePrefix = firstAttributeOf(stmt.declaredSubstatements(),
-                PrefixStatement.class);
+        String modulePrefix = firstAttributeOf(stmt.declaredSubstatements(), PrefixStatement.class);
         if (modulePrefix == null) {
-            throw new IllegalArgumentException("Prefix of the module ["
-                    + stmt.getStatementArgument() + "] is missing.");
+            throw new IllegalArgumentException("Prefix of the module [" + stmt.getStatementArgument() + "] is missing.");
         }
 
         stmt.addToNs(PrefixToModule.class, modulePrefix, qNameModule);
@@ -98,27 +93,13 @@ public class ModuleStatementSupport
         stmt.addToNs(ModuleIdentifierToModuleQName.class, moduleIdentifier, qNameModule);
 
         stmt.addToNs(ImpPrefixToModuleIdentifier.class, modulePrefix, moduleIdentifier);
-
     }
 
+    @Override
+    public void onFullDefinitionDeclared(
+            final Mutable<String, ModuleStatement, EffectiveStatement<String, ModuleStatement>> stmt)
+            throws SourceException {
 
-
-//    @Override
-//    public void onFullDefinitionDeclared(
-//            Mutable<String, ModuleStatement, EffectiveStatement<String, ModuleStatement>> stmt)
-//            throws InferenceException, SourceException {
-//
-//        Optional<Date> revisionDate = Optional.fromNullable(firstAttributeOf(
-//                stmt.declaredSubstatements(), RevisionStatement.class));
-//
-//        ModuleIdentifier moduleIdentifier = new ModuleIdentifierImpl(
-//                stmt.getStatementArgument(), Optional.<URI> absent(),
-//                revisionDate);
-//
-//        String modulePrefix = firstAttributeOf(stmt.declaredSubstatements(),
-//                PrefixStatement.class);
-//
-//        stmt.addToNs(ImpPrefixToModuleIdentifier.class, modulePrefix, moduleIdentifier);
-//    }
-
+        stmt.addContext(NamespaceToModule.class, qNameModule, stmt);
+    }
 }
\ No newline at end of file
index c326f4c4c93ea0212a6b4885aa99a9b3fc69dfa0..5df5575050d930ef3383899b2a54b87ce3ff4e6e 100644 (file)
@@ -1,5 +1,7 @@
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
 
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.MustEffectiveStatementImpl;
+
 import org.opendaylight.yangtools.yang.model.api.RevisionAwareXPath;
 import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
@@ -13,7 +15,6 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractDeclaredStatement
 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
-
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 
@@ -43,7 +44,7 @@ public class MustStatementImpl extends AbstractDeclaredStatement<RevisionAwareXP
 
         @Override public EffectiveStatement<RevisionAwareXPath, MustStatement> createEffective(
                 StmtContext<RevisionAwareXPath, MustStatement, EffectiveStatement<RevisionAwareXPath, MustStatement>> ctx) {
-            throw new UnsupportedOperationException();
+            return new MustEffectiveStatementImpl(ctx);
         }
     }
 
index db4f195602955a7ce46008593cfff6dfc841f793..31aa579d3398b6060980657565e2db6049f24d1f 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
 
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.NotificationEffectiveStatementImpl;
+
 import javax.annotation.Nullable;
 import java.util.Collection;
 import org.opendaylight.yangtools.yang.model.api.stmt.DataDefinitionStatement;
@@ -53,7 +55,7 @@ public class NotificationStatementImpl extends AbstractDeclaredStatement<QName>
         @Override
         public EffectiveStatement<QName, NotificationStatement> createEffective(
                 StmtContext<QName, NotificationStatement, EffectiveStatement<QName, NotificationStatement>> ctx) {
-            throw new UnsupportedOperationException();
+            return new NotificationEffectiveStatementImpl(ctx);
         }
 
     }
index f47c68a2f29c965de93d3a3bb70b43a3c7b9bd0b..eb9872e1eb47620bd7f9f5667db16f0d417517fd 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
 
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.OrderedByEffectiveStatementImpl;
+
 import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.OrderedByStatement;
@@ -44,7 +46,7 @@ public class OrderedByStatementImpl extends AbstractDeclaredStatement<String>
         @Override
         public EffectiveStatement<String, OrderedByStatement> createEffective(
                 StmtContext<String, OrderedByStatement, EffectiveStatement<String, OrderedByStatement>> ctx) {
-            throw new UnsupportedOperationException();
+            return new OrderedByEffectiveStatementImpl(ctx);
         }
 
     }
index 11f38b1da14de0e61e17c3522ffdfe8cf0db7fcb..afdab511a29645695b5202c4daa578530613f14d 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
 
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.OrganizationEffectiveStatementImpl;
+
 import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.OrganizationStatement;
@@ -14,8 +16,8 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractDeclaredStatement
 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
-public class OrganizationStatementImpl extends AbstractDeclaredStatement<String>
-        implements OrganizationStatement {
+public class OrganizationStatementImpl extends
+        AbstractDeclaredStatement<String> implements OrganizationStatement {
 
     protected OrganizationStatementImpl(
             StmtContext<String, OrganizationStatement, ?> context) {
@@ -44,7 +46,7 @@ public class OrganizationStatementImpl extends AbstractDeclaredStatement<String>
         @Override
         public EffectiveStatement<String, OrganizationStatement> createEffective(
                 StmtContext<String, OrganizationStatement, EffectiveStatement<String, OrganizationStatement>> ctx) {
-            throw new UnsupportedOperationException();
+            return new OrganizationEffectiveStatementImpl(ctx);
         }
 
     }
index 53044b435dc1c9982713cb7b23293c2dd9288f72..f362fbf4abaf1044f5461909d06bb6b8983396a3 100644 (file)
@@ -7,6 +7,9 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
 
+import org.opendaylight.yangtools.yang.common.QName;
+
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.OutputEffectiveStatementImpl;
 import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
 import java.util.Collection;
 import org.opendaylight.yangtools.yang.model.api.stmt.DataDefinitionStatement;
@@ -19,38 +22,39 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractDeclaredStatement
 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
-public class OutputStatementImpl extends AbstractDeclaredStatement<Void>
+public class OutputStatementImpl extends AbstractDeclaredStatement<QName>
         implements OutputStatement {
 
     protected OutputStatementImpl(
-            StmtContext<Void, OutputStatement, ?> context) {
+            StmtContext<QName, OutputStatement, ?> context) {
         super(context);
     }
 
     public static class Definition
             extends
-            AbstractStatementSupport<Void, OutputStatement, EffectiveStatement<Void, OutputStatement>> {
+            AbstractStatementSupport<QName, OutputStatement, EffectiveStatement<QName, OutputStatement>> {
 
         public Definition() {
             super(Rfc6020Mapping.OUTPUT);
         }
 
         @Override
-        public Void parseArgumentValue(StmtContext<?, ?, ?> ctx, String value)
+        public QName parseArgumentValue(StmtContext<?, ?, ?> ctx, String value)
                 throws SourceException {
-            return null;
+            value = "output";
+            return Utils.qNameFromArgument(ctx, value);
         }
 
         @Override
         public OutputStatement createDeclared(
-                StmtContext<Void, OutputStatement, ?> ctx) {
+                StmtContext<QName, OutputStatement, ?> ctx) {
             return new OutputStatementImpl(ctx);
         }
 
         @Override
-        public EffectiveStatement<Void, OutputStatement> createEffective(
-                StmtContext<Void, OutputStatement, EffectiveStatement<Void, OutputStatement>> ctx) {
-            throw new UnsupportedOperationException();
+        public EffectiveStatement<QName, OutputStatement> createEffective(
+                StmtContext<QName, OutputStatement, EffectiveStatement<QName, OutputStatement>> ctx) {
+            return new OutputEffectiveStatementImpl(ctx);
         }
 
     }
index 714c943adc847f8c8bf524195f8b7bcddc89c486..41c28754860bb8a07fe39fdd7fb25a060ce47e4b 100644 (file)
@@ -7,11 +7,12 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
 
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.PatternEffectiveStatementImpl;
+
 import org.opendaylight.yangtools.yang.model.api.stmt.DescriptionStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.ErrorAppTagStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.ErrorMessageStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.ReferenceStatement;
-
 import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.PatternStatement;
@@ -49,7 +50,7 @@ public class PatternStatementImpl extends AbstractDeclaredStatement<String>
         @Override
         public EffectiveStatement<String, PatternStatement> createEffective(
                 StmtContext<String, PatternStatement, EffectiveStatement<String, PatternStatement>> ctx) {
-            throw new UnsupportedOperationException();
+            return new PatternEffectiveStatementImpl(ctx);
         }
 
     }
index 0d0de1aae4e03967d77ba3c747dbff0ebc62af79..9496c69b751b2ee27afd946eb9202c3afb709bf0 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
 
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.PositionEffectiveStatementImpl;
+
 import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.PositionStatement;
@@ -44,7 +46,7 @@ public class PositionStatementImpl extends AbstractDeclaredStatement<String>
         @Override
         public EffectiveStatement<String, PositionStatement> createEffective(
                 StmtContext<String, PositionStatement, EffectiveStatement<String, PositionStatement>> ctx) {
-            throw new UnsupportedOperationException();
+            return new PositionEffectiveStatementImpl(ctx);
         }
 
     }
index d57c353a34674be273c1112c6c938a93bed3e4c4..bd16e1fc941147d095c57ab28eacfac2954b2374 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
 
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.RangeEffectiveStatementImpl;
+
 import org.opendaylight.yangtools.yang.model.api.stmt.DescriptionStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.ErrorAppTagStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.ErrorMessageStatement;
@@ -48,7 +50,7 @@ public class RangeStatementImpl extends AbstractDeclaredStatement<String>
         @Override
         public EffectiveStatement<String, RangeStatement> createEffective(
                 StmtContext<String, RangeStatement, EffectiveStatement<String, RangeStatement>> ctx) {
-            throw new UnsupportedOperationException();
+            return new RangeEffectiveStatementImpl(ctx);
         }
 
     }
index 73f2163cc12546388d5ccfb5c9d803cb9cc2f079..4ab19956b374d7f3ac5b2527468a0ee3fc294c5f 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
 
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.RefineEffectiveStatementImpl;
+
 import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.DescriptionStatement;
@@ -17,7 +19,6 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractDeclaredStatement
 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
-
 import javax.annotation.Nullable;
 
 public class RefineStatementImpl extends AbstractDeclaredStatement<SchemaNodeIdentifier> implements RefineStatement {
@@ -46,7 +47,7 @@ public class RefineStatementImpl extends AbstractDeclaredStatement<SchemaNodeIde
 
         @Override
         public EffectiveStatement<SchemaNodeIdentifier, RefineStatement> createEffective(StmtContext<SchemaNodeIdentifier, RefineStatement, EffectiveStatement<SchemaNodeIdentifier, RefineStatement>> ctx) {
-            throw new UnsupportedOperationException();
+            return new RefineEffectiveStatementImpl(ctx);
         }
     }
 
index 2d43039aff075adba669add665051796aac1a44f..0573fc310d25da9303390f040ba257ba1f873a2c 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
 
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.RequireInstanceEffectiveStatementImpl;
+
 import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.RequireInstanceStatement;
@@ -44,7 +46,7 @@ public class RequireInstanceStatementImpl extends
         @Override
         public EffectiveStatement<Boolean, RequireInstanceStatement> createEffective(
                 StmtContext<Boolean, RequireInstanceStatement, EffectiveStatement<Boolean, RequireInstanceStatement>> ctx) {
-            throw new UnsupportedOperationException();
+            return new RequireInstanceEffectiveStatementImpl(ctx);
         }
 
     }
index 7918d7a7bad69268ef92181abbd672fff738a545..301978546cccecde28ea28e56a11419f757129d0 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
 
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.RevisionDateEffectiveStatementImpl;
+
 import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.RevisionDateStatement;
@@ -44,7 +46,7 @@ public class RevisionDateStatementImpl extends
         @Override
         public EffectiveStatement<String, RevisionDateStatement> createEffective(
                 StmtContext<String, RevisionDateStatement, EffectiveStatement<String, RevisionDateStatement>> ctx) {
-            throw new UnsupportedOperationException();
+            return new RevisionDateEffectiveStatementImpl(ctx);
         }
 
     }
index 640a24f67283f2422de0fba1cbbb2167009ecf14..8297e156749fe2633986160bacbd5da5049533e8 100644 (file)
@@ -7,8 +7,9 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
 
-import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.RevisionEffectiveStatementImpl;
 
+import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil;
 import java.text.ParseException;
 import java.util.Date;
 import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
@@ -61,7 +62,7 @@ public class RevisionStatementImpl extends AbstractDeclaredStatement<Date>
         @Override
         public EffectiveStatement<Date, RevisionStatement> createEffective(
                 StmtContext<Date, RevisionStatement, EffectiveStatement<Date, RevisionStatement>> ctx) {
-            throw new UnsupportedOperationException();
+            return new RevisionEffectiveStatementImpl(ctx);
         }
     }
 
index 5d68f3700f4e3b200259743fbeec6db63b33e276..c5c727dfafd48a4f4f9c4632bf1def0ddb53c743 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
 
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.RpcEffectiveStatementImpl;
+
 import javax.annotation.Nullable;
 import java.util.Collection;
 import org.opendaylight.yangtools.yang.model.api.stmt.DescriptionStatement;
@@ -54,7 +56,7 @@ public class RpcStatementImpl extends AbstractDeclaredStatement<QName>
         @Override
         public EffectiveStatement<QName, RpcStatement> createEffective(
                 StmtContext<QName, RpcStatement, EffectiveStatement<QName, RpcStatement>> ctx) {
-            throw new UnsupportedOperationException();
+            return new RpcEffectiveStatementImpl(ctx);
         }
 
     }
index 323722e7fc904e2ecbf0fdcfc3bee74a1e981d25..b7401e56d2d5ebc940c49d61c6631475ca809eb3 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
 
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.StatusEffectiveStatementImpl;
+
 import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.StatusStatement;
@@ -44,7 +46,7 @@ public class StatusStatementImpl extends AbstractDeclaredStatement<String>
         @Override
         public EffectiveStatement<String, StatusStatement> createEffective(
                 StmtContext<String, StatusStatement, EffectiveStatement<String, StatusStatement>> ctx) {
-            throw new UnsupportedOperationException();
+            return new StatusEffectiveStatementImpl(ctx);
         }
 
     }
index 2778d3f6491d7013a1908f82860e962756d4ca84..f61576b4f5ac35f231d25f470e94abfd2a862f17 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
 
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.UnitsEffectiveStatementImpl;
+
 import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.UnitsStatement;
@@ -43,7 +45,7 @@ public class UnitsStatementImpl extends AbstractDeclaredStatement<String>
         @Override
         public EffectiveStatement<String, UnitsStatement> createEffective(
                 StmtContext<String, UnitsStatement, EffectiveStatement<String, UnitsStatement>> ctx) {
-            throw new UnsupportedOperationException();
+            return new UnitsEffectiveStatementImpl(ctx);
         }
 
     }
index e1058c9f98a841ce11e97e3cec0baf0e43c58257..631fb31795418774dc8158ac15e6314d408cce03 100644 (file)
@@ -9,10 +9,8 @@ package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
 
 import static org.opendaylight.yangtools.yang.parser.spi.meta.ModelProcessingPhase.FULL_DECLARATION;
 
-import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.UsesEffectiveStatementImpl;
-import org.opendaylight.yangtools.yang.parser.stmt.reactor.StatementContextBase;
-import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
 import java.util.Collection;
+
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
 import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
@@ -35,16 +33,17 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.ModelActionBuilder;
 import org.opendaylight.yangtools.yang.parser.spi.meta.ModelActionBuilder.InferenceAction;
 import org.opendaylight.yangtools.yang.parser.spi.meta.ModelActionBuilder.Prerequisite;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
+import org.opendaylight.yangtools.yang.parser.stmt.reactor.StatementContextBase;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.UsesEffectiveStatementImpl;
 
-public class UsesStatementImpl extends AbstractDeclaredStatement<QName>
-        implements UsesStatement {
+public class UsesStatementImpl extends AbstractDeclaredStatement<QName> implements UsesStatement {
 
     protected UsesStatementImpl(StmtContext<QName, UsesStatement, ?> context) {
         super(context);
     }
 
-    public static class Definition
-            extends
+    public static class Definition extends
             AbstractStatementSupport<QName, UsesStatement, EffectiveStatement<QName, UsesStatement>> {
 
         public Definition() {
@@ -57,23 +56,29 @@ public class UsesStatementImpl extends AbstractDeclaredStatement<QName>
         }
 
         @Override
-        public void onFullDefinitionDeclared(final StmtContext.Mutable<QName,UsesStatement,EffectiveStatement<QName,UsesStatement>> usesNode) throws InferenceException ,SourceException {
+        public void onFullDefinitionDeclared(
+                final StmtContext.Mutable<QName, UsesStatement, EffectiveStatement<QName, UsesStatement>> usesNode)
+                throws InferenceException, SourceException {
 
             ModelActionBuilder usesAction = usesNode.newInferenceAction(FULL_DECLARATION);
             final QName groupingName = usesNode.getStatementArgument();
 
-            final Prerequisite<StmtContext<?, ?, ?>> sourceGroupingPre = usesAction.requiresCtx(usesNode, GroupingNamespace.class, groupingName, FULL_DECLARATION);
-            final Prerequisite< ?extends StmtContext.Mutable<?,?,?>> targetNodePre = usesAction.mutatesCtx(usesNode.getParentContext(), FULL_DECLARATION);
+            final Prerequisite<StmtContext<?, ?, ?>> sourceGroupingPre = usesAction.requiresCtx(usesNode,
+                    GroupingNamespace.class, groupingName, FULL_DECLARATION);
+            final Prerequisite<? extends StmtContext.Mutable<?, ?, ?>> targetNodePre = usesAction.mutatesCtx(
+                    usesNode.getParentContext(), FULL_DECLARATION);
 
             usesAction.apply(new InferenceAction() {
 
                 @Override
                 public void apply() throws InferenceException {
-                    StatementContextBase<?, ?, ?> targetNodeStmtCtx =  (StatementContextBase<?, ?, ?>) targetNodePre.get();
-                    StatementContextBase<?, ?, ?> sourceGrpStmtCtx = (StatementContextBase<?, ?, ?>) sourceGroupingPre.get();
+                    StatementContextBase<?, ?, ?> targetNodeStmtCtx = (StatementContextBase<?, ?, ?>) targetNodePre
+                            .get();
+                    StatementContextBase<?, ?, ?> sourceGrpStmtCtx = (StatementContextBase<?, ?, ?>) sourceGroupingPre
+                            .get();
 
                     try {
-                        GroupingUtils.copyFromSourceToTarget(sourceGrpStmtCtx,targetNodeStmtCtx);
+                        GroupingUtils.copyFromSourceToTarget(sourceGrpStmtCtx, targetNodeStmtCtx);
                         GroupingUtils.resolveUsesNode(usesNode, targetNodeStmtCtx);
                     } catch (SourceException e) {
                         // TODO Auto-generated catch block
@@ -83,10 +88,11 @@ public class UsesStatementImpl extends AbstractDeclaredStatement<QName>
 
                 @Override
                 public void prerequisiteFailed(Collection<? extends Prerequisite<?>> failed) throws InferenceException {
-                    if(failed.contains(sourceGroupingPre)) {
-                        throw new InferenceException("Grouping " + groupingName + " was not resoled.", usesNode.getStatementSourceReference());
+                    if (failed.contains(sourceGroupingPre)) {
+                        throw new InferenceException("Grouping " + groupingName + " was not resovled.", usesNode
+                                .getStatementSourceReference());
                     }
-                    throw new InferenceException("Unknown error occured.", usesNode.getStatementSourceReference());
+                    throw new InferenceException("Unknown error occurred.", usesNode.getStatementSourceReference());
                 }
 
             });
@@ -94,8 +100,7 @@ public class UsesStatementImpl extends AbstractDeclaredStatement<QName>
         }
 
         @Override
-        public UsesStatement createDeclared(
-                StmtContext<QName, UsesStatement, ?> ctx) {
+        public UsesStatement createDeclared(StmtContext<QName, UsesStatement, ?> ctx) {
             return new UsesStatementImpl(ctx);
         }
 
index aa9899850b4569c68892eb0ef08dcc2303775f7f..456d124a5d774c352901f7634404b9dc1cf391c0 100644 (file)
@@ -14,19 +14,26 @@ import java.net.URISyntaxException;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Date;
+import java.util.Iterator;
+import java.util.LinkedList;
 import java.util.List;
+
+import javax.annotation.Nullable;
 import javax.xml.xpath.XPath;
 import javax.xml.xpath.XPathExpressionException;
 import javax.xml.xpath.XPathFactory;
+
 import org.antlr.v4.runtime.tree.TerminalNode;
 import org.opendaylight.yangtools.antlrv4.code.gen.YangStatementParser;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.QNameModule;
 import org.opendaylight.yangtools.yang.model.api.ModuleIdentifier;
+import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 import org.opendaylight.yangtools.yang.model.api.meta.StatementSource;
 import org.opendaylight.yangtools.yang.model.api.stmt.BelongsToStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.ModuleStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.PrefixStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier;
 import org.opendaylight.yangtools.yang.model.api.stmt.SubmoduleStatement;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContextUtils;
@@ -36,6 +43,8 @@ import org.opendaylight.yangtools.yang.parser.spi.source.ModuleIdentifierToModul
 import org.opendaylight.yangtools.yang.parser.spi.source.ModuleNameToModuleQName;
 import org.opendaylight.yangtools.yang.parser.spi.source.PrefixToModule;
 import org.opendaylight.yangtools.yang.parser.spi.source.StatementSourceReference;
+import org.opendaylight.yangtools.yang.parser.stmt.reactor.StatementContextBase;
+
 import com.google.common.base.CharMatcher;
 import com.google.common.base.Splitter;
 
@@ -44,11 +53,9 @@ public class Utils {
     private static final CharMatcher DOUBLE_QUOTE_MATCHER = CharMatcher.is('"');
     private static final CharMatcher SINGLE_QUOTE_MATCHER = CharMatcher.is('\'');
 
-    private static final char SEPARATOR_QNAME = '/';
+    private static final char SEPARATOR_NODENAME = '/';
 
     private static final String REGEX_PATH_ABS = "/[^/].+";
-    private static final String REGEX_PATH_REL1 = "\\.\\.?\\s*/(.+)";
-    private static final String REGEX_PATH_REL2 = "//.*";
 
     public static final StatementSourceReference CONTEXT_REF = new StatementSourceReference() {
 
@@ -58,6 +65,12 @@ public class Utils {
         }
     };
 
+    public static List<String> splitPathToNodeNames(String path) {
+
+        Splitter keySplitter = Splitter.on(SEPARATOR_NODENAME).omitEmptyStrings().trimResults();
+        return keySplitter.splitToList(path);
+    }
+
     public static void validateXPath(String path) {
 
         final XPath xPath = XPathFactory.newInstance().newXPath();
@@ -80,8 +93,7 @@ public class Utils {
 
         validateXPath(path);
 
-        Splitter keySplitter = Splitter.on(SEPARATOR_QNAME).omitEmptyStrings().trimResults();
-        List<String> nodeNames = keySplitter.splitToList(path);
+        List<String> nodeNames = splitPathToNodeNames(path);
         List<QName> qNames = new ArrayList<>();
 
         for (String nodeName : nodeNames) {
@@ -96,16 +108,6 @@ public class Utils {
         return qNames;
     }
 
-    public static Iterable<QName> parseAugmentPath(StmtContext<?, ?, ?> ctx, String path) {
-
-        if (path.matches(REGEX_PATH_REL1) || path.matches(REGEX_PATH_REL2)) {
-            throw new IllegalArgumentException(
-                    "An argument for augment can be only absolute path; or descendant if used in uses");
-        }
-
-        return parseXPath(ctx, path);
-    }
-
     public static String stringFromStringContext(final YangStatementParser.ArgumentContext context) {
         StringBuilder sb = new StringBuilder();
         List<TerminalNode> strings = context.STRING();
@@ -175,4 +177,60 @@ public class Utils {
 
         return QName.create(qNameModule, localName);
     }
+
+    @Nullable
+    public static StatementContextBase<?, ?, ?> findCtxOfNodeInRoot(StatementContextBase<?, ?, ?> rootStmtCtx,
+            final SchemaNodeIdentifier node) {
+
+        StatementContextBase<?, ?, ?> parent = rootStmtCtx;
+        final Iterator<QName> pathIter = node.getPathFromRoot().iterator();
+
+        QName targetNode = pathIter.next();
+
+        while (pathIter.hasNext()) {
+
+            for (StatementContextBase<?, ?, ?> child : parent.declaredSubstatements()) {
+
+                if (targetNode.equals(child.getStatementArgument())) {
+                    parent = child;
+                    targetNode = pathIter.next();
+                }
+            }
+
+            if (parent.equals(rootStmtCtx)) {
+
+                return null;
+            }
+        }
+
+        StatementContextBase<?, ?, ?> targetCtx = null;
+
+        for (StatementContextBase<?, ?, ?> child : parent.declaredSubstatements()) {
+
+            if (targetNode.equals(child.getStatementArgument())) {
+                targetCtx = child;
+            }
+        }
+
+        return targetCtx;
+    }
+
+    public static SchemaPath getSchemaPath(StmtContext<?, ?, ?> ctx) {
+
+        Iterator<Object> argumentsIterator = ctx.getArgumentsFromRoot().iterator();
+        argumentsIterator.next(); // skip root argument
+
+        List<QName> qNamesFromRoot = new LinkedList<>();
+
+        while (argumentsIterator.hasNext()) {
+            Object argument = argumentsIterator.next();
+            if (argument instanceof QName) {
+                QName qname = (QName) argument;
+                qNamesFromRoot.add(qname);
+            } else
+                return SchemaPath.SAME;
+        }
+
+        return SchemaPath.create(qNamesFromRoot, true);
+    }
 }
index 5c4dfb7c97dfd7e8eca17b8c1ca49dbf25282204..558f4c079622ff232503768eda1289595a6df00b 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
 
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.ValueEffectiveStatementImpl;
+
 import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.ValueStatement;
@@ -43,7 +45,7 @@ public class ValueStatementImpl extends AbstractDeclaredStatement<String>
         @Override
         public EffectiveStatement<String, ValueStatement> createEffective(
                 StmtContext<String, ValueStatement, EffectiveStatement<String, ValueStatement>> ctx) {
-            throw new UnsupportedOperationException();
+            return new ValueEffectiveStatementImpl(ctx);
         }
 
     }
index f6472260fc3cc79db61321297b496a83272d60d5..7e5fc5646ff568a760f622c523021f84857a1576 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
 
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.WhenEffectiveStatementImpl;
+
 import org.opendaylight.yangtools.yang.model.api.RevisionAwareXPath;
 import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
@@ -18,7 +20,6 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractDeclaredStatement
 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
-
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 
@@ -48,7 +49,7 @@ public class WhenStatementImpl extends AbstractDeclaredStatement<RevisionAwareXP
 
         @Override public EffectiveStatement<RevisionAwareXPath, WhenStatement> createEffective(
                 StmtContext<RevisionAwareXPath, WhenStatement, EffectiveStatement<RevisionAwareXPath, WhenStatement>> ctx) {
-            throw new UnsupportedOperationException();
+            return new WhenEffectiveStatementImpl(ctx);
         }
     }
 
index 4ce7f4399219e6590192bfa3ac8044adb54e4de6..093c3df202431bd52eab9b710afd1a5d2970d019 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
 
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.YangVersionEffectiveStatementImpl;
+
 import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.YangVersionStatement;
@@ -14,7 +16,6 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractDeclaredStatement
 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
-
 import javax.annotation.Nonnull;
 
 public class YangVersionStatementImpl extends AbstractDeclaredStatement<String> implements YangVersionStatement {
@@ -41,7 +42,7 @@ public class YangVersionStatementImpl extends AbstractDeclaredStatement<String>
 
         @Override
         public EffectiveStatement<String, YangVersionStatement> createEffective(StmtContext<String, YangVersionStatement, EffectiveStatement<String, YangVersionStatement>> ctx) {
-            throw new UnsupportedOperationException();
+            return new YangVersionEffectiveStatementImpl(ctx);
         }
     }
 
index 54115176e58561bbe936c601d44a7dc2fc671987..79f437a55bb20489dca3c24a65edbb6c72b57f5d 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020;
 
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.YinElementEffectiveStatementImpl;
+
 import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.YinElementStatement;
@@ -44,7 +46,7 @@ public class YinElementStatementImpl extends AbstractDeclaredStatement<Boolean>
         @Override
         public EffectiveStatement<Boolean, YinElementStatement> createEffective(
                 StmtContext<Boolean, YinElementStatement, EffectiveStatement<Boolean, YinElementStatement>> ctx) {
-            throw new UnsupportedOperationException();
+            return new YinElementEffectiveStatementImpl(ctx);
         }
 
     }
index 78906ce7607dc7c673b8b9f940335df712677957..f0b521e21bc00e3df10866f5608572b60e821fbc 100644 (file)
@@ -1,5 +1,5 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -7,14 +7,15 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
 
+import com.google.common.collect.ImmutableSet;
+
+import com.google.common.collect.ImmutableMap;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.HashSet;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
-
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
-import java.util.Map;
 import java.util.Set;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
@@ -27,11 +28,11 @@ public abstract class AbstractEffectiveDocumentedDataNodeContainer<A, D extends
         extends AbstractEffectiveDocumentedNode<A, D> implements
         DataNodeContainer {
 
-    private final Map<QName, DataSchemaNode> childNodes;
-    private final Set<GroupingDefinition> groupings;
-    private final Set<UsesNode> uses;
-    private final Set<TypeDefinition<?>> typeDefinitions;
-    private final Set<DataSchemaNode> publicChildNodes;
+    private final ImmutableMap<QName, DataSchemaNode> childNodes;
+    private final ImmutableSet<GroupingDefinition> groupings;
+    private final ImmutableSet<UsesNode> uses;
+    private final ImmutableSet<TypeDefinition<?>> typeDefinitions;
+    private final ImmutableSet<DataSchemaNode> publicChildNodes;
 
     protected AbstractEffectiveDocumentedDataNodeContainer(
             final StmtContext<A, D, ?> ctx) {
@@ -39,11 +40,11 @@ public abstract class AbstractEffectiveDocumentedDataNodeContainer<A, D extends
 
         Collection<? extends EffectiveStatement<?, ?>> effectiveSubstatements = effectiveSubstatements();
 
-        childNodes = new HashMap<QName, DataSchemaNode>();
-        groupings = new HashSet<GroupingDefinition>();
-        uses = new HashSet<UsesNode>();
-        typeDefinitions = new HashSet<TypeDefinition<?>>();
-        publicChildNodes = new HashSet<DataSchemaNode>();
+        HashMap<QName, DataSchemaNode> childNodes = new HashMap<QName, DataSchemaNode>();
+        HashSet<GroupingDefinition> groupings = new HashSet<GroupingDefinition>();
+        HashSet<UsesNode> uses = new HashSet<UsesNode>();
+        HashSet<TypeDefinition<?>> typeDefinitions = new HashSet<TypeDefinition<?>>();
+        HashSet<DataSchemaNode> publicChildNodes = new HashSet<DataSchemaNode>();
 
         for (EffectiveStatement<?, ?> effectiveStatement : effectiveSubstatements) {
             if (effectiveStatement instanceof DataSchemaNode) {
@@ -65,6 +66,12 @@ public abstract class AbstractEffectiveDocumentedDataNodeContainer<A, D extends
                 groupings.add(grp);
             }
         }
+
+        this.childNodes = ImmutableMap.copyOf(childNodes);
+        this.groupings = ImmutableSet.copyOf(groupings);
+        this.publicChildNodes = ImmutableSet.copyOf(publicChildNodes);
+        this.typeDefinitions = ImmutableSet.copyOf(typeDefinitions);
+        this.uses = ImmutableSet.copyOf(uses);
     }
 
     @Override
index 5bb79d20845374db69c4a486a1c6228681bb85f6..23ecee547575ec4853e1d7ee725c5f45e2e73cb4 100644 (file)
@@ -1,3 +1,10 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
 
 import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
index 85bf899b65411bface1604bc8129587b9cabbfc5..e84af21131271e4eab3ed1a32204323320f29748 100644 (file)
@@ -1,3 +1,10 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
 
 import com.google.common.base.Optional;
@@ -31,7 +38,6 @@ import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.UsesNode;
 
-
 public abstract class AbstractEffectiveSchemaContext implements SchemaContext {
 
     protected static final Supplier<TreeSet<Module>> MODULE_SET_SUPPLIER = new Supplier<TreeSet<Module>>() {
@@ -117,11 +123,12 @@ public abstract class AbstractEffectiveSchemaContext implements SchemaContext {
     @Override
     public Set<Module> findModuleByNamespace(final URI namespace) {
         final Set<Module> ret = getNamespaceToModules().get(namespace);
-        return ret == null ? Collections.<Module>emptySet() : ret;
+        return ret == null ? Collections.<Module> emptySet() : ret;
     }
 
     @Override
-    public Module findModuleByNamespaceAndRevision(final URI namespace, final Date revision) {
+    public Module findModuleByNamespaceAndRevision(final URI namespace,
+            final Date revision) {
         if (namespace == null) {
             return null;
         }
@@ -251,14 +258,15 @@ public abstract class AbstractEffectiveSchemaContext implements SchemaContext {
         return Collections.emptySet();
     }
 
-    //FIXME: should work for submodules too
+    // FIXME: should work for submodules too
     @Override
     public Set<ModuleIdentifier> getAllModuleIdentifiers() {
         return getIdentifiersToSources().keySet();
     }
 
     @Override
-    public Optional<String> getModuleSource(final ModuleIdentifier moduleIdentifier) {
+    public Optional<String> getModuleSource(
+            final ModuleIdentifier moduleIdentifier) {
         String maybeSource = getIdentifiersToSources().get(moduleIdentifier);
         return Optional.fromNullable(maybeSource);
     }
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/AnyXmlEffectiveStatementImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/AnyXmlEffectiveStatementImpl.java
new file mode 100644 (file)
index 0000000..ff417e0
--- /dev/null
@@ -0,0 +1,153 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import java.util.Collection;
+import java.util.LinkedList;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.Utils;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.AnyxmlStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+import com.google.common.base.Optional;
+import com.google.common.collect.ImmutableList;
+import java.util.List;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.model.api.AnyXmlSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.ConstraintDefinition;
+import org.opendaylight.yangtools.yang.model.api.DerivableSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.SchemaPath;
+import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
+
+public class AnyXmlEffectiveStatementImpl extends
+        AbstractEffectiveDocumentedNode<QName, AnyxmlStatement> implements
+        AnyXmlSchemaNode, DerivableSchemaNode {
+    private final QName qname;
+    private final SchemaPath path;
+
+    boolean configuration;
+    AnyXmlSchemaNode original;
+    ConstraintDefinition constraintsDef;
+    boolean augmenting;
+    boolean addedByUses;
+
+    ImmutableList<UnknownSchemaNode> unknownNodes;
+
+    public AnyXmlEffectiveStatementImpl(
+            StmtContext<QName, AnyxmlStatement, EffectiveStatement<QName, AnyxmlStatement>> ctx) {
+        super(ctx);
+        this.qname = ctx.getStatementArgument();
+        this.path = Utils.getSchemaPath(ctx);
+
+        initSubstatementCollections();
+    }
+
+    private void initSubstatementCollections() {
+        Collection<? extends EffectiveStatement<?, ?>> effectiveSubstatements = effectiveSubstatements();
+
+        LinkedList<UnknownSchemaNode> unknownNodes = new LinkedList<UnknownSchemaNode>();
+
+        for (EffectiveStatement<?, ?> effectiveStatement : effectiveSubstatements) {
+            if (effectiveStatement instanceof UnknownSchemaNode) {
+                UnknownSchemaNode unknownNode = (UnknownSchemaNode) effectiveStatement;
+                unknownNodes.add(unknownNode);
+            }
+        }
+
+        this.unknownNodes = ImmutableList.copyOf(unknownNodes);
+    }
+
+    @Override
+    public QName getQName() {
+        return qname;
+    }
+
+    @Override
+    public SchemaPath getPath() {
+        return path;
+    }
+
+    @Override
+    public boolean isAugmenting() {
+        return augmenting;
+    }
+
+    @Override
+    public boolean isAddedByUses() {
+        return addedByUses;
+    }
+
+    @Override
+    public Optional<AnyXmlSchemaNode> getOriginal() {
+        return Optional.fromNullable(original);
+    }
+
+    @Override
+    public boolean isConfiguration() {
+        return configuration;
+    }
+
+    @Override
+    public ConstraintDefinition getConstraints() {
+        return constraintsDef;
+    }
+
+    @Override
+    public List<UnknownSchemaNode> getUnknownSchemaNodes() {
+        return unknownNodes;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((qname == null) ? 0 : qname.hashCode());
+        result = prime * result + ((path == null) ? 0 : path.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(final Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        AnyXmlEffectiveStatementImpl other = (AnyXmlEffectiveStatementImpl) obj;
+        if (qname == null) {
+            if (other.qname != null) {
+                return false;
+            }
+        } else if (!qname.equals(other.qname)) {
+            return false;
+        }
+        if (path == null) {
+            if (other.path != null) {
+                return false;
+            }
+        } else if (!path.equals(other.path)) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder(
+                AnyXmlEffectiveStatementImpl.class.getSimpleName());
+        sb.append("[");
+        sb.append("qname=").append(qname);
+        sb.append(", path=").append(path);
+        sb.append("]");
+        return sb.toString();
+    }
+
+}
\ No newline at end of file
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/ArgumentEffectiveStatementImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/ArgumentEffectiveStatementImpl.java
new file mode 100644 (file)
index 0000000..609bf9c
--- /dev/null
@@ -0,0 +1,22 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.model.api.stmt.ArgumentStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+public class ArgumentEffectiveStatementImpl extends
+        EffectiveStatementBase<QName, ArgumentStatement> {
+
+    public ArgumentEffectiveStatementImpl(
+            StmtContext<QName, ArgumentStatement, ?> ctx) {
+        super(ctx);
+    }
+
+}
\ No newline at end of file
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/AugmentEffectiveStatementImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/AugmentEffectiveStatementImpl.java
new file mode 100644 (file)
index 0000000..0d3f374
--- /dev/null
@@ -0,0 +1,185 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import java.util.Collection;
+import java.util.LinkedList;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.AugmentStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+import com.google.common.base.Optional;
+import com.google.common.collect.ImmutableList;
+import java.net.URI;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
+import org.opendaylight.yangtools.yang.model.api.NamespaceRevisionAware;
+import org.opendaylight.yangtools.yang.model.api.RevisionAwareXPath;
+import org.opendaylight.yangtools.yang.model.api.SchemaPath;
+import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
+
+public class AugmentEffectiveStatementImpl
+        extends
+        AbstractEffectiveDocumentedDataNodeContainer<SchemaNodeIdentifier, AugmentStatement>
+        implements AugmentationSchema, NamespaceRevisionAware,
+        Comparable<AugmentEffectiveStatementImpl> {
+    private final int order;
+    private final SchemaPath targetPath;
+    RevisionAwareXPath whenCondition;
+
+    URI namespace;
+    Date revision;
+    ImmutableList<UnknownSchemaNode> unknownNodes;
+    private AugmentationSchema copyOf;
+
+    public AugmentEffectiveStatementImpl(
+            StmtContext<SchemaNodeIdentifier, AugmentStatement, EffectiveStatement<SchemaNodeIdentifier, AugmentStatement>> ctx) {
+        super(ctx);
+
+        SchemaNodeIdentifier schemaNodeIdentifier = ctx.getStatementArgument();
+        this.targetPath = SchemaPath.create(
+                schemaNodeIdentifier.getPathFromRoot(),
+                schemaNodeIdentifier.isAbsolute());
+
+        // :TODO init other fields
+        this.order = 1;
+        // firstEffective(WhenEffectiveStatementImpl.class);
+
+        initSubstatementCollections();
+    }
+
+    private void initSubstatementCollections() {
+        Collection<? extends EffectiveStatement<?, ?>> effectiveSubstatements = effectiveSubstatements();
+
+        LinkedList<UnknownSchemaNode> unknownNodes = new LinkedList<UnknownSchemaNode>();
+
+        for (EffectiveStatement<?, ?> effectiveStatement : effectiveSubstatements) {
+            if (effectiveStatement instanceof UnknownSchemaNode) {
+                UnknownSchemaNode unknownNode = (UnknownSchemaNode) effectiveStatement;
+                unknownNodes.add(unknownNode);
+            }
+        }
+
+        this.unknownNodes = ImmutableList.copyOf(unknownNodes);
+    }
+
+    public void setCopyOf(final AugmentationSchema build) {
+        this.copyOf = build;
+    }
+
+    @Override
+    public Optional<AugmentationSchema> getOriginalDefinition() {
+        return Optional.fromNullable(this.copyOf);
+    }
+
+    @Override
+    public SchemaPath getTargetPath() {
+        return targetPath;
+    }
+
+    @Override
+    public RevisionAwareXPath getWhenCondition() {
+        return whenCondition;
+    }
+
+    @Override
+    public List<UnknownSchemaNode> getUnknownSchemaNodes() {
+        return unknownNodes;
+    }
+
+    @Override
+    public URI getNamespace() {
+        return namespace;
+    }
+
+    @Override
+    public Date getRevision() {
+        return revision;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 17;
+        int result = 1;
+        result = prime * result
+                + ((targetPath == null) ? 0 : targetPath.hashCode());
+        result = prime * result
+                + ((whenCondition == null) ? 0 : whenCondition.hashCode());
+        result = prime * result + getChildNodes().hashCode();
+        return result;
+    }
+
+    @Override
+    public boolean equals(final Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        AugmentEffectiveStatementImpl other = (AugmentEffectiveStatementImpl) obj;
+        if (targetPath == null) {
+            if (other.targetPath != null) {
+                return false;
+            }
+        } else if (!targetPath.equals(other.targetPath)) {
+            return false;
+        }
+        if (whenCondition == null) {
+            if (other.whenCondition != null) {
+                return false;
+            }
+        } else if (!whenCondition.equals(other.whenCondition)) {
+            return false;
+        }
+        if (!getChildNodes().equals(other.getChildNodes())) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder(
+                AugmentEffectiveStatementImpl.class.getSimpleName());
+        sb.append("[");
+        sb.append("targetPath=").append(targetPath);
+        sb.append(", when=").append(whenCondition);
+        sb.append("]");
+        return sb.toString();
+    }
+
+    @Override
+    public int compareTo(final AugmentEffectiveStatementImpl o) {
+        checkNotNull(o);
+        Iterator<QName> thisIt = this.targetPath.getPathFromRoot().iterator();
+        Iterator<QName> otherIt = o.getTargetPath().getPathFromRoot()
+                .iterator();
+        while (thisIt.hasNext()) {
+            if (otherIt.hasNext()) {
+                int comp = thisIt.next().compareTo(otherIt.next());
+                if (comp != 0) {
+                    return comp;
+                }
+            } else {
+                return 1;
+            }
+        }
+        if (otherIt.hasNext()) {
+            return -1;
+        }
+        return this.order - o.order;
+    }
+}
\ No newline at end of file
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/BaseEffectiveStatementImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/BaseEffectiveStatementImpl.java
new file mode 100644 (file)
index 0000000..95e32a6
--- /dev/null
@@ -0,0 +1,21 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.model.api.stmt.BaseStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+public class BaseEffectiveStatementImpl extends
+        EffectiveStatementBase<QName, BaseStatement> {
+
+    public BaseEffectiveStatementImpl(StmtContext<QName, BaseStatement, ?> ctx) {
+        super(ctx);
+    }
+
+}
\ No newline at end of file
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/BelongsEffectiveToStatementImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/BelongsEffectiveToStatementImpl.java
new file mode 100644 (file)
index 0000000..7080bb7
--- /dev/null
@@ -0,0 +1,21 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import org.opendaylight.yangtools.yang.model.api.stmt.BelongsToStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+public class BelongsEffectiveToStatementImpl extends
+        EffectiveStatementBase<String, BelongsToStatement> {
+
+    public BelongsEffectiveToStatementImpl(
+            StmtContext<String, BelongsToStatement, ?> ctx) {
+        super(ctx);
+    }
+
+}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/BitEffectiveStatementImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/BitEffectiveStatementImpl.java
new file mode 100644 (file)
index 0000000..73cb760
--- /dev/null
@@ -0,0 +1,20 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import org.opendaylight.yangtools.yang.model.api.stmt.BitStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+public class BitEffectiveStatementImpl extends
+        EffectiveStatementBase<String, BitStatement> {
+
+    public BitEffectiveStatementImpl(StmtContext<String, BitStatement, ?> ctx) {
+        super(ctx);
+    }
+
+}
\ No newline at end of file
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/CaseEffectiveStatementImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/CaseEffectiveStatementImpl.java
new file mode 100644 (file)
index 0000000..e406e61
--- /dev/null
@@ -0,0 +1,170 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.LinkedList;
+
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.Utils;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.CaseStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+import com.google.common.base.Optional;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
+import java.util.List;
+import java.util.Set;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
+import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode;
+import org.opendaylight.yangtools.yang.model.api.ConstraintDefinition;
+import org.opendaylight.yangtools.yang.model.api.DerivableSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.SchemaPath;
+import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
+
+public class CaseEffectiveStatementImpl extends
+        AbstractEffectiveDocumentedDataNodeContainer<QName, CaseStatement>
+        implements ChoiceCaseNode, DerivableSchemaNode {
+    private final QName qname;
+    private final SchemaPath path;
+
+    boolean augmenting;
+    boolean addedByUses;
+    ChoiceCaseNode original;
+    ConstraintDefinition constraints;
+
+    ImmutableSet<AugmentationSchema> augmentations;
+    ImmutableList<UnknownSchemaNode> unknownNodes;
+
+    public CaseEffectiveStatementImpl(
+            StmtContext<QName, CaseStatement, EffectiveStatement<QName, CaseStatement>> ctx) {
+        super(ctx);
+        this.qname = ctx.getStatementArgument();
+        this.path = Utils.getSchemaPath(ctx);
+        // :TODO init other fields
+
+        initSubstatementCollections();
+    }
+
+    private void initSubstatementCollections() {
+        Collection<? extends EffectiveStatement<?, ?>> effectiveSubstatements = effectiveSubstatements();
+
+        LinkedList<UnknownSchemaNode> unknownNodes = new LinkedList<UnknownSchemaNode>();
+        HashSet<AugmentationSchema> augmentations = new HashSet<AugmentationSchema>();
+
+        for (EffectiveStatement<?, ?> effectiveStatement : effectiveSubstatements) {
+            if (effectiveStatement instanceof UnknownSchemaNode) {
+                UnknownSchemaNode unknownNode = (UnknownSchemaNode) effectiveStatement;
+                unknownNodes.add(unknownNode);
+            }
+            if (effectiveStatement instanceof AugmentationSchema) {
+                AugmentationSchema augmentationSchema = (AugmentationSchema) effectiveStatement;
+                augmentations.add(augmentationSchema);
+            }
+        }
+
+        this.unknownNodes = ImmutableList.copyOf(unknownNodes);
+        this.augmentations = ImmutableSet.copyOf(augmentations);
+    }
+
+    @Override
+    public QName getQName() {
+        return qname;
+    }
+
+    @Override
+    public SchemaPath getPath() {
+        return path;
+    }
+
+    @Override
+    public boolean isConfiguration() {
+        return false;
+    }
+
+    @Override
+    public ConstraintDefinition getConstraints() {
+        return constraints;
+    }
+
+    @Override
+    public boolean isAugmenting() {
+        return augmenting;
+    }
+
+    @Override
+    public boolean isAddedByUses() {
+        return addedByUses;
+    }
+
+    @Override
+    public Optional<ChoiceCaseNode> getOriginal() {
+        return Optional.fromNullable(original);
+    }
+
+    @Override
+    public List<UnknownSchemaNode> getUnknownSchemaNodes() {
+        return unknownNodes;
+    }
+
+    @Override
+    public Set<AugmentationSchema> getAvailableAugmentations() {
+        return augmentations;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((qname == null) ? 0 : qname.hashCode());
+        result = prime * result + ((path == null) ? 0 : path.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(final Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        CaseEffectiveStatementImpl other = (CaseEffectiveStatementImpl) obj;
+        if (qname == null) {
+            if (other.qname != null) {
+                return false;
+            }
+        } else if (!qname.equals(other.qname)) {
+            return false;
+        }
+        if (path == null) {
+            if (other.path != null) {
+                return false;
+            }
+        } else if (!path.equals(other.path)) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder(
+                CaseEffectiveStatementImpl.class.getSimpleName());
+        sb.append("[");
+        sb.append("qname=");
+        sb.append(qname);
+        sb.append("]");
+        return sb.toString();
+    }
+
+}
\ No newline at end of file
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/ChoiceEffectiveStatementImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/ChoiceEffectiveStatementImpl.java
new file mode 100644 (file)
index 0000000..00262b5
--- /dev/null
@@ -0,0 +1,214 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.LinkedList;
+
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.Utils;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.ChoiceStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+import com.google.common.base.Optional;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
+import java.util.List;
+import java.util.Set;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
+import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode;
+import org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.ConstraintDefinition;
+import org.opendaylight.yangtools.yang.model.api.DerivableSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.SchemaPath;
+import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
+
+public class ChoiceEffectiveStatementImpl extends AbstractEffectiveDocumentedNode<QName, ChoiceStatement> implements ChoiceSchemaNode, DerivableSchemaNode {
+    private final QName qname;
+    private final SchemaPath path;
+
+    boolean augmenting;
+    boolean addedByUses;
+    ChoiceSchemaNode original;
+    boolean configuration;
+    ConstraintDefinition constraints;
+    String defaultCase;
+
+    ImmutableSet<ChoiceCaseNode> cases;
+    ImmutableSet<AugmentationSchema> augmentations;
+    ImmutableList<UnknownSchemaNode> unknownNodes;
+
+    public ChoiceEffectiveStatementImpl(StmtContext<QName, ChoiceStatement, EffectiveStatement<QName, ChoiceStatement>> ctx) {
+        super(ctx);
+
+        this.qname = ctx.getStatementArgument();
+        this.path = Utils.getSchemaPath(ctx);
+        //:TODO init other fields
+
+        initSubstatementCollections();
+
+    }
+
+    private void initSubstatementCollections() {
+        Collection<? extends EffectiveStatement<?, ?>> effectiveSubstatements = effectiveSubstatements();
+
+        LinkedList<UnknownSchemaNode> unknownNodes = new LinkedList<UnknownSchemaNode>();
+        HashSet<AugmentationSchema> augmentations = new HashSet<AugmentationSchema>();
+        HashSet<ChoiceCaseNode> cases = new HashSet<ChoiceCaseNode>();
+
+        for (EffectiveStatement<?, ?> effectiveStatement : effectiveSubstatements) {
+            if (effectiveStatement instanceof UnknownSchemaNode) {
+                UnknownSchemaNode unknownNode = (UnknownSchemaNode) effectiveStatement;
+                unknownNodes.add(unknownNode);
+            }
+            if (effectiveStatement instanceof AugmentationSchema) {
+                AugmentationSchema augmentationSchema = (AugmentationSchema) effectiveStatement;
+                augmentations.add(augmentationSchema);
+            }
+            if (effectiveStatement instanceof ChoiceCaseNode) {
+                ChoiceCaseNode choiceCaseNode = (ChoiceCaseNode) effectiveStatement;
+                cases.add(choiceCaseNode);
+            }
+        }
+
+        this.unknownNodes = ImmutableList.copyOf(unknownNodes);
+        this.augmentations = ImmutableSet.copyOf(augmentations);
+        this.cases = ImmutableSet.copyOf(cases);
+    }
+
+    @Override
+    public QName getQName() {
+        return qname;
+    }
+
+    @Override
+    public SchemaPath getPath() {
+        return path;
+    }
+
+    @Override
+    public boolean isAugmenting() {
+        return augmenting;
+    }
+
+    @Override
+    public boolean isAddedByUses() {
+        return addedByUses;
+    }
+
+    @Override
+    public Optional<ChoiceSchemaNode> getOriginal() {
+        return Optional.fromNullable(original);
+    }
+
+    @Override
+    public boolean isConfiguration() {
+        return configuration;
+    }
+
+    @Override
+    public ConstraintDefinition getConstraints() {
+        return constraints;
+    }
+
+    @Override
+    public Set<AugmentationSchema> getAvailableAugmentations() {
+        return augmentations;
+    }
+
+    @Override
+    public List<UnknownSchemaNode> getUnknownSchemaNodes() {
+        return unknownNodes;
+    }
+
+    @Override
+    public Set<ChoiceCaseNode> getCases() {
+        return cases;
+    }
+
+    @Override
+    public ChoiceCaseNode getCaseNodeByName(final QName name) {
+        if (name == null) {
+            throw new IllegalArgumentException("Choice Case QName cannot be NULL!");
+        }
+        for (final ChoiceCaseNode caseNode : cases) {
+            if (caseNode != null && name.equals(caseNode.getQName())) {
+                return caseNode;
+            }
+        }
+        return null;
+    }
+
+    @Override
+    public ChoiceCaseNode getCaseNodeByName(final String name) {
+        if (name == null) {
+            throw new IllegalArgumentException("Choice Case string Name cannot be NULL!");
+        }
+        for (final ChoiceCaseNode caseNode : cases) {
+            if (caseNode != null && (caseNode.getQName() != null)
+                    && name.equals(caseNode.getQName().getLocalName())) {
+                return caseNode;
+            }
+        }
+        return null;
+    }
+
+    @Override
+    public String getDefaultCase() {
+        return defaultCase;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((qname == null) ? 0 : qname.hashCode());
+        result = prime * result + ((path == null) ? 0 : path.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(final Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        ChoiceEffectiveStatementImpl other = (ChoiceEffectiveStatementImpl) obj;
+        if (qname == null) {
+            if (other.qname != null) {
+                return false;
+            }
+        } else if (!qname.equals(other.qname)) {
+            return false;
+        }
+        if (path == null) {
+            if (other.path != null) {
+                return false;
+            }
+        } else if (!path.equals(other.path)) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder(ChoiceEffectiveStatementImpl.class.getSimpleName());
+        sb.append("[");
+        sb.append("qname=").append(qname);
+        sb.append("]");
+        return sb.toString();
+    }
+
+}
\ No newline at end of file
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/ConfigEffectiveStatementImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/ConfigEffectiveStatementImpl.java
new file mode 100644 (file)
index 0000000..57f7801
--- /dev/null
@@ -0,0 +1,21 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import org.opendaylight.yangtools.yang.model.api.stmt.ConfigStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+public class ConfigEffectiveStatementImpl extends
+        EffectiveStatementBase<Boolean, ConfigStatement> {
+
+    public ConfigEffectiveStatementImpl(
+            StmtContext<Boolean, ConfigStatement, ?> ctx) {
+        super(ctx);
+
+    }
+}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/ContactEffectiveStatementImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/ContactEffectiveStatementImpl.java
new file mode 100644 (file)
index 0000000..6a2ae09
--- /dev/null
@@ -0,0 +1,21 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import org.opendaylight.yangtools.yang.model.api.stmt.ContactStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+public class ContactEffectiveStatementImpl extends
+        EffectiveStatementBase<String, ContactStatement> {
+
+    public ContactEffectiveStatementImpl(
+            StmtContext<String, ContactStatement, ?> ctx) {
+        super(ctx);
+
+    }
+}
index 2c5b9c9b8573a1ffc7767216ace591e8b43e5391..d7a70c4a66d020d82a79d0c09c33221200b010d6 100644 (file)
@@ -1,7 +1,17 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
 
-import java.util.HashSet;
+import com.google.common.collect.ImmutableSet;
 
+import com.google.common.collect.ImmutableList;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.Utils;
+import java.util.HashSet;
 import java.util.LinkedList;
 import java.util.Collection;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
@@ -23,6 +33,7 @@ public class ContainerEffectiveStatementImpl extends
         implements ContainerSchemaNode, DerivableSchemaNode {
     private final QName qname;
     private final SchemaPath path;
+    private final boolean presence;
 
     boolean augmenting;
     boolean addedByUses;
@@ -30,34 +41,27 @@ public class ContainerEffectiveStatementImpl extends
     ContainerSchemaNode original;
     ConstraintDefinition constraints;
 
-    boolean presence;
-
-    private Set<AugmentationSchema> augmentations;
-    private List<UnknownSchemaNode> unknownNodes;
+    private ImmutableSet<AugmentationSchema> augmentations;
+    private ImmutableList<UnknownSchemaNode> unknownNodes;
 
     public ContainerEffectiveStatementImpl(
             StmtContext<QName, ContainerStatement, EffectiveStatement<QName, ContainerStatement>> ctx) {
         super(ctx);
-        qname = ctx.getStatementArgument();
-
-        initSubstatementCollections();
-        initPresence();
-
-        // :TODO init other fields
-        path = null;
-
-    }
 
-    private void initPresence() {
+        qname = ctx.getStatementArgument();
+        path = Utils.getSchemaPath(ctx);
         presence = (firstEffective(PresenceEffectiveStatementImpl.class) == null) ? false
                 : true;
+        // :TODO init other fields
+
+        initSubstatementCollections();
     }
 
     private void initSubstatementCollections() {
         Collection<? extends EffectiveStatement<?, ?>> effectiveSubstatements = effectiveSubstatements();
 
-        unknownNodes = new LinkedList<UnknownSchemaNode>();
-        augmentations = new HashSet<AugmentationSchema>();
+        LinkedList<UnknownSchemaNode> unknownNodes = new LinkedList<UnknownSchemaNode>();
+        HashSet<AugmentationSchema> augmentations = new HashSet<AugmentationSchema>();
 
         for (EffectiveStatement<?, ?> effectiveStatement : effectiveSubstatements) {
             if (effectiveStatement instanceof UnknownSchemaNode) {
@@ -70,7 +74,8 @@ public class ContainerEffectiveStatementImpl extends
             }
         }
 
-        // :TODO other substatement collections ...
+        this.unknownNodes = ImmutableList.copyOf(unknownNodes);
+        this.augmentations = ImmutableSet.copyOf(augmentations);
     }
 
     @Override
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/DefaultEffectiveStatementImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/DefaultEffectiveStatementImpl.java
new file mode 100644 (file)
index 0000000..26084a6
--- /dev/null
@@ -0,0 +1,21 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import org.opendaylight.yangtools.yang.model.api.stmt.DefaultStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+public class DefaultEffectiveStatementImpl extends
+        EffectiveStatementBase<String, DefaultStatement> {
+
+    public DefaultEffectiveStatementImpl(
+            StmtContext<String, DefaultStatement, ?> ctx) {
+        super(ctx);
+    }
+
+}
\ No newline at end of file
index 9e74771bebeadc923d1d7740230ebc3cf50fd9b6..1d640ac0421099a6d975995cb7817c5079776bec 100644 (file)
@@ -11,7 +11,8 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 
 import org.opendaylight.yangtools.yang.model.api.stmt.DescriptionStatement;
 
-public class DescriptionEffectiveStatementImpl extends EffectiveStatementBase<String, DescriptionStatement>  {
+public class DescriptionEffectiveStatementImpl extends
+        EffectiveStatementBase<String, DescriptionStatement> {
 
     public DescriptionEffectiveStatementImpl(
             StmtContext<String, DescriptionStatement, ?> ctx) {
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/DeviateEffectiveStatementImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/DeviateEffectiveStatementImpl.java
new file mode 100644 (file)
index 0000000..2528b6d
--- /dev/null
@@ -0,0 +1,19 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import org.opendaylight.yangtools.yang.model.api.stmt.DeviateStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+public class DeviateEffectiveStatementImpl extends
+        EffectiveStatementBase<String, DeviateStatement> {
+    public DeviateEffectiveStatementImpl(
+            StmtContext<String, DeviateStatement, ?> ctx) {
+        super(ctx);
+    }
+}
\ No newline at end of file
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/DeviationEffectiveStatementImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/DeviationEffectiveStatementImpl.java
new file mode 100644 (file)
index 0000000..c424b9e
--- /dev/null
@@ -0,0 +1,23 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import org.opendaylight.yangtools.yang.model.api.stmt.DeviationStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+public class DeviationEffectiveStatementImpl extends
+        EffectiveStatementBase<SchemaNodeIdentifier, DeviationStatement> {
+
+    public DeviationEffectiveStatementImpl(
+            StmtContext<SchemaNodeIdentifier, DeviationStatement, ?> ctx) {
+        super(ctx);
+
+    }
+
+}
\ No newline at end of file
index 9155c0d0c6baed0d3242dd860b62297c827ce4de..cc837626ed4a1159844ebf7de4eaa7391ff06b51 100644 (file)
@@ -26,44 +26,48 @@ import org.opendaylight.yangtools.yang.model.api.ModuleIdentifier;
 
 public class EffectiveSchemaContext extends AbstractEffectiveSchemaContext {
 
-    private  final Map<ModuleIdentifier, String> identifiersToSources;
-    private  final SetMultimap<URI, Module> namespaceToModules;
-    private  final SetMultimap<String, Module> nameToModules;
-    private  final Set<Module> modules;
-
+    private final Map<ModuleIdentifier, String> identifiersToSources;
+    private final SetMultimap<URI, Module> namespaceToModules;
+    private final SetMultimap<String, Module> nameToModules;
+    private final Set<Module> modules;
 
     private final ImmutableList<DeclaredStatement<?>> rootDeclaredStatements;
-    private final ImmutableList<EffectiveStatement<?,?>> rootEffectiveStatements;
+    private final ImmutableList<EffectiveStatement<?, ?>> rootEffectiveStatements;
 
-    public EffectiveSchemaContext(List<DeclaredStatement<?>> rootDeclaredStatements, List<EffectiveStatement<?,?>> rootEffectiveStatements) {
-        this.rootDeclaredStatements = ImmutableList.copyOf(rootDeclaredStatements);
-        this.rootEffectiveStatements = ImmutableList.copyOf(rootEffectiveStatements);
+    public EffectiveSchemaContext(
+            List<DeclaredStatement<?>> rootDeclaredStatements,
+            List<EffectiveStatement<?, ?>> rootEffectiveStatements) {
+        this.rootDeclaredStatements = ImmutableList
+                .copyOf(rootDeclaredStatements);
+        this.rootEffectiveStatements = ImmutableList
+                .copyOf(rootEffectiveStatements);
 
         HashSet<Module> modules = new HashSet<Module>();
         for (EffectiveStatement<?, ?> rootEffectiveStatement : rootEffectiveStatements) {
-            if(rootEffectiveStatement instanceof Module) {
+            if (rootEffectiveStatement instanceof Module) {
                 Module module = (Module) rootEffectiveStatement;
                 modules.add(module);
             }
         }
         this.modules = ImmutableSet.copyOf(modules);
 
-       final SetMultimap<URI, Module> nsMap = Multimaps.newSetMultimap(
-               new TreeMap<URI, Collection<Module>>(), MODULE_SET_SUPPLIER);
-       final SetMultimap<String, Module> nameMap = Multimaps.newSetMultimap(
-               new TreeMap<String, Collection<Module>>(), MODULE_SET_SUPPLIER);
+        final SetMultimap<URI, Module> nsMap = Multimaps.newSetMultimap(
+                new TreeMap<URI, Collection<Module>>(), MODULE_SET_SUPPLIER);
+        final SetMultimap<String, Module> nameMap = Multimaps.newSetMultimap(
+                new TreeMap<String, Collection<Module>>(), MODULE_SET_SUPPLIER);
 
-       for (Module m : modules) {
-           nameMap.put(m.getName(), m);
-           nsMap.put(m.getNamespace(), m);
-       }
+        for (Module m : modules) {
+            nameMap.put(m.getName(), m);
+            nsMap.put(m.getNamespace(), m);
+        }
 
-       namespaceToModules = ImmutableSetMultimap.copyOf(nsMap);
-       nameToModules = ImmutableSetMultimap.copyOf(nameMap);
+        namespaceToModules = ImmutableSetMultimap.copyOf(nsMap);
+        nameToModules = ImmutableSetMultimap.copyOf(nameMap);
 
-       //:TODO
-       //this.identifiersToSources = ImmutableMap.copyOf(identifiersToSources);
-       this.identifiersToSources = null;
+        // :TODO
+        // this.identifiersToSources =
+        // ImmutableMap.copyOf(identifiersToSources);
+        this.identifiersToSources = null;
 
     }
 
@@ -71,18 +75,18 @@ public class EffectiveSchemaContext extends AbstractEffectiveSchemaContext {
         return rootDeclaredStatements;
     }
 
-    public ImmutableList<EffectiveStatement<?,?>> getRootEffectiveStatements() {
+    public ImmutableList<EffectiveStatement<?, ?>> getRootEffectiveStatements() {
         return rootEffectiveStatements;
     }
 
     @Override
-    protected Map<ModuleIdentifier, String> getIdentifiersToSources(){
+    protected Map<ModuleIdentifier, String> getIdentifiersToSources() {
 
         return identifiersToSources;
     }
 
     @Override
-    public Set<Module> getModules(){
+    public Set<Module> getModules() {
 
         return modules;
     }
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/EnumEffectiveStatementImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/EnumEffectiveStatementImpl.java
new file mode 100644 (file)
index 0000000..439b8de
--- /dev/null
@@ -0,0 +1,20 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import org.opendaylight.yangtools.yang.model.api.stmt.EnumStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+public class EnumEffectiveStatementImpl extends
+        EffectiveStatementBase<String, EnumStatement> {
+
+    public EnumEffectiveStatementImpl(StmtContext<String, EnumStatement, ?> ctx) {
+        super(ctx);
+
+    }
+}
\ No newline at end of file
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/ErrorAppTagEffectiveStatementImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/ErrorAppTagEffectiveStatementImpl.java
new file mode 100644 (file)
index 0000000..fbd7efd
--- /dev/null
@@ -0,0 +1,22 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import org.opendaylight.yangtools.yang.model.api.stmt.ErrorAppTagStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+public class ErrorAppTagEffectiveStatementImpl extends
+        EffectiveStatementBase<String, ErrorAppTagStatement> {
+
+    public ErrorAppTagEffectiveStatementImpl(
+            StmtContext<String, ErrorAppTagStatement, ?> ctx) {
+        super(ctx);
+
+    }
+
+}
\ No newline at end of file
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/ErrorMessageEffectiveStatementImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/ErrorMessageEffectiveStatementImpl.java
new file mode 100644 (file)
index 0000000..6f2a749
--- /dev/null
@@ -0,0 +1,22 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import org.opendaylight.yangtools.yang.model.api.stmt.ErrorMessageStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+public class ErrorMessageEffectiveStatementImpl extends
+        EffectiveStatementBase<String, ErrorMessageStatement> {
+
+    public ErrorMessageEffectiveStatementImpl(
+            StmtContext<String, ErrorMessageStatement, ?> ctx) {
+        super(ctx);
+
+    }
+
+}
\ No newline at end of file
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/ExtensionEffectiveStatementImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/ExtensionEffectiveStatementImpl.java
new file mode 100644 (file)
index 0000000..cdea920
--- /dev/null
@@ -0,0 +1,154 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import java.util.Collection;
+import java.util.LinkedList;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.Utils;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.ExtensionStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+import com.google.common.collect.ImmutableList;
+import java.util.List;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.model.api.ExtensionDefinition;
+import org.opendaylight.yangtools.yang.model.api.SchemaPath;
+import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
+
+public class ExtensionEffectiveStatementImpl extends
+        AbstractEffectiveDocumentedNode<QName, ExtensionStatement> implements
+        ExtensionDefinition {
+    private final QName qname;
+    String argument;
+    private final SchemaPath schemaPath;
+
+    ImmutableList<UnknownSchemaNode> unknownNodes;
+    boolean yin;
+
+    public ExtensionEffectiveStatementImpl(
+            StmtContext<QName, ExtensionStatement, EffectiveStatement<QName, ExtensionStatement>> ctx) {
+        super(ctx);
+
+        this.qname = ctx.getStatementArgument();
+        this.schemaPath = Utils.getSchemaPath(ctx);
+
+        initSubstatementCollections();
+        initFields();
+
+    }
+
+    private void initFields() {
+
+        ArgumentEffectiveStatementImpl argumentSubstatement = firstEffective(ArgumentEffectiveStatementImpl.class);
+
+        if (argumentSubstatement != null) {
+            this.argument = argumentSubstatement.argument().getLocalName();
+        }
+
+        YinElementEffectiveStatementImpl yinElement = firstEffective(YinElementEffectiveStatementImpl.class);
+
+        if (yinElement != null) {
+            this.yin = yinElement.argument();
+        } else
+            yin = false;
+
+    }
+
+    private void initSubstatementCollections() {
+        Collection<? extends EffectiveStatement<?, ?>> effectiveSubstatements = effectiveSubstatements();
+
+        LinkedList<UnknownSchemaNode> unknownNodes = new LinkedList<UnknownSchemaNode>();
+
+        for (EffectiveStatement<?, ?> effectiveStatement : effectiveSubstatements) {
+            if (effectiveStatement instanceof UnknownSchemaNode) {
+                UnknownSchemaNode unknownNode = (UnknownSchemaNode) effectiveStatement;
+                unknownNodes.add(unknownNode);
+            }
+        }
+
+        this.unknownNodes = ImmutableList.copyOf(unknownNodes);
+    }
+
+    @Override
+    public QName getQName() {
+        return qname;
+    }
+
+    @Override
+    public SchemaPath getPath() {
+        return schemaPath;
+    }
+
+    @Override
+    public List<UnknownSchemaNode> getUnknownSchemaNodes() {
+        return unknownNodes;
+    }
+
+    @Override
+    public String getArgument() {
+        return argument;
+    }
+
+    @Override
+    public boolean isYinElement() {
+        return yin;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((qname == null) ? 0 : qname.hashCode());
+        result = prime * result
+                + ((schemaPath == null) ? 0 : schemaPath.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(final Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        ExtensionEffectiveStatementImpl other = (ExtensionEffectiveStatementImpl) obj;
+        if (qname == null) {
+            if (other.qname != null) {
+                return false;
+            }
+        } else if (!qname.equals(other.qname)) {
+            return false;
+        }
+        if (schemaPath == null) {
+            if (other.schemaPath != null) {
+                return false;
+            }
+        } else if (!schemaPath.equals(other.schemaPath)) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder(
+                ExtensionEffectiveStatementImpl.class.getSimpleName());
+        sb.append("[");
+        sb.append("argument=").append(argument);
+        sb.append(", qname=").append(qname);
+        sb.append(", schemaPath=").append(schemaPath);
+        sb.append(", extensionSchemaNodes=").append(unknownNodes);
+        sb.append(", yin=").append(yin);
+        sb.append("]");
+        return sb.toString();
+    }
+}
\ No newline at end of file
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/FeatureEffectiveStatementImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/FeatureEffectiveStatementImpl.java
new file mode 100644 (file)
index 0000000..a71635b
--- /dev/null
@@ -0,0 +1,23 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.model.api.stmt.FeatureStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+public class FeatureEffectiveStatementImpl extends
+        EffectiveStatementBase<QName, FeatureStatement> {
+
+    public FeatureEffectiveStatementImpl(
+            StmtContext<QName, FeatureStatement, ?> ctx) {
+        super(ctx);
+
+    }
+
+}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/FractionDigitsEffectiveStatementImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/FractionDigitsEffectiveStatementImpl.java
new file mode 100644 (file)
index 0000000..5f33bef
--- /dev/null
@@ -0,0 +1,22 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import org.opendaylight.yangtools.yang.model.api.stmt.FractionDigitsStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+public class FractionDigitsEffectiveStatementImpl extends
+        EffectiveStatementBase<String, FractionDigitsStatement> {
+
+    public FractionDigitsEffectiveStatementImpl(
+            StmtContext<String, FractionDigitsStatement, ?> ctx) {
+        super(ctx);
+
+    }
+
+}
\ No newline at end of file
index e7cbe4ca0307f1683aa8cb7bc7e4c29dae9dcef5..ea01448a56e635d9a4ec5344a017ff6a95001ace 100644 (file)
@@ -1,5 +1,7 @@
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
 
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.Utils;
+
 import java.util.Collection;
 import java.util.LinkedList;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
@@ -25,8 +27,8 @@ public class GroupingEffectiveStatementImpl extends
         super(ctx);
 
         qname = ctx.getStatementArgument();
+        path = Utils.getSchemaPath(ctx);
         // :TODO init other fields
-        path = null;
 
         initSubstatementCollections();
     }
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/IdentityEffectiveStatementImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/IdentityEffectiveStatementImpl.java
new file mode 100644 (file)
index 0000000..38c982f
--- /dev/null
@@ -0,0 +1,137 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import java.util.Collection;
+import java.util.LinkedList;
+
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.Utils;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.IdentityStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+import com.google.common.collect.ImmutableList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.model.api.IdentitySchemaNode;
+import org.opendaylight.yangtools.yang.model.api.SchemaPath;
+import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
+
+public class IdentityEffectiveStatementImpl extends
+        AbstractEffectiveDocumentedNode<QName, IdentityStatement> implements
+        IdentitySchemaNode {
+    private final QName qname;
+    private final SchemaPath path;
+    IdentitySchemaNode baseIdentity;
+    private final Set<IdentitySchemaNode> derivedIdentities;
+
+    ImmutableList<UnknownSchemaNode> unknownNodes;
+
+    public IdentityEffectiveStatementImpl(
+            StmtContext<QName, IdentityStatement, EffectiveStatement<QName, IdentityStatement>> ctx) {
+        super(ctx);
+
+        this.qname = ctx.getStatementArgument();
+        this.path = Utils.getSchemaPath(ctx);
+
+        initSubstatementCollections();
+
+        // :TODO init other fields
+        this.derivedIdentities = null;
+    }
+
+    private void initSubstatementCollections() {
+        Collection<? extends EffectiveStatement<?, ?>> effectiveSubstatements = effectiveSubstatements();
+
+        LinkedList<UnknownSchemaNode> unknownNodes = new LinkedList<UnknownSchemaNode>();
+
+        for (EffectiveStatement<?, ?> effectiveStatement : effectiveSubstatements) {
+            if (effectiveStatement instanceof UnknownSchemaNode) {
+                UnknownSchemaNode unknownNode = (UnknownSchemaNode) effectiveStatement;
+                unknownNodes.add(unknownNode);
+            }
+        }
+
+        this.unknownNodes = ImmutableList.copyOf(unknownNodes);
+    }
+
+    @Override
+    public QName getQName() {
+        return qname;
+    }
+
+    @Override
+    public IdentitySchemaNode getBaseIdentity() {
+        return baseIdentity;
+    }
+
+    @Override
+    public Set<IdentitySchemaNode> getDerivedIdentities() {
+        return Collections.unmodifiableSet(derivedIdentities);
+    }
+
+    @Override
+    public SchemaPath getPath() {
+        return path;
+    }
+
+    @Override
+    public List<UnknownSchemaNode> getUnknownSchemaNodes() {
+        return unknownNodes;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((qname == null) ? 0 : qname.hashCode());
+        result = prime * result + ((path == null) ? 0 : path.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(final Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        IdentityEffectiveStatementImpl other = (IdentityEffectiveStatementImpl) obj;
+        if (qname == null) {
+            if (other.qname != null) {
+                return false;
+            }
+        } else if (!qname.equals(other.qname)) {
+            return false;
+        }
+        if (path == null) {
+            if (other.path != null) {
+                return false;
+            }
+        } else if (!path.equals(other.path)) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder(
+                IdentityEffectiveStatementImpl.class.getSimpleName());
+        sb.append("[");
+        sb.append("base=").append(baseIdentity);
+        sb.append(", qname=").append(qname);
+        sb.append("]");
+        return sb.toString();
+    }
+}
\ No newline at end of file
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/IfFeatureEffectiveStatementImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/IfFeatureEffectiveStatementImpl.java
new file mode 100644 (file)
index 0000000..70d3e9c
--- /dev/null
@@ -0,0 +1,23 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.model.api.stmt.IfFeatureStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+public class IfFeatureEffectiveStatementImpl extends
+        EffectiveStatementBase<QName, IfFeatureStatement> {
+
+    public IfFeatureEffectiveStatementImpl(
+            StmtContext<QName, IfFeatureStatement, ?> ctx) {
+        super(ctx);
+
+    }
+
+}
\ No newline at end of file
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/ImportEffectiveStatementImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/ImportEffectiveStatementImpl.java
new file mode 100644 (file)
index 0000000..7eaae54
--- /dev/null
@@ -0,0 +1,20 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import org.opendaylight.yangtools.yang.model.api.stmt.ImportStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+public class ImportEffectiveStatementImpl extends
+        EffectiveStatementBase<String, ImportStatement> {
+
+    public ImportEffectiveStatementImpl(
+            StmtContext<String, ImportStatement, ?> ctx) {
+        super(ctx);
+    }
+}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/IncludeEffectiveStatementImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/IncludeEffectiveStatementImpl.java
new file mode 100644 (file)
index 0000000..addb604
--- /dev/null
@@ -0,0 +1,21 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import org.opendaylight.yangtools.yang.model.api.stmt.IncludeStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+public class IncludeEffectiveStatementImpl extends
+        EffectiveStatementBase<String, IncludeStatement> {
+
+    public IncludeEffectiveStatementImpl(
+            StmtContext<String, IncludeStatement, ?> ctx) {
+        super(ctx);
+    }
+
+}
\ No newline at end of file
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/InputEffectiveStatementImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/InputEffectiveStatementImpl.java
new file mode 100644 (file)
index 0000000..54e2f10
--- /dev/null
@@ -0,0 +1,168 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import java.util.HashSet;
+import java.util.LinkedList;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.Utils;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
+import java.util.List;
+import java.util.Set;
+import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
+import org.opendaylight.yangtools.yang.model.api.ConstraintDefinition;
+import org.opendaylight.yangtools.yang.model.api.SchemaPath;
+import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
+import java.util.Collection;
+import org.opendaylight.yangtools.yang.model.api.stmt.InputStatement;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+public class InputEffectiveStatementImpl extends
+        AbstractEffectiveDocumentedDataNodeContainer<QName, InputStatement>
+        implements ContainerSchemaNode {
+
+    private final QName qname;
+    private final SchemaPath path;
+    private final boolean presence;
+
+    boolean augmenting;
+    boolean addedByUses;
+    boolean configuration;
+    ContainerSchemaNode original;
+    ConstraintDefinition constraints;
+
+    private ImmutableSet<AugmentationSchema> augmentations;
+    private ImmutableList<UnknownSchemaNode> unknownNodes;
+
+    public InputEffectiveStatementImpl(
+            StmtContext<QName, InputStatement, EffectiveStatement<QName, InputStatement>> ctx) {
+        super(ctx);
+
+        qname = ctx.getStatementArgument();
+        path = Utils.getSchemaPath(ctx);
+        presence = (firstEffective(PresenceEffectiveStatementImpl.class) == null) ? false
+                : true;
+        // :TODO init other fields
+
+        initSubstatementCollections();
+    }
+
+    private void initSubstatementCollections() {
+        Collection<? extends EffectiveStatement<?, ?>> effectiveSubstatements = effectiveSubstatements();
+
+        LinkedList<UnknownSchemaNode> unknownNodes = new LinkedList<UnknownSchemaNode>();
+        HashSet<AugmentationSchema> augmentations = new HashSet<AugmentationSchema>();
+
+        for (EffectiveStatement<?, ?> effectiveStatement : effectiveSubstatements) {
+            if (effectiveStatement instanceof UnknownSchemaNode) {
+                UnknownSchemaNode unknownNode = (UnknownSchemaNode) effectiveStatement;
+                unknownNodes.add(unknownNode);
+            }
+            if (effectiveStatement instanceof AugmentationSchema) {
+                AugmentationSchema augmentationSchema = (AugmentationSchema) effectiveStatement;
+                augmentations.add(augmentationSchema);
+            }
+        }
+
+        this.unknownNodes = ImmutableList.copyOf(unknownNodes);
+        this.augmentations = ImmutableSet.copyOf(augmentations);
+    }
+
+    @Override
+    public QName getQName() {
+        return qname;
+    }
+
+    @Override
+    public SchemaPath getPath() {
+        return path;
+    }
+
+    @Override
+    public boolean isAugmenting() {
+        return augmenting;
+    }
+
+    @Override
+    public boolean isAddedByUses() {
+        return addedByUses;
+    }
+
+    @Override
+    public boolean isConfiguration() {
+        return configuration;
+    }
+
+    @Override
+    public ConstraintDefinition getConstraints() {
+        return constraints;
+    }
+
+    @Override
+    public Set<AugmentationSchema> getAvailableAugmentations() {
+        return augmentations;
+    }
+
+    @Override
+    public boolean isPresenceContainer() {
+        return presence;
+    }
+
+    @Override
+    public List<UnknownSchemaNode> getUnknownSchemaNodes() {
+        return unknownNodes;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((qname == null) ? 0 : qname.hashCode());
+        result = prime * result + ((path == null) ? 0 : path.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(final Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        InputEffectiveStatementImpl other = (InputEffectiveStatementImpl) obj;
+        if (qname == null) {
+            if (other.qname != null) {
+                return false;
+            }
+        } else if (!qname.equals(other.qname)) {
+            return false;
+        }
+        if (path == null) {
+            if (other.path != null) {
+                return false;
+            }
+        } else if (!path.equals(other.path)) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        return "RPC input " + qname.getLocalName();
+    }
+
+}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/KeyEffectiveStatementImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/KeyEffectiveStatementImpl.java
new file mode 100644 (file)
index 0000000..4d61814
--- /dev/null
@@ -0,0 +1,24 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import java.util.Collection;
+import org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier;
+
+import org.opendaylight.yangtools.yang.model.api.stmt.KeyStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+public class KeyEffectiveStatementImpl extends
+        EffectiveStatementBase<Collection<SchemaNodeIdentifier>, KeyStatement> {
+
+    public KeyEffectiveStatementImpl(
+            StmtContext<Collection<SchemaNodeIdentifier>, KeyStatement, ?> ctx) {
+        super(ctx);
+    }
+
+}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/LeafEffectiveStatementImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/LeafEffectiveStatementImpl.java
new file mode 100644 (file)
index 0000000..45ecda5
--- /dev/null
@@ -0,0 +1,173 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import java.util.Collection;
+import java.util.LinkedList;
+
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.Utils;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+import org.opendaylight.yangtools.yang.model.api.stmt.LeafStatement;
+import com.google.common.base.Optional;
+import com.google.common.collect.ImmutableList;
+import java.util.List;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.model.api.ConstraintDefinition;
+import org.opendaylight.yangtools.yang.model.api.DerivableSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.SchemaPath;
+import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
+import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
+
+public class LeafEffectiveStatementImpl extends
+        AbstractEffectiveDocumentedNode<QName, LeafStatement> implements
+        LeafSchemaNode, DerivableSchemaNode {
+    private final QName qname;
+    private final SchemaPath path;
+
+    boolean augmenting;
+    boolean addedByUses;
+    LeafSchemaNode original;
+    boolean configuration;
+    ConstraintDefinition constraintsDef;
+    TypeDefinition<?> type;
+    String defaultStr;
+    String unitsStr;
+
+    private ImmutableList<UnknownSchemaNode> unknownNodes;
+
+    public LeafEffectiveStatementImpl(
+            StmtContext<QName, LeafStatement, EffectiveStatement<QName, LeafStatement>> ctx) {
+        super(ctx);
+        this.qname = ctx.getStatementArgument();
+        this.path = Utils.getSchemaPath(ctx);
+        // :TODO init other fields
+
+        initSubstatementCollections();
+    }
+
+    private void initSubstatementCollections() {
+        Collection<? extends EffectiveStatement<?, ?>> effectiveSubstatements = effectiveSubstatements();
+
+        LinkedList<UnknownSchemaNode> unknownNodes = new LinkedList<UnknownSchemaNode>();
+
+        for (EffectiveStatement<?, ?> effectiveStatement : effectiveSubstatements) {
+            if (effectiveStatement instanceof UnknownSchemaNode) {
+                UnknownSchemaNode unknownNode = (UnknownSchemaNode) effectiveStatement;
+                unknownNodes.add(unknownNode);
+            }
+        }
+
+        this.unknownNodes = ImmutableList.copyOf(unknownNodes);
+    }
+
+    @Override
+    public QName getQName() {
+        return qname;
+    }
+
+    @Override
+    public SchemaPath getPath() {
+        return path;
+    }
+
+    @Override
+    public boolean isAugmenting() {
+        return augmenting;
+    }
+
+    @Override
+    public boolean isAddedByUses() {
+        return addedByUses;
+    }
+
+    @Override
+    public Optional<LeafSchemaNode> getOriginal() {
+        return Optional.fromNullable(original);
+    }
+
+    @Override
+    public boolean isConfiguration() {
+        return configuration;
+    }
+
+    @Override
+    public ConstraintDefinition getConstraints() {
+        return constraintsDef;
+    }
+
+    @Override
+    public TypeDefinition<?> getType() {
+        return type;
+    }
+
+    @Override
+    public List<UnknownSchemaNode> getUnknownSchemaNodes() {
+        return unknownNodes;
+    }
+
+    @Override
+    public String getDefault() {
+        return defaultStr;
+    }
+
+    @Override
+    public String getUnits() {
+        return unitsStr;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((qname == null) ? 0 : qname.hashCode());
+        result = prime * result + ((path == null) ? 0 : path.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(final Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        LeafEffectiveStatementImpl other = (LeafEffectiveStatementImpl) obj;
+        if (qname == null) {
+            if (other.qname != null) {
+                return false;
+            }
+        } else if (!qname.equals(other.qname)) {
+            return false;
+        }
+        if (path == null) {
+            if (other.path != null) {
+                return false;
+            }
+        } else if (!path.equals(other.path)) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder(
+                LeafEffectiveStatementImpl.class.getSimpleName());
+        sb.append("[");
+        sb.append("qname=").append(qname);
+        sb.append(", path=").append(path);
+        sb.append("]");
+        return sb.toString();
+    }
+}
\ No newline at end of file
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/LeafListEffectiveStatementImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/LeafListEffectiveStatementImpl.java
new file mode 100644 (file)
index 0000000..768a99e
--- /dev/null
@@ -0,0 +1,162 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import java.util.Collection;
+import java.util.LinkedList;
+
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.Utils;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+import org.opendaylight.yangtools.yang.model.api.stmt.LeafListStatement;
+import com.google.common.base.Optional;
+import com.google.common.collect.ImmutableList;
+import java.util.List;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.model.api.ConstraintDefinition;
+import org.opendaylight.yangtools.yang.model.api.DerivableSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.SchemaPath;
+import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
+import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
+
+public class LeafListEffectiveStatementImpl extends AbstractEffectiveDocumentedNode<QName, LeafListStatement> implements LeafListSchemaNode, DerivableSchemaNode {
+    private final QName qname;
+    private final SchemaPath path;
+
+    boolean augmenting;
+    boolean addedByUses;
+    LeafListSchemaNode original;
+    boolean configuration;
+    ConstraintDefinition constraintsDef;
+    TypeDefinition<?> type;
+    boolean userOrdered;
+
+    private ImmutableList<UnknownSchemaNode> unknownNodes;
+
+    public LeafListEffectiveStatementImpl(StmtContext<QName, LeafListStatement, EffectiveStatement<QName, LeafListStatement>> ctx) {
+        super(ctx);
+        this.qname = ctx.getStatementArgument();
+        this.path = Utils.getSchemaPath(ctx);
+        //:TODO init other fields
+
+        initSubstatementCollections();
+    }
+
+    private void initSubstatementCollections() {
+        Collection<? extends EffectiveStatement<?, ?>> effectiveSubstatements = effectiveSubstatements();
+
+        LinkedList<UnknownSchemaNode> unknownNodes = new LinkedList<UnknownSchemaNode>();
+
+        for (EffectiveStatement<?, ?> effectiveStatement : effectiveSubstatements) {
+            if (effectiveStatement instanceof UnknownSchemaNode) {
+                UnknownSchemaNode unknownNode = (UnknownSchemaNode) effectiveStatement;
+                unknownNodes.add(unknownNode);
+            }
+        }
+
+        this.unknownNodes = ImmutableList.copyOf(unknownNodes);
+    }
+
+    @Override
+    public QName getQName() {
+        return qname;
+    }
+
+    @Override
+    public SchemaPath getPath() {
+        return path;
+    }
+
+    @Override
+    public boolean isAugmenting() {
+        return augmenting;
+    }
+
+    @Override
+    public boolean isAddedByUses() {
+        return addedByUses;
+    }
+
+    @Override
+    public Optional<LeafListSchemaNode> getOriginal() {
+        return Optional.fromNullable(original);
+    }
+
+    @Override
+    public boolean isConfiguration() {
+        return configuration;
+    }
+
+    @Override
+    public ConstraintDefinition getConstraints() {
+        return constraintsDef;
+    }
+
+    @Override
+    public TypeDefinition<?> getType() {
+        return type;
+    }
+
+    @Override
+    public boolean isUserOrdered() {
+        return userOrdered;
+    }
+
+    @Override
+    public List<UnknownSchemaNode> getUnknownSchemaNodes() {
+        return unknownNodes;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((qname == null) ? 0 : qname.hashCode());
+        result = prime * result + ((path == null) ? 0 : path.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(final Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        LeafListEffectiveStatementImpl other = (LeafListEffectiveStatementImpl) obj;
+        if (qname == null) {
+            if (other.qname != null) {
+                return false;
+            }
+        } else if (!qname.equals(other.qname)) {
+            return false;
+        }
+        if (path == null) {
+            if (other.path != null) {
+                return false;
+            }
+        } else if (!path.equals(other.path)) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder(LeafListEffectiveStatementImpl.class.getSimpleName());
+        sb.append("[");
+        sb.append(qname);
+        sb.append("]");
+        return sb.toString();
+    }
+}
\ No newline at end of file
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/LengthEffectiveStatementImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/LengthEffectiveStatementImpl.java
new file mode 100644 (file)
index 0000000..a2d18ec
--- /dev/null
@@ -0,0 +1,22 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import org.opendaylight.yangtools.yang.model.api.stmt.LengthStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+public class LengthEffectiveStatementImpl extends
+        EffectiveStatementBase<String, LengthStatement> {
+
+    public LengthEffectiveStatementImpl(
+            StmtContext<String, LengthStatement, ?> ctx) {
+        super(ctx);
+
+    }
+
+}
\ No newline at end of file
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/ListEffectiveStatementImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/ListEffectiveStatementImpl.java
new file mode 100644 (file)
index 0000000..30ba7d4
--- /dev/null
@@ -0,0 +1,188 @@
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.LinkedList;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.Utils;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+import org.opendaylight.yangtools.yang.model.api.stmt.ListStatement;
+import com.google.common.base.Optional;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
+import java.util.List;
+import java.util.Set;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
+import org.opendaylight.yangtools.yang.model.api.ConstraintDefinition;
+import org.opendaylight.yangtools.yang.model.api.DerivableSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.SchemaPath;
+import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
+
+public class ListEffectiveStatementImpl extends
+        AbstractEffectiveDocumentedDataNodeContainer<QName, ListStatement>
+        implements ListSchemaNode, DerivableSchemaNode {
+    private final QName qname;
+    private final SchemaPath path;
+
+    boolean augmenting;
+    boolean addedByUses;
+    ListSchemaNode original;
+    boolean configuration;
+    ConstraintDefinition constraints;
+    boolean userOrdered;
+
+    ImmutableList<QName> keyDefinition;
+    ImmutableSet<AugmentationSchema> augmentations;
+    ImmutableList<UnknownSchemaNode> unknownNodes;
+
+    public ListEffectiveStatementImpl(
+            StmtContext<QName, ListStatement, EffectiveStatement<QName, ListStatement>> ctx) {
+        super(ctx);
+        this.qname = ctx.getStatementArgument();
+        this.path = Utils.getSchemaPath(ctx);
+        // :TODO init other fields
+
+        initKeyDefinition();
+        initSubstatementCollections();
+    }
+
+    /**
+     *
+     */
+    private void initKeyDefinition() {
+        List<QName> keyDefinition = new LinkedList<QName>();
+        KeyEffectiveStatementImpl key = firstEffective(KeyEffectiveStatementImpl.class);
+
+        if (key != null) {
+            Collection<SchemaNodeIdentifier> keyParts = key.argument();
+            for (SchemaNodeIdentifier keyPart : keyParts) {
+                keyDefinition.add(keyPart.getLastComponent());
+            }
+        }
+
+        this.keyDefinition = ImmutableList.copyOf(keyDefinition);
+    }
+
+    private void initSubstatementCollections() {
+        Collection<? extends EffectiveStatement<?, ?>> effectiveSubstatements = effectiveSubstatements();
+
+        LinkedList<UnknownSchemaNode> unknownNodes = new LinkedList<UnknownSchemaNode>();
+        HashSet<AugmentationSchema> augmentations = new HashSet<AugmentationSchema>();
+
+        for (EffectiveStatement<?, ?> effectiveStatement : effectiveSubstatements) {
+            if (effectiveStatement instanceof UnknownSchemaNode) {
+                UnknownSchemaNode unknownNode = (UnknownSchemaNode) effectiveStatement;
+                unknownNodes.add(unknownNode);
+            }
+            if (effectiveStatement instanceof AugmentationSchema) {
+                AugmentationSchema augmentationSchema = (AugmentationSchema) effectiveStatement;
+                augmentations.add(augmentationSchema);
+            }
+        }
+
+        this.unknownNodes = ImmutableList.copyOf(unknownNodes);
+        this.augmentations = ImmutableSet.copyOf(augmentations);
+    }
+
+    @Override
+    public QName getQName() {
+        return qname;
+    }
+
+    @Override
+    public SchemaPath getPath() {
+        return path;
+    }
+
+    @Override
+    public List<QName> getKeyDefinition() {
+        return keyDefinition;
+    }
+
+    @Override
+    public boolean isAugmenting() {
+        return augmenting;
+    }
+
+    @Override
+    public boolean isAddedByUses() {
+        return addedByUses;
+    }
+
+    @Override
+    public Optional<ListSchemaNode> getOriginal() {
+        return Optional.fromNullable(original);
+    }
+
+    @Override
+    public boolean isConfiguration() {
+        return configuration;
+    }
+
+    @Override
+    public ConstraintDefinition getConstraints() {
+        return constraints;
+    }
+
+    @Override
+    public Set<AugmentationSchema> getAvailableAugmentations() {
+        return augmentations;
+    }
+
+    @Override
+    public boolean isUserOrdered() {
+        return userOrdered;
+    }
+
+    @Override
+    public List<UnknownSchemaNode> getUnknownSchemaNodes() {
+        return unknownNodes;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((qname == null) ? 0 : qname.hashCode());
+        result = prime * result + ((path == null) ? 0 : path.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(final Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        final ListEffectiveStatementImpl other = (ListEffectiveStatementImpl) obj;
+        if (qname == null) {
+            if (other.qname != null) {
+                return false;
+            }
+        } else if (!qname.equals(other.qname)) {
+            return false;
+        }
+        if (path == null) {
+            if (other.path != null) {
+                return false;
+            }
+        } else if (!path.equals(other.path)) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        return "list " + qname.getLocalName();
+    }
+}
\ No newline at end of file
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/MandatoryEffectiveStatementImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/MandatoryEffectiveStatementImpl.java
new file mode 100644 (file)
index 0000000..408c97f
--- /dev/null
@@ -0,0 +1,22 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import org.opendaylight.yangtools.yang.model.api.stmt.MandatoryStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+public class MandatoryEffectiveStatementImpl extends
+        EffectiveStatementBase<Boolean, MandatoryStatement> {
+
+    public MandatoryEffectiveStatementImpl(
+            StmtContext<Boolean, MandatoryStatement, ?> ctx) {
+        super(ctx);
+
+    }
+
+}
\ No newline at end of file
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/MaxElementsEffectiveStatementImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/MaxElementsEffectiveStatementImpl.java
new file mode 100644 (file)
index 0000000..7055f74
--- /dev/null
@@ -0,0 +1,22 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import org.opendaylight.yangtools.yang.model.api.stmt.MaxElementsStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+public class MaxElementsEffectiveStatementImpl extends
+        EffectiveStatementBase<String, MaxElementsStatement> {
+
+    public MaxElementsEffectiveStatementImpl(
+            StmtContext<String, MaxElementsStatement, ?> ctx) {
+        super(ctx);
+
+    }
+
+}
\ No newline at end of file
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/MinElementsEffectiveStatementImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/MinElementsEffectiveStatementImpl.java
new file mode 100644 (file)
index 0000000..e80e26c
--- /dev/null
@@ -0,0 +1,22 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import org.opendaylight.yangtools.yang.model.api.stmt.MinElementsStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+public class MinElementsEffectiveStatementImpl extends
+        EffectiveStatementBase<String, MinElementsStatement> {
+
+    public MinElementsEffectiveStatementImpl(
+            StmtContext<String, MinElementsStatement, ?> ctx) {
+        super(ctx);
+
+    }
+
+}
\ No newline at end of file
index 1e82cf19f234729a8de5c0cc536529eb2e9bfba5..1e6d51cf8b27912fdf920afea11c4f1b00c1b696 100644 (file)
@@ -7,8 +7,10 @@
  */
 package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
 
-import org.opendaylight.yangtools.yang.parser.spi.source.ModuleNameToModuleQName;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
 
+import org.opendaylight.yangtools.yang.parser.spi.source.ModuleNameToModuleQName;
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.LinkedList;
@@ -37,23 +39,23 @@ public class ModuleEffectiveStatementImpl extends
         AbstractEffectiveDocumentedDataNodeContainer<String, ModuleStatement>
         implements Module, Immutable {
 
-    private QNameModule qnameModule;
-    private String name;
+    private final QNameModule qnameModule;
+    private final String name;
     private String sourcePath;
     private String prefix;
     private String yangVersion;
     private String organization;
     private String contact;
-    private Set<ModuleImport> imports;
-    private Set<Module> submodules;
-    private Set<FeatureDefinition> features;
-    private Set<NotificationDefinition> notifications;
-    private Set<AugmentationSchema> augmentations;
-    private Set<RpcDefinition> rpcs;
-    private Set<Deviation> deviations;
-    private List<ExtensionDefinition> extensionNodes;
-    private Set<IdentitySchemaNode> identities;
-    private List<UnknownSchemaNode> unknownNodes;
+    private ImmutableSet<ModuleImport> imports;
+    private ImmutableSet<Module> submodules;
+    private ImmutableSet<FeatureDefinition> features;
+    private ImmutableSet<NotificationDefinition> notifications;
+    private ImmutableSet<AugmentationSchema> augmentations;
+    private ImmutableSet<RpcDefinition> rpcs;
+    private ImmutableSet<Deviation> deviations;
+    private ImmutableList<ExtensionDefinition> extensionNodes;
+    private ImmutableSet<IdentitySchemaNode> identities;
+    private ImmutableList<UnknownSchemaNode> unknownNodes;
     private String source;
 
     public ModuleEffectiveStatementImpl(
@@ -62,17 +64,17 @@ public class ModuleEffectiveStatementImpl extends
 
         name = argument();
         qnameModule = ctx.getFromNamespace(ModuleNameToModuleQName.class, name);
+        // :TODO init other fields
 
         initSubstatementCollections();
 
-        // :TODO init other fields
     }
 
     private void initSubstatementCollections() {
         Collection<? extends EffectiveStatement<?, ?>> effectiveSubstatements = effectiveSubstatements();
 
-        unknownNodes = new LinkedList<UnknownSchemaNode>();
-        augmentations = new HashSet<AugmentationSchema>();
+        LinkedList<UnknownSchemaNode> unknownNodes = new LinkedList<UnknownSchemaNode>();
+        HashSet<AugmentationSchema> augmentations = new HashSet<AugmentationSchema>();
 
         for (EffectiveStatement<?, ?> effectiveStatement : effectiveSubstatements) {
             if (effectiveStatement instanceof UnknownSchemaNode) {
@@ -85,6 +87,9 @@ public class ModuleEffectiveStatementImpl extends
             }
         }
 
+        this.unknownNodes = ImmutableList.copyOf(unknownNodes);
+        this.augmentations = ImmutableSet.copyOf(augmentations);
+
         // :TODO other substatement collections ...
     }
 
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/MustEffectiveStatementImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/MustEffectiveStatementImpl.java
new file mode 100644 (file)
index 0000000..52bbd37
--- /dev/null
@@ -0,0 +1,16 @@
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import org.opendaylight.yangtools.yang.model.api.RevisionAwareXPath;
+import org.opendaylight.yangtools.yang.model.api.stmt.MustStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+public class MustEffectiveStatementImpl extends
+        EffectiveStatementBase<RevisionAwareXPath, MustStatement> {
+
+    public MustEffectiveStatementImpl(
+            StmtContext<RevisionAwareXPath, MustStatement, ?> ctx) {
+        super(ctx);
+
+    }
+
+}
\ No newline at end of file
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/NotificationEffectiveStatementImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/NotificationEffectiveStatementImpl.java
new file mode 100644 (file)
index 0000000..4afe4f4
--- /dev/null
@@ -0,0 +1,133 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.LinkedList;
+
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.Utils;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.NotificationStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
+import java.util.List;
+import java.util.Set;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
+import org.opendaylight.yangtools.yang.model.api.NotificationDefinition;
+import org.opendaylight.yangtools.yang.model.api.SchemaPath;
+import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
+
+public class NotificationEffectiveStatementImpl
+        extends
+        AbstractEffectiveDocumentedDataNodeContainer<QName, NotificationStatement>
+        implements NotificationDefinition {
+    private final QName qname;
+    private final SchemaPath path;
+    ImmutableSet<AugmentationSchema> augmentations;
+    ImmutableList<UnknownSchemaNode> unknownNodes;
+
+    public NotificationEffectiveStatementImpl(
+            StmtContext<QName, NotificationStatement, EffectiveStatement<QName, NotificationStatement>> ctx) {
+        super(ctx);
+        this.qname = ctx.getStatementArgument();
+        this.path = Utils.getSchemaPath(ctx);
+
+        initSubstatementCollections();
+    }
+
+    private void initSubstatementCollections() {
+        Collection<? extends EffectiveStatement<?, ?>> effectiveSubstatements = effectiveSubstatements();
+
+        LinkedList<UnknownSchemaNode> unknownNodes = new LinkedList<UnknownSchemaNode>();
+        HashSet<AugmentationSchema> augmentations = new HashSet<AugmentationSchema>();
+
+        for (EffectiveStatement<?, ?> effectiveStatement : effectiveSubstatements) {
+            if (effectiveStatement instanceof UnknownSchemaNode) {
+                UnknownSchemaNode unknownNode = (UnknownSchemaNode) effectiveStatement;
+                unknownNodes.add(unknownNode);
+            }
+            if (effectiveStatement instanceof AugmentationSchema) {
+                AugmentationSchema augmentationSchema = (AugmentationSchema) effectiveStatement;
+                augmentations.add(augmentationSchema);
+            }
+        }
+
+        this.unknownNodes = ImmutableList.copyOf(unknownNodes);
+        this.augmentations = ImmutableSet.copyOf(augmentations);
+    }
+
+    @Override
+    public QName getQName() {
+        return qname;
+    }
+
+    @Override
+    public SchemaPath getPath() {
+        return path;
+    }
+
+    @Override
+    public Set<AugmentationSchema> getAvailableAugmentations() {
+        return augmentations;
+    }
+
+    @Override
+    public List<UnknownSchemaNode> getUnknownSchemaNodes() {
+        return unknownNodes;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((qname == null) ? 0 : qname.hashCode());
+        result = prime * result + ((path == null) ? 0 : path.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(final Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        final NotificationEffectiveStatementImpl other = (NotificationEffectiveStatementImpl) obj;
+        if (qname == null) {
+            if (other.qname != null) {
+                return false;
+            }
+        } else if (!qname.equals(other.qname)) {
+            return false;
+        }
+        if (path == null) {
+            if (other.path != null) {
+                return false;
+            }
+        } else if (!path.equals(other.path)) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder(
+                NotificationEffectiveStatementImpl.class.getSimpleName());
+        sb.append("[qname=").append(qname).append(", path=").append(path)
+                .append("]");
+        return sb.toString();
+    }
+}
\ No newline at end of file
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/OrderedByEffectiveStatementImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/OrderedByEffectiveStatementImpl.java
new file mode 100644 (file)
index 0000000..8189e90
--- /dev/null
@@ -0,0 +1,22 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import org.opendaylight.yangtools.yang.model.api.stmt.OrderedByStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+public class OrderedByEffectiveStatementImpl extends
+        EffectiveStatementBase<String, OrderedByStatement> {
+
+    public OrderedByEffectiveStatementImpl(
+            StmtContext<String, OrderedByStatement, ?> ctx) {
+        super(ctx);
+
+    }
+
+}
\ No newline at end of file
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/OrganizationEffectiveStatementImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/OrganizationEffectiveStatementImpl.java
new file mode 100644 (file)
index 0000000..2dd08e1
--- /dev/null
@@ -0,0 +1,22 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import org.opendaylight.yangtools.yang.model.api.stmt.OrganizationStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+public class OrganizationEffectiveStatementImpl extends
+EffectiveStatementBase<String, OrganizationStatement> {
+
+    public OrganizationEffectiveStatementImpl(
+            StmtContext<String, OrganizationStatement, ?> ctx) {
+        super(ctx);
+
+    }
+
+}
\ No newline at end of file
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/OutputEffectiveStatementImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/OutputEffectiveStatementImpl.java
new file mode 100644 (file)
index 0000000..e35efd9
--- /dev/null
@@ -0,0 +1,168 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import java.util.HashSet;
+import java.util.LinkedList;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.Utils;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
+import java.util.List;
+import java.util.Set;
+import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
+import org.opendaylight.yangtools.yang.model.api.ConstraintDefinition;
+import org.opendaylight.yangtools.yang.model.api.SchemaPath;
+import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
+import java.util.Collection;
+import org.opendaylight.yangtools.yang.model.api.stmt.OutputStatement;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+public class OutputEffectiveStatementImpl extends
+        AbstractEffectiveDocumentedDataNodeContainer<QName, OutputStatement>
+        implements ContainerSchemaNode {
+
+    private final QName qname;
+    private final SchemaPath path;
+    private final boolean presence;
+
+    boolean augmenting;
+    boolean addedByUses;
+    boolean configuration;
+    ContainerSchemaNode original;
+    ConstraintDefinition constraints;
+
+    private ImmutableSet<AugmentationSchema> augmentations;
+    private ImmutableList<UnknownSchemaNode> unknownNodes;
+
+    public OutputEffectiveStatementImpl(
+            StmtContext<QName, OutputStatement, EffectiveStatement<QName, OutputStatement>> ctx) {
+        super(ctx);
+
+        qname = ctx.getStatementArgument();
+        path = Utils.getSchemaPath(ctx);
+        presence = (firstEffective(PresenceEffectiveStatementImpl.class) == null) ? false
+                : true;
+        // :TODO init other fields
+
+        initSubstatementCollections();
+    }
+
+    private void initSubstatementCollections() {
+        Collection<? extends EffectiveStatement<?, ?>> effectiveSubstatements = effectiveSubstatements();
+
+        LinkedList<UnknownSchemaNode> unknownNodes = new LinkedList<UnknownSchemaNode>();
+        HashSet<AugmentationSchema> augmentations = new HashSet<AugmentationSchema>();
+
+        for (EffectiveStatement<?, ?> effectiveStatement : effectiveSubstatements) {
+            if (effectiveStatement instanceof UnknownSchemaNode) {
+                UnknownSchemaNode unknownNode = (UnknownSchemaNode) effectiveStatement;
+                unknownNodes.add(unknownNode);
+            }
+            if (effectiveStatement instanceof AugmentationSchema) {
+                AugmentationSchema augmentationSchema = (AugmentationSchema) effectiveStatement;
+                augmentations.add(augmentationSchema);
+            }
+        }
+
+        this.unknownNodes = ImmutableList.copyOf(unknownNodes);
+        this.augmentations = ImmutableSet.copyOf(augmentations);
+    }
+
+    @Override
+    public QName getQName() {
+        return qname;
+    }
+
+    @Override
+    public SchemaPath getPath() {
+        return path;
+    }
+
+    @Override
+    public boolean isAugmenting() {
+        return augmenting;
+    }
+
+    @Override
+    public boolean isAddedByUses() {
+        return addedByUses;
+    }
+
+    @Override
+    public boolean isConfiguration() {
+        return configuration;
+    }
+
+    @Override
+    public ConstraintDefinition getConstraints() {
+        return constraints;
+    }
+
+    @Override
+    public Set<AugmentationSchema> getAvailableAugmentations() {
+        return augmentations;
+    }
+
+    @Override
+    public boolean isPresenceContainer() {
+        return presence;
+    }
+
+    @Override
+    public List<UnknownSchemaNode> getUnknownSchemaNodes() {
+        return unknownNodes;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((qname == null) ? 0 : qname.hashCode());
+        result = prime * result + ((path == null) ? 0 : path.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(final Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        OutputEffectiveStatementImpl other = (OutputEffectiveStatementImpl) obj;
+        if (qname == null) {
+            if (other.qname != null) {
+                return false;
+            }
+        } else if (!qname.equals(other.qname)) {
+            return false;
+        }
+        if (path == null) {
+            if (other.path != null) {
+                return false;
+            }
+        } else if (!path.equals(other.path)) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        return "RPC Output " + qname.getLocalName();
+    }
+
+}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/PatternEffectiveStatementImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/PatternEffectiveStatementImpl.java
new file mode 100644 (file)
index 0000000..c3a776e
--- /dev/null
@@ -0,0 +1,22 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import org.opendaylight.yangtools.yang.model.api.stmt.PatternStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+public class PatternEffectiveStatementImpl extends
+        EffectiveStatementBase<String, PatternStatement> {
+
+    public PatternEffectiveStatementImpl(
+            StmtContext<String, PatternStatement, ?> ctx) {
+        super(ctx);
+
+    }
+
+}
\ No newline at end of file
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/PositionEffectiveStatementImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/PositionEffectiveStatementImpl.java
new file mode 100644 (file)
index 0000000..41eaba7
--- /dev/null
@@ -0,0 +1,22 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import org.opendaylight.yangtools.yang.model.api.stmt.PositionStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+public class PositionEffectiveStatementImpl extends
+        EffectiveStatementBase<String, PositionStatement> {
+
+    public PositionEffectiveStatementImpl(
+            StmtContext<String, PositionStatement, ?> ctx) {
+        super(ctx);
+
+    }
+
+}
\ No newline at end of file
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/RangeEffectiveStatementImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/RangeEffectiveStatementImpl.java
new file mode 100644 (file)
index 0000000..8b03a38
--- /dev/null
@@ -0,0 +1,22 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import org.opendaylight.yangtools.yang.model.api.stmt.RangeStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+public class RangeEffectiveStatementImpl extends
+        EffectiveStatementBase<String, RangeStatement> {
+
+    public RangeEffectiveStatementImpl(
+            StmtContext<String, RangeStatement, ?> ctx) {
+        super(ctx);
+
+    }
+
+}
\ No newline at end of file
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/RefineEffectiveStatementImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/RefineEffectiveStatementImpl.java
new file mode 100644 (file)
index 0000000..b5c2221
--- /dev/null
@@ -0,0 +1,23 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * <p/>
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import org.opendaylight.yangtools.yang.model.api.stmt.RefineStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+public class RefineEffectiveStatementImpl extends
+        EffectiveStatementBase<SchemaNodeIdentifier, RefineStatement> {
+
+    public RefineEffectiveStatementImpl(
+            StmtContext<SchemaNodeIdentifier, RefineStatement, ?> ctx) {
+        super(ctx);
+
+    }
+
+}
\ No newline at end of file
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/RequireInstanceEffectiveStatementImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/RequireInstanceEffectiveStatementImpl.java
new file mode 100644 (file)
index 0000000..b89b443
--- /dev/null
@@ -0,0 +1,22 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import org.opendaylight.yangtools.yang.model.api.stmt.RequireInstanceStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+public class RequireInstanceEffectiveStatementImpl extends
+        EffectiveStatementBase<Boolean, RequireInstanceStatement> {
+
+    public RequireInstanceEffectiveStatementImpl(
+            StmtContext<Boolean, RequireInstanceStatement, ?> ctx) {
+        super(ctx);
+
+    }
+
+}
\ No newline at end of file
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/RevisionDateEffectiveStatementImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/RevisionDateEffectiveStatementImpl.java
new file mode 100644 (file)
index 0000000..5c95080
--- /dev/null
@@ -0,0 +1,21 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import org.opendaylight.yangtools.yang.model.api.stmt.RevisionDateStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+public class RevisionDateEffectiveStatementImpl extends
+        EffectiveStatementBase<String, RevisionDateStatement> {
+
+    public RevisionDateEffectiveStatementImpl(
+            StmtContext<String, RevisionDateStatement, ?> ctx) {
+        super(ctx);
+    }
+
+}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/RevisionEffectiveStatementImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/RevisionEffectiveStatementImpl.java
new file mode 100644 (file)
index 0000000..b255ff9
--- /dev/null
@@ -0,0 +1,22 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import java.util.Date;
+import org.opendaylight.yangtools.yang.model.api.stmt.RevisionStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+public class RevisionEffectiveStatementImpl extends
+        EffectiveStatementBase<Date, RevisionStatement> {
+
+    public RevisionEffectiveStatementImpl(
+            StmtContext<Date, RevisionStatement, ?> ctx) {
+        super(ctx);
+    }
+
+}
\ No newline at end of file
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/RpcEffectiveStatementImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/RpcEffectiveStatementImpl.java
new file mode 100644 (file)
index 0000000..a0d1ad1
--- /dev/null
@@ -0,0 +1,178 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.LinkedList;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.Utils;
+import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+import org.opendaylight.yangtools.yang.model.api.stmt.RpcStatement;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
+import java.util.List;
+import java.util.Set;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.GroupingDefinition;
+import org.opendaylight.yangtools.yang.model.api.RpcDefinition;
+import org.opendaylight.yangtools.yang.model.api.SchemaPath;
+import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
+import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
+
+public class RpcEffectiveStatementImpl extends AbstractEffectiveDocumentedNode<QName, RpcStatement> implements RpcDefinition {
+    private final QName qname;
+    private final SchemaPath path;
+
+    private ContainerSchemaNode input;
+    private ContainerSchemaNode output;
+
+    ImmutableSet<TypeDefinition<?>> typeDefinitions;
+    ImmutableSet<GroupingDefinition> groupings;
+    ImmutableList<UnknownSchemaNode> unknownNodes;
+
+    public RpcEffectiveStatementImpl(StmtContext<QName, RpcStatement, EffectiveStatement<QName, RpcStatement>> ctx) {
+        super(ctx);
+        this.qname = ctx.getStatementArgument();
+        this.path = Utils.getSchemaPath(ctx);
+
+        initSubstatements();
+
+    }
+
+    private void initSubstatements() {
+        Collection<? extends EffectiveStatement<?, ?>> effectiveSubstatements = effectiveSubstatements();
+
+        LinkedList<UnknownSchemaNode> unknownNodes = new LinkedList<UnknownSchemaNode>();
+        HashSet<GroupingDefinition> groupings = new HashSet<GroupingDefinition>();
+        HashSet<TypeDefinition<?>> typeDefinitions = new HashSet<TypeDefinition<?>>();
+
+        for (EffectiveStatement<?, ?> effectiveStatement : effectiveSubstatements) {
+            if (effectiveStatement instanceof UnknownSchemaNode) {
+                UnknownSchemaNode unknownNode = (UnknownSchemaNode) effectiveStatement;
+                unknownNodes.add(unknownNode);
+            }
+            if (effectiveStatement instanceof GroupingDefinition) {
+                GroupingDefinition groupingDefinition = (GroupingDefinition) effectiveStatement;
+                groupings.add(groupingDefinition);
+            }
+            if (effectiveStatement instanceof TypeDefinition) {
+                TypeDefinition<?> typeDefinition = (TypeDefinition<?>) effectiveStatement;
+                typeDefinitions.add(typeDefinition);
+            }
+            if (this.input == null && effectiveStatement instanceof InputEffectiveStatementImpl) {
+                this.input = (InputEffectiveStatementImpl) effectiveStatement;
+            }
+            if (this.output == null && effectiveStatement instanceof OutputEffectiveStatementImpl) {
+                this.output = (OutputEffectiveStatementImpl) effectiveStatement;
+            }
+        }
+
+        this.unknownNodes = ImmutableList.copyOf(unknownNodes);
+        this.groupings = ImmutableSet.copyOf(groupings);
+        this.typeDefinitions = ImmutableSet.copyOf(typeDefinitions);
+    }
+
+    @Override
+    public QName getQName() {
+        return qname;
+    }
+
+    @Override
+    public SchemaPath getPath() {
+        return path;
+    }
+
+    @Override
+    public ContainerSchemaNode getInput() {
+        return input;
+    }
+
+    void setInput(final ContainerSchemaNode input) {
+        this.input = input;
+    }
+
+    @Override
+    public ContainerSchemaNode getOutput() {
+        return output;
+    }
+
+    void setOutput(final ContainerSchemaNode output) {
+        this.output = output;
+    }
+
+    @Override
+    public Set<TypeDefinition<?>> getTypeDefinitions() {
+        return typeDefinitions;
+    }
+
+    @Override
+    public Set<GroupingDefinition> getGroupings() {
+        return groupings;
+    }
+
+    @Override
+    public List<UnknownSchemaNode> getUnknownSchemaNodes() {
+        return unknownNodes;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((qname == null) ? 0 : qname.hashCode());
+        result = prime * result + ((path == null) ? 0 : path.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(final Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        final RpcEffectiveStatementImpl other = (RpcEffectiveStatementImpl) obj;
+        if (qname == null) {
+            if (other.qname != null) {
+                return false;
+            }
+        } else if (!qname.equals(other.qname)) {
+            return false;
+        }
+        if (path == null) {
+            if (other.path != null) {
+                return false;
+            }
+        } else if (!path.equals(other.path)) {
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder(RpcEffectiveStatementImpl.class.getSimpleName());
+        sb.append("[");
+        sb.append("qname=");
+        sb.append(qname);
+        sb.append(", path=");
+        sb.append(path);
+        sb.append(", input=");
+        sb.append(input);
+        sb.append(", output=");
+        sb.append(output);
+        sb.append("]");
+        return sb.toString();
+    }
+}
\ No newline at end of file
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/StatusEffectiveStatementImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/StatusEffectiveStatementImpl.java
new file mode 100644 (file)
index 0000000..eb5274d
--- /dev/null
@@ -0,0 +1,22 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import org.opendaylight.yangtools.yang.model.api.stmt.StatusStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+public class StatusEffectiveStatementImpl extends
+        EffectiveStatementBase<String, StatusStatement> {
+
+    public StatusEffectiveStatementImpl(
+            StmtContext<String, StatusStatement, ?> ctx) {
+        super(ctx);
+
+    }
+
+}
\ No newline at end of file
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/SubmoduleEffectiveStatementImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/SubmoduleEffectiveStatementImpl.java
new file mode 100644 (file)
index 0000000..762d408
--- /dev/null
@@ -0,0 +1,23 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import org.opendaylight.yangtools.yang.model.api.stmt.ModuleStatement;
+
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+public class SubmoduleEffectiveStatementImpl extends
+        ModuleEffectiveStatementImpl {
+
+    public SubmoduleEffectiveStatementImpl(
+            StmtContext<String, ModuleStatement, ?> ctx) {
+        super(ctx);
+
+    }
+
+}
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/UnitsEffectiveStatementImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/UnitsEffectiveStatementImpl.java
new file mode 100644 (file)
index 0000000..83e4fd2
--- /dev/null
@@ -0,0 +1,21 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import org.opendaylight.yangtools.yang.model.api.stmt.UnitsStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+public class UnitsEffectiveStatementImpl extends
+        EffectiveStatementBase<String, UnitsStatement> {
+
+    public UnitsEffectiveStatementImpl(
+            StmtContext<String, UnitsStatement, ?> ctx) {
+        super(ctx);
+    }
+
+}
index f2c7f508aa1515840a82c837e12669e67f43e5f1..21f6831cdfa6d9d96eb49a87f84c5ad35be7b64c 100644 (file)
@@ -1,5 +1,5 @@
-/*
- * Copyright (c) 2013-2015 Cisco Systems, Inc. and others.  All rights reserved.
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/ValueEffectiveStatementImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/ValueEffectiveStatementImpl.java
new file mode 100644 (file)
index 0000000..d21d6fa
--- /dev/null
@@ -0,0 +1,22 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import org.opendaylight.yangtools.yang.model.api.stmt.ValueStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+public class ValueEffectiveStatementImpl extends
+        EffectiveStatementBase<String, ValueStatement> {
+
+    public ValueEffectiveStatementImpl(
+            StmtContext<String, ValueStatement, ?> ctx) {
+        super(ctx);
+
+    }
+
+}
\ No newline at end of file
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/WhenEffectiveStatementImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/WhenEffectiveStatementImpl.java
new file mode 100644 (file)
index 0000000..c7eeac5
--- /dev/null
@@ -0,0 +1,23 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import org.opendaylight.yangtools.yang.model.api.RevisionAwareXPath;
+import org.opendaylight.yangtools.yang.model.api.stmt.WhenStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+public class WhenEffectiveStatementImpl extends
+        EffectiveStatementBase<RevisionAwareXPath, WhenStatement> {
+
+    public WhenEffectiveStatementImpl(
+            StmtContext<RevisionAwareXPath, WhenStatement, ?> ctx) {
+        super(ctx);
+
+    }
+
+}
\ No newline at end of file
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/YangVersionEffectiveStatementImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/YangVersionEffectiveStatementImpl.java
new file mode 100644 (file)
index 0000000..3247968
--- /dev/null
@@ -0,0 +1,22 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import org.opendaylight.yangtools.yang.model.api.stmt.YangVersionStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+public class YangVersionEffectiveStatementImpl extends
+        EffectiveStatementBase<String, YangVersionStatement> {
+
+    public YangVersionEffectiveStatementImpl(
+            StmtContext<String, YangVersionStatement, ?> ctx) {
+        super(ctx);
+
+    }
+
+}
\ No newline at end of file
diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/YinElementEffectiveStatementImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/YinElementEffectiveStatementImpl.java
new file mode 100644 (file)
index 0000000..600b0c5
--- /dev/null
@@ -0,0 +1,21 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective;
+
+import org.opendaylight.yangtools.yang.model.api.stmt.YinElementStatement;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+
+public class YinElementEffectiveStatementImpl extends
+        EffectiveStatementBase<Boolean, YinElementStatement> {
+
+    public YinElementEffectiveStatementImpl(
+            StmtContext<Boolean, YinElementStatement, ?> ctx) {
+        super(ctx);
+    }
+
+}
index 83a3abdb7d065a390f54e2a9ac6e4e0b58897161..166d08b9c6f51a8344ada62abff1f40735ce16a9 100644 (file)
@@ -2,22 +2,27 @@ package org.opendaylight.yangtools.yang.stmt.effective.build.test;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
-import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.EffectiveSchemaContext;
-import org.opendaylight.yangtools.yang.model.api.GroupingDefinition;
-import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.Module;
+
 import java.net.URI;
+
+import org.junit.Test;
+import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.QNameModule;
-import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangInferencePipeline;
-import org.opendaylight.yangtools.yang.parser.stmt.reactor.CrossSourceStatementReactor.BuildAction;
+import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.GroupingDefinition;
+import org.opendaylight.yangtools.yang.model.api.Module;
+import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
-import org.junit.Test;
 import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
+import org.opendaylight.yangtools.yang.parser.stmt.reactor.CrossSourceStatementReactor.BuildAction;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangInferencePipeline;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangStatementSourceImpl;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.EffectiveSchemaContext;
 
 public class EffectiveBuildTest {
 
-    private static final YangFileStatementSource SIMPLE_MODULE = new YangFileStatementSource("/stmt-test/effective-build/simple-module.yang");
+    private static final YangStatementSourceImpl SIMPLE_MODULE = new YangStatementSourceImpl(
+            "/stmt-test/effective-build/simple-module.yang");
     private static final QNameModule SIMPLE_MODULE_QNAME = QNameModule.create(URI.create("simple.yang"), null);
 
     @Test
@@ -28,7 +33,7 @@ public class EffectiveBuildTest {
 
         assertNotNull(result);
 
-        Module simpleModule = result.findModuleByName("simple-module",null);
+        Module simpleModule = result.findModuleByName("simple-module", null);
         assertNotNull(simpleModule);
 
         QName q1 = QName.create(SIMPLE_MODULE_QNAME, "root-container");
@@ -39,34 +44,38 @@ public class EffectiveBuildTest {
         QName q6 = QName.create(SIMPLE_MODULE_QNAME, "sub-sub-container2");
         QName q7 = QName.create(SIMPLE_MODULE_QNAME, "grp");
 
-        ContainerSchemaNode rootCon = (ContainerSchemaNode)simpleModule.getDataChildByName(q1);
+        ContainerSchemaNode rootCon = (ContainerSchemaNode) simpleModule.getDataChildByName(q1);
         assertNotNull(rootCon);
 
-        ContainerSchemaNode subCon = (ContainerSchemaNode)rootCon.getDataChildByName(q2);
+        ContainerSchemaNode subCon = (ContainerSchemaNode) rootCon.getDataChildByName(q2);
         assertNotNull(subCon);
 
-        ContainerSchemaNode subSubCon = (ContainerSchemaNode)subCon.getDataChildByName(q3);
+        ContainerSchemaNode subSubCon = (ContainerSchemaNode) subCon.getDataChildByName(q3);
         assertNotNull(subSubCon);
 
-        ContainerSchemaNode rootCon2 = (ContainerSchemaNode)simpleModule.getDataChildByName(q4);
+        ContainerSchemaNode rootCon2 = (ContainerSchemaNode) simpleModule.getDataChildByName(q4);
         assertNotNull(rootCon2);
 
-        ContainerSchemaNode subCon2 = (ContainerSchemaNode)rootCon2.getDataChildByName(q5);
+        ContainerSchemaNode subCon2 = (ContainerSchemaNode) rootCon2.getDataChildByName(q5);
         assertNotNull(subCon2);
 
-        ContainerSchemaNode subSubCon2 = (ContainerSchemaNode)subCon2.getDataChildByName(q6);
+        ContainerSchemaNode subSubCon2 = (ContainerSchemaNode) subCon2.getDataChildByName(q6);
         assertNotNull(subSubCon2);
 
         GroupingDefinition grp = simpleModule.getGroupings().iterator().next();
         assertNotNull(grp);
-        assertEquals(q7,grp.getQName());
+        assertEquals(q7, grp.getQName());
 
         ContainerSchemaNode grpSubCon2 = (ContainerSchemaNode) grp.getDataChildByName(q5);
         assertNotNull(grpSubCon2);
 
-        ContainerSchemaNode grpSubSubCon2 = (ContainerSchemaNode)grpSubCon2.getDataChildByName(q6);
+        ContainerSchemaNode grpSubSubCon2 = (ContainerSchemaNode) grpSubCon2.getDataChildByName(q6);
         assertNotNull(grpSubSubCon2);
 
+        assertEquals(SchemaPath.create(true, q1, q2, q3), subSubCon.getPath());
+        assertEquals(SchemaPath.create(true, q4, q5, q6), subSubCon2.getPath());
+        assertEquals(SchemaPath.create(true, q7, q5, q6), grpSubSubCon2.getPath());
+
     }
 
     private void log(Throwable e, String indent) {
@@ -79,9 +88,8 @@ public class EffectiveBuildTest {
 
     }
 
-    private void addSources(BuildAction reactor,
-            YangFileStatementSource... sources) {
-        for (YangFileStatementSource source : sources) {
+    private void addSources(BuildAction reactor, YangStatementSourceImpl... sources) {
+        for (YangStatementSourceImpl source : sources) {
             reactor.addSource(source);
         }
     }
diff --git a/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/AugmentProcessTest.java b/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/AugmentProcessTest.java
new file mode 100644 (file)
index 0000000..d9ecd4e
--- /dev/null
@@ -0,0 +1,87 @@
+package org.opendaylight.yangtools.yang.stmt.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.junit.Test;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.common.QNameModule;
+import org.opendaylight.yangtools.yang.model.api.AnyXmlSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.Module;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
+import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
+import org.opendaylight.yangtools.yang.parser.spi.source.StatementStreamSource;
+import org.opendaylight.yangtools.yang.parser.stmt.reactor.CrossSourceStatementReactor;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangInferencePipeline;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangStatementSourceImpl;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.EffectiveSchemaContext;
+
+import java.net.URI;
+
+public class AugmentProcessTest {
+
+    private static final YangStatementSourceImpl AUGMENTED = new YangStatementSourceImpl(
+            "/stmt-test/effective-build/augmented.yang");
+    private static final YangStatementSourceImpl ROOT = new YangStatementSourceImpl(
+            "/stmt-test/effective-build/aug-root.yang");
+
+    private static final QNameModule AUGMENTED_QNAME_MODULE = QNameModule.create(URI.create("aug"), null);
+
+    QName augParent1 = QName.create(AUGMENTED_QNAME_MODULE, "aug-parent1");
+    QName augParent2 = QName.create(AUGMENTED_QNAME_MODULE, "aug-parent2");
+    QName contTarget = QName.create(AUGMENTED_QNAME_MODULE, "cont-target");
+
+    QName contAdded1 = QName.create(AUGMENTED_QNAME_MODULE, "cont-added1");
+    QName contAdded2 = QName.create(AUGMENTED_QNAME_MODULE, "cont-added2");
+
+    QName list1 = QName.create(AUGMENTED_QNAME_MODULE, "list1");
+    QName axml = QName.create(AUGMENTED_QNAME_MODULE, "axml");
+
+    QName contGrp = QName.create(AUGMENTED_QNAME_MODULE, "cont-grp");
+    QName axmlGrp = QName.create(AUGMENTED_QNAME_MODULE, "axml-grp");
+
+    @Test
+    public void readAndParseYangFileTest() throws SourceException, ReactorException {
+
+        CrossSourceStatementReactor.BuildAction reactor = YangInferencePipeline.RFC6020_REACTOR.newBuild();
+        addSources(reactor, AUGMENTED, ROOT);
+
+        final EffectiveSchemaContext result = reactor.buildEffective();
+
+        assertNotNull(result);
+
+        Module augmentedModule = result.findModuleByName("augmented", null);
+        assertNotNull(augmentedModule);
+
+        ContainerSchemaNode augParent1Node = (ContainerSchemaNode) result.getDataChildByName(augParent1);
+        ContainerSchemaNode augParent2Node = (ContainerSchemaNode) augParent1Node.getDataChildByName(augParent2);
+        ContainerSchemaNode targetContNode = (ContainerSchemaNode) augParent2Node.getDataChildByName(contTarget);
+        assertNotNull(targetContNode);
+
+        assertNotNull(targetContNode.getChildNodes());
+        assertEquals(3, targetContNode.getChildNodes().size());
+
+        ContainerSchemaNode contAdded1Node = (ContainerSchemaNode) targetContNode.getDataChildByName(contAdded1);
+        assertNotNull(contAdded1Node);
+        ListSchemaNode list1Node = (ListSchemaNode) contAdded1Node.getDataChildByName(list1);
+        assertNotNull(list1Node);
+
+        ContainerSchemaNode contAdded2Node = (ContainerSchemaNode) targetContNode.getDataChildByName(contAdded2);
+        assertNotNull(contAdded2Node);
+        AnyXmlSchemaNode axmlNode = (AnyXmlSchemaNode) contAdded2Node.getDataChildByName(axml);
+        assertNotNull(axmlNode);
+
+        ContainerSchemaNode contGrpNode = (ContainerSchemaNode) targetContNode.getDataChildByName(contGrp);
+        assertNotNull(contGrpNode);
+        AnyXmlSchemaNode axmlGrpNode = (AnyXmlSchemaNode) contGrpNode.getDataChildByName(axmlGrp);
+        assertNotNull(axmlGrpNode);
+    }
+
+    private void addSources(CrossSourceStatementReactor.BuildAction reactor, StatementStreamSource... sources) {
+        for (StatementStreamSource source : sources) {
+            reactor.addSource(source);
+        }
+    }
+}
diff --git a/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/AugmentSimplestTest.java b/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/AugmentSimplestTest.java
new file mode 100644 (file)
index 0000000..4c02208
--- /dev/null
@@ -0,0 +1,32 @@
+package org.opendaylight.yangtools.yang.stmt.test;
+
+import org.junit.Test;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
+import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
+import org.opendaylight.yangtools.yang.parser.spi.source.StatementStreamSource;
+import org.opendaylight.yangtools.yang.parser.stmt.reactor.CrossSourceStatementReactor;
+import org.opendaylight.yangtools.yang.parser.stmt.reactor.EffectiveModelContext;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangInferencePipeline;
+
+import static org.junit.Assert.assertNotNull;
+
+public class AugmentSimplestTest {
+
+    private static final TestYangFileStatementSource AUGMENTED = new TestYangFileStatementSource("/semantic-statement-parser/augmented.yang");
+    private static final TestYangFileStatementSource ROOT = new TestYangFileStatementSource("/semantic-statement-parser/root.yang");
+
+    @Test
+    public void readAndParseYangFileTest() throws SourceException, ReactorException {
+        CrossSourceStatementReactor.BuildAction reactor = YangInferencePipeline.RFC6020_REACTOR.newBuild();
+        addSources(reactor, AUGMENTED, ROOT);
+
+        EffectiveModelContext result = reactor.build();
+        assertNotNull(result);
+    }
+
+    private void addSources(CrossSourceStatementReactor.BuildAction reactor, StatementStreamSource... sources) {
+        for (StatementStreamSource source : sources) {
+            reactor.addSource(source);
+        }
+    }
+}
index c88ad9c6433b77af0ed78c91242491f97834a86c..ee2b10a22209a22dceb8b1a0c103d359a2d8274e 100644 (file)
@@ -31,10 +31,25 @@ public class YangFileStmtTest {
         private static final YangStatementSourceImpl EXTUSE = new YangStatementSourceImpl("/semantic-statement-parser/ext-use.yang");
 
         @Test
-        public void readAndParseYangFileTest() throws SourceException, ReactorException {
+        public void readAndParseYangFileTest1() throws SourceException, ReactorException {
                 CrossSourceStatementReactor.BuildAction reactor = YangInferencePipeline.RFC6020_REACTOR.newBuild();
                 addSources(reactor, YANGFILE, SIMPLENODES, IMPORTEDYANGFILE, FOO);
-                addSources(reactor, FILE1, FILE2, FILE3, FILE4);
+                EffectiveModelContext result = reactor.build();
+                assertNotNull(result);
+        }
+
+        // TODO uncomment when Augment in Uses implemented
+//        @Test
+//        public void readAndParseYangFileTest2() throws SourceException, ReactorException {
+//                CrossSourceStatementReactor.BuildAction reactor = YangInferencePipeline.RFC6020_REACTOR.newBuild();
+//                addSources(reactor, FILE1, FILE2, FILE3, FILE4);
+//                EffectiveModelContext result = reactor.build();
+//                assertNotNull(result);
+//        }
+
+        @Test
+        public void readAndParseYangFileTest3() throws SourceException, ReactorException {
+                CrossSourceStatementReactor.BuildAction reactor = YangInferencePipeline.RFC6020_REACTOR.newBuild();
                 addSources(reactor, EXTFILE, EXTUSE);
                 EffectiveModelContext result = reactor.build();
                 assertNotNull(result);
index 69b12424587a98596d81a00a3f8dcfc850de8987..85308f284130cf8aac27560ad2d3cd9483d0a1f1 100644 (file)
@@ -43,8 +43,12 @@ public class AugmentTest {
         BuildAction reactor = YangInferencePipeline.RFC6020_REACTOR.newBuild();
         addSources(reactor, VALID_ABS);
 
-        EffectiveModelContext result = reactor.build();
-        assertNotNull(result);
+        try {
+            reactor.build();
+        } catch (Exception e) {
+            // if augment argument is correct we only catch an exception that it cannot be found in mock model
+            assertEquals(NullPointerException.class, e.getClass());
+        }
     }
 
     @Test
@@ -53,8 +57,12 @@ public class AugmentTest {
         BuildAction reactor = YangInferencePipeline.RFC6020_REACTOR.newBuild();
         addSources(reactor, IMPORTED, VALID_ABS_PREFIXED);
 
-        EffectiveModelContext result = reactor.build();
-        assertNotNull(result);
+        try {
+            reactor.build();
+        } catch (Exception e) {
+            // if augment argument is correct we only catch an exception that it cannot be found in mock model
+            assertEquals(NullPointerException.class, e.getClass());
+        }
     }
 
     @Test
@@ -63,8 +71,12 @@ public class AugmentTest {
         BuildAction reactor = YangInferencePipeline.RFC6020_REACTOR.newBuild();
         addSources(reactor, VALID_REL);
 
-        EffectiveModelContext result = reactor.build();
-        assertNotNull(result);
+        try {
+            reactor.build();
+        } catch (Exception e) {
+            // if augment argument is correct we only catch an exception that it cannot be found in mock model
+            assertEquals(NullPointerException.class, e.getClass());
+        }
     }
 
     @Test
@@ -73,8 +85,12 @@ public class AugmentTest {
         BuildAction reactor = YangInferencePipeline.RFC6020_REACTOR.newBuild();
         addSources(reactor, IMPORTED, VALID_REL_PREFIXED);
 
-        EffectiveModelContext result = reactor.build();
-        assertNotNull(result);
+        try {
+            reactor.build();
+        } catch (Exception e) {
+            // if augment argument is correct we only catch an exception that it cannot be found in mock model
+            assertEquals(NullPointerException.class, e.getClass());
+        }
     }
 
     @Test
index ba9c745d6b07ec520810c9fe36daecd75d3aa63d..60190093a5f362c79b31e1c15f917d53399caa3a 100644 (file)
@@ -57,7 +57,7 @@ public class TestAugmentSource implements StatementStreamSource {
 
     @Override
     public void writeLinkageAndStatementDefinitions(StatementWriter writer, QNameToStatementDefinition stmtDef,
-            PrefixToModule prefixes) throws SourceException {
+                                                    PrefixToModule prefixes) throws SourceException {
         this.writer = writer;
         header();
         extensions();
index c75b62cff49790d9563b53fbfb7f5b6adc6cb2de..412f9c15a94cee69b1eb00034608dba937de79d1 100644 (file)
@@ -3,7 +3,7 @@ submodule subfoo {
 
     belongs-to foo {
         prefix f;
-    } 
+    }
 
     import bar {
         prefix "br";
diff --git a/yang/yang-parser-impl/src/test/resources/semantic-statement-parser/augmented.yang b/yang/yang-parser-impl/src/test/resources/semantic-statement-parser/augmented.yang
new file mode 100644 (file)
index 0000000..7d43280
--- /dev/null
@@ -0,0 +1,11 @@
+module augmented {
+       prefix augmented_pref;
+       namespace augmented_ns;
+
+       container cont1 {
+               container cont2 {
+                       container cont-target {
+                       }
+               }
+       }
+}
\ No newline at end of file
diff --git a/yang/yang-parser-impl/src/test/resources/semantic-statement-parser/root.yang b/yang/yang-parser-impl/src/test/resources/semantic-statement-parser/root.yang
new file mode 100644 (file)
index 0000000..2e72ad1
--- /dev/null
@@ -0,0 +1,14 @@
+module root {
+       prefix root_pref;
+       namespace root_ns;
+
+       import augmented {
+               prefix imp;
+       }
+
+       augment /imp:cont1/imp:cont2/imp:cont-target {
+               leaf added {
+                       type string;
+               }
+       }
+}
\ No newline at end of file
diff --git a/yang/yang-parser-impl/src/test/resources/stmt-test/effective-build/aug-root.yang b/yang/yang-parser-impl/src/test/resources/stmt-test/effective-build/aug-root.yang
new file mode 100644 (file)
index 0000000..017b108
--- /dev/null
@@ -0,0 +1,21 @@
+module aug-root {
+       namespace root;
+       prefix root;
+
+       import augmented {
+               prefix aug;
+       }
+
+       augment "aug:aug-parent1/aug:aug-parent2/aug:cont-target" {
+               container cont-added1 {
+                       list list1 {
+                       }
+               }
+
+               container cont-added2 {
+                       anyxml axml;
+               }
+
+               uses aug:grp;
+       }
+}
\ No newline at end of file
diff --git a/yang/yang-parser-impl/src/test/resources/stmt-test/effective-build/augmented.yang b/yang/yang-parser-impl/src/test/resources/stmt-test/effective-build/augmented.yang
new file mode 100644 (file)
index 0000000..47ca018
--- /dev/null
@@ -0,0 +1,18 @@
+module augmented {
+       namespace aug;
+       prefix aug;
+
+       container aug-parent1 {
+               container aug-parent2 {
+                       container cont-target {
+
+                       }
+               }
+       }
+
+       grouping grp {
+               container cont-grp {
+                       anyxml axml-grp;
+               }
+       }
+}
\ No newline at end of file