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.stmt.anyxmlschema;
10 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
11 import org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier;
12 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
13 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
14 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext.Mutable;
15 import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
16 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.SupportedExtensionsMapping;
17 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.Utils;
19 public final class AnyxmlSchemaLocationSupport
20 extends AbstractStatementSupport<SchemaNodeIdentifier, AnyxmlSchemaLocationStatement,
21 EffectiveStatement<SchemaNodeIdentifier, AnyxmlSchemaLocationStatement>> {
22 private static final SubstatementValidator SUBSTATEMENT_VALIDATOR = SubstatementValidator.builder(
23 SupportedExtensionsMapping.ANYXML_SCHEMA_LOCATION).build();
24 private static final AnyxmlSchemaLocationSupport INSTANCE = new AnyxmlSchemaLocationSupport();
26 private AnyxmlSchemaLocationSupport() {
27 super(SupportedExtensionsMapping.ANYXML_SCHEMA_LOCATION);
30 public static AnyxmlSchemaLocationSupport getInstance() {
35 public SchemaNodeIdentifier parseArgumentValue(final StmtContext<?, ?, ?> ctx, final String value) {
36 return Utils.nodeIdentifierFromPath(ctx, value);
40 public void onFullDefinitionDeclared(final Mutable<SchemaNodeIdentifier, AnyxmlSchemaLocationStatement,
41 EffectiveStatement<SchemaNodeIdentifier, AnyxmlSchemaLocationStatement>> stmt) {
42 super.onFullDefinitionDeclared(stmt);
43 stmt.getParentContext().addToNs(AnyxmlSchemaLocationNamespace.class,
44 SupportedExtensionsMapping.ANYXML_SCHEMA_LOCATION, stmt);
48 public AnyxmlSchemaLocationStatement createDeclared(
49 final StmtContext<SchemaNodeIdentifier, AnyxmlSchemaLocationStatement, ?> ctx) {
50 return new AnyxmlSchemaLocationStatementImpl(ctx);
54 public EffectiveStatement<SchemaNodeIdentifier, AnyxmlSchemaLocationStatement> createEffective(
55 final StmtContext<SchemaNodeIdentifier, AnyxmlSchemaLocationStatement,
56 EffectiveStatement<SchemaNodeIdentifier, AnyxmlSchemaLocationStatement>> ctx) {
57 return new AnyxmlSchemaLocationEffectiveStatementImpl(ctx);
61 protected SubstatementValidator getSubstatementValidator() {
62 return SUBSTATEMENT_VALIDATOR;