From 279e09efcdee60e60c61f0582969a035a5682321 Mon Sep 17 00:00:00 2001 From: Guillaume Delhumeau <guillaume.delhumeau@xwiki.com> Date: Mon, 4 Mar 2019 18:22:56 +0100 Subject: [PATCH] Revert "XWIKI-16199: Remove the need to declare the eventstream store in hibernate.hbm.xml to make XWiki upgrade easier." This reverts commit c06d7c1265222e5d5ccfb98e611606f78ac3e2b8. --- .../ActivityStreamMappingInitializer.java | 73 ------------------- .../main/resources/META-INF/components.txt | 1 - ...ystream.hbm.xml => activitystream.hbm.xml} | 0 .../internal/EventStreamStoreInitializer.java | 73 ------------------- .../main/resources/META-INF/components.txt | 1 - .../src/main/resources/activitystream.hbm.xml | 31 -------- .../pom.xml | 3 +- .../pom.xml | 2 + .../pom.xml | 2 + .../xwiki-platform-wiki-test-tests/pom.xml | 4 +- xwiki-platform-distribution/pom.xml | 2 +- 11 files changed, 9 insertions(+), 183 deletions(-) delete mode 100644 xwiki-platform-core/xwiki-platform-activitystream/xwiki-platform-activitystream-api/src/main/java/com/xpn/xwiki/plugin/activitystream/internal/ActivityStreamMappingInitializer.java rename xwiki-platform-core/xwiki-platform-activitystream/xwiki-platform-activitystream-api/src/main/resources/{legacy-activitystream.hbm.xml => activitystream.hbm.xml} (100%) delete mode 100644 xwiki-platform-core/xwiki-platform-eventstream/xwiki-platform-eventstream-store/src/main/java/org/xwiki/eventstream/store/internal/EventStreamStoreInitializer.java delete mode 100644 xwiki-platform-core/xwiki-platform-eventstream/xwiki-platform-eventstream-store/src/main/resources/activitystream.hbm.xml diff --git a/xwiki-platform-core/xwiki-platform-activitystream/xwiki-platform-activitystream-api/src/main/java/com/xpn/xwiki/plugin/activitystream/internal/ActivityStreamMappingInitializer.java b/xwiki-platform-core/xwiki-platform-activitystream/xwiki-platform-activitystream-api/src/main/java/com/xpn/xwiki/plugin/activitystream/internal/ActivityStreamMappingInitializer.java deleted file mode 100644 index c898aac07ac..00000000000 --- a/xwiki-platform-core/xwiki-platform-activitystream/xwiki-platform-activitystream-api/src/main/java/com/xpn/xwiki/plugin/activitystream/internal/ActivityStreamMappingInitializer.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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)); - } -} diff --git a/xwiki-platform-core/xwiki-platform-activitystream/xwiki-platform-activitystream-api/src/main/resources/META-INF/components.txt b/xwiki-platform-core/xwiki-platform-activitystream/xwiki-platform-activitystream-api/src/main/resources/META-INF/components.txt index e003c791f5f..59670169d3c 100644 --- a/xwiki-platform-core/xwiki-platform-activitystream/xwiki-platform-activitystream-api/src/main/resources/META-INF/components.txt +++ b/xwiki-platform-core/xwiki-platform-activitystream/xwiki-platform-activitystream-api/src/main/resources/META-INF/components.txt @@ -1,5 +1,4 @@ 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 diff --git a/xwiki-platform-core/xwiki-platform-activitystream/xwiki-platform-activitystream-api/src/main/resources/legacy-activitystream.hbm.xml b/xwiki-platform-core/xwiki-platform-activitystream/xwiki-platform-activitystream-api/src/main/resources/activitystream.hbm.xml similarity index 100% rename from xwiki-platform-core/xwiki-platform-activitystream/xwiki-platform-activitystream-api/src/main/resources/legacy-activitystream.hbm.xml rename to xwiki-platform-core/xwiki-platform-activitystream/xwiki-platform-activitystream-api/src/main/resources/activitystream.hbm.xml diff --git a/xwiki-platform-core/xwiki-platform-eventstream/xwiki-platform-eventstream-store/src/main/java/org/xwiki/eventstream/store/internal/EventStreamStoreInitializer.java b/xwiki-platform-core/xwiki-platform-eventstream/xwiki-platform-eventstream-store/src/main/java/org/xwiki/eventstream/store/internal/EventStreamStoreInitializer.java deleted file mode 100644 index 6c7dd8c8e91..00000000000 --- a/xwiki-platform-core/xwiki-platform-eventstream/xwiki-platform-eventstream-store/src/main/java/org/xwiki/eventstream/store/internal/EventStreamStoreInitializer.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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)); - } -} diff --git a/xwiki-platform-core/xwiki-platform-eventstream/xwiki-platform-eventstream-store/src/main/resources/META-INF/components.txt b/xwiki-platform-core/xwiki-platform-eventstream/xwiki-platform-eventstream-store/src/main/resources/META-INF/components.txt index f4628368d74..42dc4a7a8a4 100644 --- a/xwiki-platform-core/xwiki-platform-eventstream/xwiki-platform-eventstream-store/src/main/resources/META-INF/components.txt +++ b/xwiki-platform-core/xwiki-platform-eventstream/xwiki-platform-eventstream-store/src/main/resources/META-INF/components.txt @@ -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 diff --git a/xwiki-platform-core/xwiki-platform-eventstream/xwiki-platform-eventstream-store/src/main/resources/activitystream.hbm.xml b/xwiki-platform-core/xwiki-platform-eventstream/xwiki-platform-eventstream-store/src/main/resources/activitystream.hbm.xml deleted file mode 100644 index 14ea938094c..00000000000 --- a/xwiki-platform-core/xwiki-platform-eventstream/xwiki-platform-eventstream-store/src/main/resources/activitystream.hbm.xml +++ /dev/null @@ -1,31 +0,0 @@ -<?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 diff --git a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-test/xwiki-platform-notifications-test-tests/pom.xml b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-test/xwiki-platform-notifications-test-tests/pom.xml index d490a764043..d7ccdcb1626 100644 --- a/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-test/xwiki-platform-notifications-test-tests/pom.xml +++ b/xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-test/xwiki-platform-notifications-test-tests/pom.xml @@ -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> diff --git a/xwiki-platform-core/xwiki-platform-user/xwiki-platform-user-directory/xwiki-platform-user-directory-test/xwiki-platform-user-directory-test-tests/pom.xml b/xwiki-platform-core/xwiki-platform-user/xwiki-platform-user-directory/xwiki-platform-user-directory-test/xwiki-platform-user-directory-test-tests/pom.xml index 1e488038105..814f50ecf6f 100644 --- a/xwiki-platform-core/xwiki-platform-user/xwiki-platform-user-directory/xwiki-platform-user-directory-test/xwiki-platform-user-directory-test-tests/pom.xml +++ b/xwiki-platform-core/xwiki-platform-user/xwiki-platform-user-directory/xwiki-platform-user-directory-test/xwiki-platform-user-directory-test-tests/pom.xml @@ -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> diff --git a/xwiki-platform-core/xwiki-platform-user/xwiki-platform-user-profile/xwiki-platform-user-profile-test/xwiki-platform-user-profile-test-tests/pom.xml b/xwiki-platform-core/xwiki-platform-user/xwiki-platform-user-profile/xwiki-platform-user-profile-test/xwiki-platform-user-profile-test-tests/pom.xml index 83b9a35a6ca..d1b25f07e33 100644 --- a/xwiki-platform-core/xwiki-platform-user/xwiki-platform-user-profile/xwiki-platform-user-profile-test/xwiki-platform-user-profile-test-tests/pom.xml +++ b/xwiki-platform-core/xwiki-platform-user/xwiki-platform-user-profile/xwiki-platform-user-profile-test/xwiki-platform-user-profile-test-tests/pom.xml @@ -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> diff --git a/xwiki-platform-core/xwiki-platform-wiki/xwiki-platform-wiki-test/xwiki-platform-wiki-test-tests/pom.xml b/xwiki-platform-core/xwiki-platform-wiki/xwiki-platform-wiki-test/xwiki-platform-wiki-test-tests/pom.xml index b91e2eca3cb..fd3c26987f4 100644 --- a/xwiki-platform-core/xwiki-platform-wiki/xwiki-platform-wiki-test/xwiki-platform-wiki-test-tests/pom.xml +++ b/xwiki-platform-core/xwiki-platform-wiki/xwiki-platform-wiki-test/xwiki-platform-wiki-test-tests/pom.xml @@ -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> diff --git a/xwiki-platform-distribution/pom.xml b/xwiki-platform-distribution/pom.xml index aebeeda7f1a..94ef60c3597 100644 --- a/xwiki-platform-distribution/pom.xml +++ b/xwiki-platform-distribution/pom.xml @@ -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> -- GitLab