Author: ltheussl Date: Tue Jan 10 09:52:11 2006 New Revision: 367705 URL: http://svn.apache.org/viewcvs?rev=367705&view=rev Log: Add a jira-roadmap report.
Modified: maven/maven-1/plugins/trunk/jira/plugin.jelly maven/maven-1/plugins/trunk/jira/plugin.properties maven/maven-1/plugins/trunk/jira/src/main/org/apache/maven/jira/JiraDownloader.java maven/maven-1/plugins/trunk/jira/src/plugin-resources/jira.jsl maven/maven-1/plugins/trunk/jira/xdocs/changes.xml maven/maven-1/plugins/trunk/jira/xdocs/properties.xml Modified: maven/maven-1/plugins/trunk/jira/plugin.jelly URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/jira/plugin.jelly?rev=367705&r1=367704&r2=367705&view=diff ============================================================================== --- maven/maven-1/plugins/trunk/jira/plugin.jelly (original) +++ maven/maven-1/plugins/trunk/jira/plugin.jelly Tue Jan 10 09:52:11 2006 @@ -32,10 +32,19 @@ pluginName="maven-jira-plugin" link="jira" description="Report all issues defined in Jira."/> + <j:if test="${maven.jira.roadmap}"> + <doc:registerReport + name="Jira Roadmap Report" + pluginName="" + link="jira-roadmap" + description="Report all issues that are scheduled for the next release." + /> + </j:if> </goal> <goal name="maven-jira-plugin:deregister"> <doc:deregisterReport name="Jira Report"/> + <doc:deregisterReport name="Jira Roadmap Report"/> </goal> <define:taglib uri="jira"> @@ -50,7 +59,7 @@ name="maven-jira-plugin:report" description="Generate report with all entries defined in Jira"> <mkdir dir="${maven.build.dir}/jira"/> - + <jira:jira project="${pom}" output="${maven.build.dir}/jira/jira-results.xml" @@ -64,11 +73,17 @@ jiraUser="${maven.jira.jiraUser}" jiraPassword="${maven.jira.jiraPassword}" component="${maven.jira.component}" + roadmap="${maven.jira.roadmap}" /> <mkdir dir="${maven.gen.docs}"/> <j:catch var="parseresult"> + + <j:set var="title" value="Jira Report"/> + <j:set var="description" value="Report all issues defined in Jira."/> + <j:remove var="roadmapUrl"/> + <doc:jslFile input="${maven.build.dir}/jira/jira-results.xml" output="${maven.gen.docs}/jira.xml" @@ -94,7 +109,44 @@ </copy> </j:otherwise> </j:choose> - + + <j:if test="${maven.jira.roadmap}"> + + <j:catch var="parseresult"> + + <j:set var="title" value="Jira Roadmap Report"/> + <j:set var="description" value="Report all issues that are scheduled for the next release."/> + <j:set var="roadmapUrl" value="${pom.issueTrackingUrl}?report=com.atlassian.jira.plugin.system.project:roadmap-panel"/> + + <doc:jslFile + input="${maven.build.dir}/jira/jira-roadmap.xml" + output="${maven.gen.docs}/jira-roadmap.xml" + stylesheet="${plugin.resources}/jira.jsl" + outputMode="xml" + prettyPrint="true" + /> + <j:remove var="roadmapUrl"/> + </j:catch> + + <!-- FIXME: Hack, taken from announcement/plugin.jelly --> + <ant:replace file="${maven.gen.docs}/jira-roadmap.xml" token="&amp;" value="&"/> + + <j:choose> + <j:when test="${!empty(parseresult)}"> + <ant:echo>Error: unable to parse jira results due to an error: ${parseresult.message}. Jira roadmap report will not be generated</ant:echo> + </j:when> + <j:otherwise> + <!-- go on --> + <copy todir="${maven.docs.dest}/images/jira" overwrite="no" filtering="no"> + <fileset dir="${plugin.resources}/images"> + <include name="**/*.gif"/> + </fileset> + </copy> + </j:otherwise> + </j:choose> + + </j:if> + </goal> </project> Modified: maven/maven-1/plugins/trunk/jira/plugin.properties URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/jira/plugin.properties?rev=367705&r1=367704&r2=367705&view=diff ============================================================================== --- maven/maven-1/plugins/trunk/jira/plugin.properties (original) +++ maven/maven-1/plugins/trunk/jira/plugin.properties Tue Jan 10 09:52:11 2006 @@ -27,3 +27,4 @@ maven.jira.resolution=Unresolved maven.jira.priority= maven.jira.component= +maven.jira.roadmap=true \ No newline at end of file Modified: maven/maven-1/plugins/trunk/jira/src/main/org/apache/maven/jira/JiraDownloader.java URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/jira/src/main/org/apache/maven/jira/JiraDownloader.java?rev=367705&r1=367704&r2=367705&view=diff ============================================================================== --- maven/maven-1/plugins/trunk/jira/src/main/org/apache/maven/jira/JiraDownloader.java (original) +++ maven/maven-1/plugins/trunk/jira/src/main/org/apache/maven/jira/JiraDownloader.java Tue Jan 10 09:52:11 2006 @@ -90,6 +90,10 @@ /** The maven project. */ private Project project; + /** Include a Jira roadmap. */ + private boolean roadmap; + + /** Mapping containing all JIRA status values. */ private static Map statusMap = new HashMap(); @@ -212,7 +216,7 @@ if (pos >= 0) { // url id = url.substring(url.lastIndexOf("=") + 1); - } + } String jiraUrl = url.substring(0, url.lastIndexOf("/")); if (jiraUrl.endsWith("secure") || jiraUrl.endsWith("browse")) { @@ -220,26 +224,37 @@ } log.info("Jira lives at: " + jiraUrl); doAuthentication(cl, jiraUrl); - - if (id == null) { - GetMethod gm = new GetMethod(url); - log.info("Jira URL " + url + " doesn't include a pid, trying to get it"); - try { + String projectPage = ""; + + if ( id == null || roadmap) + { + GetMethod gm = new GetMethod( url + "?report=com.atlassian.jira.plugin.system.project:roadmap-panel" ); + try + { cl.executeMethod(gm); log.info("Succesfully reached JIRA."); } - catch (Exception e) { - if (log.isDebugEnabled()) { + catch (Exception e) + { + if (log.isDebugEnabled()) + { log.error("Unable to reach JIRA project page:", e); } - else { + else + { log.error("Unable to reach JIRA project page. Cause is: " + e.getLocalizedMessage()); } } - String projectPage = gm.getResponseBodyAsString(); + projectPage = gm.getResponseBodyAsString(); + } + + if ( id == null ) + { + log.info("Jira URL " + url + " doesn't include a pid, trying to get it"); int pidIndex = projectPage.indexOf("pid="); // @todo, a safer way to get the PID - if (pidIndex == -1) { + if (pidIndex == -1) + { // fail log.error("Unable to get JIRA pid using url " + project.getIssueTrackingUrl()); return; @@ -249,7 +264,6 @@ Number pidNumber = nf.parse(projectPage, new ParsePosition(pidIndex + 4)); id = Integer.toString(pidNumber.intValue()); } - // create the URL for getting the proper iussues from JIRA String fullURL = jiraUrl + "/secure/IssueNavigator.jspa?view=rss&pid=" + id; @@ -257,7 +271,33 @@ fullURL += "&tempMax=" + nbEntriesMax + "&reset=true&decorator=none"; // execute the GET - download(cl, fullURL); + download(cl, fullURL, output); + + if ( roadmap ) + { + int fixforIndex = projectPage.indexOf("fixfor="); // @todo, a safer way to get the PID + + if (fixforIndex == -1) + { + // fail + log.error("Unable to get JIRA roadmap using url " + project.getIssueTrackingUrl()); + return; + } + + NumberFormat nf = NumberFormat.getInstance(); + Number fixforNumber = nf.parse(projectPage, new ParsePosition(fixforIndex + 7)); + String fixfor = Integer.toString(fixforNumber.intValue()); + setFilter("&&fixfor=" + fixfor + "&sorter/field=status&sorter/order=ASC"); + fullURL = jiraUrl + "/secure/IssueNavigator.jspa?view=rss&pid=" + id; + fullURL += createFilter(); + fullURL += "&tempMax=" + nbEntriesMax + "&reset=true&decorator=none"; + String outFile = output.getAbsolutePath(); + int endIndex = outFile.lastIndexOf( '/' ); + outFile = outFile.substring( 0, endIndex ) + "/jira-roadmap.xml"; + // execute the GET + download(cl, fullURL, new File( outFile ) ); + } + } catch (Exception e) { log.error("Error accessing " + project.getIssueTrackingUrl(), e); } @@ -349,7 +389,7 @@ * the JiraUrl * @return */ - private void download(final HttpClient cl, final String link) { + private void download(final HttpClient cl, final String link, final File outFile) { try { GetMethod gm = new GetMethod(link); log.info("Downloading " + link); @@ -357,7 +397,7 @@ cl.executeMethod(gm); final String strGetResponseBody = gm.getResponseBodyAsString(); // write the reponse to file - PrintWriter pw = new PrintWriter(new FileWriter(output)); + PrintWriter pw = new PrintWriter(new FileWriter(outFile)); pw.print(strGetResponseBody); pw.close(); StatusLine sl = gm.getStatusLine(); @@ -374,7 +414,7 @@ } else { String newLink = locationHeader.getValue(); log.debug("Following redirect to " + newLink); - download(cl, newLink); + download(cl, newLink, outFile); } } @@ -514,6 +554,14 @@ */ public void setComponent(final String theseComponents) { this.component = theseComponents; + } + + /** + * Sets the roadmap property. + * @param thisRoadmap The roadmap. + */ + public void setRoadmap(final boolean thisRoadmap) { + this.roadmap = thisRoadmap; } } Modified: maven/maven-1/plugins/trunk/jira/src/plugin-resources/jira.jsl URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/jira/src/plugin-resources/jira.jsl?rev=367705&r1=367704&r2=367705&view=diff ============================================================================== --- maven/maven-1/plugins/trunk/jira/src/plugin-resources/jira.jsl (original) +++ maven/maven-1/plugins/trunk/jira/src/plugin-resources/jira.jsl Tue Jan 10 09:52:11 2006 @@ -32,10 +32,17 @@ <jsl:template match="rss"> <document> <properties> - <title>Jira Report</title> + <title>${title}</title> </properties> <body> - <section name="Jira Report"> + <section name="${title}"> + <p> + ${description} + <j:if test="${roadmapUrl != null}"> + For the latest list, please check the Jira + <a href="${roadmapUrl}">roadmap</a>. + </j:if> + </p> <x:forEach var="entry" select="channel"> <table> <thead> Modified: maven/maven-1/plugins/trunk/jira/xdocs/changes.xml URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/jira/xdocs/changes.xml?rev=367705&r1=367704&r2=367705&view=diff ============================================================================== --- maven/maven-1/plugins/trunk/jira/xdocs/changes.xml (original) +++ maven/maven-1/plugins/trunk/jira/xdocs/changes.xml Tue Jan 10 09:52:11 2006 @@ -24,6 +24,7 @@ </properties> <body> <release version="1.3-SNAPSHOT" date="in SVN"> + <action dev="ltheussl" type="add">Add a jira-roadmap report.</action> <action dev="ltheussl" type="update">Layout changes: mimic default JIRA appearance, also show votes.</action> <action dev="aheritier" type="fix">Icons are corrupted (images are filtered during the copy).</action> </release> Modified: maven/maven-1/plugins/trunk/jira/xdocs/properties.xml URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/jira/xdocs/properties.xml?rev=367705&r1=367704&r2=367705&view=diff ============================================================================== --- maven/maven-1/plugins/trunk/jira/xdocs/properties.xml (original) +++ maven/maven-1/plugins/trunk/jira/xdocs/properties.xml Tue Jan 10 09:52:11 2006 @@ -164,6 +164,19 @@ </td> <td></td> </tr> + <tr> + <td>maven.jira.roadmap</td> + <td>Yes</td> + <td> + <p> + If set to <code>true</code>, a report on issues in the Jira + roadmap is generated. This includes issues + that are fixed in the current development version and issues + that are scheduled to be fixed in the next release. + </p> + </td> + <td><p><code>true</code></p></td> + </tr> </table> </section> </body>