org.apache.jackrabbit.oak.spi.state.NodeStore.retrieve()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(9.4k)|赞(0)|评价(0)|浏览(95)

本文整理了Java中org.apache.jackrabbit.oak.spi.state.NodeStore.retrieve()方法的一些代码示例,展示了NodeStore.retrieve()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。NodeStore.retrieve()方法的具体详情如下:
包路径:org.apache.jackrabbit.oak.spi.state.NodeStore
类名称:NodeStore
方法名:retrieve

NodeStore.retrieve介绍

[英]Retrieves the root node from a previously created repository checkpoint.
[中]从以前创建的存储库检查点检索根节点。

代码示例

代码示例来源:origin: apache/jackrabbit-oak

@Override
public NodeState retrieve(@NotNull String checkpoint) {
  if (inheritedCheckpoints.contains(checkpoint)) {
    return nodeStore.retrieve(checkpoint);
  } else if (checkpointMapping.containsKey(checkpoint)) {
    return memoryNodeStore.retrieve(checkpointMapping.get(checkpoint));
  } else {
    return null;
  }
}

代码示例来源:origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

@Override
public NodeState retrieve(@Nonnull String checkpoint) {
  if (inheritedCheckpoints.contains(checkpoint)) {
    return nodeStore.retrieve(checkpoint);
  } else if (checkpointMapping.containsKey(checkpoint)) {
    return memoryNodeStore.retrieve(checkpointMapping.get(checkpoint));
  } else {
    return null;
  }
}

代码示例来源:origin: org.apache.jackrabbit/oak-core

@Override
public NodeState retrieve(@NotNull String checkpoint) {
  if (inheritedCheckpoints.contains(checkpoint)) {
    return nodeStore.retrieve(checkpoint);
  } else if (checkpointMapping.containsKey(checkpoint)) {
    return memoryNodeStore.retrieve(checkpointMapping.get(checkpoint));
  } else {
    return null;
  }
}

代码示例来源:origin: apache/jackrabbit-oak

@Override
public NodeState retrieve(@NotNull String checkpoint) {
  return getNodeStore().retrieve(checkpoint);
}

代码示例来源:origin: org.apache.jackrabbit/oak-core

@Override
public NodeState retrieve(@NotNull String checkpoint) {
  return getNodeStore().retrieve(checkpoint);
}

代码示例来源:origin: apache/jackrabbit-oak

@Override
public NodeState retrieve(String checkpoint) {
  return getNodeStore().retrieve(checkpoint);
}

代码示例来源:origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

@Override
public NodeState retrieve(@Nonnull String checkpoint) {
  return getNodeStore().retrieve(checkpoint);
}

代码示例来源:origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

@Override
public NodeState retrieve(String checkpoint) {
  return getNodeStore().retrieve(checkpoint);
}

代码示例来源:origin: org.apache.jackrabbit/oak-core

public BranchNodeStore(NodeStore nodeStore) throws CommitFailedException {
  this.nodeStore = nodeStore;
  this.inheritedCheckpoints = newArrayList(nodeStore.checkpoints());
  this.checkpointMapping = newConcurrentMap();
  String cp = nodeStore.checkpoint(CHECKPOINT_LIFETIME, singletonMap("type", "copy-on-write"));
  memoryNodeStore = new MemoryNodeStore(nodeStore.retrieve(cp));
}

代码示例来源:origin: apache/jackrabbit-oak

public BranchNodeStore(NodeStore nodeStore) throws CommitFailedException {
  this.nodeStore = nodeStore;
  this.inheritedCheckpoints = newArrayList(nodeStore.checkpoints());
  this.checkpointMapping = newConcurrentMap();
  String cp = nodeStore.checkpoint(CHECKPOINT_LIFETIME, singletonMap("type", "copy-on-write"));
  memoryNodeStore = new MemoryNodeStore(nodeStore.retrieve(cp));
}

代码示例来源:origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

public BranchNodeStore(NodeStore nodeStore) throws CommitFailedException {
  this.nodeStore = nodeStore;
  this.inheritedCheckpoints = newArrayList(nodeStore.checkpoints());
  this.checkpointMapping = newConcurrentMap();
  String cp = nodeStore.checkpoint(CHECKPOINT_LIFETIME, singletonMap("type", "copy-on-write"));
  memoryNodeStore = new MemoryNodeStore(nodeStore.retrieve(cp));
}

代码示例来源:origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

public IndexImporter(NodeStore nodeStore, File indexDir, IndexEditorProvider indexEditorProvider,
           AsyncIndexerLock indexerLock) throws IOException {
  checkArgument(indexDir.exists() && indexDir.isDirectory(), "Path [%s] does not point " +
      "to existing directory", indexDir.getAbsolutePath());
  this.nodeStore = nodeStore;
  this.indexDir = indexDir;
  this.indexEditorProvider = indexEditorProvider;
  indexerInfo = IndexerInfo.fromDirectory(indexDir);
  this.indexerLock = indexerLock;
  indexes = indexerInfo.getIndexes();
  indexedState = checkNotNull(nodeStore.retrieve(indexerInfo.checkpoint), "Cannot retrieve " +
      "checkpointed state [%s]", indexerInfo.checkpoint);
  this.indexDefinitionUpdater = new IndexDefinitionUpdater(new File(indexDir, INDEX_DEFINITIONS_JSON));
  this.asyncLaneToIndexMapping = mapIndexesToLanes(indexes);
}

代码示例来源:origin: apache/jackrabbit-oak

public IndexImporter(NodeStore nodeStore, File indexDir, IndexEditorProvider indexEditorProvider,
           AsyncIndexerLock indexerLock) throws IOException {
  checkArgument(indexDir.exists() && indexDir.isDirectory(), "Path [%s] does not point " +
      "to existing directory", indexDir.getAbsolutePath());
  this.nodeStore = nodeStore;
  this.indexDir = indexDir;
  this.indexEditorProvider = indexEditorProvider;
  indexerInfo = IndexerInfo.fromDirectory(indexDir);
  this.indexerLock = indexerLock;
  indexes = indexerInfo.getIndexes();
  indexedState = checkNotNull(nodeStore.retrieve(indexerInfo.checkpoint), "Cannot retrieve " +
      "checkpointed state [%s]", indexerInfo.checkpoint);
  this.indexDefinitionUpdater = new IndexDefinitionUpdater(new File(indexDir, INDEX_DEFINITIONS_JSON));
  this.asyncLaneToIndexMapping = mapIndexesToLanes(indexes);
}

代码示例来源:origin: org.apache.jackrabbit/oak-core

public IndexImporter(NodeStore nodeStore, File indexDir, IndexEditorProvider indexEditorProvider,
           AsyncIndexerLock indexerLock) throws IOException {
  checkArgument(indexDir.exists() && indexDir.isDirectory(), "Path [%s] does not point " +
      "to existing directory", indexDir.getAbsolutePath());
  this.nodeStore = nodeStore;
  this.indexDir = indexDir;
  this.indexEditorProvider = indexEditorProvider;
  indexerInfo = IndexerInfo.fromDirectory(indexDir);
  this.indexerLock = indexerLock;
  indexes = indexerInfo.getIndexes();
  indexedState = checkNotNull(nodeStore.retrieve(indexerInfo.checkpoint), "Cannot retrieve " +
      "checkpointed state [%s]", indexerInfo.checkpoint);
  this.indexDefinitionUpdater = new IndexDefinitionUpdater(new File(indexDir, INDEX_DEFINITIONS_JSON));
  this.asyncLaneToIndexMapping = mapIndexesToLanes(indexes);
}

代码示例来源:origin: apache/jackrabbit-oak

@Test
public void retrieveAny() {
  assertTrue(store.retrieve("r42-0-0") == null);
}

代码示例来源:origin: apache/jackrabbit-oak

@Override
public NodeState retrieve(String checkpoint) {
  if (!checkpointExists(ctx.getGlobalStore().getNodeStore(), checkpoint)) {
    LOG.warn("Checkpoint {} doesn't exist on the global store. Debug info:\n{}", checkpoint, checkpointDebugInfo());
    return null;
  }
  Map<String, String> props = ctx.getGlobalStore().getNodeStore().checkpointInfo(checkpoint);
  Map<MountedNodeStore, NodeState> nodeStates = newHashMap();
  nodeStates.put(ctx.getGlobalStore(), ctx.getGlobalStore().getNodeStore().retrieve(checkpoint));
  for (MountedNodeStore nodeStore : ctx.getNonDefaultStores()) {
    NodeState nodeState;
    String partialCheckpoint = getPartialCheckpointName(nodeStore, checkpoint, props, true);
    if (partialCheckpoint == null) {
      nodeState = nodeStore.getNodeStore().getRoot();
    } else {
      nodeState = nodeStore.getNodeStore().retrieve(partialCheckpoint);
    }
    nodeStates.put(nodeStore, nodeState);
  }
  if (any(nodeStates.values(), isNull())) {
    LOG.warn("Checkpoint {} doesn't exist. Debug info:\n{}", checkpoint, checkpointDebugInfo());
    return null;
  }
  return ctx.createRootNodeState(nodeStates);
}

代码示例来源:origin: apache/jackrabbit-oak

@After
public void cleanup() throws Exception {
  assertTrue("Test method was not executed", executed.get());
  String referenced = getReferenceCp(store, name);
  assertNotNull("Reference checkpoint doesn't exist", referenced);
  assertNotNull(
      "Failed indexer must not clean successful indexer's checkpoint",
      store.retrieve(referenced));
}

代码示例来源:origin: apache/jackrabbit-oak

@Override
public void importIndex(NodeState root, NodeBuilder defn, File indexDir) {
  assertEquals("fooIndex", indexDir.getName());
  assertEquals(2, defn.getProperty(REINDEX_COUNT).getValue(Type.LONG).longValue());
  defn.getChildNode(IndexConstants.INDEX_CONTENT_NODE_NAME).remove();
  NodeState cpState = store.retrieve(checkpoint);
  NodeState indexData = NodeStateUtils.getNode(cpState, "/oak:index/fooIndex/:index");
  defn.setChildNode(IndexConstants.INDEX_CONTENT_NODE_NAME, indexData);
}

代码示例来源:origin: apache/jackrabbit-oak

@Test
public void checkpoint() throws CommitFailedException {
  String cp = store.checkpoint(Long.MAX_VALUE);
  NodeBuilder builder = store.getRoot().builder();
  builder.setChildNode("new");
  store.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
  assertFalse(root.equals(store.getRoot()));
  assertEquals(root, store.retrieve(cp));
  assertTrue(store.release(cp));
  assertNull(store.retrieve(cp));
}

代码示例来源:origin: apache/jackrabbit-oak

protected void verifyCheckpoint() {
  assertEquals("after", destination.getRoot().getString("checkpoint-state"));
  String checkpointReference = null;
  for (String c : destination.checkpoints()) {
    if (destination.checkpointInfo(c).containsKey("key")) {
      checkpointReference = c;
      break;
    }
  }
  assertNotNull(checkpointReference);
  Map<String, String> info = destination.checkpointInfo(checkpointReference);
  assertEquals("123", info.get("key"));
  NodeState checkpoint = destination.retrieve(checkpointReference);
  assertEquals("before", checkpoint.getString("checkpoint-state"));
  assertEquals("123", destination.getRoot().getChildNode(":async").getString("test"));
  for (String name : new String[] {"var", "etc", "sling.css", "apps", "libs", "sightly"}) {
    assertSameRecord(destination.getRoot().getChildNode(name), checkpoint.getChildNode(name));
  }
}

相关文章