import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailedException;
import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.api.SchemaContextProvider;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContextProvider;
import scala.concurrent.duration.FiniteDuration;
/**
}
private void updateSchemaContext(final UpdateSchemaContext message) {
- updateSchemaContext(message.getSchemaContext());
+ updateSchemaContext(message.getEffectiveModelContext());
}
@VisibleForTesting
- void updateSchemaContext(final SchemaContext schemaContext) {
+ void updateSchemaContext(final @NonNull EffectiveModelContext schemaContext) {
store.updateSchemaContext(schemaContext);
}
private ShardIdentifier id;
private Map<String, String> peerAddresses = Collections.emptyMap();
private DatastoreContext datastoreContext;
- private SchemaContextProvider schemaContextProvider;
+ private EffectiveModelContextProvider schemaContextProvider;
private DatastoreSnapshot.ShardSnapshot restoreFromSnapshot;
private DataTree dataTree;
return self();
}
- public T schemaContextProvider(final SchemaContextProvider newSchemaContextProvider) {
+ public T schemaContextProvider(final EffectiveModelContextProvider newSchemaContextProvider) {
checkSealed();
this.schemaContextProvider = requireNonNull(newSchemaContextProvider);
return self();
return datastoreContext;
}
- public SchemaContext getSchemaContext() {
- return Verify.verifyNotNull(schemaContextProvider.getSchemaContext());
+ public EffectiveModelContext getSchemaContext() {
+ return Verify.verifyNotNull(schemaContextProvider.getEffectiveModelContext());
}
public DatastoreSnapshot.ShardSnapshot getRestoreFromSnapshot() {
import org.opendaylight.yangtools.yang.data.codec.binfmt.NormalizedNodeStreamVersion;
import org.opendaylight.yangtools.yang.data.impl.schema.tree.InMemoryDataTreeFactory;
import org.opendaylight.yangtools.yang.data.util.DataSchemaContextTree;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private int currentTransactionBatch;
- ShardDataTree(final Shard shard, final SchemaContext schemaContext, final DataTree dataTree,
+ ShardDataTree(final Shard shard, final EffectiveModelContext schemaContext, final DataTree dataTree,
final ShardDataTreeChangeListenerPublisher treeChangeListenerPublisher,
final String logContext,
final ShardDataTreeMetadata<?>... metadata) {
tip = dataTree;
}
- ShardDataTree(final Shard shard, final SchemaContext schemaContext, final TreeType treeType,
+ ShardDataTree(final Shard shard, final EffectiveModelContext schemaContext, final TreeType treeType,
final YangInstanceIdentifier root,
final ShardDataTreeChangeListenerPublisher treeChangeListenerPublisher,
final String logContext,
}
@VisibleForTesting
- public ShardDataTree(final Shard shard, final SchemaContext schemaContext, final TreeType treeType) {
+ public ShardDataTree(final Shard shard, final EffectiveModelContext schemaContext, final TreeType treeType) {
this(shard, schemaContext, treeType, YangInstanceIdentifier.empty(),
new DefaultShardDataTreeChangeListenerPublisher(""), "");
}
return schemaContext;
}
- void updateSchemaContext(final SchemaContext newSchemaContext) {
- dataTree.setSchemaContext(newSchemaContext);
- this.schemaContext = requireNonNull(newSchemaContext);
+ void updateSchemaContext(final @NonNull EffectiveModelContext newSchemaContext) {
+ dataTree.setEffectiveModelContext(newSchemaContext);
+ this.schemaContext = newSchemaContext;
this.dataSchemaContext = DataSchemaContextTree.from(newSchemaContext);
}
* 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.controller.cluster.datastore.messages;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-
-public class UpdateSchemaContext {
- private final SchemaContext schemaContext;
-
- public UpdateSchemaContext(SchemaContext schemaContext) {
- this.schemaContext = schemaContext;
- }
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
+import org.opendaylight.yangtools.yang.model.util.AbstractEffectiveModelContextProvider;
- public SchemaContext getSchemaContext() {
- return schemaContext;
+public class UpdateSchemaContext extends AbstractEffectiveModelContextProvider {
+ public UpdateSchemaContext(final EffectiveModelContext modelContext) {
+ super(modelContext);
}
}
import com.google.common.base.Verify;
import java.util.concurrent.atomic.AtomicReference;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.api.SchemaContextProvider;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContextProvider;
-final class AtomicShardContextProvider extends AtomicReference<SchemaContext> implements SchemaContextProvider {
+final class AtomicShardContextProvider extends AtomicReference<EffectiveModelContext>
+ implements EffectiveModelContextProvider {
private static final long serialVersionUID = 1L;
@Override
- public SchemaContext getSchemaContext() {
+ public EffectiveModelContext getEffectiveModelContext() {
return Verify.verifyNotNull(get());
}
}
\ No newline at end of file
import org.opendaylight.controller.cluster.datastore.shardmanager.ShardManager.OnShardReady;
import org.opendaylight.controller.cluster.raft.RaftState;
import org.opendaylight.yangtools.yang.data.api.schema.tree.ReadOnlyDataTree;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
this.activeMember = isActiveMember;
}
- SchemaContext getSchemaContext() {
- return schemaContextProvider.getSchemaContext();
+ EffectiveModelContext getSchemaContext() {
+ return schemaContextProvider.getEffectiveModelContext();
}
- void setSchemaContext(final SchemaContext schemaContext) {
+ void setSchemaContext(final EffectiveModelContext schemaContext) {
schemaContextProvider.set(requireNonNull(schemaContext));
}
import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier;
import org.opendaylight.yangtools.concepts.Registration;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import scala.concurrent.ExecutionContext;
@VisibleForTesting
final ShardPeerAddressResolver peerAddressResolver;
- private SchemaContext schemaContext;
+ private EffectiveModelContext schemaContext;
private DatastoreSnapshot restoreFromSnapshot;
Future<Object> futureObj = ask(getContext().actorSelection(primaryPath),
new RemoveServer(shardId.toString()), removeServerTimeout);
- futureObj.onComplete(new OnComplete<Object>() {
+ futureObj.onComplete(new OnComplete<>() {
@Override
public void onComplete(final Throwable failure, final Object response) {
if (failure != null) {
Future<Object> futureObj = ask(getContext().actorSelection(primaryPath),
new RemoveServer(shardId.toString()), removeServerTimeout);
- futureObj.onComplete(new OnComplete<Object>() {
+ futureObj.onComplete(new OnComplete<>() {
@Override
public void onComplete(final Throwable failure, final Object response) {
if (failure != null) {
final Future<Boolean> stopFuture = Patterns.gracefulStop(shardActor,
FiniteDuration.apply(timeoutInMS, TimeUnit.MILLISECONDS), Shutdown.INSTANCE);
- final CompositeOnComplete<Boolean> onComplete = new CompositeOnComplete<Boolean>() {
+ final CompositeOnComplete<Boolean> onComplete = new CompositeOnComplete<>() {
@Override
public void onComplete(final Throwable failure, final Boolean result) {
if (failure == null) {
* @param message the message to send
*/
private void updateSchemaContext(final Object message) {
- schemaContext = ((UpdateSchemaContext) message).getSchemaContext();
+ schemaContext = ((UpdateSchemaContext) message).getEffectiveModelContext();
LOG.debug("Got updated SchemaContext: # of modules {}", schemaContext.getModules().size());
.getShardInitializationTimeout().duration().$times(2));
Future<Object> futureObj = ask(getSelf(), new FindPrimary(shardName, true), findPrimaryTimeout);
- futureObj.onComplete(new OnComplete<Object>() {
+ futureObj.onComplete(new OnComplete<>() {
@Override
public void onComplete(final Throwable failure, final Object response) {
if (failure != null) {
final Future<Object> futureObj = ask(getContext().actorSelection(response.getPrimaryPath()),
new AddServer(shardInfo.getShardId().toString(), localShardAddress, true), addServerTimeout);
- futureObj.onComplete(new OnComplete<Object>() {
+ futureObj.onComplete(new OnComplete<>() {
@Override
public void onComplete(final Throwable failure, final Object addServerResponse) {
if (failure != null) {
Future<Object> future = ask(localShardFound.getPath(), GetOnDemandRaftState.INSTANCE,
Timeout.apply(30, TimeUnit.SECONDS));
- future.onComplete(new OnComplete<Object>() {
+ future.onComplete(new OnComplete<>() {
@Override
public void onComplete(final Throwable failure, final Object response) {
if (failure != null) {
.getShardInitializationTimeout().duration().$times(2));
Future<Object> futureObj = ask(getSelf(), new FindLocalShard(shardName, true), findLocalTimeout);
- futureObj.onComplete(new OnComplete<Object>() {
+ futureObj.onComplete(new OnComplete<>() {
@Override
public void onComplete(final Throwable failure, final Object response) {
if (failure != null) {
Timeout timeout = new Timeout(datastoreContext.getShardLeaderElectionTimeout().duration().$times(2));
Future<Object> futureObj = ask(shardActorRef, changeServersVotingStatus, timeout);
- futureObj.onComplete(new OnComplete<Object>() {
+ futureObj.onComplete(new OnComplete<>() {
@Override
public void onComplete(final Throwable failure, final Object response) {
shardReplicaOperationsInProgress.remove(shardName);
import org.opendaylight.controller.cluster.reporting.MetricsReporter;
import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
import org.opendaylight.yangtools.yang.data.api.schema.tree.ReadOnlyDataTree;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import scala.concurrent.Await;
private static final String DISTRIBUTED_DATA_STORE_METRIC_REGISTRY = "distributed-data-store";
private static final String METRIC_RATE = "rate";
private static final Mapper<Throwable, Throwable> FIND_PRIMARY_FAILURE_TRANSFORMER =
- new Mapper<Throwable, Throwable>() {
+ new Mapper<>() {
@Override
public Throwable apply(final Throwable failure) {
Throwable actualFailure = failure;
private Timeout shardInitializationTimeout;
private final Dispatchers dispatchers;
- private volatile SchemaContext schemaContext;
+ private volatile EffectiveModelContext schemaContext;
// Used as a write memory barrier.
@SuppressWarnings("unused")
return actorSystem.actorSelection(actorPath);
}
- public void setSchemaContext(final SchemaContext schemaContext) {
+ public void setSchemaContext(final EffectiveModelContext schemaContext) {
this.schemaContext = schemaContext;
if (shardManager != null) {
}
}
- public SchemaContext getSchemaContext() {
+ public EffectiveModelContext getSchemaContext() {
return schemaContext;
}
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailedException;
import org.opendaylight.yangtools.yang.data.impl.schema.tree.InMemoryDataTreeFactory;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
public final class NormalizedNodeAggregator {
private final YangInstanceIdentifier rootIdentifier;
private final DataTree dataTree;
private NormalizedNodeAggregator(final YangInstanceIdentifier rootIdentifier,
- final List<Optional<NormalizedNode<?, ?>>> nodes, final SchemaContext schemaContext,
+ final List<Optional<NormalizedNode<?, ?>>> nodes, final EffectiveModelContext schemaContext,
final LogicalDatastoreType logicalDatastoreType) {
this.rootIdentifier = rootIdentifier;
this.nodes = nodes;
this.dataTree = new InMemoryDataTreeFactory().create(
logicalDatastoreType == LogicalDatastoreType.CONFIGURATION ? DataTreeConfiguration.DEFAULT_CONFIGURATION
: DataTreeConfiguration.DEFAULT_OPERATIONAL);
- this.dataTree.setSchemaContext(schemaContext);
+ this.dataTree.setEffectiveModelContext(schemaContext);
}
/**
* Combine data from all the nodes in the list into a tree with root as rootIdentifier.
*/
public static Optional<NormalizedNode<?,?>> aggregate(final YangInstanceIdentifier rootIdentifier,
- final List<Optional<NormalizedNode<?, ?>>> nodes, final SchemaContext schemaContext,
+ final List<Optional<NormalizedNode<?, ?>>> nodes, final EffectiveModelContext schemaContext,
final LogicalDatastoreType logicalDatastoreType) throws DataValidationFailedException {
return new NormalizedNodeAggregator(rootIdentifier, nodes, schemaContext, logicalDatastoreType).aggregate();
}
.build());
// XXX: can we guarantee that the root is present in the schemacontext?
- this.dataTree.setSchemaContext(distributedDataStore.getActorUtils().getSchemaContext());
+ this.dataTree.setEffectiveModelContext(distributedDataStore.getActorUtils().getSchemaContext());
this.shardPath = prefix.getRootIdentifier();
this.childShards = childShards;
}
@SuppressWarnings("unchecked")
final AbstractDOMDataTreeChangeListenerRegistration<L> registration =
- new AbstractDOMDataTreeChangeListenerRegistration<L>((L) listener) {
+ new AbstractDOMDataTreeChangeListenerRegistration<>((L) listener) {
@Override
protected void removeRegistration() {
listener.close();
import org.opendaylight.mdsal.dom.spi.store.DOMStoreReadWriteTransaction;
import org.opendaylight.mdsal.dom.spi.store.DOMStoreTransactionChain;
import org.opendaylight.mdsal.dom.spi.store.DOMStoreWriteTransaction;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
public class ClientBackedDataStoreTest {
private static final LocalHistoryIdentifier HISTORY_ID = new LocalHistoryIdentifier(CLIENT_IDENTIFIER, 0);
private static final TransactionIdentifier TRANSACTION_IDENTIFIER = new TransactionIdentifier(HISTORY_ID, 0);
- private static SchemaContext SCHEMA_CONTEXT;
+ private static EffectiveModelContext SCHEMA_CONTEXT;
@Mock
private DataStoreClient clientActor;
import org.opendaylight.yangtools.yang.data.api.schema.tree.ModificationType;
import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
import org.opendaylight.yangtools.yang.data.impl.schema.tree.InMemoryDataTreeFactory;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
import scala.concurrent.Await;
import scala.concurrent.Future;
import scala.concurrent.duration.FiniteDuration;
* @author Thomas Pantelis
*/
public abstract class AbstractShardTest extends AbstractActorTest {
- protected static final SchemaContext SCHEMA_CONTEXT = TestModel.createTestContext();
+ protected static final EffectiveModelContext SCHEMA_CONTEXT = TestModel.createTestContext();
private static final AtomicInteger NEXT_SHARD_NUM = new AtomicInteger();
}).when(mock).commit(any(DataTreeCandidate.class));
doAnswer(invocation -> {
- actual.setSchemaContext(invocation.getArgument(0));
+ actual.setEffectiveModelContext(invocation.getArgument(0));
return null;
- }).when(mock).setSchemaContext(any(SchemaContext.class));
+ }).when(mock).setEffectiveModelContext(any(EffectiveModelContext.class));
doAnswer(invocation -> actual.takeSnapshot()).when(mock).takeSnapshot();
import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
import org.opendaylight.yangtools.yang.data.impl.schema.tree.InMemoryDataTreeFactory;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
public class ShardDataTreeTest extends AbstractTest {
private final Shard mockShard = Mockito.mock(Shard.class);
private ShardDataTree shardDataTree;
- private SchemaContext fullSchema;
+ private EffectiveModelContext fullSchema;
@Before
public void setUp() {
import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType;
import org.opendaylight.yangtools.yang.data.impl.schema.tree.InMemoryDataTreeFactory;
import org.opendaylight.yangtools.yang.data.impl.schema.tree.SchemaValidationFailedException;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private static final Logger FOO_LOGGER = LoggerFactory.getLogger("foo");
private ShardDataTree peopleDataTree;
- private SchemaContext peopleSchemaContext;
- private SchemaContext carsSchemaContext;
+ private EffectiveModelContext peopleSchemaContext;
+ private EffectiveModelContext carsSchemaContext;
private ShardRecoveryCoordinator coordinator;
@Before
private Optional<NormalizedNode<?,?>> readCars(final ShardDataTree shardDataTree) {
final DataTree dataTree = shardDataTree.getDataTree();
// FIXME: this should not be called here
- dataTree.setSchemaContext(peopleSchemaContext);
+ dataTree.setEffectiveModelContext(peopleSchemaContext);
return shardDataTree.readNode(CarsModel.BASE_PATH);
}
private Optional<NormalizedNode<?,?>> readPeople(final ShardDataTree shardDataTree) {
final DataTree dataTree = shardDataTree.getDataTree();
// FIXME: this should not be called here
- dataTree.setSchemaContext(peopleSchemaContext);
+ dataTree.setEffectiveModelContext(peopleSchemaContext);
return shardDataTree.readNode(PeopleModel.BASE_PATH);
}
import org.opendaylight.mdsal.common.api.ReadFailedException;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
import scala.concurrent.Await;
import scala.concurrent.Future;
import scala.concurrent.duration.FiniteDuration;
* @author Basheeruddin Ahmed
*/
public class ShardTransactionFailureTest extends AbstractActorTest {
- private static final SchemaContext TEST_SCHEMA_CONTEXT = TestModel.createTestContext();
+ private static final EffectiveModelContext TEST_SCHEMA_CONTEXT = TestModel.createTestContext();
private static final TransactionType RO = TransactionType.READ_ONLY;
private static final TransactionType RW = TransactionType.READ_WRITE;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableContainerNodeBuilder;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
public class ShardTransactionTest extends AbstractActorTest {
private static final ShardIdentifier SHARD_IDENTIFIER =
ShardIdentifier.create("inventory", MEMBER_NAME, "config");
- private static final SchemaContext TEST_MODEL = TestModel.createTestContext();
+ private static final EffectiveModelContext TEST_MODEL = TestModel.createTestContext();
private DatastoreContext datastoreContext = DatastoreContext.newBuilder().persistent(false).build();
import org.opendaylight.controller.md.cluster.datastore.model.TestModel;
import org.opendaylight.yangtools.concepts.Registration;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import scala.concurrent.Await;
private static final MemberName MEMBER_2 = MemberName.forName("member-2");
private static final MemberName MEMBER_3 = MemberName.forName("member-3");
- private static SchemaContext TEST_SCHEMA_CONTEXT;
+ private static EffectiveModelContext TEST_SCHEMA_CONTEXT;
private final String shardMgrID = ShardManagerIdentifier.builder().type(shardMrgIDSuffix).build().toString();
.createActor(newShardMgrProps(new ConfigurationImpl(new EmptyModuleShardConfigProvider()))
.withDispatcher(Dispatchers.DefaultDispatcherId()));
- SchemaContext schemaContext = TEST_SCHEMA_CONTEXT;
+ EffectiveModelContext schemaContext = TEST_SCHEMA_CONTEXT;
shardManager.tell(new UpdateSchemaContext(schemaContext), ActorRef.noSender());
DatastoreContext datastoreContext = DatastoreContext.newBuilder().shardElectionTimeoutFactor(100)
kit.expectMsgClass(Duration.ofSeconds(5), Success.class);
- SchemaContext schemaContext = TEST_SCHEMA_CONTEXT;
+ EffectiveModelContext schemaContext = TEST_SCHEMA_CONTEXT;
shardManager.tell(new UpdateSchemaContext(schemaContext), ActorRef.noSender());
shardManager.tell(new FindLocalShard("foo", true), kit.getRef());
import org.opendaylight.yangtools.yang.data.impl.schema.tree.InMemoryDataTreeFactory;
import org.opendaylight.yangtools.yang.data.impl.schema.tree.SchemaValidationFailedException;
import org.opendaylight.yangtools.yang.data.util.DataSchemaContextTree;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
@RunWith(MockitoJUnitRunner.class)
public class PruningDataTreeModificationTest {
static final QName INVALID_TEST_QNAME = QName.create(TestModel.TEST_QNAME, "invalid");
static final YangInstanceIdentifier INVALID_TEST_PATH = YangInstanceIdentifier.of(INVALID_TEST_QNAME);
- private static SchemaContext SCHEMA_CONTEXT;
+ private static EffectiveModelContext SCHEMA_CONTEXT;
private static DataSchemaContextTree CONTEXT_TREE;
@Mock