2 * Copyright (c) 2015 Cisco Systems, Inc. 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.data.api.schema.xpath;
10 import com.google.common.base.Converter;
11 import javax.annotation.Nonnull;
12 import javax.xml.xpath.XPathException;
13 import org.opendaylight.yangtools.yang.common.QNameModule;
14 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
17 * A factory for obtaining {@link XPathSchemaContext}s. This is the primary entry point to an XPath evaluation
18 * implementation. Users are expected to resolve these via their service resolution framework, be it
19 * {@link java.util.ServiceLoader}, OSGi or similar.
21 * Implementations are required to support {@link java.util.ServiceLoader}.
23 public interface XPathSchemaContextFactory {
25 * Create an {@link XPathSchemaContext} based on a {@link SchemaContext}. This effectively binds the namespaces
26 * the user expects to map to YANG schema. The {@link XPathExpression} compilation, relocation and optimization
27 * processes can take advantage of the YANG schema provided and the prefix mappings requested by the provided
30 * The user must provide a prefix-to-mapping {@link Converter}, which will be used to convert any prefixes found
31 * in the XPath expression being compiled in the resulting context.
33 * @param context SchemaContext associated with the resulting {@link XPathSchemaContext}
34 * @param prefixToNamespace Prefix-to-namespace converter
35 * @return An {@link XPathSchemaContext} instance
36 * @throws IllegalArgumentException if the converter contains a namespace which does not exist in the supplied
39 @Nonnull XPathSchemaContext createContext(@Nonnull SchemaContext context,
40 Converter<String, QNameModule> prefixToNamespace) throws XPathException;