import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.odlext.model.api.AnyxmlSchemaLocationEffectiveStatement;
import org.opendaylight.yangtools.odlext.model.api.AnyxmlSchemaLocationStatement;
-import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
import org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier;
import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ParserNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext.Mutable;
/**
* Source-specific mapping of prefixes to namespaces.
*/
-public interface AnyxmlSchemaLocationNamespace extends IdentifierNamespace<StatementDefinition,
+public interface AnyxmlSchemaLocationNamespace extends ParserNamespace<StatementDefinition,
Mutable<SchemaNodeIdentifier, AnyxmlSchemaLocationStatement, AnyxmlSchemaLocationEffectiveStatement>> {
NamespaceBehaviour<StatementDefinition, Mutable<SchemaNodeIdentifier, AnyxmlSchemaLocationStatement,
AnyxmlSchemaLocationEffectiveStatement>,
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.common.Empty;
import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ParserNamespace;
/**
* Namespace for remembering the {@code yang-data} argument's QName. This namespace is necessary because we are forced
*/
@Beta
// FIXME: YANGTOOLS-1196: remove this namespace once we can bind freely
-public interface YangDataArgumentNamespace extends IdentifierNamespace<Empty, QName> {
+public interface YangDataArgumentNamespace extends ParserNamespace<Empty, QName> {
NamespaceBehaviour<Empty, QName, @NonNull YangDataArgumentNamespace> BEHAVIOUR =
NamespaceBehaviour.statementLocal(YangDataArgumentNamespace.class);
import org.opendaylight.yangtools.yang.common.YangVersion;
import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
-import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
import org.opendaylight.yangtools.yang.model.repo.api.RevisionSourceIdentifier;
import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
import org.opendaylight.yangtools.yang.model.repo.api.StatementParserMode;
import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour.Registry;
import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour.StorageNodeType;
import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceNotAvailableException;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ParserNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
import org.opendaylight.yangtools.yang.parser.spi.meta.SomeModifiersUnresolvedException;
import org.opendaylight.yangtools.yang.parser.spi.meta.StatementSupport;
}
@Override
- public <K, V, N extends IdentifierNamespace<K, V>> NamespaceBehaviourWithListeners<K, V, N> getNamespaceBehaviour(
+ public <K, V, N extends ParserNamespace<K, V>> NamespaceBehaviourWithListeners<K, V, N> getNamespaceBehaviour(
final Class<N> type) {
NamespaceBehaviourWithListeners<?, ?, ?> potential = supportedNamespaces.get(type);
if (potential == null) {
}
@SuppressWarnings({ "unchecked", "rawtypes" })
- private <K, V, N extends IdentifierNamespace<K, V>> NamespaceBehaviourWithListeners<K, V, N> createNamespaceContext(
+ private <K, V, N extends ParserNamespace<K, V>> NamespaceBehaviourWithListeners<K, V, N> createNamespaceContext(
final NamespaceBehaviour<K, V, N> potentialRaw) {
if (potentialRaw instanceof DerivedNamespaceBehaviour) {
final VirtualNamespaceContext derivedContext = new VirtualNamespaceContext(
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
-import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
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.NamespaceKeyCriterion;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ParserNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.StatementNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext.Mutable;
}
@SuppressWarnings({ "rawtypes", "unchecked" })
- private <K, C extends Mutable<?, ?, ?>, N extends IdentifierNamespace<K, ? extends StmtContext<?, ?, ?>>>
+ private <K, C extends Mutable<?, ?, ?>, N extends ParserNamespace<K, ? extends StmtContext<?, ?, ?>>>
AbstractPrerequisite<C> mutatesCtxImpl(final StmtContext<?, ?, ?> context, final Class<N> namespace,
final K key, final ModelProcessingPhase phase) {
checkNotRegistered();
@Override
@Deprecated
- public <N extends IdentifierNamespace<?, ?>> Prerequisite<Mutable<?, ?, ?>> mutatesNs(
- final Mutable<?, ?, ?> context, final Class<N> namespace) {
+ public <N extends ParserNamespace<?, ?>> Prerequisite<Mutable<?, ?, ?>> mutatesNs(final Mutable<?, ?, ?> context,
+ final Class<N> namespace) {
return addMutation(new NamespaceMutation<>(contextImpl(context), namespace));
}
@Override
- public <K, E extends EffectiveStatement<?, ?>, N extends IdentifierNamespace<K, ? extends StmtContext<?, ?, ?>>>
+ public <K, E extends EffectiveStatement<?, ?>, N extends ParserNamespace<K, ? extends StmtContext<?, ?, ?>>>
AbstractPrerequisite<Mutable<?, ?, E>> mutatesEffectiveCtx(final StmtContext<?, ?, ?> context,
final Class<N> namespace, final K key) {
return mutatesCtxImpl(context, namespace, key, EFFECTIVE_MODEL);
}
@Override
- public <K, E extends EffectiveStatement<?, ?>, N extends IdentifierNamespace<K, ? extends StmtContext<?, ?, ?>>>
+ public <K, E extends EffectiveStatement<?, ?>, N extends ParserNamespace<K, ? extends StmtContext<?, ?, ?>>>
AbstractPrerequisite<Mutable<?, ?, E>> mutatesEffectiveCtxPath(final StmtContext<?, ?, ?> context,
final Class<N> namespace, final Iterable<K> keys) {
checkNotRegistered();
}
}
- private final class NamespaceMutation<N extends IdentifierNamespace<?, ?>>
+ private final class NamespaceMutation<N extends ParserNamespace<?, ?>>
extends AbstractPrerequisite<Mutable<?, ?, ?>> {
NamespaceMutation(final StatementContextBase<?, ?, ?> ctx, final Class<N> namespace) {
resolvePrereq(ctx);
* give us the first step. When it does, we hook onto the first item to provide us the second step and so on.
*/
private final class PhaseModificationInNamespacePath<C extends Mutable<?, ?, ?>, K,
- N extends IdentifierNamespace<K, ? extends StmtContext<?, ?, ?>>> extends AbstractPrerequisite<C>
+ N extends ParserNamespace<K, ? extends StmtContext<?, ?, ?>>> extends AbstractPrerequisite<C>
implements OnNamespaceItemAdded, ContextMutation {
private final ModelProcessingPhase modPhase;
private final Iterable<K> keys;
import java.util.List;
import java.util.Map;
import org.eclipse.jdt.annotation.NonNull;
-import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ParserNamespace;
-abstract class NamespaceBehaviourWithListeners<K, V, N extends IdentifierNamespace<K, V>>
+abstract class NamespaceBehaviourWithListeners<K, V, N extends ParserNamespace<K, V>>
extends NamespaceBehaviour<K, V, N> {
abstract static class ValueAddedListener<K> {
import java.util.Map.Entry;
import java.util.Optional;
import org.eclipse.jdt.annotation.NonNull;
-import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour.NamespaceStorageNode;
import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour.Registry;
import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceKeyCriterion;
import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceNotAvailableException;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ParserNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.StatementNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
*/
public abstract @NonNull Registry getBehaviourRegistry();
- protected void checkLocalNamespaceAllowed(final Class<? extends IdentifierNamespace<?, ?>> type) {
+ protected void checkLocalNamespaceAllowed(final Class<? extends ParserNamespace<?, ?>> type) {
// NOOP
}
*
* @throws SourceException instance of SourceException
*/
- protected <K, V, N extends IdentifierNamespace<K, V>> void onNamespaceElementAdded(final Class<N> type, final K key,
+ protected <K, V, N extends ParserNamespace<K, V>> void onNamespaceElementAdded(final Class<N> type, final K key,
final V value) {
// NOOP
}
- public final <K, V, N extends IdentifierNamespace<K, V>> Optional<Entry<K, V>> getFromNamespace(
+ public final <K, V, N extends ParserNamespace<K, V>> Optional<Entry<K, V>> getFromNamespace(
final Class<N> type, final NamespaceKeyCriterion<K> criterion) {
return getBehaviourRegistry().getNamespaceBehaviour(type).getFrom(this, criterion);
}
- public final <K, V, N extends IdentifierNamespace<K, V>> Map<K, V> getNamespace(final Class<N> type) {
+ public final <K, V, N extends ParserNamespace<K, V>> Map<K, V> getNamespace(final Class<N> type) {
return getBehaviourRegistry().getNamespaceBehaviour(type).getAllFrom(this);
}
@SuppressWarnings("unchecked")
- final <K, V, N extends IdentifierNamespace<K, V>> Map<K, V> getLocalNamespace(final Class<N> type) {
+ final <K, V, N extends ParserNamespace<K, V>> Map<K, V> getLocalNamespace(final Class<N> type) {
return (Map<K, V>) accessNamespaces().get(type);
}
- final <K, V, T extends K, U extends V, N extends IdentifierNamespace<K, V>> void addToNamespace(
+ final <K, V, T extends K, U extends V, N extends ParserNamespace<K, V>> void addToNamespace(
final Class<N> type, final T key, final U value) {
getBehaviourRegistry().getNamespaceBehaviour(type).addTo(this, key, value);
}
- final <K, V, T extends K, U extends V, N extends IdentifierNamespace<K, V>> void addToNamespace(
+ final <K, V, T extends K, U extends V, N extends ParserNamespace<K, V>> void addToNamespace(
final Class<N> type, final Map<T, U> map) {
final NamespaceBehaviour<K, V, N> behavior = getBehaviourRegistry().getNamespaceBehaviour(type);
for (final Entry<T, U> validationBundle : map.entrySet()) {
@SuppressWarnings("unchecked")
@Override
- public <K, V, N extends IdentifierNamespace<K, V>> V getFromLocalStorage(final Class<N> type, final K key) {
+ public <K, V, N extends ParserNamespace<K, V>> V getFromLocalStorage(final Class<N> type, final K key) {
final Map<K, V> localNamespace = (Map<K, V>) accessNamespaces().get(type);
return localNamespace == null ? null : localNamespace.get(key);
}
@Override
- public <K, V, N extends IdentifierNamespace<K, V>> Map<K, V> getAllFromLocalStorage(final Class<N> type) {
+ public <K, V, N extends ParserNamespace<K, V>> Map<K, V> getAllFromLocalStorage(final Class<N> type) {
@SuppressWarnings("unchecked")
final Map<K, V> localNamespace = (Map<K, V>) accessNamespaces().get(type);
return localNamespace;
}
@Override
- public <K, V, N extends IdentifierNamespace<K, V>> V putToLocalStorage(final Class<N> type, final K key,
+ public <K, V, N extends ParserNamespace<K, V>> V putToLocalStorage(final Class<N> type, final K key,
final V value) {
final V ret = ensureLocalNamespace(type).put(key, value);
onNamespaceElementAdded(type, key, value);
}
@Override
- public <K, V, N extends IdentifierNamespace<K, V>> V putToLocalStorageIfAbsent(final Class<N> type, final K key,
+ public <K, V, N extends ParserNamespace<K, V>> V putToLocalStorageIfAbsent(final Class<N> type, final K key,
final V value) {
final V ret = ensureLocalNamespace(type).putIfAbsent(key, value);
if (ret == null) {
return verifyNotNull(namespaces, "Attempted to access swept namespaces of %s", this);
}
- private <K, V, N extends IdentifierNamespace<K, V>> Map<K, V> ensureLocalNamespace(final Class<N> type) {
+ private <K, V, N extends ParserNamespace<K, V>> Map<K, V> ensureLocalNamespace(final Class<N> type) {
@SuppressWarnings("unchecked")
Map<K, V> ret = (Map<K,V>) accessNamespaces().get(type);
if (ret == null) {
import org.opendaylight.yangtools.yang.model.api.SchemaPath;
import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
-import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
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.ConfigEffectiveStatement;
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.NamespaceBehaviour.Registry;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ParserNamespace;
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.meta.StmtContextUtils;
//
@Override
- public final <K, V, T extends K, N extends IdentifierNamespace<K, V>> V namespaceItem(final Class<@NonNull N> type,
+ public final <K, V, T extends K, N extends ParserNamespace<K, V>> V namespaceItem(final Class<@NonNull N> type,
final T key) {
return getBehaviourRegistry().getNamespaceBehaviour(type).getFrom(this, key);
}
@Override
- public final <K, V, N extends IdentifierNamespace<K, V>> Map<K, V> namespace(final Class<@NonNull N> type) {
+ public final <K, V, N extends ParserNamespace<K, V>> Map<K, V> namespace(final Class<@NonNull N> type) {
return getNamespace(type);
}
@Override
- public final <K, V, N extends IdentifierNamespace<K, V>>
+ public final <K, V, N extends ParserNamespace<K, V>>
Map<K, V> localNamespacePortion(final Class<@NonNull N> type) {
return getLocalNamespace(type);
}
@Override
- protected final void checkLocalNamespaceAllowed(final Class<? extends IdentifierNamespace<?, ?>> type) {
+ protected final void checkLocalNamespaceAllowed(final Class<? extends ParserNamespace<?, ?>> type) {
definition().checkNamespaceAllowed(type);
}
@Override
- protected <K, V, N extends IdentifierNamespace<K, V>> void onNamespaceElementAdded(final Class<N> type, final K key,
+ protected <K, V, N extends ParserNamespace<K, V>> void onNamespaceElementAdded(final Class<N> type, final K key,
final V value) {
// definition().onNamespaceElementAdded(this, type, key, value);
}
import org.opendaylight.yangtools.yang.model.api.SchemaPath;
import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
-import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.CopyHistory;
import org.opendaylight.yangtools.yang.parser.spi.meta.CopyType;
import org.opendaylight.yangtools.yang.parser.spi.meta.ModelProcessingPhase;
import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour.StorageNodeType;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ParserNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.StatementNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
import org.opendaylight.yangtools.yang.parser.spi.source.StatementSourceReference;
}
@Override
- public <K, V, T extends K, U extends V, N extends IdentifierNamespace<K, V>> void addToNs(
- final Class<@NonNull N> type, final T key, final U value) {
+ public <K, V, T extends K, U extends V, N extends ParserNamespace<K, V>> void addToNs(final Class<@NonNull N> type,
+ final T key, final U value) {
throw new UnsupportedOperationException();
}
import org.opendaylight.yangtools.yang.model.api.SchemaPath;
import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
-import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
import org.opendaylight.yangtools.yang.parser.spi.GroupingNamespace;
import org.opendaylight.yangtools.yang.parser.spi.SchemaTreeNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour.NamespaceStorageNode;
import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour.Registry;
import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour.StorageNodeType;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ParserNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.RootStmtContext;
import org.opendaylight.yangtools.yang.parser.spi.source.IncludedModuleContext;
import org.opendaylight.yangtools.yang.parser.spi.source.StatementSourceReference;
}
@Override
- public <K, V, N extends IdentifierNamespace<K, V>> V putToLocalStorage(final Class<N> type, final K key,
+ public <K, V, N extends ParserNamespace<K, V>> V putToLocalStorage(final Class<N> type, final K key,
final V value) {
if (IncludedModuleContext.class.isAssignableFrom(type)) {
if (includedContexts.isEmpty()) {
}
@Override
- public <K, V, N extends IdentifierNamespace<K, V>> V getFromLocalStorage(final Class<N> type, final K key) {
+ public <K, V, N extends ParserNamespace<K, V>> V getFromLocalStorage(final Class<N> type, final K key) {
return getFromLocalStorage(type, key, new HashSet<>());
}
* We need to track already checked RootStatementContexts due to possible
* circular chains of includes between submodules
*/
- private <K, V, N extends IdentifierNamespace<K, V>> @Nullable V getFromLocalStorage(final Class<N> type,
+ private <K, V, N extends ParserNamespace<K, V>> @Nullable V getFromLocalStorage(final Class<N> type,
final K key, final HashSet<RootStatementContext<?, ?, ?>> alreadyChecked) {
final V potentialLocal = super.getFromLocalStorage(type, key);
if (potentialLocal != null) {
}
@Override
- public <K, V, N extends IdentifierNamespace<K, V>> Map<K, V> getAllFromLocalStorage(final Class<N> type) {
+ public <K, V, N extends ParserNamespace<K, V>> Map<K, V> getAllFromLocalStorage(final Class<N> type) {
return getAllFromLocalStorage(type, new HashSet<>());
}
* We need to track already checked RootStatementContexts due to possible
* circular chains of includes between submodules
*/
- private <K, V, N extends IdentifierNamespace<K, V>> @Nullable Map<K, V> getAllFromLocalStorage(final Class<N> type,
+ private <K, V, N extends ParserNamespace<K, V>> @Nullable Map<K, V> getAllFromLocalStorage(final Class<N> type,
final HashSet<RootStatementContext<?, ?, ?>> alreadyChecked) {
final Map<K, V> potentialLocal = super.getAllFromLocalStorage(type);
if (potentialLocal != null) {
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
-import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ParserNamespace;
-final class SimpleNamespaceContext<K, V, N extends IdentifierNamespace<K, V>>
+final class SimpleNamespaceContext<K, V, N extends ParserNamespace<K, V>>
extends NamespaceBehaviourWithListeners<K, V, N> {
// FIXME: Change this to Multimap, once issue with modules is resolved.
private List<KeyedValueAddedListener<K>> listeners;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.QNameModule;
import org.opendaylight.yangtools.yang.common.YangVersion;
-import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
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.NamespaceBehaviour;
import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour.NamespaceStorageNode;
import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour.StorageNodeType;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ParserNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.StatementDefinitionNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.StatementSupport;
import org.opendaylight.yangtools.yang.parser.spi.meta.StatementSupportBundle;
}
@Override
- public <K, V, N extends IdentifierNamespace<K, V>> V putToLocalStorage(final Class<N> type, final K key,
+ public <K, V, N extends ParserNamespace<K, V>> V putToLocalStorage(final Class<N> type, final K key,
final V value) {
// RootStatementContext takes care of IncludedModuleContext and the rest...
final V ret = getRoot().putToLocalStorage(type, key, value);
}
@Override
- public <K, V, N extends IdentifierNamespace<K, V>> V putToLocalStorageIfAbsent(final Class<N> type, final K key,
+ public <K, V, N extends ParserNamespace<K, V>> V putToLocalStorageIfAbsent(final Class<N> type, final K key,
final V value) {
// RootStatementContext takes care of IncludedModuleContext and the rest...
final V ret = getRoot().putToLocalStorageIfAbsent(type, key, value);
}
@Override
- public <K, V, N extends IdentifierNamespace<K, V>> V getFromLocalStorage(final Class<N> type, final K key) {
+ public <K, V, N extends ParserNamespace<K, V>> V getFromLocalStorage(final Class<N> type, final K key) {
final V potentialLocal = getRoot().getFromLocalStorage(type, key);
if (potentialLocal != null) {
return potentialLocal;
}
@Override
- public <K, V, N extends IdentifierNamespace<K, V>> Map<K, V> getAllFromLocalStorage(final Class<N> type) {
+ public <K, V, N extends ParserNamespace<K, V>> Map<K, V> getAllFromLocalStorage(final Class<N> type) {
final Map<K, V> potentialLocal = getRoot().getAllFromLocalStorage(type);
if (potentialLocal != null) {
return potentialLocal;
}
@Override
- public <K, V, N extends IdentifierNamespace<K, V>> NamespaceBehaviour<K, V, N> getNamespaceBehaviour(
+ public <K, V, N extends ParserNamespace<K, V>> NamespaceBehaviour<K, V, N> getNamespaceBehaviour(
final Class<N> type) {
return globalContext.getNamespaceBehaviour(type);
}
import org.opendaylight.yangtools.yang.common.QNameModule;
import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
-import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
import org.opendaylight.yangtools.yang.parser.spi.meta.CopyHistory;
import org.opendaylight.yangtools.yang.parser.spi.meta.CopyType;
import org.opendaylight.yangtools.yang.parser.spi.meta.MutableStatement;
import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceKeyCriterion;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ParserNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.StatementNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.StatementSupport;
import org.opendaylight.yangtools.yang.parser.spi.meta.StatementSupport.CopyPolicy;
}
@Override
- public final <K, V, T extends K, U extends V, N extends IdentifierNamespace<K, V>> void addToNs(
+ public final <K, V, T extends K, U extends V, N extends ParserNamespace<K, V>> void addToNs(
final Class<@NonNull N> type, final T key, final U value) {
addToNamespace(type, key, value);
}
return definition;
}
- final <K, V, N extends IdentifierNamespace<K, V>> void onNamespaceItemAddedAction(final Class<N> type, final K key,
+ final <K, V, N extends ParserNamespace<K, V>> void onNamespaceItemAddedAction(final Class<N> type, final K key,
final OnNamespaceItemAdded listener) {
final Object potential = getFromNamespace(type, key);
if (potential != null) {
});
}
- final <K, V, N extends IdentifierNamespace<K, V>> void onNamespaceItemAddedAction(final Class<N> type,
+ final <K, V, N extends ParserNamespace<K, V>> void onNamespaceItemAddedAction(final Class<N> type,
final ModelProcessingPhase phase, final NamespaceKeyCriterion<K> criterion,
final OnNamespaceItemAdded listener) {
final Optional<Entry<K, V>> existing = getFromNamespace(type, criterion);
});
}
- final <K, V, N extends IdentifierNamespace<K, V>> void selectMatch(final Class<N> type,
+ final <K, V, N extends ParserNamespace<K, V>> void selectMatch(final Class<N> type,
final NamespaceKeyCriterion<K> criterion, final OnNamespaceItemAdded listener) {
final Optional<Entry<K, V>> optMatch = getFromNamespace(type, criterion);
checkState(optMatch.isPresent(), "Failed to find a match for criterion %s in namespace %s node %s", criterion,
listener.namespaceItemAdded(StatementContextBase.this, type, match.getKey(), match.getValue());
}
- final <K, V, N extends IdentifierNamespace<K, V>> void waitForPhase(final Object value, final Class<N> type,
+ final <K, V, N extends ParserNamespace<K, V>> void waitForPhase(final Object value, final Class<N> type,
final ModelProcessingPhase phase, final NamespaceKeyCriterion<K> criterion,
final OnNamespaceItemAdded listener) {
((StatementContextBase<?, ? ,?>) value).addPhaseCompletedListener(phase,
});
}
- private <K, V, N extends IdentifierNamespace<K, V>> NamespaceBehaviourWithListeners<K, V, N> getBehaviour(
+ private <K, V, N extends ParserNamespace<K, V>> NamespaceBehaviourWithListeners<K, V, N> getBehaviour(
final Class<N> type) {
final NamespaceBehaviour<K, V, N> behaviour = getBehaviourRegistry().getNamespaceBehaviour(type);
checkArgument(behaviour instanceof NamespaceBehaviourWithListeners, "Namespace %s does not support listeners",
import org.opendaylight.yangtools.yang.model.api.meta.ArgumentDefinition;
import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
-import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
import org.opendaylight.yangtools.yang.parser.spi.meta.ImplicitParentAwareStatementSupport;
import org.opendaylight.yangtools.yang.parser.spi.meta.ModelProcessingPhase;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ParserNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.StatementFactory;
import org.opendaylight.yangtools.yang.parser.spi.meta.StatementSupport;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
return support.adaptArgumentValue(context, targetModule);
}
- public void checkNamespaceAllowed(final Class<? extends IdentifierNamespace<?,?>> namespace) {
+ public void checkNamespaceAllowed(final Class<? extends ParserNamespace<?,?>> namespace) {
// Noop
}
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
-import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.DerivedNamespaceBehaviour;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ParserNamespace;
-final class VirtualNamespaceContext<K, V, N extends IdentifierNamespace<K, V>, D>
+final class VirtualNamespaceContext<K, V, N extends ParserNamespace<K, V>, D>
extends NamespaceBehaviourWithListeners<K, V, N> {
private final Multimap<D, KeyedValueAddedListener<K>> listeners = HashMultimap.create();
import com.google.common.annotations.Beta;
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.common.QNameModule;
-import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ParserNamespace;
/**
* Implementation-internal cache for looking up URI to import prefix. URIs are taken in as Strings to save ourselves
* some quality parsing time.
*/
@Beta
-public interface ModuleQNameToPrefix extends IdentifierNamespace<QNameModule, String> {
+public interface ModuleQNameToPrefix extends ParserNamespace<QNameModule, String> {
NamespaceBehaviour<QNameModule, String, @NonNull ModuleQNameToPrefix> BEHAVIOUR =
NamespaceBehaviour.rootStatementLocal(ModuleQNameToPrefix.class);
}
import com.google.common.annotations.Beta;
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.common.YangNamespaceContext;
-import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ParserNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext.Mutable;
@Beta
-public interface YangNamespaceContextNamespace extends IdentifierNamespace<StmtContext<?, ?, ?>, YangNamespaceContext> {
+public interface YangNamespaceContextNamespace extends ParserNamespace<StmtContext<?, ?, ?>, YangNamespaceContext> {
NamespaceBehaviour<StmtContext<?, ?, ?>, YangNamespaceContext, @NonNull YangNamespaceContextNamespace> BEHAVIOUR =
NamespaceBehaviour.global(YangNamespaceContextNamespace.class);
import com.google.common.annotations.Beta;
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.common.Empty;
-import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ParserNamespace;
import org.opendaylight.yangtools.yang.parser.stmt.reactor.StatementContextBase;
/**
*/
@Beta
public interface AugmentImplicitHandlingNamespace
- extends IdentifierNamespace<Empty, StatementContextBase<?, ?, ?>> {
+ extends ParserNamespace<Empty, StatementContextBase<?, ?, ?>> {
NamespaceBehaviour<Empty, StatementContextBase<?, ?, ?>, @NonNull AugmentImplicitHandlingNamespace>
BEHAVIOUR = NamespaceBehaviour.statementLocal(AugmentImplicitHandlingNamespace.class);
import com.google.common.annotations.Beta;
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.common.Empty;
-import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ParserNamespace;
/**
* Statement-local namespace carrying the versioning information about how the import was satisfied.
*/
@Beta
-public interface ImportedVersionNamespace extends IdentifierNamespace<Empty, SourceIdentifier> {
+public interface ImportedVersionNamespace extends ParserNamespace<Empty, SourceIdentifier> {
NamespaceBehaviour<Empty, SourceIdentifier, @NonNull ImportedVersionNamespace> BEHAVIOUR =
NamespaceBehaviour.statementLocal(ImportedVersionNamespace.class);
import com.google.common.annotations.Beta;
import org.eclipse.jdt.annotation.NonNull;
-import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ParserNamespace;
import org.opendaylight.yangtools.yang.parser.spi.source.StatementSourceReference;
@Beta
-public interface ConfigListWarningNamespace extends IdentifierNamespace<StatementSourceReference, Boolean> {
+public interface ConfigListWarningNamespace extends ParserNamespace<StatementSourceReference, Boolean> {
NamespaceBehaviour<StatementSourceReference, Boolean, @NonNull ConfigListWarningNamespace> BEHAVIOUR =
NamespaceBehaviour.global(ConfigListWarningNamespace.class);
}
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.common.Empty;
import org.opendaylight.yangtools.yang.common.QNameModule;
-import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ParserNamespace;
/**
* Module-local namespace holding the module's QName.
*/
@Beta
-public interface QNameModuleNamespace extends IdentifierNamespace<Empty, QNameModule> {
+public interface QNameModuleNamespace extends ParserNamespace<Empty, QNameModule> {
NamespaceBehaviour<Empty, QNameModule, @NonNull QNameModuleNamespace> BEHAVIOUR =
NamespaceBehaviour.statementLocal(QNameModuleNamespace.class);
import com.google.common.annotations.Beta;
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.common.Empty;
-import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ParserNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
@Beta
-public interface BaseTypeNamespace extends IdentifierNamespace<Empty, StmtContext<?, ?, ?>> {
+public interface BaseTypeNamespace extends ParserNamespace<Empty, StmtContext<?, ?, ?>> {
NamespaceBehaviour<Empty, StmtContext<?, ?, ?>, @NonNull BaseTypeNamespace> BEHAVIOUR =
NamespaceBehaviour.statementLocal(BaseTypeNamespace.class);
}
import com.google.common.annotations.Beta;
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.common.Empty;
-import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ParserNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
@Beta
-public interface SourceGroupingNamespace extends IdentifierNamespace<Empty, StmtContext<?, ?, ?>> {
+public interface SourceGroupingNamespace extends ParserNamespace<Empty, StmtContext<?, ?, ?>> {
NamespaceBehaviour<Empty, StmtContext<?, ?, ?>, @NonNull SourceGroupingNamespace> BEHAVIOUR =
NamespaceBehaviour.statementLocal(SourceGroupingNamespace.class);
}
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.common.Empty;
-import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ParserNamespace;
/**
* ThirdPartyNamespace.
*/
-public interface ThirdPartyNamespace extends IdentifierNamespace<Empty, String> {
+public interface ThirdPartyNamespace extends ParserNamespace<Empty, String> {
@NonNull NamespaceBehaviour<Empty, String, @NonNull ThirdPartyNamespace> BEHAVIOR =
NamespaceBehaviour.statementLocal(ThirdPartyNamespace.class);
return (SchemaTreeNamespace<D, E>) INSTANCE;
}
- @Override
- public StmtContext<?, D, E> get(final QName key) {
- // FIXME: 7.0.0: this method needs to be well-defined
- return null;
- }
-
/**
* {@inheritDoc}
*
import com.google.common.base.MoreObjects.ToStringHelper;
import java.util.Map;
-import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
/**
* An {@link NamespaceBehaviour} which derives keys from a different namespace.
* @param <L> Original key type
* @param <O> Original namespace type
*/
-public abstract class DerivedNamespaceBehaviour<K, V, L, N extends IdentifierNamespace<K, V>,
- O extends IdentifierNamespace<L, ?>> extends NamespaceBehaviour<K, V, N> {
+public abstract class DerivedNamespaceBehaviour<K, V, L, N extends ParserNamespace<K, V>,
+ O extends ParserNamespace<L, ?>> extends NamespaceBehaviour<K, V, N> {
private final Class<O> derivedFrom;
*/
package org.opendaylight.yangtools.yang.parser.spi.meta;
-import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
-
/**
* Special namespace which allows import of namespaces from other sources.
*
*
* @param <K> Imported context identifier
*/
-public interface ImportedNamespaceContext<K> extends IdentifierNamespace<K, StmtContext<?, ?, ?>> {
+public interface ImportedNamespaceContext<K> extends ParserNamespace<K, StmtContext<?, ?, ?>> {
}
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
-import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext.Mutable;
/**
return mutatesCtx(context, EFFECTIVE_MODEL);
}
- <K, E extends EffectiveStatement<?, ?>, N extends IdentifierNamespace<K, ? extends StmtContext<?, ?, ?>>>
+ <K, E extends EffectiveStatement<?, ?>, N extends ParserNamespace<K, ? extends StmtContext<?, ?, ?>>>
@NonNull Prerequisite<Mutable<?, ?, E>> mutatesEffectiveCtx(StmtContext<?, ?, ?> context, Class<N> namespace,
K key);
- default <K, E extends EffectiveStatement<?, ?>, N extends IdentifierNamespace<K, ? extends StmtContext<?, ?, ?>>>
+ default <K, E extends EffectiveStatement<?, ?>, N extends ParserNamespace<K, ? extends StmtContext<?, ?, ?>>>
@NonNull Prerequisite<Mutable<?, ?, E>> mutatesEffectiveCtxPath(final StmtContext<?, ?, ?> context,
final Class<N> namespace, final Iterable<K> keys) {
throw new UnsupportedOperationException(getClass() + " does not implement mutatesEffectiveCtxPath()");
* @deprecated Undocumented method. Use at your own risk.
*/
@Deprecated
- <N extends IdentifierNamespace<?, ?>> @NonNull Prerequisite<Mutable<?,?,?>> mutatesNs(Mutable<?,?, ?> ctx,
+ <N extends ParserNamespace<?, ?>> @NonNull Prerequisite<Mutable<?,?,?>> mutatesNs(Mutable<?,?, ?> ctx,
Class<N> namespace);
}
import org.opendaylight.yangtools.concepts.AbstractSimpleIdentifiable;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
-import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
import org.opendaylight.yangtools.yang.model.api.stmt.SchemaTreeAwareEffectiveStatement;
import org.opendaylight.yangtools.yang.model.api.stmt.SchemaTreeEffectiveStatement;
import org.opendaylight.yangtools.yang.parser.spi.SchemaTreeNamespace;
* @param <V> Value type
* @param <N> Namespace Type
*/
-public abstract class NamespaceBehaviour<K, V, N extends IdentifierNamespace<K, V>>
+public abstract class NamespaceBehaviour<K, V, N extends ParserNamespace<K, V>>
extends AbstractSimpleIdentifiable<Class<N>> {
public enum StorageNodeType {
* @return Namespace behaviour
* @throws NamespaceNotAvailableException when the namespace is not available
*/
- <K, V, N extends IdentifierNamespace<K, V>> NamespaceBehaviour<K, V, N> getNamespaceBehaviour(Class<N> type);
+ <K, V, N extends ParserNamespace<K, V>> NamespaceBehaviour<K, V, N> getNamespaceBehaviour(Class<N> type);
}
public interface NamespaceStorageNode {
@Nullable NamespaceStorageNode getParentNamespaceStorage();
- <K, V, N extends IdentifierNamespace<K, V>> @Nullable V getFromLocalStorage(Class<N> type, K key);
+ <K, V, N extends ParserNamespace<K, V>> @Nullable V getFromLocalStorage(Class<N> type, K key);
- <K, V, N extends IdentifierNamespace<K, V>> @Nullable Map<K, V> getAllFromLocalStorage(Class<N> type);
+ <K, V, N extends ParserNamespace<K, V>> @Nullable Map<K, V> getAllFromLocalStorage(Class<N> type);
/**
* Populate specified namespace with a key/value pair, overwriting previous contents. Similar to
* @param value Value
* @return Previously-stored value, or null if the key was not present
*/
- <K, V, N extends IdentifierNamespace<K, V>> @Nullable V putToLocalStorage(Class<N> type, K key, V value);
+ <K, V, N extends ParserNamespace<K, V>> @Nullable V putToLocalStorage(Class<N> type, K key, V value);
/**
* Populate specified namespace with a key/value pair unless the key is already associated with a value. Similar
* @param value Value
* @return Preexisting value or null if there was no previous mapping
*/
- <K, V, N extends IdentifierNamespace<K, V>> @Nullable V putToLocalStorageIfAbsent(Class<N> type, K key,
- V value);
+ <K, V, N extends ParserNamespace<K, V>> @Nullable V putToLocalStorageIfAbsent(Class<N> type, K key, V value);
}
/**
* @param <N> type parameter
* @return global namespace behaviour for supplied namespace type.
*/
- public static <K, V, N extends IdentifierNamespace<K, V>> @NonNull NamespaceBehaviour<K, V, N> global(
+ public static <K, V, N extends ParserNamespace<K, V>> @NonNull NamespaceBehaviour<K, V, N> global(
final Class<N> identifier) {
return new StorageSpecific<>(identifier, StorageNodeType.GLOBAL);
}
* @param <N> type parameter
* @return source-local namespace behaviour for supplied namespace type.
*/
- public static <K, V, N extends IdentifierNamespace<K, V>> @NonNull NamespaceBehaviour<K, V, N> sourceLocal(
+ public static <K, V, N extends ParserNamespace<K, V>> @NonNull NamespaceBehaviour<K, V, N> sourceLocal(
final Class<N> identifier) {
return new StorageSpecific<>(identifier, StorageNodeType.SOURCE_LOCAL_SPECIAL);
}
- public static <K, V, N extends IdentifierNamespace<K, V>> @NonNull NamespaceBehaviour<K, V, N> statementLocal(
+ public static <K, V, N extends ParserNamespace<K, V>> @NonNull NamespaceBehaviour<K, V, N> statementLocal(
final Class<N> identifier) {
return new StatementLocal<>(identifier);
}
* @param <N> type parameter
* @return root-statement-local namespace behaviour for supplied namespace type.
*/
- public static <K, V, N extends IdentifierNamespace<K, V>> @NonNull NamespaceBehaviour<K, V, N> rootStatementLocal(
+ public static <K, V, N extends ParserNamespace<K, V>> @NonNull NamespaceBehaviour<K, V, N> rootStatementLocal(
final Class<N> identifier) {
return new StorageSpecific<>(identifier, StorageNodeType.ROOT_STATEMENT_LOCAL);
}
* @param <N> type parameter
* @return tree-scoped namespace behaviour for supplied namespace type.
*/
- public static <K, V, N extends IdentifierNamespace<K, V>> @NonNull NamespaceBehaviour<K, V, N> treeScoped(
+ public static <K, V, N extends ParserNamespace<K, V>> @NonNull NamespaceBehaviour<K, V, N> treeScoped(
final Class<N> identifier) {
return new TreeScoped<>(identifier);
}
storage.putToLocalStorage(getIdentifier(), key, value);
}
- abstract static class AbstractSpecific<K, V, N extends IdentifierNamespace<K, V>>
+ abstract static class AbstractSpecific<K, V, N extends ParserNamespace<K, V>>
extends NamespaceBehaviour<K, V, N> {
AbstractSpecific(final Class<N> identifier) {
super(identifier);
abstract NamespaceStorageNode findStorageNode(NamespaceStorageNode storage);
}
- static final class StatementLocal<K, V, N extends IdentifierNamespace<K, V>> extends AbstractSpecific<K, V, N> {
+ static final class StatementLocal<K, V, N extends ParserNamespace<K, V>> extends AbstractSpecific<K, V, N> {
StatementLocal(final Class<N> identifier) {
super(identifier);
}
}
}
- static final class StorageSpecific<K, V, N extends IdentifierNamespace<K, V>> extends AbstractSpecific<K, V, N> {
+ static final class StorageSpecific<K, V, N extends ParserNamespace<K, V>> extends AbstractSpecific<K, V, N> {
private final StorageNodeType storageType;
StorageSpecific(final Class<N> identifier, final StorageNodeType type) {
}
}
- static final class TreeScoped<K, V, N extends IdentifierNamespace<K, V>> extends NamespaceBehaviour<K, V, N> {
+ static final class TreeScoped<K, V, N extends ParserNamespace<K, V>> extends NamespaceBehaviour<K, V, N> {
TreeScoped(final Class<N> identifier) {
super(identifier);
}
import java.util.Map;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
-import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
/**
* Support work with namespace content.
* @param nsType namespace type class
* @return Namespace contents, if available
*/
- <K, V, N extends IdentifierNamespace<K, V>> @Nullable Map<K, V> namespace(Class<@NonNull N> nsType);
+ <K, V, N extends ParserNamespace<K, V>> @Nullable Map<K, V> namespace(Class<@NonNull N> nsType);
/**
* Return a value associated with specified key within a namespace.
* @return Value, or null if there is no element
* @throws NamespaceNotAvailableException when the namespace is not available.
*/
- <K, V, T extends K, N extends IdentifierNamespace<K, V>> @Nullable V namespaceItem(Class<@NonNull N> nsType, T key);
+ <K, V, T extends K, N extends ParserNamespace<K, V>> @Nullable V namespaceItem(Class<@NonNull N> nsType, T key);
/**
* Return the portion of specified namespace stored in this node. Depending on namespace behaviour this may or may
* @param nsType namespace type class
* @return Namespace portion stored in this node, if available
*/
- <K, V, N extends IdentifierNamespace<K, V>> @Nullable Map<K, V> localNamespacePortion(Class<@NonNull N> nsType);
+ <K, V, N extends ParserNamespace<K, V>> @Nullable Map<K, V> localNamespacePortion(Class<@NonNull N> nsType);
/**
* Return the selected namespace.
* @return Namespace contents, if available
*/
// TODO: migrate users away
- default <K, V, N extends IdentifierNamespace<K, V>> Map<K, V> getAllFromNamespace(final Class<N> nsType) {
+ default <K, V, N extends ParserNamespace<K, V>> Map<K, V> getAllFromNamespace(final Class<N> nsType) {
return namespace(nsType);
}
* @throws NamespaceNotAvailableException when the namespace is not available.
*/
// TODO: migrate users away
- default <K, V, T extends K, N extends IdentifierNamespace<K, V>>
+ default <K, V, T extends K, N extends ParserNamespace<K, V>>
@Nullable V getFromNamespace(final Class<@NonNull N> type, final T key) {
return namespaceItem(type, key);
}
--- /dev/null
+/*
+ * Copyright (c) 2020 PANTHEON.tech, s.r.o. 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.spi.meta;
+
+import com.google.common.annotations.Beta;
+
+/**
+ * {@link ParserNamespace} serves as common superclass for namespaces used during parser operation. Each such namespace,
+ * is a type-captured subclass. This type capture of namespace allows for handy type-safe reading methods such as
+ * {@link NamespaceStmtCtx#getFromNamespace(Class, Object)} and still allows introduction of new namespaces without need
+ * to change APIs.
+ *
+ * @param <K> Identifier type
+ * @param <V> Value type
+ */
+@Beta
+public interface ParserNamespace<K, V> {
+
+}
import com.google.common.annotations.Beta;
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.concepts.SemVer;
-import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
/**
* Namespace class for storing semantic version of yang modules.
*/
@Beta
-public interface SemanticVersionNamespace extends IdentifierNamespace<StmtContext<?, ?, ?>, SemVer> {
+public interface SemanticVersionNamespace extends ParserNamespace<StmtContext<?, ?, ?>, SemVer> {
NamespaceBehaviour<StmtContext<?, ?, ?>, SemVer, @NonNull SemanticVersionNamespace> BEHAVIOUR =
NamespaceBehaviour.global(SemanticVersionNamespace.class);
import com.google.common.annotations.Beta;
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
/**
* @author Robert Varga
*/
@Beta
-public interface StatementDefinitionNamespace extends IdentifierNamespace<QName, StatementSupport<?, ?, ?>> {
+public interface StatementDefinitionNamespace extends ParserNamespace<QName, StatementSupport<?, ?, ?>> {
NamespaceBehaviour<QName, StatementSupport<?, ?, ?>, @NonNull StatementDefinitionNamespace> BEHAVIOUR =
NamespaceBehaviour.global(StatementDefinitionNamespace.class);
import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
-import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
-public interface StatementNamespace<K, D extends DeclaredStatement<?>, E extends EffectiveStatement<?, D>> extends
- IdentifierNamespace<K, StmtContext<?, D, E>> {
- @Override
- StmtContext<?, D, E> get(K key);
+public interface StatementNamespace<K, D extends DeclaredStatement<?>, E extends EffectiveStatement<?, D>>
+ extends ParserNamespace<K, StmtContext<?, D, E>> {
interface TreeScoped<K, D extends DeclaredStatement<?>, E extends EffectiveStatement<?, D>> extends
StatementNamespace<K, D, E> {
import org.opendaylight.yangtools.concepts.Immutable;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.YangVersion;
-import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@Override
@SuppressWarnings("unchecked")
- public <K, V, N extends IdentifierNamespace<K, V>> NamespaceBehaviour<K, V, N> getNamespaceBehaviour(
+ public <K, V, N extends ParserNamespace<K, V>> NamespaceBehaviour<K, V, N> getNamespaceBehaviour(
final Class<N> namespace) {
final NamespaceBehaviour<?, ?, ?> potential = namespaceDefinitions.get(namespace);
if (potential != null) {
return null;
}
- public <K, V, N extends IdentifierNamespace<K, V>> boolean hasNamespaceBehaviour(final Class<N> namespace) {
+ public <K, V, N extends ParserNamespace<K, V>> boolean hasNamespaceBehaviour(final Class<N> namespace) {
if (namespaceDefinitions.containsKey(namespace)) {
return true;
}
return this;
}
- public <K, V, N extends IdentifierNamespace<K, V>> Builder addSupport(
+ public <K, V, N extends ParserNamespace<K, V>> Builder addSupport(
final NamespaceBehaviour<K, V, N> namespaceSupport) {
final Class<N> identifier = namespaceSupport.getIdentifier();
checkState(!namespaces.containsKey(identifier));
import org.opendaylight.yangtools.yang.common.YangVersion;
import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
-import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
import org.opendaylight.yangtools.yang.model.api.meta.StatementSource;
import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
* @param <U> value type
* @throws NamespaceNotAvailableException when the namespace is not available.
*/
- <K, V, T extends K, U extends V, N extends IdentifierNamespace<K, V>> void addToNs(Class<@NonNull N> type,
+ <K, V, T extends K, U extends V, N extends ParserNamespace<K, V>> void addToNs(Class<@NonNull N> type,
T key, U value);
@Override
package org.opendaylight.yangtools.yang.parser.spi.source;
import org.eclipse.jdt.annotation.NonNull;
-import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ParserNamespace;
/**
* Source-specific mapping of prefixes to namespaces.
*/
-public interface BelongsToPrefixToModuleName extends IdentifierNamespace<String, String> {
+public interface BelongsToPrefixToModuleName extends ParserNamespace<String, String> {
NamespaceBehaviour<String, String, @NonNull BelongsToPrefixToModuleName> BEHAVIOUR =
NamespaceBehaviour.sourceLocal(BelongsToPrefixToModuleName.class);
}
import java.net.URI;
import org.eclipse.jdt.annotation.NonNull;
-import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ParserNamespace;
/**
* Pre-linkage source-specific mapping of prefixes to module namespaces.
*/
-public interface ImpPrefixToNamespace extends IdentifierNamespace<String, URI> {
+public interface ImpPrefixToNamespace extends ParserNamespace<String, URI> {
NamespaceBehaviour<String, URI, @NonNull ImpPrefixToNamespace> BEHAVIOUR =
NamespaceBehaviour.rootStatementLocal(ImpPrefixToNamespace.class);
}
package org.opendaylight.yangtools.yang.parser.spi.source;
import org.eclipse.jdt.annotation.NonNull;
-import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ParserNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
/**
* Source-specific mapping of prefix strings to module context.
*/
-public interface ImportPrefixToModuleCtx extends IdentifierNamespace<String, StmtContext<?, ?, ?>> {
+public interface ImportPrefixToModuleCtx extends ParserNamespace<String, StmtContext<?, ?, ?>> {
NamespaceBehaviour<String, StmtContext<?, ?, ?>, @NonNull ImportPrefixToModuleCtx> BEHAVIOUR =
NamespaceBehaviour.rootStatementLocal(ImportPrefixToModuleCtx.class);
}
import com.google.common.annotations.Beta;
import org.eclipse.jdt.annotation.NonNull;
-import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
import org.opendaylight.yangtools.yang.model.repo.api.SemVerSourceIdentifier;
import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ParserNamespace;
/**
* Source-specific mapping of prefixes to source identifier with specified semantic version.
*/
@Beta
-public interface ImportPrefixToSemVerSourceIdentifier
- extends IdentifierNamespace<String, SemVerSourceIdentifier> {
+public interface ImportPrefixToSemVerSourceIdentifier extends ParserNamespace<String, SemVerSourceIdentifier> {
NamespaceBehaviour<String, SemVerSourceIdentifier, @NonNull ImportPrefixToSemVerSourceIdentifier> BEHAVIOUR =
NamespaceBehaviour.rootStatementLocal(ImportPrefixToSemVerSourceIdentifier.class);
package org.opendaylight.yangtools.yang.parser.spi.source;
import org.eclipse.jdt.annotation.NonNull;
-import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ParserNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
/**
* Source-specific mapping of prefixes to namespaces.
*/
-public interface IncludedSubmoduleNameToModuleCtx extends IdentifierNamespace<String, StmtContext<?, ?, ?>> {
+public interface IncludedSubmoduleNameToModuleCtx extends ParserNamespace<String, StmtContext<?, ?, ?>> {
NamespaceBehaviour<String, StmtContext<?, ?, ?>, @NonNull IncludedSubmoduleNameToModuleCtx> BEHAVIOUR =
NamespaceBehaviour.sourceLocal(IncludedSubmoduleNameToModuleCtx.class);
}
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.common.QNameModule;
-import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ParserNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
/**
* Global mapping of modules to QNameModules.
*/
-public interface ModuleCtxToModuleQName extends IdentifierNamespace<StmtContext<?,?,?>, QNameModule> {
+public interface ModuleCtxToModuleQName extends ParserNamespace<StmtContext<?,?,?>, QNameModule> {
NamespaceBehaviour<StmtContext<?, ?, ?>, QNameModule, @NonNull ModuleCtxToModuleQName> BEHAVIOUR =
NamespaceBehaviour.global(ModuleCtxToModuleQName.class);
package org.opendaylight.yangtools.yang.parser.spi.source;
import org.eclipse.jdt.annotation.NonNull;
-import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ParserNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
/**
* Global mapping of modules to source identifier.
*/
-public interface ModuleCtxToSourceIdentifier extends IdentifierNamespace<StmtContext<?, ?, ?>, SourceIdentifier> {
+public interface ModuleCtxToSourceIdentifier extends ParserNamespace<StmtContext<?, ?, ?>, SourceIdentifier> {
NamespaceBehaviour<StmtContext<?, ?, ?>, SourceIdentifier, @NonNull ModuleCtxToSourceIdentifier> BEHAVIOUR =
NamespaceBehaviour.global(ModuleCtxToSourceIdentifier.class);
}
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.common.QNameModule;
-import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ParserNamespace;
/**
* Source-specific mapping of prefixes to namespaces.
*/
-public interface ModuleNameToModuleQName extends IdentifierNamespace<String, QNameModule> {
+public interface ModuleNameToModuleQName extends ParserNamespace<String, QNameModule> {
NamespaceBehaviour<String, QNameModule, @NonNull ModuleNameToModuleQName> BEHAVIOUR =
NamespaceBehaviour.sourceLocal(ModuleNameToModuleQName.class);
}
import java.net.URI;
import org.eclipse.jdt.annotation.NonNull;
-import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ParserNamespace;
/**
* Pre-linkage global mapping of module names to namespaces.
*/
-public interface ModuleNameToNamespace extends IdentifierNamespace<String, URI> {
+public interface ModuleNameToNamespace extends ParserNamespace<String, URI> {
NamespaceBehaviour<String, URI, @NonNull ModuleNameToNamespace> BEHAVIOUR =
NamespaceBehaviour.global(ModuleNameToNamespace.class);
}
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.common.QNameModule;
-import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ParserNamespace;
/**
* Source-specific mapping of prefixes to namespaces.
*/
-public interface ModuleQNameToModuleName extends IdentifierNamespace<QNameModule, String> {
+public interface ModuleQNameToModuleName extends ParserNamespace<QNameModule, String> {
NamespaceBehaviour<QNameModule, String, @NonNull ModuleQNameToModuleName> BEHAVIOUR =
NamespaceBehaviour.global(ModuleQNameToModuleName.class);
}
import com.google.common.collect.SetMultimap;
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.common.QNameModule;
-import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ParserNamespace;
/**
* Namespace used for storing information about modules that support deviation resolution.
*/
@Beta
public interface ModulesDeviatedByModules
- extends IdentifierNamespace<ModulesDeviatedByModules.SupportedModules, SetMultimap<QNameModule, QNameModule>> {
+ extends ParserNamespace<ModulesDeviatedByModules.SupportedModules, SetMultimap<QNameModule, QNameModule>> {
NamespaceBehaviour<SupportedModules, SetMultimap<QNameModule, QNameModule>, @NonNull ModulesDeviatedByModules>
BEHAVIOUR = NamespaceBehaviour.global(ModulesDeviatedByModules.class);
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.opendaylight.yangtools.yang.common.QNameModule;
-import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ParserNamespace;
/**
* Source-specific mapping of prefixes to namespaces.
*/
-public interface PrefixToModule extends IdentifierNamespace<String, QNameModule> {
+public interface PrefixToModule extends ParserNamespace<String, QNameModule> {
NamespaceBehaviour<String, QNameModule, @NonNull PrefixToModule> BEHAVIOUR =
NamespaceBehaviour.global(PrefixToModule.class);
String DEFAULT_PREFIX = "";
/**
- * Returns QNameModule (namespace + revision) associated with supplied
- * prefix.
+ * Returns QNameModule (namespace + revision) associated with supplied prefix.
*
- * @param prefix
- * Prefix
- * @return QNameModule associated with supplied prefix, or null if prefix is
- * not defined.
+ * @param prefix Prefix
+ * @return QNameModule associated with supplied prefix, or null if prefix is not defined.
*/
- @Override
QNameModule get(String prefix);
/**
* Returns QNameModule (namespace + revision) associated with XML namespace (URI).
*
- * @param namespace
- * XML Namespace
- * @return QNameModule associated with supplied namespace, or null if prefix
- * is not defined.
+ * @param namespace XML Namespace
+ * @return QNameModule associated with supplied namespace, or null if prefix is not defined.
* @throws URISyntaxException if the input string is not valid URI
*/
@Nullable QNameModule getByNamespace(String namespace) throws URISyntaxException;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ParserNamespace;
/**
* Map of fully qualified statement name to statement definition.
*/
-public interface QNameToStatementDefinition extends IdentifierNamespace<QName, StatementDefinition> {
+public interface QNameToStatementDefinition extends ParserNamespace<QName, StatementDefinition> {
NamespaceBehaviour<QName, StatementDefinition, @NonNull QNameToStatementDefinition> BEHAVIOUR =
NamespaceBehaviour.sourceLocal(QNameToStatementDefinition.class);
/**
* Returns StatementDefinition with specified QName.
*
- * @param identifier
- * QName of requested statement
+ * @param identifier QName of requested statement
* @return StatementDefinition
*/
- @Override
StatementDefinition get(QName identifier);
/**
* Returns StatementDefinition with specified namespace and localName.
*
- * @param namespace
- * namespace of requested statement
- * @param localName
- * localName of requested statement
+ * @param namespace namespace of requested statement
+ * @param localName localName of requested statement
* @return StatementDefinition
*/
@Nullable StatementDefinition getByNamespaceAndLocalName(@NonNull URI namespace, @NonNull String localName);
* 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.spi.source;
import java.util.Set;
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ParserNamespace;
public interface SupportedFeaturesNamespace
- extends IdentifierNamespace<SupportedFeaturesNamespace.SupportedFeatures, Set<QName>> {
+ extends ParserNamespace<SupportedFeaturesNamespace.SupportedFeatures, Set<QName>> {
NamespaceBehaviour<SupportedFeatures, Set<QName>, @NonNull SupportedFeaturesNamespace> BEHAVIOUR =
NamespaceBehaviour.global(SupportedFeaturesNamespace.class);
import java.util.Collection;
import org.eclipse.jdt.annotation.NonNull;
-import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ParserNamespace;
/**
* Namespace used for validating whether a node is of some type, e.g. usable target for some operation or has other
* significant properties.
*/
-public interface ValidationBundlesNamespace extends
- IdentifierNamespace<ValidationBundlesNamespace.ValidationBundleType, Collection<?>> {
+public interface ValidationBundlesNamespace
+ extends ParserNamespace<ValidationBundlesNamespace.ValidationBundleType, Collection<?>> {
NamespaceBehaviour<ValidationBundleType, Collection<?>, @NonNull ValidationBundlesNamespace> BEHAVIOUR =
NamespaceBehaviour.global(ValidationBundlesNamespace.class);