From 10e3bbac08ee443c44c8a7956bb13c5c9e1b44f3 Mon Sep 17 00:00:00 2001 From: michael-conway Date: Tue, 31 May 2016 14:00:35 -0400 Subject: [PATCH] #2 add publish mech annotation --- .../publish/dummy/DummyPublishMechanism.java | 2 + .../mechanism/api/PublishMechanism.java | 5 ++ .../api/annotations/PublicationDriver.java | 50 +++++++++++++++++++ .../api/annotations/package-info.java | 6 +++ 4 files changed, 63 insertions(+) create mode 100644 publisher-api/src/main/java/org/iplantc/de/publish/mechanism/api/annotations/PublicationDriver.java create mode 100644 publisher-api/src/main/java/org/iplantc/de/publish/mechanism/api/annotations/package-info.java diff --git a/dummy-publish/src/main/java/og/iplantc/de/publish/dummy/DummyPublishMechanism.java b/dummy-publish/src/main/java/og/iplantc/de/publish/dummy/DummyPublishMechanism.java index 0ef63a5..491a6ee 100644 --- a/dummy-publish/src/main/java/og/iplantc/de/publish/dummy/DummyPublishMechanism.java +++ b/dummy-publish/src/main/java/og/iplantc/de/publish/dummy/DummyPublishMechanism.java @@ -9,6 +9,7 @@ import org.iplantc.de.publish.mechanism.api.PublishPhaseEnum; import org.iplantc.de.publish.mechanism.api.PublishResult; import org.iplantc.de.publish.mechanism.api.PublishStatusEnum; +import org.iplantc.de.publish.mechanism.api.annotations.PublicationDriver; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -18,6 +19,7 @@ * @author Mike Conway - DICE * */ +@PublicationDriver(author = "DFC", description = "Noop publisher that just logs", name = "Dummy Logging", version = "1.0.0", isAsynch = false) public class DummyPublishMechanism implements PublishMechanism { public static final Logger log = LoggerFactory diff --git a/publisher-api/src/main/java/org/iplantc/de/publish/mechanism/api/PublishMechanism.java b/publisher-api/src/main/java/org/iplantc/de/publish/mechanism/api/PublishMechanism.java index 2b7a3a7..b0b456f 100644 --- a/publisher-api/src/main/java/org/iplantc/de/publish/mechanism/api/PublishMechanism.java +++ b/publisher-api/src/main/java/org/iplantc/de/publish/mechanism/api/PublishMechanism.java @@ -3,6 +3,8 @@ */ package org.iplantc.de.publish.mechanism.api; +import org.iplantc.de.publish.mechanism.api.annotations.PublicationDriver; + /** * Describes a publish mechanism, this is a plugin that can format and publish * collection data sorted as an AIP in the DE/iRODS environment as a DIP in an @@ -10,6 +12,9 @@ * underneath this interface, and can surface a preValidate foreground method * that can do sanity checks and pre-processing, and a sych|asynch publish * action that actually creates the DIP in the target repository. + *

+ * Note that subclasses should be annotated with the {@link PublicationDriver} + * annotation to describe the driver to the publishing subsystem. * * @author Mike Conway - DICE, Dennis Roberts, CyVerse * diff --git a/publisher-api/src/main/java/org/iplantc/de/publish/mechanism/api/annotations/PublicationDriver.java b/publisher-api/src/main/java/org/iplantc/de/publish/mechanism/api/annotations/PublicationDriver.java new file mode 100644 index 0000000..df4fba2 --- /dev/null +++ b/publisher-api/src/main/java/org/iplantc/de/publish/mechanism/api/annotations/PublicationDriver.java @@ -0,0 +1,50 @@ +/** + * + */ +package org.iplantc.de.publish.mechanism.api.annotations; + +import java.lang.annotation.Documented; + +/** + * Annotation that marks up a publish mechanism for discovery + * + * @author Mike Conway - DICE + * + */ +@Documented +public @interface PublicationDriver { + /** + * Author of the publisher plugin + * + * @return String with author + */ + String author(); + + /** + * Context-dependent version string + * + * @return String with version string + */ + String version(); + + /** + * Display name of the publisher driver + * + * @return String with the name of the driver + */ + String name(); + + /** + * Description of the driver (for mouseovers or other user doc) + * + * @return String with the description of the driver + */ + String description(); + + /** + * Indicates if the publish action is asynchronous (through the app) + * + * @return + */ + boolean isAsynch() default false; +} diff --git a/publisher-api/src/main/java/org/iplantc/de/publish/mechanism/api/annotations/package-info.java b/publisher-api/src/main/java/org/iplantc/de/publish/mechanism/api/annotations/package-info.java new file mode 100644 index 0000000..8734554 --- /dev/null +++ b/publisher-api/src/main/java/org/iplantc/de/publish/mechanism/api/annotations/package-info.java @@ -0,0 +1,6 @@ +/** + * Annotations for publisher + * @author Mike Conway - DICE + * + */ +package org.iplantc.de.publish.mechanism.api.annotations; \ No newline at end of file