hudson.plugins.collabnet.tracker
Class CNTracker

java.lang.Object
  extended by hudson.tasks.BuildStepCompatibilityLayer
      extended by hudson.tasks.Publisher
          extended by hudson.tasks.Notifier
              extended by hudson.plugins.collabnet.tracker.CNTracker
All Implemented Interfaces:
hudson.ExtensionPoint, hudson.model.Describable<hudson.tasks.Publisher>, hudson.tasks.BuildStep

public class CNTracker
extends hudson.tasks.Notifier


Nested Class Summary
static class CNTracker.DescriptorImpl
           
 
Nested classes/interfaces inherited from class hudson.tasks.Publisher
hudson.tasks.Publisher.DescriptorExtensionListImpl
 
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
hudson.ExtensionPoint.LegacyInstancesAreScopedToHudson
 
Nested classes/interfaces inherited from interface hudson.tasks.BuildStep
hudson.tasks.BuildStep.PublisherList
 
Field Summary
 
Fields inherited from interface hudson.tasks.BuildStep
BUILDERS, PUBLISHERS
 
Constructor Summary
CNTracker(java.lang.String username, java.lang.String password, java.lang.String collabNetUrl, java.lang.String project, java.lang.String tracker, java.lang.String title, java.lang.String assign_user, java.lang.String priority, boolean attach_log, boolean always_update, boolean close_issue, java.lang.String release, boolean override_auth)
          Constructs a new CNTracker instance.
 
Method Summary
 boolean alwaysUpdate()
           
 boolean attachLog()
           
 boolean closeOnSuccess()
           
 void closeSucceedingBuild(com.collabnet.ce.soap50.webservices.tracker.ArtifactSoapDO issue, hudson.model.AbstractBuild<?,?> build)
          Update the issue with a build that's successful, and close it.
 com.collabnet.ce.soap50.webservices.tracker.ArtifactSoapDO createNewTrackerArtifact(java.lang.String projectId, java.lang.String trackerId, java.lang.String status, java.lang.String description, hudson.model.AbstractBuild<?,?> build)
          Create a new tracker artifact with the given values.
 com.collabnet.ce.soap50.webservices.tracker.ArtifactSoapDO findTrackerArtifact(java.lang.String trackerId, hudson.model.AbstractBuild<?,?> build)
          Return a tracker artifact with the matching title.
 java.lang.String getAssignUser()
           
 java.lang.String getCollabNetUrl()
           
 java.lang.String getPassword()
           
 int getPriority()
           
 java.lang.String getProject()
           
 java.lang.String getProjectId(java.lang.String projectName)
          Given a project title, find the matching projectId.
 java.lang.String[] getProjects()
           
 java.lang.String getRelease()
           
 java.lang.String[] getReleases()
           
 hudson.tasks.BuildStepMonitor getRequiredMonitorService()
           
static TeamForgeShare.TeamForgeShareDescriptor getTeamForgeShareDescriptor()
           
 java.lang.String getTitle()
           
 java.lang.String getTracker()
           
 java.lang.String getTrackerId(java.lang.String projectId, java.lang.String trackerName)
          Given a tracker title and a projectId, find the matching tracker id.
 java.lang.String[] getTrackers()
           
 java.lang.String getUsername()
           
 java.lang.String[] getUsers()
           
 void logoff()
          Log out of the collabnet server.
 boolean overrideAuth()
           
 boolean perform(hudson.model.AbstractBuild<?,?> build, hudson.Launcher launcher, hudson.model.BuildListener listener)
          Create/Update/Close the tracker issue, according to the Hudson build status.
 void updateFailingBuild(com.collabnet.ce.soap50.webservices.tracker.ArtifactSoapDO issue, hudson.model.AbstractBuild<?,?> build)
          Update the issue with failing build status.
 void updateSucceedingBuild(com.collabnet.ce.soap50.webservices.tracker.ArtifactSoapDO issue, hudson.model.AbstractBuild<?,?> build)
          Update the issue with a build that's successful, but do not change its status.
 
Methods inherited from class hudson.tasks.Notifier
getDescriptor
 
Methods inherited from class hudson.tasks.Publisher
all, getProjectAction, needsToRunAfterFinalized, prebuild
 
Methods inherited from class hudson.tasks.BuildStepCompatibilityLayer
getProjectAction, perform, prebuild
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface hudson.tasks.BuildStep
getProjectAction, prebuild
 

Constructor Detail

CNTracker

public CNTracker(java.lang.String username,
                 java.lang.String password,
                 java.lang.String collabNetUrl,
                 java.lang.String project,
                 java.lang.String tracker,
                 java.lang.String title,
                 java.lang.String assign_user,
                 java.lang.String priority,
                 boolean attach_log,
                 boolean always_update,
                 boolean close_issue,
                 java.lang.String release,
                 boolean override_auth)
Constructs a new CNTracker instance.

Parameters:
username - to login as.
password - to login with.
collabNetUrl - URL of the CollabNet server.
project - project name.
tracker - tracker name.
title - title to use when create new tracker artifacts OR to find existing tracker artifacts.
assign_user - user to assign new tracker artifacts to.
priority - of new tracker artifacts.
attach_log - if true, Hudson build logs will be uploaded and attached when creating/updating tracker artifacts.
always_update - if true, always update the tracker artifacts (or create one), even if build is successful and the tracker artifact is closed. If false, only update when the tracker artifact is failing or is open.
close_issue - if true, the tracker artifact will be closed if the Hudson build is successful. Otherwise, open issues will be updated with a successful message, but remain open.
release - to report the tracker artifact in.
Method Detail

overrideAuth

public boolean overrideAuth()
Returns:
whether or not auth is overriden

getUsername

public java.lang.String getUsername()
Returns:
username to login as.

getPassword

public java.lang.String getPassword()
Returns:
password to login with.

getCollabNetUrl

public java.lang.String getCollabNetUrl()
Returns:
URL of the CollabNet server.

getProject

public java.lang.String getProject()
Returns:
project name.

getTracker

public java.lang.String getTracker()
Returns:
tracker name.

getTitle

public java.lang.String getTitle()
Returns:
title for the Tracker Artifact.

getAssignUser

public java.lang.String getAssignUser()
Returns:
the user to assign new Tracker Artifacts to.

getPriority

public int getPriority()
Returns:
the priority to set new Tracker Artifacts to.

attachLog

public boolean attachLog()
Returns:
true, if logs should be attached to Tracker Artifacts.

alwaysUpdate

public boolean alwaysUpdate()
Returns:
true, if artifact creation/update should happen, even if the Hudson build is successful and the artifact is not open.

closeOnSuccess

public boolean closeOnSuccess()
Returns:
true, if artifacts should be closed when the Hudson build succeeds.

getRelease

public java.lang.String getRelease()
Returns:
the name of the release which new Tracker Artifacts will be reported in.

getTeamForgeShareDescriptor

public static TeamForgeShare.TeamForgeShareDescriptor getTeamForgeShareDescriptor()
Returns:
the TeamForge share descriptor.

getProjects

public java.lang.String[] getProjects()
Returns:
the list of all possible projects, given the login data.

getTrackers

public java.lang.String[] getTrackers()
Returns:
the list of all possible trackers, given the login data.

getUsers

public java.lang.String[] getUsers()
Returns:
the list of all project members, given the login data.

getReleases

public java.lang.String[] getReleases()
Returns:
the list of all possible releases, given the login data.

getRequiredMonitorService

public hudson.tasks.BuildStepMonitor getRequiredMonitorService()

perform

public boolean perform(hudson.model.AbstractBuild<?,?> build,
                       hudson.Launcher launcher,
                       hudson.model.BuildListener listener)
                throws java.lang.InterruptedException,
                       java.io.IOException
Create/Update/Close the tracker issue, according to the Hudson build status.

Specified by:
perform in interface hudson.tasks.BuildStep
Overrides:
perform in class hudson.tasks.BuildStepCompatibilityLayer
Parameters:
build - the current Hudson build.
launcher - unused.
listener - receives events that occur during a build; used for logging.
Returns:
false if a critical error occurred, true otherwise.
Throws:
java.lang.InterruptedException
java.io.IOException

logoff

public void logoff()
Log out of the collabnet server.


getProjectId

public java.lang.String getProjectId(java.lang.String projectName)
Given a project title, find the matching projectId. If none is found, return null.

Parameters:
projectName -
Returns:
project id corresponding to the name, or null if none is found.

getTrackerId

public java.lang.String getTrackerId(java.lang.String projectId,
                                     java.lang.String trackerName)
Given a tracker title and a projectId, find the matching tracker id.

Parameters:
projectId -
trackerName -
Returns:
the tracker id for the tracker that matches this name, or null if no matching tracker is found.

findTrackerArtifact

public com.collabnet.ce.soap50.webservices.tracker.ArtifactSoapDO findTrackerArtifact(java.lang.String trackerId,
                                                                                      hudson.model.AbstractBuild<?,?> build)
                                                                               throws java.io.IOException,
                                                                                      java.lang.InterruptedException
Return a tracker artifact with the matching title.

Parameters:
trackerId -
build - the current Hudson build.
Returns:
the artifact soap data object, if one exists which matches the title. Otherwise, null.
Throws:
java.io.IOException
java.lang.InterruptedException

createNewTrackerArtifact

public com.collabnet.ce.soap50.webservices.tracker.ArtifactSoapDO createNewTrackerArtifact(java.lang.String projectId,
                                                                                           java.lang.String trackerId,
                                                                                           java.lang.String status,
                                                                                           java.lang.String description,
                                                                                           hudson.model.AbstractBuild<?,?> build)
                                                                                    throws java.io.IOException,
                                                                                           java.lang.InterruptedException
Create a new tracker artifact with the given values.

Parameters:
projectId - id for project
trackerId - id for tracker
status - status to set on the new artifact (Open, Closed, etc.).
description - description of the new artifact.
Returns:
the newly created ArtifactSoapDO.
Throws:
java.io.IOException
java.lang.InterruptedException

updateFailingBuild

public void updateFailingBuild(com.collabnet.ce.soap50.webservices.tracker.ArtifactSoapDO issue,
                               hudson.model.AbstractBuild<?,?> build)
                        throws java.io.IOException,
                               java.lang.InterruptedException
Update the issue with failing build status.

Parameters:
issue - the existing issue.
build - the current Hudson build.
Throws:
java.io.IOException
java.lang.InterruptedException

updateSucceedingBuild

public void updateSucceedingBuild(com.collabnet.ce.soap50.webservices.tracker.ArtifactSoapDO issue,
                                  hudson.model.AbstractBuild<?,?> build)
                           throws java.io.IOException,
                                  java.lang.InterruptedException
Update the issue with a build that's successful, but do not change its status.

Parameters:
issue - the existing issue.
build - the current Hudson build.
Throws:
java.io.IOException
java.lang.InterruptedException

closeSucceedingBuild

public void closeSucceedingBuild(com.collabnet.ce.soap50.webservices.tracker.ArtifactSoapDO issue,
                                 hudson.model.AbstractBuild<?,?> build)
                          throws java.io.IOException,
                                 java.lang.InterruptedException
Update the issue with a build that's successful, and close it.

Parameters:
issue - the existing issue.
build - the current Hudson build.
Throws:
java.io.IOException
java.lang.InterruptedException


Copyright © 2010. All Rights Reserved.