com.atlassian.theplugin.commons.bamboo.api
Class BambooSessionImpl
java.lang.Object
com.atlassian.theplugin.commons.remoteapi.rest.AbstractHttpSession
com.atlassian.theplugin.commons.bamboo.api.BambooSessionImpl
- All Implemented Interfaces:
- BambooSession, ProductSession
public class BambooSessionImpl
- extends AbstractHttpSession
- implements BambooSession
Communication stub for Bamboo REST API.
Methods inherited from class com.atlassian.theplugin.commons.remoteapi.rest.AbstractHttpSession |
doConditionalGet, getPassword, getServerNameFromUrl, getUrl, getUsername, retrieveDeleteResponse, retrieveGetResponse, retrieveGetResponseAsBytes, retrievePostResponse, retrievePostResponse, retrievePostResponse, setUrl, setUrl |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BambooSessionImpl
public BambooSessionImpl(java.lang.String url)
throws RemoteApiMalformedUrlException
- For testing purposes, shouldn't be publicb
- Parameters:
url
- bamboo server url
- Throws:
RemoteApiMalformedUrlException
- malformed url
BambooSessionImpl
public BambooSessionImpl(BambooServerCfg serverCfg,
HttpSessionCallback callback)
throws RemoteApiMalformedUrlException
- Public constructor for BambooSessionImpl.
- Parameters:
serverCfg
- The server configuration for this sessioncallback
- The callback needed for preparing HttpClient calls
- Throws:
RemoteApiMalformedUrlException
- malformed url
login
public void login(java.lang.String name,
char[] aPassword)
throws RemoteApiLoginException
- Connects to Bamboo server instance. On successful login authentication token is returned from
server and stored in Bamboo session for subsequent calls.
The exception returned may have the getCause() examined for to get the actual exception reason.
If the exception is caused by a valid error response from the server (no IOEXception, UnknownHostException,
MalformedURLException or JDOMException), the
RemoteApiLoginFailedException
is actually thrown. This may be used as a hint that the password is invalid.
- Specified by:
login
in interface ProductSession
- Parameters:
name
- username defined on Bamboo server instanceaPassword
- for username
- Throws:
RemoteApiLoginException
- on connection or authentication errors
logout
public void logout()
- Specified by:
logout
in interface ProductSession
getBamboBuildNumber
public int getBamboBuildNumber()
throws RemoteApiException
- Specified by:
getBamboBuildNumber
in interface BambooSession
- Throws:
RemoteApiException
listProjectNames
public java.util.List<BambooProject> listProjectNames()
throws RemoteApiException
- Specified by:
listProjectNames
in interface BambooSession
- Throws:
RemoteApiException
listPlanNames
public java.util.List<BambooPlan> listPlanNames()
throws RemoteApiException
- Specified by:
listPlanNames
in interface BambooSession
- Throws:
RemoteApiException
getLatestBuildForPlan
public BambooBuild getLatestBuildForPlan(java.lang.String planKey)
throws RemoteApiSessionExpiredException
- Returns a
BambooBuild
information about the latest build in a plan.
Returned structure contains either the information about the build or an error message if the connection fails.
- Specified by:
getLatestBuildForPlan
in interface BambooSession
- Parameters:
planKey
- ID of the plan to get info about
- Returns:
- Information about the last build or error message
- Throws:
RemoteApiSessionExpiredException
getFavouriteUserPlans
public java.util.List<java.lang.String> getFavouriteUserPlans()
throws RemoteApiSessionExpiredException
- Specified by:
getFavouriteUserPlans
in interface BambooSession
- Throws:
RemoteApiSessionExpiredException
getBuildResultDetails
public BuildDetails getBuildResultDetails(java.lang.String buildKey,
java.lang.String buildNumber)
throws RemoteApiException
- Specified by:
getBuildResultDetails
in interface BambooSession
- Throws:
RemoteApiException
addLabelToBuild
public void addLabelToBuild(java.lang.String buildKey,
java.lang.String buildNumber,
java.lang.String buildLabel)
throws RemoteApiException
- Specified by:
addLabelToBuild
in interface BambooSession
- Throws:
RemoteApiException
addCommentToBuild
public void addCommentToBuild(java.lang.String buildKey,
java.lang.String buildNumber,
java.lang.String buildComment)
throws RemoteApiException
- Specified by:
addCommentToBuild
in interface BambooSession
- Throws:
RemoteApiException
executeBuild
public void executeBuild(java.lang.String buildKey)
throws RemoteApiException
- Specified by:
executeBuild
in interface BambooSession
- Throws:
RemoteApiException
isLoggedIn
public boolean isLoggedIn()
- Specified by:
isLoggedIn
in interface ProductSession
getBuildLogs
public byte[] getBuildLogs(java.lang.String buildKey,
java.lang.String buildNumber)
throws RemoteApiException
- Specified by:
getBuildLogs
in interface BambooSession
- Throws:
RemoteApiException
adjustHttpHeader
protected void adjustHttpHeader(org.apache.commons.httpclient.HttpMethod method)
- Specified by:
adjustHttpHeader
in class AbstractHttpSession
preprocessResult
protected void preprocessResult(org.jdom.Document doc)
throws org.jdom.JDOMException,
RemoteApiSessionExpiredException
- Specified by:
preprocessResult
in class AbstractHttpSession
- Throws:
org.jdom.JDOMException
RemoteApiSessionExpiredException
Copyright © 2008-2009 Atlassian Pty Ltd. All Rights Reserved.