xwiki-activity component


Short-term: Log events fired by xwiki-observation into a dedicated table in the database, allowing cheap retrieval of activity within various scopes: farm, wiki, space.
Short-term: Use this component as a datasource for the notification module (watchlist).
Long-term: Use this component as a datasource for the statistics module.


Additions to org.xwiki.observation.event.Event

Event getParent()
Date getDate()
Source getSource()
Data getData()

Creation of:

  • org.xwiki.observation.event.EventCriteria (Used by EventListeners to registers to events)

Addition to AbstractDocumentEvent:
public abstract class AbstractDocumentEvent implements Event, Serializable

Only one notify method:
org.xwiki.observation.internal#DefaultObservationManager#notify(Event event)

DocumentUpdateEventCriteria criteria = new DocumentUpdateEventCriteria();
criteria.setSpaceFilter(new ExactStringFilter("Main"));
criteria.setCreationDateFilter(new DateBeforeFilter("200801010000"));

Architecture proposal

  • xwiki-event/
    • xwiki-event-observation/
      • xwiki-event-observation-local/

      • xwiki-event-observation-remote/
    • xwiki-event-persistence/
      • internal/
        • (Flattened version of Event)
        • (implements org.xwiki.observation.EventListener)
        • (stores all events defined by the configuration)
        • (short term: implementation in a plugin or xwiki-core, bridge between 1.0 and 2.0 configuration)
      • (configure which events the listener must listen to)
        • void addEvent(Event)
        • void removeEvent(Event)
        • List<Event> getEvents(EventCriteria)
 * All Event types must implement this interface.

public interface Event
   Event getParent();
   Date getDate();
   Object getSource();
   Object getData();
   String getUser();
   String getWiki();
   String getSpace();
   String getPage();




  • EventStore implementation must implement a storage queue and process it with another thread (see statistics implementation).
  • EventStore must rely on xwiki-query to retrieve events from the database (if possible).
String getId()
String getParent()
Date getDate()
String getType() /* Example: org.xwiki.observation.event.DocumentSaveEvent */
String getSource()
String getUser()
String getWiki()
String getSpace()
String getPage()
String getData()


<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"

<class name="org.xwiki.activity.internal.DefaultActivityEvent" table="activityevent">
 <id name="id" type="string" unsaved-value="undefined">
   <column name="id" length="255" not-null="true" />
   <generator class="assigned" />
 <property name="date" type="timestamp">
   <column name="date" />
 <property name="type" type="string">
   <column name="type" length="255" />
 <property name="user" type="string">
   <column name="user" length="255" />
 <property name="wiki" type="string">
   <column name="wiki" length="255" />
 <property name="space" type="string">
   <column name="space" length="255" />
 <property name="page" type="string">
   <column name="page" length="255" />
 <property name="string1" type="string">
   <column name="string1" length="255" />
 <property name="string2" type="string">
   <column name="string2" length="255" />
 <property name="string3" type="string">
   <column name="string3" length="255" />
  [.. 10 strings]
 <property name="text1" type="string">
   <column name="text1" length="60000" />
 <property name="text2" type="string">
   <column name="text2" length="60000" />
 <property name="date1" type="timestamp">
   <column name="date1" not-null="true"/>
 <property name="date2" type="timestamp">
   <column name="date2" not-null="true"/>
 <property name="number1" type="double">
   <column name="number1" />
 <property name="number2" type="double">
   <column name="number2" />


  • Is it acceptable to lose the activity stream on a XAR export ?
  • Do we delete activity events when a document is deleted ?


Created by Jean-Vincent Drean on 2013/11/13 15:58

Get Connected