2 * Copyright (c) 2019 PANTHEON.tech 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.data.api.schema;
10 import java.util.Optional;
11 import org.eclipse.jdt.annotation.NonNull;
12 import org.opendaylight.yangtools.yang.common.MountPointLabel;
13 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
14 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContextProvider;
17 * A context of either an explicit (RFC8528 Schema Mount instance) or implicit (system root). It encapsulates a data
18 * {@link org.opendaylight.yangtools.yang.model.api.EffectiveModelContext} and information resident in
19 * {@code schema-mounts} within this hierarchy.
22 * This context exposed enough of an API surface to navigate RFC8528 Schema Mount instaces with respect to normalized,
23 * so that proper {@link MountPointLabel}ed {@link NormalizedMountPoint}s can be created. This is enough to integrate
24 * with other elements of this API.
26 public interface MountPointContext extends EffectiveModelContextProvider {
28 * Attempt to acquire a {@link MountPointContextFactory} to resolve schemas for the purposes of interpreting
29 * this mount point. An empty result indicates the mount point is not attached.
31 * @param label Mount point label, as defined via the use of {@code mount-point} statement
32 * @return An optional handler for mount point data
33 * @throws NullPointerException if label is null
35 Optional<MountPointContextFactory> findMountPoint(@NonNull MountPointLabel label);
38 * Return an empty {@link MountPointContext} with the specified {@link EffectiveModelContext}.
40 * @param modelContext Backing {@link EffectiveModelContext}
41 * @return A {@link MountPointContext} containing no {@link MountPointContextFactory}.
43 static @NonNull MountPointContext of(final @NonNull EffectiveModelContext modelContext) {
44 return new EmptyMountPointContext(modelContext);