Skip to content
Snippets Groups Projects
Commit 279e09ef authored by Guillaume Delhumeau's avatar Guillaume Delhumeau
Browse files

Revert "XWIKI-16199: Remove the need to declare the eventstream store in...

Revert "XWIKI-16199: Remove the need to declare the eventstream store in hibernate.hbm.xml to make XWiki upgrade easier."

This reverts commit c06d7c12.
parent d801c9ee
No related branches found
No related tags found
No related merge requests found
Showing
with 9 additions and 183 deletions
/*
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package com.xpn.xwiki.plugin.activitystream.internal;
import com.xpn.xwiki.store.hibernate.HibernateSessionFactory;
import com.xpn.xwiki.util.Util;
import org.xwiki.component.annotation.Component;
import org.xwiki.observation.EventListener;
import org.xwiki.observation.event.ApplicationStartedEvent;
import org.xwiki.observation.event.Event;
import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
import java.util.Collections;
import java.util.List;
/**
* Register the activity stream mapping.
*
* @since 11.2RC1
* @since 11.1.1
* @version $Id$
*/
@Component
@Named("ActivityStreamMappingInitializer")
@Singleton
public class ActivityStreamMappingInitializer implements EventListener
{
@Inject
private HibernateSessionFactory sessionFactory;
@Override
public List<Event> getEvents()
{
return Collections.singletonList(new ApplicationStartedEvent());
}
@Override
public String getName()
{
return "Activity Stream Mapping Initializer";
}
@Override
public void onEvent(Event event, Object source, Object data)
{
loadMappingFile("legacy-activitystream.hbm.xml");
}
protected void loadMappingFile(String path)
{
// This only adds the mappings to a queue. The mappings will be available after the session factory is created.
this.sessionFactory.getConfiguration().addInputStream(Util.getResourceAsStream(path));
}
}
com.xpn.xwiki.plugin.activitystream.eventstreambridge.BridgeEventStream
com.xpn.xwiki.plugin.activitystream.internal.ActivityStreamMappingInitializer
com.xpn.xwiki.plugin.activitystream.internal.DefaultEventStatusManager
com.xpn.xwiki.plugin.activitystream.eventstreambridge.EventConverter
com.xpn.xwiki.plugin.activitystream.impl.ActivityStreamConfiguration
......
/*
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.xwiki.eventstream.store.internal;
import com.xpn.xwiki.store.hibernate.HibernateSessionFactory;
import com.xpn.xwiki.util.Util;
import org.xwiki.component.annotation.Component;
import org.xwiki.observation.EventListener;
import org.xwiki.observation.event.ApplicationStartedEvent;
import org.xwiki.observation.event.Event;
import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
import java.util.Collections;
import java.util.List;
/**
* Register the event stream store mapping.
*
* @since 11.2RC1
* @since 11.1.1
* @version $Id$
*/
@Component
@Named("EventStreamStoreInitializer")
@Singleton
public class EventStreamStoreInitializer implements EventListener
{
@Inject
private HibernateSessionFactory sessionFactory;
@Override
public List<Event> getEvents()
{
return Collections.singletonList(new ApplicationStartedEvent());
}
@Override
public String getName()
{
return "Event Stream Store";
}
@Override
public void onEvent(Event event, Object source, Object data)
{
loadMappingFile("eventstream.hbm.xml");
}
protected void loadMappingFile(String path)
{
// This only adds the mappings to a queue. The mappings will be available after the session factory is created.
this.sessionFactory.getConfiguration().addInputStream(Util.getResourceAsStream(path));
}
}
......@@ -3,7 +3,6 @@ org.xwiki.eventstream.store.internal.DocumentEventRecorder
org.xwiki.eventstream.store.internal.EventStreamCleaner
org.xwiki.eventstream.store.internal.EventStreamCleanerJob
org.xwiki.eventstream.store.internal.EventStreamCleanerJobDocumentInitializer
org.xwiki.eventstream.store.internal.EventStreamStoreInitializer
org.xwiki.eventstream.store.internal.LegacyEventConverter
org.xwiki.eventstream.store.internal.LegacyEventDeleter
org.xwiki.eventstream.store.internal.LegacyEventLoader
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-->
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<!--
This empty mapping is here because the event stream store replaces activity stream but a lot of users forget to
remove the activity stream mapping in hibernate.hbm.xml, which makes XWiki launch fail.
By having this empty file, hibernate manages to find this file and do not throw any error.
-->
<hibernate-mapping />
\ No newline at end of file
......@@ -37,8 +37,9 @@
com.xpn.xwiki.plugin.skinx.LinkExtensionPlugin,\
com.xpn.xwiki.plugin.scheduler.SchedulerPlugin
</xwikiCfgPlugins>
<!-- Mapping needed by the EventStream migrator since AS is a dependency of the User Directory -->
<!-- Mapping needed by the Mail Sender -->
<xwikiDbHbmCommonExtraMappings>mailsender.hbm.xml,notification-filter-preferences.hbm.xml</xwikiDbHbmCommonExtraMappings>
<xwikiDbHbmCommonExtraMappings>eventstream.hbm.xml,mailsender.hbm.xml,notification-filter-preferences.hbm.xml</xwikiDbHbmCommonExtraMappings>
<!-- TODO: Remove once https://jira.xwiki.org/browse/XWIKI-7581 is fixed -->
<xwikiCfgSuperadminPassword>pass</xwikiCfgSuperadminPassword>
</properties>
......
......@@ -37,6 +37,8 @@
<xwikiCfgSuperadminPassword>pass</xwikiCfgSuperadminPassword>
<!-- Functional tests are allowed to output content to the console -->
<xwiki.surefire.captureconsole.skip>true</xwiki.surefire.captureconsole.skip>
<!-- Mapping needed by the EventStream migrator since Notification is a dependency of the User Directory -->
<xwikiDbHbmCommonExtraMappings>eventstream.hbm.xml</xwikiDbHbmCommonExtraMappings>
</properties>
<dependencies>
<dependency>
......
......@@ -37,6 +37,8 @@
<xwikiCfgSuperadminPassword>pass</xwikiCfgSuperadminPassword>
<!-- Functional tests are allowed to output content to the console -->
<xwiki.surefire.captureconsole.skip>true</xwiki.surefire.captureconsole.skip>
<!-- Mapping required by the Event Stream API implementation that we're using during tests. -->
<xwikiDbHbmCommonExtraMappings>eventstream.hbm.xml</xwikiDbHbmCommonExtraMappings>
</properties>
<dependencies>
<dependency>
......
......@@ -38,8 +38,8 @@
<xwikiCfgSuperadminPassword>pass</xwikiCfgSuperadminPassword>
<!-- Functional tests are allowed to output content to the console -->
<xwiki.surefire.captureconsole.skip>true</xwiki.surefire.captureconsole.skip>
<!-- Mapping needed by the Notifications, which is a dependency -->
<xwikiDbHbmCommonExtraMappings>notification-filter-preferences.hbm.xml</xwikiDbHbmCommonExtraMappings>
<!-- Mapping needed by the Notifications, which is a dependency (event stream is also needed by notifications) -->
<xwikiDbHbmCommonExtraMappings>notification-filter-preferences.hbm.xml,eventstream.hbm.xml</xwikiDbHbmCommonExtraMappings>
</properties>
<dependencies>
<dependency>
......
......@@ -69,7 +69,7 @@
<!-- Hibernate configuration -->
<xwiki.db.common.extraMappings>
instance.hbm.xml,notification-filter-preferences.hbm.xml
eventstream.hbm.xml,instance.hbm.xml,notification-filter-preferences.hbm.xml
</xwiki.db.common.extraMappings>
<xwiki.db.default.extraMappings>mailsender.hbm.xml</xwiki.db.default.extraMappings>
<xwiki.db.oracle.extraMappings>mailsender.oracle.hbm.xml</xwiki.db.oracle.extraMappings>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment