-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Misc] Moving deprecated Job APIs to legacy #482
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,7 @@ | |
* 02110-1301 USA, or see the FSF site: http://www.fsf.org. | ||
--> | ||
|
||
<org.xwiki.job.internal.DefaultJobStatus> | ||
<org.xwiki.job.DefaultJobStatus> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had to modify the serialization in the XML files of the test, since the class is not present anymore in this module. I don't think it would have an impact for real world status serialization if the old class is available through the legacy module. |
||
<state>FINISHED</state> | ||
<request class="org.xwiki.job.DefaultRequest"> | ||
<id> | ||
|
@@ -62,4 +62,4 @@ | |
<null/> | ||
</java.util.concurrent.ConcurrentLinkedQueue> | ||
</logs> | ||
</org.xwiki.job.internal.DefaultJobStatus> | ||
</org.xwiki.job.DefaultJobStatus> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?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. | ||
--> | ||
|
||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.xwiki.commons</groupId> | ||
<artifactId>xwiki-commons-legacy</artifactId> | ||
<version>15.7-SNAPSHOT</version> | ||
</parent> | ||
<artifactId>xwiki-commons-legacy-extension</artifactId> | ||
<name>XWiki Commons - Legacy - Extension - Parent POM</name> | ||
<packaging>pom</packaging> | ||
<description>Legacy modules for xwiki-commons-extension-*</description> | ||
<modules> | ||
<module>xwiki-commons-legacy-extension-api</module> | ||
</modules> | ||
</project> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?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. | ||
--> | ||
|
||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.xwiki.commons</groupId> | ||
<artifactId>xwiki-commons-legacy-extension</artifactId> | ||
<version>15.7-SNAPSHOT</version> | ||
</parent> | ||
<artifactId>xwiki-commons-legacy-extension-api</artifactId> | ||
<name>XWiki Commons - Legacy - Extension - API</name> | ||
<packaging>jar</packaging> | ||
<description>Legacy module for xwiki-commons-extension-api</description> | ||
<properties> | ||
<xwiki.jacoco.instructionRatio>0.00</xwiki.jacoco.instructionRatio> | ||
<!-- The features provided by this module so that it's found when resolving extension --> | ||
<xwiki.extension.features>org.xwiki.commons:xwiki-commons-extension-api</xwiki.extension.features> | ||
</properties> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.xwiki.commons</groupId> | ||
<artifactId>xwiki-commons-extension-api</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.xwiki.commons</groupId> | ||
<artifactId>xwiki-commons-legacy-job-api</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
</dependencies> | ||
</project> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* 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.extension.job.history.internal; | ||
|
||
import javax.inject.Named; | ||
import javax.inject.Singleton; | ||
|
||
import org.xwiki.component.annotation.Component; | ||
import org.xwiki.extension.job.history.ReplayJobStatus; | ||
import org.xwiki.job.Job; | ||
import org.xwiki.job.event.JobStartedEvent; | ||
import org.xwiki.job.internal.AbstractJobStatus; | ||
import org.xwiki.observation.event.Event; | ||
|
||
/** | ||
* Legacy implementation of {@link ExtensionJobHistoryRecorder}. | ||
* | ||
* @version $Id$ | ||
* @since 15.7RC1 | ||
*/ | ||
@Component | ||
@Named(ExtensionJobHistoryRecorder.NAME) | ||
@Singleton | ||
@Deprecated | ||
public class LegacyExtensionJobHistoryRecorder extends ExtensionJobHistoryRecorder | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems to me this class is actually useless. |
||
{ | ||
@Override | ||
public void onEvent(Event event, Object source, Object data) | ||
{ | ||
boolean ignore = false; | ||
if (event instanceof JobStartedEvent) { | ||
Job job = (Job) source; | ||
if (job.getStatus() instanceof org.xwiki.job.AbstractJobStatus | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I might have used an aspect for injecting this condition check, but it felt easier to do it like that. |
||
&& isSubJob((AbstractJobStatus<?>) job.getStatus())) { | ||
// We record only the jobs that have been triggered explicitly or that are part of a replay. | ||
ignore = true; | ||
} | ||
} | ||
if (!ignore) { | ||
super.onEvent(event, source, data); | ||
} | ||
} | ||
|
||
private <T extends AbstractJobStatus<?>> boolean isSubJob(T jobStatus) | ||
{ | ||
return jobStatus.isSubJob() && !(jobStatus.getParentJobStatus() instanceof ReplayJobStatus); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
500:org.xwiki.extension.job.history.internal.LegacyExtensionJobHistoryRecorder |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?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. | ||
--> | ||
|
||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.xwiki.commons</groupId> | ||
<artifactId>xwiki-commons-legacy</artifactId> | ||
<version>15.7-SNAPSHOT</version> | ||
</parent> | ||
<artifactId>xwiki-commons-legacy-job</artifactId> | ||
<name>XWiki Commons - Legacy - Job - Parent POM</name> | ||
<packaging>pom</packaging> | ||
<description>Legacy modules for xwiki-commons-job-*</description> | ||
<modules> | ||
<module>xwiki-commons-legacy-job-api</module> | ||
<module>xwiki-commons-legacy-job-default</module> | ||
</modules> | ||
</project> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?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. | ||
--> | ||
|
||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.xwiki.commons</groupId> | ||
<artifactId>xwiki-commons-legacy-job</artifactId> | ||
<version>15.7-SNAPSHOT</version> | ||
</parent> | ||
<artifactId>xwiki-commons-legacy-job-api</artifactId> | ||
<name>XWiki Commons - Legacy - Job - API</name> | ||
<packaging>jar</packaging> | ||
<description>Legacy module for xwiki-commons-job-api</description> | ||
<properties> | ||
<xwiki.jacoco.instructionRatio>0.00</xwiki.jacoco.instructionRatio> | ||
<!-- The features provided by this module so that it's found when resolving extension --> | ||
<xwiki.extension.features>org.xwiki.commons:xwiki-commons-job-api</xwiki.extension.features> | ||
</properties> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.xwiki.commons</groupId> | ||
<artifactId>xwiki-commons-job-api</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
</dependencies> | ||
</project> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This impacts a condition in
#onJobStarted
which is called from#onEvent
hence the legacy class I added to support the condition with the old class.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those should have moved to
org.xwiki.job.AbstractJobStatus
back when it was introduced. There is no need to introduce any legacy for this change, asorg.xwiki.job.internal.AbstractJobStatus
is aorg.xwiki.job.AbstractJobStatus
too.