javax.jcr.observation.ObservationManager.getEventJournal()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(8.5k)|赞(0)|评价(0)|浏览(101)

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

ObservationManager.getEventJournal介绍

[英]Retrieves the event journal for this workspace. If journaled observation is not supported for this workspace, null is returned. Events recorded in the EventJournal instance will be filtered according to the current session's access rights as well as any additional restrictions specified through implemention-specific configuration.
[中]检索此工作区的事件日志。如果此工作区不支持日志观察,则返回nullEventJournal实例中记录的事件将根据当前会话的访问权限以及通过特定于实现的配置指定的任何附加限制进行过滤。

代码示例

代码示例来源:origin: net.adamcin.oakpal/oakpal-core

@Override
  public EventJournal getEventJournal(int eventTypes, String absPath, boolean isDeep,
                    String[] uuid, String[] nodeTypeName)
      throws RepositoryException {
    return delegate.getEventJournal(eventTypes, absPath, isDeep, uuid, nodeTypeName);
  }
}

代码示例来源:origin: net.adamcin.oakpal/oakpal-core

@Override
public EventJournal getEventJournal() throws RepositoryException {
  return delegate.getEventJournal();
}

代码示例来源:origin: org.onehippo.cms7/hippo-repository-engine

public EventJournal getEventJournal(int eventTypes, String absPath, boolean isDeep, String[] uuid, String[] nodeTypeName) throws RepositoryException {
    return upstream.getEventJournal(eventTypes, absPath, isDeep, uuid, nodeTypeName);
  }
};

代码示例来源:origin: org.onehippo.cms7/hippo-repository-engine

public EventJournal getEventJournal() throws RepositoryException {
  return upstream.getEventJournal();
}

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

private EventJournal getEventJournal(int eventTypes, String absPath, boolean isDeep, String[] uuid, String[] nodeTypeName) throws RepositoryException {
  return superuser.getWorkspace().getObservationManager().getEventJournal(eventTypes, absPath, isDeep, uuid, nodeTypeName);
}

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

public void testIsDeepTrue() throws RepositoryException {
  Node n1 = testRootNode.addNode(nodeName1);
  Node n2 = n1.addNode(nodeName2);
  journal = obsMgr.getEventJournal();
  skipToNow();
  superuser.save();
  checkJournal(new String[]{n1.getPath(), n2.getPath()}, new String[0]);
}

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

public void testUUID() throws RepositoryException, NotExecutableException {
  Node n1 = testRootNode.addNode(nodeName1);
  ensureMixinType(n1, mixReferenceable);
  superuser.save();
  Node n2 = n1.addNode(nodeName2);
  journal = obsMgr.getEventJournal();
  skipToNow();
  superuser.save();
  checkJournal(new String[]{n2.getPath()}, new String[0]);
}

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

protected void setUp() throws Exception {
  checkSupportedOption(Repository.OPTION_JOURNALED_OBSERVATION_SUPPORTED);
  super.setUp();
  journal = obsMgr.getEventJournal();
}

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

public void testUserData() throws RepositoryException {
  testRootNode.addNode(nodeName1);
  String data = createRandomString(5);
  obsMgr.setUserData(data);
  journal = obsMgr.getEventJournal();
  skipToNow();
  superuser.save();
  assertTrue("no more events", journal.hasNext());
  assertEquals("Wrong user data", data, journal.nextEvent().getUserData());
}

代码示例来源:origin: org.onehippo.cms7/hippo-repository-engine

private void prepareEventJournalAndLastRevision() throws RepositoryException {
  // ensure eventJournal will be 'up-to-date' and that there are no pending session changes
  eventProcessorSession.refresh(false);
  if (eventJournal == null) {
    final ObservationManager observationManager = eventProcessorSession.getWorkspace().getObservationManager();
    eventJournal = (RevisionEventJournal) observationManager.getEventJournal();
    lastRevision = getLastRevision();
  }
  if (lastRevision == -1) {
    // first skip to almost now (minus 1 minute), so we likely can capture the current last revision fast
    // this is useful when enabling autoexport on an existing (production copy?) repository with a large journal
    eventJournal.skipTo(System.currentTimeMillis()-1000*60);
    RevisionEvent lastEvent = null;
    while (eventJournal.hasNext()) {
      lastEvent = eventJournal.nextEvent();
    }
    if (lastEvent != null) {
      log.info("Skipping to initial eventjournal head revision: {} ", lastEvent.getRevision());
      lastRevision = lastEvent.getRevision();
      setLastRevision(lastRevision);
    }
  } else {
    eventJournal.skipToRevision(lastRevision);
  }
}

代码示例来源:origin: ModeShape/modeshape

@Test
@FixFor( "MODE-2019" )
public void shouldProvideFullEventJournal() throws Exception {
  // add node
  Node node1 = getRoot().addNode("node1");
  node1.setProperty("prop1", "value");
  node1.setProperty("prop2", "value2");
  Node node2 = getRoot().addNode("node2");
  session.save();
  Thread.sleep(100);
  node1.setProperty("prop2", "edited value");
  node1.setProperty("prop1", (String) null);
  node2.remove();
  session.save();
  Thread.sleep(100);
  EventJournal eventJournal = getObservationManager().getEventJournal();
  assertPathsInJournal(eventJournal, false,
             "/testroot/node1", "/testroot/node1/jcr:primaryType", "/testroot/node1/prop1",
             "/testroot/node1/prop2", "/testroot/node2/jcr:primaryType", "/testroot/node2/jcr:primaryType",
             "/testroot/node1/prop2", "/testroot/node1/prop1", "/testroot/node1/prop2");
}

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

/**
 * {@inheritDoc}
 */
public EventBundle getEvents(SessionInfo sessionInfo,
                EventFilter filter,
                long after)
    throws RepositoryException, UnsupportedRepositoryOperationException {
  SessionInfoImpl sInfo = getSessionInfoImpl(sessionInfo);
  EventJournal journal = sInfo.getSession().getWorkspace().getObservationManager().getEventJournal();
  if (journal == null) {
    throw new UnsupportedRepositoryOperationException();
  }
  EventFactory factory = new EventFactory(sInfo.getSession(),
      sInfo.getNamePathResolver(), idFactory, qValueFactory);
  journal.skipTo(after);
  List<Event> events = new ArrayList<Event>();
  int batchSize = 1024;
  boolean distinctDates = true;
  long lastDate = Long.MIN_VALUE;
  while (journal.hasNext() && (batchSize > 0 || !distinctDates)) {
    Event e = factory.fromJCREvent(journal.nextEvent());
    if (filter.accept(e, false)) {
      distinctDates = lastDate != e.getDate();
      lastDate = e.getDate();
      events.add(e);
      batchSize--;
    }
  }
  return new EventBundleImpl(events, false);
}

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

/**
 * {@inheritDoc}
 */
public EventBundle getEvents(SessionInfo sessionInfo,
                EventFilter filter,
                long after)
    throws RepositoryException, UnsupportedRepositoryOperationException {
  SessionInfoImpl sInfo = getSessionInfoImpl(sessionInfo);
  EventJournal journal = sInfo.getSession().getWorkspace().getObservationManager().getEventJournal();
  if (journal == null) {
    throw new UnsupportedRepositoryOperationException();
  }
  EventFactory factory = new EventFactory(sInfo.getSession(),
      sInfo.getNamePathResolver(), idFactory, qValueFactory);
  journal.skipTo(after);
  List<Event> events = new ArrayList<Event>();
  int batchSize = 1024;
  boolean distinctDates = true;
  long lastDate = Long.MIN_VALUE;
  while (journal.hasNext() && (batchSize > 0 || !distinctDates)) {
    Event e = factory.fromJCREvent(journal.nextEvent());
    if (filter.accept(e, false)) {
      distinctDates = lastDate != e.getDate();
      lastDate = e.getDate();
      events.add(e);
      batchSize--;
    }
  }
  return new EventBundleImpl(events, false);
}

代码示例来源:origin: ModeShape/modeshape

@Test
@FixFor( "MODE-2019" )
public void shouldProvideFilteredEventJournal() throws Exception {
  // add node
  Node node1 = getRoot().addNode("node1");
  getRoot().addNode("node2");
  Node node3 = getRoot().addNode("node3");
  session.save();
  Thread.sleep(200);
  EventJournal eventJournal = getObservationManager().getEventJournal(org.modeshape.jcr.api.observation.Event.ALL_EVENTS,
                                    null, true, new String[]{node1.getIdentifier(),
                                                 node3.getIdentifier()},
                                    null);
  assertPathsInJournal(eventJournal, true,
             "/testroot/node1", "/testroot/node1/jcr:primaryType",
             "/testroot/node3", "/testroot/node3/jcr:primaryType");
}

代码示例来源:origin: ModeShape/modeshape

long afterNode3 = System.currentTimeMillis();
EventJournal journal = getObservationManager().getEventJournal();
journal.skipTo(startingDate);
assertPathsInJournal(journal, true,
           "/testroot/node3", "/testroot/node3/jcr:primaryType");
journal = getObservationManager().getEventJournal();
journal.skipTo(afterNode1);
assertPathsInJournal(journal, true,
           "/testroot/node3", "/testroot/node3/jcr:primaryType");
journal = getObservationManager().getEventJournal();
journal.skipTo(afterNode2);
assertPathsInJournal(journal, true,
           "/testroot/node3", "/testroot/node3/jcr:primaryType");
journal = getObservationManager().getEventJournal();
journal.skipTo(afterNode3);
assertFalse(journal.hasNext());

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

.getEventJournal();
if (ej == null) {
  throw new DavException(HttpServletResponse.SC_NOT_IMPLEMENTED, "event journal not supported");

相关文章