org.apache.jackrabbit.oak.api.Root.rebase()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(7.8k)|赞(0)|评价(0)|浏览(135)

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

Root.rebase介绍

[英]Rebase this root instance to the latest revision. After a call to this method, trees obtained through #getTree(String) may become non existing.
[中]将此根实例重设为最新版本。调用此方法后,通过#getTree(String)获得的树可能不存在。

代码示例

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

@Override
public void rebase() {
  base.rebase();
}

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

@Override
void apply(Root root) {
  root.rebase();
}

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

public void refresh(boolean keepChanges) {
  sessionCounters.refreshTime = clock.getTime();
  sessionCounters.refreshCount++;
  if (keepChanges && hasPendingChanges()) {
    root.rebase();
  } else {
    root.refresh();
  }
  if (permissionProvider != null) {
    permissionProvider.refresh();
  }
}

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

public void refresh(boolean keepChanges) {
  sessionCounters.refreshTime = clock.getTime();
  sessionCounters.refreshCount++;
  if (keepChanges && hasPendingChanges()) {
    root.rebase();
  } else {
    root.refresh();
  }
  if (permissionProvider != null) {
    permissionProvider.refresh();
  }
}

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

public void refresh(boolean keepChanges) {
  sessionCounters.refreshTime = clock.getTime();
  sessionCounters.refreshCount++;
  if (keepChanges && hasPendingChanges()) {
    root.rebase();
  } else {
    root.refresh();
  }
  if (permissionProvider != null) {
    permissionProvider.refresh();
  }
}

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

@Test
public void modifiedAfterRebase() throws CommitFailedException {
  Tree tree = root.getTree("/");
  tree.addChild("new");
  assertEquals(Status.MODIFIED, tree.getStatus());
  root.rebase();
  assertEquals(Status.MODIFIED, tree.getStatus());
}

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

@Test
public void rebase() throws CommitFailedException {
  Root root1 = session.getLatestRoot();
  Root root2 = session.getLatestRoot();
  checkEqual(root1.getTree("/"), root2.getTree("/"));
  root2.getTree("/").addChild("one").addChild("two").addChild("three")
      .setProperty("p1", "V1");
  root2.commit();
  root1.rebase();
  checkEqual(root1.getTree("/"), (root2.getTree("/")));
  Tree one = root2.getTree("/one");
  one.getChild("two").remove();
  one.addChild("four");
  root2.commit();
  root1.rebase();
  checkEqual(root1.getTree("/"), (root2.getTree("/")));
}

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

@Test
public void rebaseWithMove() throws CommitFailedException {
  Root root1 = session.getLatestRoot();
  Root root2 = session.getLatestRoot();
  checkEqual(root1.getTree("/"), root2.getTree("/"));
  root2.getTree("/").addChild("one").addChild("two").addChild("three")
      .setProperty("p1", "V1");
  root2.commit();
  root1.move("/x", "/y/x-moved");
  root1.rebase();
  root2.move("/x", "/y/x-moved");
  checkEqual(root1.getTree("/"), (root2.getTree("/")));
}

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

@Test
public void rebasePreservesStatus() throws CommitFailedException {
  Root root1 = session.getLatestRoot();
  Root root2 = session.getLatestRoot();
  Tree x = root1.getTree("/x");
  Tree added = x.addChild("added");
  assertEquals(NEW, added.getStatus());
  root2.getTree("/x").addChild("bar");
  root2.commit();
  root1.rebase();
  assertTrue(x.hasChild("added"));
  assertEquals(NEW, x.getChild("added").getStatus());
  assertTrue(x.hasChild("bar"));
}

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

@Test
public void rebaseWithSetProperty() throws CommitFailedException {
  Root root1 = session.getLatestRoot();
  Root root2 = session.getLatestRoot();
  checkEqual(root1.getTree("/"), root2.getTree("/"));
  root2.getTree("/").addChild("one").addChild("two").addChild("three")
      .setProperty("p1", "V1");
  root2.commit();
  root1.getTree("/").setProperty("a", 42);
  root1.rebase();
  root2.getTree("/").setProperty("a", 42);
  checkEqual(root1.getTree("/"), (root2.getTree("/")));
}

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

@Test
public void rebaseWithAddNode() throws CommitFailedException {
  Root root1 = session.getLatestRoot();
  Root root2 = session.getLatestRoot();
  checkEqual(root1.getTree("/"), root2.getTree("/"));
  root2.getTree("/").addChild("one").addChild("two").addChild("three")
      .setProperty("p1", "V1");
  root2.commit();
  root1.getTree("/").addChild("child");
  root1.rebase();
  root2.getTree("/").addChild("child");
  checkEqual(root1.getTree("/"), (root2.getTree("/")));
}

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

@Test
public void rebaseWithAddProperty() throws CommitFailedException {
  Root root1 = session.getLatestRoot();
  Root root2 = session.getLatestRoot();
  checkEqual(root1.getTree("/"), root2.getTree("/"));
  root2.getTree("/").addChild("one").addChild("two").addChild("three")
      .setProperty("p1", "V1");
  root2.commit();
  root1.getTree("/").setProperty("new", 42);
  root1.rebase();
  root2.getTree("/").setProperty("new", 42);
  checkEqual(root1.getTree("/"), (root2.getTree("/")));
}

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

@Test
public void rebaseWithRemoveProperty() throws CommitFailedException {
  Root root1 = session.getLatestRoot();
  Root root2 = session.getLatestRoot();
  checkEqual(root1.getTree("/"), root2.getTree("/"));
  root2.getTree("/").addChild("one").addChild("two").addChild("three")
      .setProperty("p1", "V1");
  root2.commit();
  root1.getTree("/").removeProperty("a");
  root1.rebase();
  root2.getTree("/").removeProperty("a");
  checkEqual(root1.getTree("/"), (root2.getTree("/")));
}

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

@Test
public void rebaseWithRemoveNode() throws CommitFailedException {
  Root root1 = session.getLatestRoot();
  Root root2 = session.getLatestRoot();
  checkEqual(root1.getTree("/"), root2.getTree("/"));
  root2.getTree("/").addChild("one").addChild("two").addChild("three")
      .setProperty("p1", "V1");
  root2.commit();
  root1.getTree("/").getChild("x").remove();
  root1.rebase();
  root2.getTree("/").getChild("x").remove();
  checkEqual(root1.getTree("/"), (root2.getTree("/")));
}

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

@Test
public void updateOldIndexDefinition() throws Exception{
  IndexDefinitionBuilder idxb = new IndexDefinitionBuilder().noAsync();
  idxb.indexRule("nt:base").property("foo").propertyIndex();
  Tree idx = root.getTree("/").getChild("oak:index").addChild("test1");
  idxb.build(idx);
  Tree rootTree = root.getTree("/");
  rootTree.addChild("a").setProperty("foo", "bar");
  rootTree.addChild("b").setProperty("bar", "bar");
  root.commit();
  //Cannot use Tree api as it cannot read hidden tree
  String clonedDefnPath = "/oak:index/test1/" + INDEX_DEFINITION_NODE;
  assertTrue(NodeStateUtils.getNode(nodeStore.getRoot(), clonedDefnPath).exists());
  NodeBuilder builder = nodeStore.getRoot().builder();
  child(builder, clonedDefnPath).remove();
  nodeStore.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
  root.rebase();
  rootTree = root.getTree("/");
  rootTree.addChild("c").setProperty("foo", "bar");
  root.commit();
  //Definition state should be recreated
  assertTrue(NodeStateUtils.getNode(nodeStore.getRoot(), clonedDefnPath).exists());
}

相关文章