Class AbstractIssueTracker
- java.lang.Object
-
- org.jboss.set.aphrodite.issue.trackers.common.AbstractIssueTracker
-
- All Implemented Interfaces:
IssueTrackerService
public abstract class AbstractIssueTracker extends Object implements IssueTrackerService
An abstract IssueTracker which provides logic common to all issue trackers.- Author:
- Ryan Emerson
-
-
Field Summary
Fields Modifier and Type Field Description protected URLbaseUrlprotected IssueTrackerConfigconfigprotected ExecutorServiceexecutorServiceprotected TrackerTypeTRACKER_TYPEstatic PatternURL_REGEX
-
Constructor Summary
Constructors Constructor Description AbstractIssueTracker(TrackerType TRACKER_TYPE)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddCommentToIssue(org.jboss.set.aphrodite.domain.Issue issue, org.jboss.set.aphrodite.domain.Comment comment)Adds a new comment to the specified issue.protected voidcheckHost(URL url)static StringconvertToTrackerID(URL url)protected Collection<org.jboss.set.aphrodite.domain.Issue>filterIssuesByHost(Collection<org.jboss.set.aphrodite.domain.Issue> issues)protected Map<org.jboss.set.aphrodite.domain.Issue,org.jboss.set.aphrodite.domain.Comment>filterIssuesByHost(Map<org.jboss.set.aphrodite.domain.Issue,org.jboss.set.aphrodite.domain.Comment> commentMap)protected Collection<URL>filterUrlsByHost(Collection<URL> urls)List<org.jboss.set.aphrodite.domain.Issue>getIssuesAssociatedWith(org.jboss.set.aphrodite.domain.PullRequest pullRequest)Retrieve all Issues associated with the provided pullRequest object.protected abstract org.apache.commons.logging.LoggetLog()StringgetTrackerID()Return string format of tracker id, this value, can be used as key/index and compared toAbstractIssueTracker#convertToTrackerID().booleaninit(AphroditeConfig aphroditeConfig)Initiate thisIssueTrackerServiceusing the suppliedAphroditeConfig.booleaninit(IssueTrackerConfig config)Initiate thisIssueTrackerServiceusing the suppliedIssueTrackerConfig.booleanurlExists(URL url)Checks whether the providedURLis on the same host as this service.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jboss.set.aphrodite.spi.IssueTrackerService
addCommentToIssue, addCommentToIssue, createIssue, destroy, getIssue, getIssues, isCPReleased, searchIssues, searchIssuesByFilter, updateIssue
-
-
-
-
Field Detail
-
URL_REGEX
public static final Pattern URL_REGEX
-
TRACKER_TYPE
protected final TrackerType TRACKER_TYPE
-
executorService
protected ExecutorService executorService
-
config
protected IssueTrackerConfig config
-
baseUrl
protected URL baseUrl
-
-
Constructor Detail
-
AbstractIssueTracker
public AbstractIssueTracker(TrackerType TRACKER_TYPE)
-
-
Method Detail
-
getLog
protected abstract org.apache.commons.logging.Log getLog()
-
init
public boolean init(AphroditeConfig aphroditeConfig)
Description copied from interface:IssueTrackerServiceInitiate thisIssueTrackerServiceusing the suppliedAphroditeConfig. The firstIssueTrackerConfigobject found in theAphroditeConfigobject, is used to initiate the service and is subsequently removed from the config to prevent the same service being initiated twice.- Specified by:
initin interfaceIssueTrackerService- Parameters:
aphroditeConfig- aAphroditeConfigobject containing at least oneIssueTrackerConfigobject.- Returns:
trueif the service was initialised without errors,falseotherwise.
-
init
public boolean init(IssueTrackerConfig config)
Description copied from interface:IssueTrackerServiceInitiate thisIssueTrackerServiceusing the suppliedIssueTrackerConfig.- Specified by:
initin interfaceIssueTrackerService- Parameters:
config- aIssueTrackerConfigobject containing all configuration information.- Returns:
trueif the service was initialised without errors,falseotherwise.
-
getIssuesAssociatedWith
public List<org.jboss.set.aphrodite.domain.Issue> getIssuesAssociatedWith(org.jboss.set.aphrodite.domain.PullRequest pullRequest)
Description copied from interface:IssueTrackerServiceRetrieve all Issues associated with the provided pullRequest object. Implementations of this method assume that the urls of the related issues are present in the pullRequest's description field.- Specified by:
getIssuesAssociatedWithin interfaceIssueTrackerService- Parameters:
pullRequest- thePullRequestobject whoms associated Issues should be returned.- Returns:
- a list of all
Issueobjects, or an empty list if no issues can be found.
-
addCommentToIssue
public void addCommentToIssue(org.jboss.set.aphrodite.domain.Issue issue, org.jboss.set.aphrodite.domain.Comment comment) throws NotFoundExceptionDescription copied from interface:IssueTrackerServiceAdds a new comment to the specified issue.- Specified by:
addCommentToIssuein interfaceIssueTrackerService- Parameters:
issue- the issue to add a new comment to.comment- the comment to be added to the issue.- Throws:
NotFoundException- if the providedIssuecannot be found at the IssueTracker.
-
checkHost
protected void checkHost(URL url) throws NotFoundException
- Throws:
NotFoundException
-
urlExists
public boolean urlExists(URL url)
Description copied from interface:IssueTrackerServiceChecks whether the providedURLis on the same host as this service.- Specified by:
urlExistsin interfaceIssueTrackerService- Parameters:
url- theURLto check.- Returns:
- true if the provided
URLhas the same host as this service, otherwise false.
-
getTrackerID
public String getTrackerID()
Description copied from interface:IssueTrackerServiceReturn string format of tracker id, this value, can be used as key/index and compared toAbstractIssueTracker#convertToTrackerID().- Specified by:
getTrackerIDin interfaceIssueTrackerService- Returns:
-
filterIssuesByHost
protected Map<org.jboss.set.aphrodite.domain.Issue,org.jboss.set.aphrodite.domain.Comment> filterIssuesByHost(Map<org.jboss.set.aphrodite.domain.Issue,org.jboss.set.aphrodite.domain.Comment> commentMap)
-
filterIssuesByHost
protected Collection<org.jboss.set.aphrodite.domain.Issue> filterIssuesByHost(Collection<org.jboss.set.aphrodite.domain.Issue> issues)
-
filterUrlsByHost
protected Collection<URL> filterUrlsByHost(Collection<URL> urls)
-
-