org.kohsuke.jnt
Class JNMailingList

java.lang.Object
  extended by org.kohsuke.jnt.JNMailingList

public final class JNMailingList
extends Object

A mailing list of a project on java.net.

Author:
Bruno Souza, Kohsuke Kawaguchi

Nested Class Summary
static class JNMailingList.MessagePerMonth
          The number of messages posted per month.
static interface JNMailingList.ProgressCallback
          Appliation can implement this interface to receive progress reports on subscribing e-mail addresses to a mailing list.
 
Method Summary
 void delete()
          Deletes this mailing list.
 boolean equals(Object o)
           
 String getDescription()
          Gets the description of this list.
 List<JNMailingList.MessagePerMonth> getMessagesPerMonth()
          Returns a list of JNMailingList.MessagePerMonth.
 String getName()
          Gets the name of ths mailing list, such as "issues" or "cvs".
 String getPostAddress()
          Gets the e-mail address to post to this list.
 JNProject getProject()
          Gets the project to which this mailing list belongs.
 List<String> getSubscribers(SubscriptionMode mode)
          Gets the list of subscriber e-mail addresses.
 int getTotalMessages()
          Gets the total number of messages this list holds.
 int hashCode()
           
 int massSubscribe(Collection<String> addresses, SubscriptionMode mode, JNMailingList.ProgressCallback callback)
          Subscribes the specified e-mail addresses to this mailing list.
 int massSubscribe(String[] addresses, SubscriptionMode mode, JNMailingList.ProgressCallback callback)
          Subscribes the specified e-mail addresses to this mailing list.
 int massSubscribe(String address, SubscriptionMode mode)
          Subscribes the specified e-mail address to this mailing list.
 int massUnsubscribe(Collection<String> addresses, SubscriptionMode mode, JNMailingList.ProgressCallback callback)
          Unsubscribes the specified e-mail addresses from this mailing list.
 int massUnsubscribe(String[] addresses, SubscriptionMode mode, JNMailingList.ProgressCallback callback)
          Unsubscribes the specified e-mail addresses from this mailing list.
 void subscribe(SubscriptionMode mode)
          Subscribes yourself.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getProject

public JNProject getProject()
Gets the project to which this mailing list belongs.


getName

public String getName()
Gets the name of ths mailing list, such as "issues" or "cvs".

Returns:
never null.

getPostAddress

public String getPostAddress()
Gets the e-mail address to post to this list.

Returns:
a string that looks like 'cvs@jaxb.dev.java.net' for example.

getDescription

public String getDescription()
                      throws ProcessingException
Gets the description of this list.

In java.net, every mailing list can have a human-readable description associated with it. This method returns it.

TODO: check if the description can contain HTML.

Returns:
non-null valid string.
Throws:
ProcessingException

getTotalMessages

public int getTotalMessages()
                     throws ProcessingException
Gets the total number of messages this list holds.

Throws:
ProcessingException

getSubscribers

public List<String> getSubscribers(SubscriptionMode mode)
                            throws ProcessingException
Gets the list of subscriber e-mail addresses.

This is an admin operation that requires a priviledge.

Returns:
read-only non-null (but possibly empty) list.
Throws:
ProcessingException

subscribe

public void subscribe(SubscriptionMode mode)
               throws ProcessingException
Subscribes yourself.

Throws:
ProcessingException

massSubscribe

public int massSubscribe(String address,
                         SubscriptionMode mode)
                  throws ProcessingException
Subscribes the specified e-mail address to this mailing list.

Doing this requires that you have a moderator permission on this mailing list.

Parameters:
mode - the subscription mode that the specified e-mail address uses.
Throws:
ProcessingException

massSubscribe

public int massSubscribe(String[] addresses,
                         SubscriptionMode mode,
                         JNMailingList.ProgressCallback callback)
                  throws ProcessingException
Subscribes the specified e-mail addresses to this mailing list.

Convenience method to invoke massSubscribe(Collection,SubscriptionMode,ProgressCallback)

Throws:
ProcessingException

massSubscribe

public int massSubscribe(Collection<String> addresses,
                         SubscriptionMode mode,
                         JNMailingList.ProgressCallback callback)
                  throws ProcessingException
Subscribes the specified e-mail addresses to this mailing list.

Doing this requires that you have a moderator permission on this mailing list.

Parameters:
addresses - collection of e-mail address of a Collection of Strings.
mode - the subscription mode that the specified e-mail address uses.
callback - If not null, this interface receives progress indication.
Throws:
ProcessingException

massUnsubscribe

public int massUnsubscribe(String[] addresses,
                           SubscriptionMode mode,
                           JNMailingList.ProgressCallback callback)
                    throws ProcessingException
Unsubscribes the specified e-mail addresses from this mailing list.

Convenience method to invoke massUnsubscribe(Collection,SubscriptionMode,ProgressCallback)

Throws:
ProcessingException

massUnsubscribe

public int massUnsubscribe(Collection<String> addresses,
                           SubscriptionMode mode,
                           JNMailingList.ProgressCallback callback)
                    throws ProcessingException
Unsubscribes the specified e-mail addresses from this mailing list.

Doing this requires that you have a moderator permission on this mailing list.

Parameters:
addresses - collection of e-mail address of a Collection of Strings.
mode - the subscription mode that the specified e-mail addresses use.
callback - If not null, this interface receives progress indication.
Throws:
ProcessingException

delete

public void delete()
            throws ProcessingException
Deletes this mailing list.

This is a priviledged operation.

Throws:
ProcessingException

getMessagesPerMonth

public List<JNMailingList.MessagePerMonth> getMessagesPerMonth()
                                                        throws ProcessingException
Returns a list of JNMailingList.MessagePerMonth.

Becaus of the way java.net is designed, this information is cheap to obtain.

Returns:
always non-null (but possibly empty) list of JNMailingList.MessagePerMonth.
Throws:
ProcessingException

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2003-2010 Kohsuke Kawaguchi. All Rights Reserved.