2 * Copyright (c) 2017 Pantheon Technologies, s.r.o. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.yangtools.yang.parser.odlext.stmt;
10 import static org.opendaylight.yangtools.odlext.model.api.OpenDaylightExtensionsStatements.ANYXML_SCHEMA_LOCATION;
12 import org.opendaylight.yangtools.odlext.model.api.AnyxmlSchemaLocationStatement;
13 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
14 import org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier;
15 import org.opendaylight.yangtools.yang.parser.odlext.namespace.AnyxmlSchemaLocationNamespace;
16 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.ArgumentUtils;
17 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
18 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
19 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext.Mutable;
20 import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
22 public final class AnyxmlSchemaLocationSupport
23 extends AbstractStatementSupport<SchemaNodeIdentifier, AnyxmlSchemaLocationStatement,
24 EffectiveStatement<SchemaNodeIdentifier, AnyxmlSchemaLocationStatement>> {
25 private static final SubstatementValidator SUBSTATEMENT_VALIDATOR = SubstatementValidator.builder(
26 ANYXML_SCHEMA_LOCATION).build();
27 private static final AnyxmlSchemaLocationSupport INSTANCE = new AnyxmlSchemaLocationSupport();
29 private AnyxmlSchemaLocationSupport() {
30 super(ANYXML_SCHEMA_LOCATION);
33 public static AnyxmlSchemaLocationSupport getInstance() {
38 public SchemaNodeIdentifier parseArgumentValue(final StmtContext<?, ?, ?> ctx, final String value) {
39 return ArgumentUtils.nodeIdentifierFromPath(ctx, value);
43 public void onFullDefinitionDeclared(final Mutable<SchemaNodeIdentifier, AnyxmlSchemaLocationStatement,
44 EffectiveStatement<SchemaNodeIdentifier, AnyxmlSchemaLocationStatement>> stmt) {
45 super.onFullDefinitionDeclared(stmt);
46 stmt.getParentContext().addToNs(AnyxmlSchemaLocationNamespace.class, ANYXML_SCHEMA_LOCATION, stmt);
50 public AnyxmlSchemaLocationStatement createDeclared(
51 final StmtContext<SchemaNodeIdentifier, AnyxmlSchemaLocationStatement, ?> ctx) {
52 return new AnyxmlSchemaLocationStatementImpl(ctx);
56 public EffectiveStatement<SchemaNodeIdentifier, AnyxmlSchemaLocationStatement> createEffective(
57 final StmtContext<SchemaNodeIdentifier, AnyxmlSchemaLocationStatement,
58 EffectiveStatement<SchemaNodeIdentifier, AnyxmlSchemaLocationStatement>> ctx) {
59 return new AnyxmlSchemaLocationEffectiveStatementImpl(ctx);
63 protected SubstatementValidator getSubstatementValidator() {
64 return SUBSTATEMENT_VALIDATOR;