-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'update-example' into 'master'
Update example See merge request irida/irida-plugin-example!1
- Loading branch information
Showing
15 changed files
with
1,127 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
.idea | ||
target | ||
*.iml | ||
/.classpath | ||
/.project | ||
/.settings | ||
/bin |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,75 +1,92 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<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/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>ca.tom</groupId> | ||
<artifactId>testPlugin</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<groupId>ca.corefacility.bioinformatics.irida.plugins</groupId> | ||
<artifactId>example-plugin</artifactId> | ||
<version>0.1.0-SNAPSHOT</version> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>ca.corefacility.bioinformatics</groupId> | ||
<artifactId>irida</artifactId> | ||
<version>0.23.0-SNAPSHOT</version> | ||
<classifier>classes</classifier> | ||
</dependency> | ||
<!-- Please fill out these properties with information about your particular plugin --> | ||
<properties> | ||
<!-- Information used to define properties about a plugin. Please see the PF4J docs for more details https://pf4j.org/doc/getting-started.html --> | ||
<plugin.id>example-plugin</plugin.id> | ||
<plugin.class>ca.corefacility.bioinformatics.irida.plugins.ExamplePlugin</plugin.class> | ||
<plugin.version>0.1.0</plugin.version> | ||
<plugin.provider>Aaron Petkau</plugin.provider> | ||
<plugin.dependencies></plugin.dependencies> | ||
<plugin.requires.runtime>1.0.0</plugin.requires.runtime> | ||
|
||
<dependency> | ||
<groupId>org.pf4j</groupId> | ||
<artifactId>pf4j</artifactId> | ||
<version>2.3.0</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
</dependencies> | ||
<!-- The version of IRIDA your plugin must be compiled against. --> | ||
<irida.version.compiletime>0.23.0-SNAPSHOT</irida.version.compiletime> | ||
|
||
<!-- Version of the pf4j dependency --> | ||
<pf4j.version>2.4.0</pf4j.version> | ||
|
||
<build> | ||
<plugins> | ||
<!-- Maven compiler plugin --> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.1</version> | ||
<configuration> | ||
<source>1.8</source> | ||
<target>1.8</target> | ||
<forceJavacCompilerUse>true</forceJavacCompilerUse> | ||
</configuration> | ||
</plugin> | ||
<!-- Version of Java to target for this plugin --> | ||
<java.version>1.8</java.version> | ||
</properties> | ||
|
||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
<!-- Dependencies used to build this plugin package --> | ||
<dependencies> | ||
<dependency> | ||
<groupId>ca.corefacility.bioinformatics</groupId> | ||
<artifactId>irida</artifactId> | ||
<version>${irida.version.compiletime}</version> | ||
<classifier>classes</classifier> | ||
</dependency> | ||
|
||
<configuration> | ||
<archive> | ||
<manifestEntries> | ||
<Plugin-Class>ca.corefacility.bioinformatics.irida.ExamplePlugin</Plugin-Class> | ||
<Plugin-Dependencies></Plugin-Dependencies> | ||
<Plugin-Id>plugin-example</Plugin-Id> | ||
<Plugin-Provider>Tom Matthews</Plugin-Provider> | ||
<Plugin-Version>0.0.1</Plugin-Version> | ||
</manifestEntries> | ||
</archive> | ||
</configuration> | ||
</plugin> | ||
<dependency> | ||
<groupId>org.pf4j</groupId> | ||
<artifactId>pf4j</artifactId> | ||
<version>${pf4j.version}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-assembly-plugin</artifactId> | ||
<version>2.6</version> | ||
<configuration> | ||
<descriptorRefs> | ||
<descriptorRef>jar-with-dependencies</descriptorRef> | ||
</descriptorRefs> | ||
</configuration> | ||
</plugin> | ||
<!-- You should normally not have to modify any of the below information --> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.1</version> | ||
<configuration> | ||
<source>${java.version}</source> | ||
<target>${java.version}</target> | ||
<forceJavacCompilerUse>true</forceJavacCompilerUse> | ||
</configuration> | ||
</plugin> | ||
|
||
</plugins> | ||
|
||
|
||
</build> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
|
||
<configuration> | ||
<archive> | ||
<manifestEntries> | ||
<Plugin-Class>${plugin.class}</Plugin-Class> | ||
<Plugin-Dependencies>${plugin.dependencies}</Plugin-Dependencies> | ||
<Plugin-Id>${plugin.id}</Plugin-Id> | ||
<Plugin-Provider>${plugin.provider}</Plugin-Provider> | ||
<Plugin-Version>${plugin.version}</Plugin-Version> | ||
<Plugin-Requires>${plugin.requires.runtime}</Plugin-Requires> | ||
</manifestEntries> | ||
</archive> | ||
</configuration> | ||
</plugin> | ||
|
||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-assembly-plugin</artifactId> | ||
<version>2.6</version> | ||
<configuration> | ||
<descriptorRefs> | ||
<descriptorRef>jar-with-dependencies</descriptorRef> | ||
</descriptorRefs> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
58 changes: 0 additions & 58 deletions
58
src/main/java/ca/corefacility/bioinformatics/irida/ExamplePlugin.java
This file was deleted.
Oops, something went wrong.
129 changes: 129 additions & 0 deletions
129
src/main/java/ca/corefacility/bioinformatics/irida/plugins/ExamplePlugin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
package ca.corefacility.bioinformatics.irida.plugins; | ||
|
||
import java.awt.Color; | ||
import java.util.Optional; | ||
import java.util.UUID; | ||
|
||
import org.pf4j.Extension; | ||
import org.pf4j.Plugin; | ||
import org.pf4j.PluginWrapper; | ||
|
||
import ca.corefacility.bioinformatics.irida.model.workflow.analysis.type.AnalysisType; | ||
import ca.corefacility.bioinformatics.irida.pipeline.results.updater.AnalysisSampleUpdater; | ||
import ca.corefacility.bioinformatics.irida.service.sample.MetadataTemplateService; | ||
import ca.corefacility.bioinformatics.irida.service.sample.SampleService; | ||
import ca.corefacility.bioinformatics.irida.service.workflow.IridaWorkflowsService; | ||
|
||
/** | ||
* An example {@link IridaPlugin} implementation which will extract some | ||
* information from the sequencing reads. | ||
*/ | ||
public class ExamplePlugin extends Plugin { | ||
|
||
/** | ||
* The {@link AnalysisType} used by this plugin. This wraps around a string and | ||
* is used to store the type of the analysis pipeline (which should be unique | ||
* for each pipeline). | ||
*/ | ||
public static final AnalysisType READ_INFO = new AnalysisType("READ_INFO"); | ||
|
||
public ExamplePlugin(PluginWrapper wrapper) { | ||
super(wrapper); | ||
} | ||
|
||
/** | ||
* This class defines information about this particular plugin. On start-up, | ||
* IRIDA will make use of the information provided by this class to integrate | ||
* the plugin pipeline. | ||
*/ | ||
@Extension | ||
public static class PluginInfo implements IridaPlugin { | ||
|
||
/******************************************************************************* | ||
* Required methods | ||
* | ||
* These methods are required to be overridden when implementing a pipeline as a | ||
* plugin. | ||
*******************************************************************************/ | ||
|
||
/** | ||
* Gets the particular {@link AnalysisType} object for this workflow. This | ||
* should correspond to the <strong>analysisType</strong> entry in the | ||
* <strong>irida_workflow.xml</strong> file. | ||
* | ||
* <pre> | ||
* {@code <analysisType>READ_INFO</analysisType>} | ||
* </pre> | ||
* | ||
* @return The particular {@link AnalysisType} for this pipeline. | ||
*/ | ||
@Override | ||
public AnalysisType getAnalysisType() { | ||
return READ_INFO; | ||
} | ||
|
||
/** | ||
* Gets the particular workflow id. This should correspond to the | ||
* <strong>id</strong> entry in the <strong>irida_workflow.xml</strong> file. | ||
* | ||
* <pre> | ||
* {@code <id>79d90ca8-00ae-441b-b5c7-193c9e85a968</id>} | ||
* </pre> | ||
* | ||
* @return A {@link UUID} defining the id of this pipeline. | ||
*/ | ||
@Override | ||
public UUID getDefaultWorkflowUUID() { | ||
return UUID.fromString("79d90ca8-00ae-441b-b5c7-193c9e85a968"); | ||
} | ||
|
||
/******************************************************************************* | ||
* Optional methods | ||
* | ||
* These methods are not required to be overridden but can be used to adjust the | ||
* appearance/behavior of the pipeline. | ||
*******************************************************************************/ | ||
|
||
/** | ||
* Defines the background color in the IRIDA UI corresponding to this pipeline. | ||
* | ||
* @return An {@link Optional} color for the background of the IRIDA UI for this | ||
* pipeline. | ||
*/ | ||
@Override | ||
public Optional<Color> getBackgroundColor() { | ||
return Optional.of(Color.decode("#dd1c77")); | ||
} | ||
|
||
/** | ||
* Defines the text color in the IRIDA UI corresponding to this pipeline. | ||
* | ||
* @return An {@link Optional} color for the text of the IRIDA UI for this | ||
* pipeline. | ||
*/ | ||
@Override | ||
public Optional<Color> getTextColor() { | ||
return Optional.of(Color.BLACK); | ||
} | ||
|
||
/** | ||
* Builds a {@link Optional} {@link AnalysisSampleUpdater} used to update | ||
* metadata from the pipeline results. | ||
* | ||
* @param metadataTemplateService An IRIDA service to manipulate and save | ||
* metadata templates. | ||
* @param sampleService An IRIDA service to manipulate and save | ||
* information associated with a {@link Sample}. | ||
* @param iridaWorkflowsService An IRIDA service for getting information about | ||
* the workflow. | ||
* | ||
* @return An {@link Optional} {@link AnalysisSampleUpdater} used to update | ||
* metadata from the pipeline results. | ||
*/ | ||
@Override | ||
public Optional<AnalysisSampleUpdater> getUpdater(MetadataTemplateService metadataTemplateService, | ||
SampleService sampleService, IridaWorkflowsService iridaWorkflowsService) throws IridaPluginException { | ||
return Optional.of(new ExamplePluginUpdater(metadataTemplateService, sampleService, iridaWorkflowsService)); | ||
} | ||
} | ||
} |
Oops, something went wrong.