glennm 2002/06/03 14:43:43
Modified: src/java/org/apache/maven/cvslib CvsChangeLogGenerator.java
src/java/org/apache/maven/project Contributor.java
Developer.java
src/java/org/apache/maven/util AsyncStreamReader.java
src/templates/xdocs team-list.xml
Log:
Glenn McAllister - 2002/06/03
- Added <roles><role> element to Contributor.
- Developer now extends Contributor (its pretty empty now) so gets roles for
free.
- Updated the team-list.xml template to display Contributor and Developer
roles.
- Added an okToConsume method to AsyncStreamReader to make it easier to create
subclasses that an be picky about what lines to add to the internal buffer;
by default this method always returns true (preserves the current behaviour).
- Added a custom AsynStreamReader to the CvsChangeLogGenerator to squelch
displaying all the "cvs server: Logging" lines.
Revision Changes Path
1.7 +31 -3
jakarta-turbine-maven/src/java/org/apache/maven/cvslib/CvsChangeLogGenerator.java
Index: CvsChangeLogGenerator.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/cvslib/CvsChangeLogGenerator.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- CvsChangeLogGenerator.java 27 May 2002 23:26:06 -0000 1.6
+++ CvsChangeLogGenerator.java 3 Jun 2002 21:43:40 -0000 1.7
@@ -88,7 +88,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Stefan Bodewig</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Peter Donald</a>
* @version
- * $Id: CvsChangeLogGenerator.java,v 1.6 2002/05/27 23:26:06 dion Exp $
+ * $Id: CvsChangeLogGenerator.java,v 1.7 2002/06/03 21:43:40 glennm Exp $
*/
class CvsChangeLogGenerator
implements ChangeLogGenerator, ExecuteStreamHandler
@@ -280,7 +280,7 @@
*/
public void setProcessErrorStream(InputStream is)
{
- errorReader = new AsyncStreamReader(is);
+ errorReader = new CvsAsyncErrorReader(is);
}
/**
@@ -303,5 +303,33 @@
entries = clParser.parse(in);
}
-
+ /**
+ * A private AsyncStreamReader class that "swallows" the "cvs server:
+ * Logging" lines.
+ */
+ private static class CvsAsyncErrorReader extends AsyncStreamReader
+ {
+ /**
+ * The obvious constructor.
+ *
+ * @param anInputStream the input stream to consume
+ */
+ public CvsAsyncErrorReader(InputStream anInputStream)
+ {
+ super(anInputStream);
+ }
+
+ /**
+ * If the line does not start with "cvs server: Logging", it's ok to
+ * consume it.
+ *
+ * @param line the line to check
+ * @return <code>true</code> if the line does not start with "cvs
+ * server: Logging"
+ */
+ protected boolean okToConsume(String line)
+ {
+ return !line.startsWith("cvs server: Logging");
+ }
+ }
}
1.2 +48 -6
jakarta-turbine-maven/src/java/org/apache/maven/project/Contributor.java
Index: Contributor.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/project/Contributor.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Contributor.java 3 Jun 2002 17:13:16 -0000 1.1
+++ Contributor.java 3 Jun 2002 21:43:41 -0000 1.2
@@ -52,12 +52,21 @@
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
+ *
+ * ====================================================================
*/
+import java.util.SortedSet;
+import java.util.TreeSet;
+
/**
+ * A Contributor to a project is an individual that has contributed in some way
+ * to the project, but is not a Contributor.
+ *
* @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
* @author <a href="mailto:[EMAIL PROTECTED]">bob mcwhirter</a>
- * @version $Id: Contributor.java,v 1.1 2002/06/03 17:13:16 werken Exp $
+ * @author <a href="mailto:[EMAIL PROTECTED]">Glenn McAllister</a>
+ * @version $Id: Contributor.java,v 1.2 2002/06/03 21:43:41 glennm Exp $
*/
public class Contributor
extends BaseObject
@@ -74,14 +83,21 @@
private String organization;
/**
- * Constructor for the Developer object
+ * Contributor's role(s) in the project.
+ */
+ private SortedSet roles = new TreeSet();
+
+ /**
+ * Constructor for the Contributor object
*/
public Contributor()
{
}
/**
- * Sets the email attribute of the Developer object
+ * Sets the email attribute of the Contributor object
+ *
+ * @param email the Contributor's email address
*/
public void setEmail(String email)
{
@@ -89,7 +105,9 @@
}
/**
- * Gets the email attribute of the Developer object
+ * Gets the email attribute of the Contributor object
+ *
+ * @return the Contributor's email address
*/
public String getEmail()
{
@@ -97,7 +115,9 @@
}
/**
- * Sets the organization attribute of the Developer object
+ * Sets the organization attribute of the Contributor object
+ *
+ * @param organization the Contributor's organization affiliation
*/
public void setOrganization(String organization)
{
@@ -105,10 +125,32 @@
}
/**
- * Gets the organization attribute of the Developer object
+ * Gets the organization attribute of the Contributor object
+ *
+ * @return the organization the Contributor is affiliated with
*/
public String getOrganization()
{
return organization;
+ }
+
+ /**
+ * Adds a role attribute to the Contributor object.
+ *
+ * @param role a role the Contributor plays in the project
+ */
+ public void addRole(String role)
+ {
+ roles.add(role);
+ }
+
+ /**
+ * Gets the sorted set of unique role attributes of the Contributor object.
+ *
+ * @return the sorted set of roles the Contributor plays in the project.
+ */
+ public SortedSet getRoles()
+ {
+ return roles;
}
}
1.4 +7 -45
jakarta-turbine-maven/src/java/org/apache/maven/project/Developer.java
Index: Developer.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/project/Developer.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Developer.java 24 Feb 2002 17:33:44 -0000 1.3
+++ Developer.java 3 Jun 2002 21:43:41 -0000 1.4
@@ -52,62 +52,24 @@
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
+ *
+ * ====================================================================
*/
/**
+ * A Developer is, in Jakarta terms, a committer on a project.
+ *
* @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
- * @version $Id: Developer.java,v 1.3 2002/02/24 17:33:44 jvanzyl Exp $
+ * @author <a href="mailto:[EMAIL PROTECTED]">Glenn McAllister</a>
+ * @version $Id: Developer.java,v 1.4 2002/06/03 21:43:41 glennm Exp $
*/
public class Developer
- extends BaseObject
+ extends Contributor
{
/**
- * Developer's email address. NOTE: there may eventually be more than
- * one email address.
- */
- private String email;
-
- /**
- * Developer's organziation.
- */
- private String organization;
-
- /**
* Constructor for the Developer object
*/
public Developer()
{
- }
-
- /**
- * Sets the email attribute of the Developer object
- */
- public void setEmail(String email)
- {
- this.email = email;
- }
-
- /**
- * Gets the email attribute of the Developer object
- */
- public String getEmail()
- {
- return email;
- }
-
- /**
- * Sets the organization attribute of the Developer object
- */
- public void setOrganization(String organization)
- {
- this.organization = organization;
- }
-
- /**
- * Gets the organization attribute of the Developer object
- */
- public String getOrganization()
- {
- return organization;
}
}
1.3 +22 -10
jakarta-turbine-maven/src/java/org/apache/maven/util/AsyncStreamReader.java
Index: AsyncStreamReader.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/util/AsyncStreamReader.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AsyncStreamReader.java 27 May 2002 13:49:42 -0000 1.2
+++ AsyncStreamReader.java 3 Jun 2002 21:43:42 -0000 1.3
@@ -66,12 +66,13 @@
* provide the output as a String
*
* @author <a href="mailto:[EMAIL PROTECTED]">dIon Gillard</a>
- * @version $Id: AsyncStreamReader.java,v 1.2 2002/05/27 13:49:42 dion Exp $
+ * @version $Id: AsyncStreamReader.java,v 1.3 2002/06/03 21:43:42 glennm Exp $
*/
public class AsyncStreamReader extends Thread
{
/** buffer to dump output to */
private StringBuffer streamBuffer = new StringBuffer();
+
/** stream to read from */
private BufferedReader stream;
@@ -94,15 +95,16 @@
*/
public void run()
{
- String line = null;
+ String line;
try
{
- line = stream.readLine();
- while (line != null)
+ while((line = stream.readLine()) != null)
{
- streamBuffer.append(line);
- streamBuffer.append('\n');
- line = stream.readLine();
+ if (okToConsume(line))
+ {
+ streamBuffer.append(line);
+ streamBuffer.append('\n');
+ }
}
}
catch (IOException ioe)
@@ -118,7 +120,17 @@
{
return streamBuffer.toString();
}
-} // end of AsyncStreamReader
-
-
+ /**
+ * Indicate if its ok to consume (add to the buffer) this line. This
+ * implementation always returns <code>true</code>.
+ *
+ * @param line the line to check.
+ * @return if its ok to add this line to the buffer.
+ */
+ protected boolean okToConsume(String line)
+ {
+ return true;
+ }
+
+} // end of AsyncStreamReader
1.2 +12 -0 jakarta-turbine-maven/src/templates/xdocs/team-list.xml
Index: team-list.xml
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/templates/xdocs/team-list.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- team-list.xml 3 Jun 2002 17:13:16 -0000 1.1
+++ team-list.xml 3 Jun 2002 21:43:42 -0000 1.2
@@ -42,12 +42,18 @@
<th>Name</th>
<th>Email</th>
<th>Organization</th>
+ <th>Roles</th>
</tr>
#foreach ($developer in $project.developers)
<tr>
<td>$!developer.name</td>
<td><a href="mailto:$!developer.email">$!developer.email</a></td>
<td>$!developer.organization</td>
+ <td>
+ #foreach ($role in $developer.roles)
+ $role<br/>
+ #end
+ </td>
</tr>
#end
</table>
@@ -63,12 +69,18 @@
<th>Name</th>
<th>Email</th>
<th>Organization</th>
+ <th>Roles</th>
</tr>
#foreach ($contributor in $project.contributors)
<tr>
<td>$!contributor.name</td>
<td><a href="mailto:$!contributor.email">$!contributor.email</a></td>
<td>$!contributor.organization</td>
+ <td>
+ #foreach ($role in $contributor.roles)
+ $role<br/>
+ #end
+ </td>
</tr>
#end
</table>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>