Package b4j.core.session
Class BugzillaRpcSession
java.lang.Object
b4j.core.session.AbstractHttpSession
b4j.core.session.BugzillaRpcSession
- All Implemented Interfaces:
Session
,IConfigurable
public class BugzillaRpcSession extends AbstractHttpSession
Accesses Bugzilla via REST.
Please read carefully documentation at Bugzilla::WebService:Bug interface in order to understand what parameters are valid for searching (e.g. "classification" is not allowed as of 4.4).
- Since:
- 2.0
- Author:
- ralph
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
BUGZILLA_MINIMUM_VERSION
-
Constructor Summary
Constructors Constructor Description BugzillaRpcSession()
Constructor. -
Method Summary
Modifier and Type Method Description void
close()
Closes the previously established Bugzilla session.void
configure(org.apache.commons.configuration.Configuration config)
Configuration allows:
<bugzilla-home>URL</bugzilla-home> - the Bugzilla base URL
<proxy-host> - HTTP proxy (optional)
<ProxyAuthorization> - HTTP proxy authentication (optional)protected BugzillaClient
createClient()
Creates theBugzillaClient
.java.io.InputStream
getAttachment(Attachment attachment)
Returns an input stream that will contain the attachment's content.java.net.URL
getBaseUrl()
Returns the baseUrl.java.lang.String
getBugzillaVersion()
Returns the bugzilla version this session object is connected to.protected BugzillaClient
getClient()
Returns the client.Issue
getIssue(java.lang.String id)
Returns the given issuejava.lang.String
getMaximumBugzillaVersion()
Returns the maximum Bugzilla version this session class supports.java.lang.String
getMinimumBugzillaVersion()
Returns the minimum Bugzilla version this session class supports.protected ServerInfo
getServerInfo()
Returns the serverInfo.boolean
isLoggedIn()
Returns true when session is connected to Bugzilla.boolean
open()
Opens the session with configured Bugzilla instance.java.lang.Iterable<Issue>
searchBugs(SearchData searchData, SearchResultCountCallback callback)
Performs a search for Bugzilla bugs.void
setBaseUrl(java.net.URL baseUrl)
Sets the baseUrl.Methods inherited from class b4j.core.session.AbstractHttpSession
checkBugzillaVersion, checkLoggedIn, createIssue, dump, getBugzillaBugClass, getHttpSessionParams, getLog, setBugzillaBugClass, setHttpSessionParams
-
Field Details
-
BUGZILLA_MINIMUM_VERSION
public static final java.lang.String BUGZILLA_MINIMUM_VERSION- See Also:
- Constant Field Values
-
-
Constructor Details
-
BugzillaRpcSession
public BugzillaRpcSession()Constructor.
-
-
Method Details
-
configure
public void configure(org.apache.commons.configuration.Configuration config) throws org.apache.commons.configuration.ConfigurationExceptionConfiguration allows:
<bugzilla-home>URL</bugzilla-home> - the Bugzilla base URL
<proxy-host> - HTTP proxy (optional)
<ProxyAuthorization> - HTTP proxy authentication (optional)- Specified by:
configure
in interfaceIConfigurable
- Overrides:
configure
in classAbstractHttpSession
- Parameters:
config
- - configuration object- Throws:
org.apache.commons.configuration.ConfigurationException
- - when configuration fails
-
getBaseUrl
public java.net.URL getBaseUrl()Returns the baseUrl.- Returns:
- the baseUrl
-
setBaseUrl
public void setBaseUrl(java.net.URL baseUrl)Sets the baseUrl.- Parameters:
baseUrl
- the baseUrl to set
-
isLoggedIn
public boolean isLoggedIn()Returns true when session is connected to Bugzilla.- Returns:
- true if session was successfully established, false otherwise
-
open
public boolean open()Opens the session with configured Bugzilla instance.- Returns:
- true when session could be established successfully, false otherwise
-
createClient
Creates theBugzillaClient
.- Returns:
- the client created
-
close
public void close()Closes the previously established Bugzilla session. -
searchBugs
public java.lang.Iterable<Issue> searchBugs(SearchData searchData, SearchResultCountCallback callback)Performs a search for Bugzilla bugs. This method returns an iterable over all bug records found. Implementations should not perform a query for all actual record data here as callers might not want to retrieve this data. Instead the iterator's next() method of theIterable
should retrieve these details.- Parameters:
searchData
- - all search parameterscallback
- - a callback object that will retrieve the number of bugs found for this search- Returns:
- iterable on all bugs fulfilling the criteria expressed by search parameters.
-
getIssue
Returns the given issue- Parameters:
id
- id of issue- Returns:
- issue
-
getAttachment
Returns an input stream that will contain the attachment's content. A caller is responsible to close the stream again.- Parameters:
attachment
- attachment to retrieve.- Returns:
- the input stream for the attachment itself
- Throws:
java.io.IOException
- when the IO stream cannot be created
-
getMinimumBugzillaVersion
public java.lang.String getMinimumBugzillaVersion()Returns the minimum Bugzilla version this session class supports. Can return null if no lower limits must be enforced.- Returns:
- minimum version of supported Bugzilla software.
-
getMaximumBugzillaVersion
public java.lang.String getMaximumBugzillaVersion()Returns the maximum Bugzilla version this session class supports. Can return null if no upper limits must be enforced.- Returns:
- maximum version of supported Bugzilla software.
-
getBugzillaVersion
public java.lang.String getBugzillaVersion()Returns the bugzilla version this session object is connected to. Can return null if version is unknown.- Returns:
- version number or null if unknown or not connected
-
getClient
Returns the client.- Returns:
- the client
- Since:
- 2.0.3
-
getServerInfo
Returns the serverInfo.- Returns:
- the serverInfo
- Since:
- 2.0.3
-