Skip to content
This repository has been archived by the owner on Jul 3, 2018. It is now read-only.

Commit

Permalink
#2 add dummy publish mech
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-conway committed May 27, 2016
1 parent c7de816 commit 471a056
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/**
*
*/
package og.iplantc.de.publish.dummy;

import org.iplantc.de.publish.mechanism.api.PublishActionDescriptor;
import org.iplantc.de.publish.mechanism.api.PublishContext;
import org.iplantc.de.publish.mechanism.api.PublishMechanism;
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.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Simple noop publish mechanism for testing and demonstration
*
* @author Mike Conway - DICE
*
*/
public class DummyPublishMechanism implements PublishMechanism {

public static final Logger log = LoggerFactory
.getLogger(DummyPublishMechanism.class);

/**
*
*/
public DummyPublishMechanism() {
}

/*
* (non-Javadoc)
*
* @see
* org.iplantc.de.publish.mechanism.api.PublishMechanism#preValidate(org
* .iplantc.de.publish.mechanism.api.PublishActionDescriptor,
* org.iplantc.de.publish.mechanism.api.PublishContext)
*/
@Override
public PublishResult preValidate(
PublishActionDescriptor publishActionDescriptor,
PublishContext publishContext) {

log.info("preValidate()");
log.info("publishActionDescriptor:{}", publishActionDescriptor);
log.info("publishContext:{}", publishContext);
PublishResult publishResult = new PublishResult();
publishResult.setPublishStatus(PublishStatusEnum.SUBMITTED);
publishResult.setResponseCode(PublishResult.PUBLISH_RESULT_NORMAL);
publishResult.setResponseMessage("preValidate successful");
publishResult.setPublishPhase(PublishPhaseEnum.PRE_VALIDATE);
return publishResult;

}

/*
* (non-Javadoc)
*
* @see
* org.iplantc.de.publish.mechanism.api.PublishMechanism#publish(org.iplantc
* .de.publish.mechanism.api.PublishActionDescriptor,
* org.iplantc.de.publish.mechanism.api.PublishContext)
*/
@Override
public PublishResult publish(
PublishActionDescriptor publishActionDescriptor,
PublishContext publishContext) {

log.info("publish()");
log.info("publishActionDescriptor:{}", publishActionDescriptor);
log.info("publishContext:{}", publishContext);
PublishResult publishResult = new PublishResult();
publishResult.setPublishStatus(PublishStatusEnum.SUBMITTED);
publishResult.setResponseCode(PublishResult.PUBLISH_RESULT_NORMAL);
publishResult.setResponseMessage("publish successful");
publishResult.setPublishPhase(PublishPhaseEnum.PUBLISH);
return publishResult;

}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/**
*
*/
/**
* Base dummy publisher for testing and demonstration
* @author Mike Conway - DICE
*
*/
package og.iplantc.de.publish.dummy;
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
*/
public class PublishResult {

public static final int PUBLISH_RESULT_NORMAL = 0;

/**
* Represents the phase of the publishing cycle that this response pertains
* to
Expand Down

0 comments on commit 471a056

Please sign in to comment.