You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jb...@apache.org on 2004/10/10 23:02:52 UTC
svn commit: rev 54266 - in geronimo/trunk/specs: activation/src/java/javax/activation javamail/src/java/javax/mail javamail/src/java/javax/mail/event javamail/src/java/javax/mail/internet javamail/src/java/javax/mail/search
Author: jboynes
Date: Sun Oct 10 14:02:50 2004
New Revision: 54266
Modified:
geronimo/trunk/specs/activation/src/java/javax/activation/ActivationDataFlavor.java
geronimo/trunk/specs/activation/src/java/javax/activation/CommandInfo.java
geronimo/trunk/specs/activation/src/java/javax/activation/CommandMap.java
geronimo/trunk/specs/activation/src/java/javax/activation/CommandObject.java
geronimo/trunk/specs/activation/src/java/javax/activation/DataContentHandler.java
geronimo/trunk/specs/activation/src/java/javax/activation/DataContentHandlerFactory.java
geronimo/trunk/specs/activation/src/java/javax/activation/DataHandler.java
geronimo/trunk/specs/activation/src/java/javax/activation/DataSource.java
geronimo/trunk/specs/activation/src/java/javax/activation/FileDataSource.java
geronimo/trunk/specs/activation/src/java/javax/activation/FileTypeMap.java
geronimo/trunk/specs/activation/src/java/javax/activation/MailcapCommandMap.java
geronimo/trunk/specs/activation/src/java/javax/activation/MimeTypeParameterList.java
geronimo/trunk/specs/activation/src/java/javax/activation/MimeTypeParseException.java
geronimo/trunk/specs/activation/src/java/javax/activation/MimetypesFileTypeMap.java
geronimo/trunk/specs/activation/src/java/javax/activation/URLDataSource.java
geronimo/trunk/specs/activation/src/java/javax/activation/UnsupportedDataTypeException.java
geronimo/trunk/specs/javamail/src/java/javax/mail/Address.java
geronimo/trunk/specs/javamail/src/java/javax/mail/AuthenticationFailedException.java
geronimo/trunk/specs/javamail/src/java/javax/mail/Authenticator.java
geronimo/trunk/specs/javamail/src/java/javax/mail/BodyPart.java
geronimo/trunk/specs/javamail/src/java/javax/mail/FetchProfile.java
geronimo/trunk/specs/javamail/src/java/javax/mail/Flags.java
geronimo/trunk/specs/javamail/src/java/javax/mail/Folder.java
geronimo/trunk/specs/javamail/src/java/javax/mail/FolderClosedException.java
geronimo/trunk/specs/javamail/src/java/javax/mail/FolderNotFoundException.java
geronimo/trunk/specs/javamail/src/java/javax/mail/Header.java
geronimo/trunk/specs/javamail/src/java/javax/mail/IllegalWriteException.java
geronimo/trunk/specs/javamail/src/java/javax/mail/Message.java
geronimo/trunk/specs/javamail/src/java/javax/mail/MessageAware.java
geronimo/trunk/specs/javamail/src/java/javax/mail/MessageContext.java
geronimo/trunk/specs/javamail/src/java/javax/mail/MessageRemovedException.java
geronimo/trunk/specs/javamail/src/java/javax/mail/MessagingException.java
geronimo/trunk/specs/javamail/src/java/javax/mail/MethodNotSupportedException.java
geronimo/trunk/specs/javamail/src/java/javax/mail/Multipart.java
geronimo/trunk/specs/javamail/src/java/javax/mail/MultipartDataSource.java
geronimo/trunk/specs/javamail/src/java/javax/mail/NoSuchProviderException.java
geronimo/trunk/specs/javamail/src/java/javax/mail/Part.java
geronimo/trunk/specs/javamail/src/java/javax/mail/PasswordAuthentication.java
geronimo/trunk/specs/javamail/src/java/javax/mail/Provider.java
geronimo/trunk/specs/javamail/src/java/javax/mail/ReadOnlyFolderException.java
geronimo/trunk/specs/javamail/src/java/javax/mail/SendFailedException.java
geronimo/trunk/specs/javamail/src/java/javax/mail/Service.java
geronimo/trunk/specs/javamail/src/java/javax/mail/Session.java
geronimo/trunk/specs/javamail/src/java/javax/mail/Store.java
geronimo/trunk/specs/javamail/src/java/javax/mail/StoreClosedException.java
geronimo/trunk/specs/javamail/src/java/javax/mail/Transport.java
geronimo/trunk/specs/javamail/src/java/javax/mail/UIDFolder.java
geronimo/trunk/specs/javamail/src/java/javax/mail/event/ConnectionAdapter.java
geronimo/trunk/specs/javamail/src/java/javax/mail/event/ConnectionEvent.java
geronimo/trunk/specs/javamail/src/java/javax/mail/event/ConnectionListener.java
geronimo/trunk/specs/javamail/src/java/javax/mail/event/FolderAdapter.java
geronimo/trunk/specs/javamail/src/java/javax/mail/event/FolderEvent.java
geronimo/trunk/specs/javamail/src/java/javax/mail/event/FolderListener.java
geronimo/trunk/specs/javamail/src/java/javax/mail/event/MailEvent.java
geronimo/trunk/specs/javamail/src/java/javax/mail/event/MessageChangedEvent.java
geronimo/trunk/specs/javamail/src/java/javax/mail/event/MessageChangedListener.java
geronimo/trunk/specs/javamail/src/java/javax/mail/event/MessageCountAdapter.java
geronimo/trunk/specs/javamail/src/java/javax/mail/event/MessageCountEvent.java
geronimo/trunk/specs/javamail/src/java/javax/mail/event/MessageCountListener.java
geronimo/trunk/specs/javamail/src/java/javax/mail/event/StoreEvent.java
geronimo/trunk/specs/javamail/src/java/javax/mail/event/StoreListener.java
geronimo/trunk/specs/javamail/src/java/javax/mail/event/TransportAdapter.java
geronimo/trunk/specs/javamail/src/java/javax/mail/event/TransportEvent.java
geronimo/trunk/specs/javamail/src/java/javax/mail/event/TransportListener.java
geronimo/trunk/specs/javamail/src/java/javax/mail/internet/AddressException.java
geronimo/trunk/specs/javamail/src/java/javax/mail/internet/ContentDisposition.java
geronimo/trunk/specs/javamail/src/java/javax/mail/internet/ContentType.java
geronimo/trunk/specs/javamail/src/java/javax/mail/internet/HeaderTokenizer.java
geronimo/trunk/specs/javamail/src/java/javax/mail/internet/InternetAddress.java
geronimo/trunk/specs/javamail/src/java/javax/mail/internet/InternetHeaders.java
geronimo/trunk/specs/javamail/src/java/javax/mail/internet/MailDateFormat.java
geronimo/trunk/specs/javamail/src/java/javax/mail/internet/MimeBodyPart.java
geronimo/trunk/specs/javamail/src/java/javax/mail/internet/MimeMessage.java
geronimo/trunk/specs/javamail/src/java/javax/mail/internet/MimeMultipart.java
geronimo/trunk/specs/javamail/src/java/javax/mail/internet/MimePart.java
geronimo/trunk/specs/javamail/src/java/javax/mail/internet/MimePartDataSource.java
geronimo/trunk/specs/javamail/src/java/javax/mail/internet/MimeUtility.java
geronimo/trunk/specs/javamail/src/java/javax/mail/internet/NewsAddress.java
geronimo/trunk/specs/javamail/src/java/javax/mail/internet/ParameterList.java
geronimo/trunk/specs/javamail/src/java/javax/mail/internet/ParseException.java
geronimo/trunk/specs/javamail/src/java/javax/mail/internet/SharedInputStream.java
geronimo/trunk/specs/javamail/src/java/javax/mail/search/AddressStringTerm.java
geronimo/trunk/specs/javamail/src/java/javax/mail/search/AddressTerm.java
geronimo/trunk/specs/javamail/src/java/javax/mail/search/AndTerm.java
geronimo/trunk/specs/javamail/src/java/javax/mail/search/BodyTerm.java
geronimo/trunk/specs/javamail/src/java/javax/mail/search/ComparisonTerm.java
geronimo/trunk/specs/javamail/src/java/javax/mail/search/DateTerm.java
geronimo/trunk/specs/javamail/src/java/javax/mail/search/FlagTerm.java
geronimo/trunk/specs/javamail/src/java/javax/mail/search/FromStringTerm.java
geronimo/trunk/specs/javamail/src/java/javax/mail/search/FromTerm.java
geronimo/trunk/specs/javamail/src/java/javax/mail/search/HeaderTerm.java
geronimo/trunk/specs/javamail/src/java/javax/mail/search/IntegerComparisonTerm.java
geronimo/trunk/specs/javamail/src/java/javax/mail/search/MessageIDTerm.java
geronimo/trunk/specs/javamail/src/java/javax/mail/search/MessageNumberTerm.java
geronimo/trunk/specs/javamail/src/java/javax/mail/search/NotTerm.java
geronimo/trunk/specs/javamail/src/java/javax/mail/search/OrTerm.java
geronimo/trunk/specs/javamail/src/java/javax/mail/search/ReceivedDateTerm.java
geronimo/trunk/specs/javamail/src/java/javax/mail/search/RecipientStringTerm.java
geronimo/trunk/specs/javamail/src/java/javax/mail/search/RecipientTerm.java
geronimo/trunk/specs/javamail/src/java/javax/mail/search/SearchException.java
geronimo/trunk/specs/javamail/src/java/javax/mail/search/SearchTerm.java
geronimo/trunk/specs/javamail/src/java/javax/mail/search/SentDateTerm.java
geronimo/trunk/specs/javamail/src/java/javax/mail/search/SizeTerm.java
geronimo/trunk/specs/javamail/src/java/javax/mail/search/StringTerm.java
geronimo/trunk/specs/javamail/src/java/javax/mail/search/SubjectTerm.java
Log:
reformat code
Modified: geronimo/trunk/specs/activation/src/java/javax/activation/ActivationDataFlavor.java
==============================================================================
--- geronimo/trunk/specs/activation/src/java/javax/activation/ActivationDataFlavor.java (original)
+++ geronimo/trunk/specs/activation/src/java/javax/activation/ActivationDataFlavor.java Sun Oct 10 14:02:50 2004
@@ -20,9 +20,6 @@
import java.awt.datatransfer.DataFlavor;
/**
- *
- *
- *
* @version $Rev$ $Date$
*/
public class ActivationDataFlavor extends DataFlavor {
Modified: geronimo/trunk/specs/activation/src/java/javax/activation/CommandInfo.java
==============================================================================
--- geronimo/trunk/specs/activation/src/java/javax/activation/CommandInfo.java (original)
+++ geronimo/trunk/specs/activation/src/java/javax/activation/CommandInfo.java Sun Oct 10 14:02:50 2004
@@ -20,9 +20,6 @@
import java.io.IOException;
/**
- *
- *
- *
* @version $Rev$ $Date$
*/
public class CommandInfo {
Modified: geronimo/trunk/specs/activation/src/java/javax/activation/CommandMap.java
==============================================================================
--- geronimo/trunk/specs/activation/src/java/javax/activation/CommandMap.java (original)
+++ geronimo/trunk/specs/activation/src/java/javax/activation/CommandMap.java Sun Oct 10 14:02:50 2004
@@ -18,9 +18,6 @@
package javax.activation;
/**
- *
- *
- *
* @version $Rev$ $Date$
*/
public abstract class CommandMap {
Modified: geronimo/trunk/specs/activation/src/java/javax/activation/CommandObject.java
==============================================================================
--- geronimo/trunk/specs/activation/src/java/javax/activation/CommandObject.java (original)
+++ geronimo/trunk/specs/activation/src/java/javax/activation/CommandObject.java Sun Oct 10 14:02:50 2004
@@ -20,9 +20,6 @@
import java.io.IOException;
/**
- *
- *
- *
* @version $Rev$ $Date$
*/
public interface CommandObject {
Modified: geronimo/trunk/specs/activation/src/java/javax/activation/DataContentHandler.java
==============================================================================
--- geronimo/trunk/specs/activation/src/java/javax/activation/DataContentHandler.java (original)
+++ geronimo/trunk/specs/activation/src/java/javax/activation/DataContentHandler.java Sun Oct 10 14:02:50 2004
@@ -23,9 +23,6 @@
import java.io.OutputStream;
/**
- *
- *
- *
* @version $Rev$ $Date$
*/
public interface DataContentHandler {
Modified: geronimo/trunk/specs/activation/src/java/javax/activation/DataContentHandlerFactory.java
==============================================================================
--- geronimo/trunk/specs/activation/src/java/javax/activation/DataContentHandlerFactory.java (original)
+++ geronimo/trunk/specs/activation/src/java/javax/activation/DataContentHandlerFactory.java Sun Oct 10 14:02:50 2004
@@ -18,9 +18,6 @@
package javax.activation;
/**
- *
- *
- *
* @version $Rev$ $Date$
*/
public interface DataContentHandlerFactory {
Modified: geronimo/trunk/specs/activation/src/java/javax/activation/DataHandler.java
==============================================================================
--- geronimo/trunk/specs/activation/src/java/javax/activation/DataHandler.java (original)
+++ geronimo/trunk/specs/activation/src/java/javax/activation/DataHandler.java Sun Oct 10 14:02:50 2004
@@ -30,6 +30,7 @@
*/
public class DataHandler implements Transferable {
private DataSource _ds;
+
public DataHandler(DataSource ds) {
_ds = ds;
}
@@ -42,11 +43,14 @@
private Object _data;
private String _type;
+
public Object getContent() {
return _data;
}
+
/**
* Store an object as a data source type
+ *
* @param data the object
* @param type the mimeType
*/
@@ -88,6 +92,7 @@
}
}
+
public DataHandler(URL url) {
/*@todo implement*/
}
@@ -128,7 +133,7 @@
}
public Object getTransferData(DataFlavor flavor)
- throws UnsupportedFlavorException, IOException {
+ throws UnsupportedFlavorException, IOException {
/*@todo implement*/
return null;
}
Modified: geronimo/trunk/specs/activation/src/java/javax/activation/DataSource.java
==============================================================================
--- geronimo/trunk/specs/activation/src/java/javax/activation/DataSource.java (original)
+++ geronimo/trunk/specs/activation/src/java/javax/activation/DataSource.java Sun Oct 10 14:02:50 2004
@@ -26,7 +26,10 @@
*/
public interface DataSource {
public abstract InputStream getInputStream() throws IOException;
+
public abstract OutputStream getOutputStream() throws IOException;
+
public abstract String getContentType();
+
public abstract String getName();
}
Modified: geronimo/trunk/specs/activation/src/java/javax/activation/FileDataSource.java
==============================================================================
--- geronimo/trunk/specs/activation/src/java/javax/activation/FileDataSource.java (original)
+++ geronimo/trunk/specs/activation/src/java/javax/activation/FileDataSource.java Sun Oct 10 14:02:50 2004
@@ -25,9 +25,6 @@
import java.io.OutputStream;
/**
- *
- *
- *
* @version $Rev$ $Date$
*/
public class FileDataSource implements DataSource {
Modified: geronimo/trunk/specs/activation/src/java/javax/activation/FileTypeMap.java
==============================================================================
--- geronimo/trunk/specs/activation/src/java/javax/activation/FileTypeMap.java (original)
+++ geronimo/trunk/specs/activation/src/java/javax/activation/FileTypeMap.java Sun Oct 10 14:02:50 2004
@@ -25,8 +25,8 @@
* @version $Rev$ $Date$
*/
public abstract class FileTypeMap {
-
- private static FileTypeMap defaultFileTypeMap;
+
+ private static FileTypeMap defaultFileTypeMap;
public FileTypeMap() {
}
@@ -35,19 +35,19 @@
public abstract String getContentType(String filename);
- /**
- * Sets the default FileTypeMap for the system
- */
+ /**
+ * Sets the default FileTypeMap for the system
+ */
public static void setDefaultFileTypeMap(FileTypeMap map) {
defaultFileTypeMap = map;
}
- /**
- * Returns the default FileTypeMap
- */
+ /**
+ * Returns the default FileTypeMap
+ */
public static FileTypeMap getDefaultFileTypeMap() {
- if (defaultFileTypeMap==null)
- return new MimetypesFileTypeMap();
+ if (defaultFileTypeMap == null)
+ return new MimetypesFileTypeMap();
return defaultFileTypeMap;
}
}
Modified: geronimo/trunk/specs/activation/src/java/javax/activation/MailcapCommandMap.java
==============================================================================
--- geronimo/trunk/specs/activation/src/java/javax/activation/MailcapCommandMap.java (original)
+++ geronimo/trunk/specs/activation/src/java/javax/activation/MailcapCommandMap.java Sun Oct 10 14:02:50 2004
@@ -21,9 +21,6 @@
import java.io.InputStream;
/**
- *
- *
- *
* @version $Rev$ $Date$
*/
public class MailcapCommandMap extends CommandMap {
Modified: geronimo/trunk/specs/activation/src/java/javax/activation/MimeTypeParameterList.java
==============================================================================
--- geronimo/trunk/specs/activation/src/java/javax/activation/MimeTypeParameterList.java (original)
+++ geronimo/trunk/specs/activation/src/java/javax/activation/MimeTypeParameterList.java Sun Oct 10 14:02:50 2004
@@ -17,11 +17,11 @@
package javax.activation;
-import java.util.Enumeration;
-import java.util.StringTokenizer;
import java.util.Collections;
+import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
+import java.util.StringTokenizer;
/**
Modified: geronimo/trunk/specs/activation/src/java/javax/activation/MimeTypeParseException.java
==============================================================================
--- geronimo/trunk/specs/activation/src/java/javax/activation/MimeTypeParseException.java (original)
+++ geronimo/trunk/specs/activation/src/java/javax/activation/MimeTypeParseException.java Sun Oct 10 14:02:50 2004
@@ -18,9 +18,6 @@
package javax.activation;
/**
- *
- *
- *
* @version $Rev$ $Date$
*/
public class MimeTypeParseException extends Exception {
Modified: geronimo/trunk/specs/activation/src/java/javax/activation/MimetypesFileTypeMap.java
==============================================================================
--- geronimo/trunk/specs/activation/src/java/javax/activation/MimetypesFileTypeMap.java (original)
+++ geronimo/trunk/specs/activation/src/java/javax/activation/MimetypesFileTypeMap.java Sun Oct 10 14:02:50 2004
@@ -22,9 +22,6 @@
import java.io.InputStream;
/**
- *
- *
- *
* @version $Rev$ $Date$
*/
public class MimetypesFileTypeMap extends FileTypeMap {
Modified: geronimo/trunk/specs/activation/src/java/javax/activation/URLDataSource.java
==============================================================================
--- geronimo/trunk/specs/activation/src/java/javax/activation/URLDataSource.java (original)
+++ geronimo/trunk/specs/activation/src/java/javax/activation/URLDataSource.java Sun Oct 10 14:02:50 2004
@@ -24,7 +24,6 @@
import java.net.URLConnection;
/**
- *
* @version $Rev$ $Date$
*/
public class URLDataSource implements DataSource {
@@ -41,7 +40,6 @@
/**
* Returns the value of the URL content-type header field
- *
*/
public String getContentType() {
URLConnection connection = null;
Modified: geronimo/trunk/specs/activation/src/java/javax/activation/UnsupportedDataTypeException.java
==============================================================================
--- geronimo/trunk/specs/activation/src/java/javax/activation/UnsupportedDataTypeException.java (original)
+++ geronimo/trunk/specs/activation/src/java/javax/activation/UnsupportedDataTypeException.java Sun Oct 10 14:02:50 2004
@@ -20,9 +20,6 @@
import java.io.IOException;
/**
- *
- *
- *
* @version $Rev$ $Date$
*/
public class UnsupportedDataTypeException extends IOException {
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/Address.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/Address.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/Address.java Sun Oct 10 14:02:50 2004
@@ -16,12 +16,16 @@
*/
package javax.mail;
+
import java.io.Serializable;
+
/**
* @version $Rev$ $Date$
*/
public abstract class Address implements Serializable {
public abstract boolean equals(Object object);
+
public abstract String getType();
+
public abstract String toString();
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/AuthenticationFailedException.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/AuthenticationFailedException.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/AuthenticationFailedException.java Sun Oct 10 14:02:50 2004
@@ -16,6 +16,7 @@
*/
package javax.mail;
+
/**
* @version $Rev$ $Date$
*/
@@ -23,6 +24,7 @@
public AuthenticationFailedException() {
super();
}
+
public AuthenticationFailedException(String message) {
super(message);
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/Authenticator.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/Authenticator.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/Authenticator.java Sun Oct 10 14:02:50 2004
@@ -16,7 +16,9 @@
*/
package javax.mail;
+
import java.net.InetAddress;
+
/**
* @version $Rev$ $Date$
*/
@@ -25,21 +27,27 @@
private int _port;
private String _prompt;
private String _protocol;
+
protected final String getDefaultUserName() {
return System.getProperty("mail.user");
}
+
protected PasswordAuthentication getPasswordAuthentication() {
return null;
}
+
protected final int getRequestingPort() {
return _port;
}
+
protected final String getRequestingPrompt() {
return _prompt;
}
+
protected final String getRequestingProtocol() {
return _protocol;
}
+
protected final InetAddress getRequestingSite() {
return _host;
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/BodyPart.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/BodyPart.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/BodyPart.java Sun Oct 10 14:02:50 2004
@@ -16,11 +16,13 @@
*/
package javax.mail;
+
/**
* @version $Rev$ $Date$
*/
public abstract class BodyPart implements Part {
protected Multipart parent;
+
public Multipart getParent() {
return parent;
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/FetchProfile.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/FetchProfile.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/FetchProfile.java Sun Oct 10 14:02:50 2004
@@ -16,8 +16,10 @@
*/
package javax.mail;
+
import java.util.HashMap;
import java.util.Map;
+
/**
* @version $Rev$ $Date$
*/
@@ -30,34 +32,43 @@
// Can't find any standards for this?
public static final Item FLAGS = new Item("X-Flags");
private String _header;
+
protected Item(String header) {
if (header == null) {
throw new IllegalArgumentException("Header cannot be null");
}
_header = header;
}
+
String getHeader() {
return _header;
}
}
+
private static final String[] headersType = new String[0];
private static final Item[] itemsType = new Item[0];
private Map _items = new HashMap();
+
public void add(Item item) {
_items.put(item._header, item);
}
+
public void add(String header) {
_items.put(header, new Item(header));
}
+
public boolean contains(Item item) {
return _items.containsKey(item._header);
}
+
public boolean contains(String header) {
return _items.containsKey(header);
}
+
public String[] getHeaderNames() {
return (String[]) _items.keySet().toArray(headersType);
}
+
public Item[] getItems() {
return (Item[]) _items.values().toArray(itemsType);
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/Flags.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/Flags.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/Flags.java Sun Oct 10 14:02:50 2004
@@ -16,12 +16,14 @@
*/
package javax.mail;
+
import java.io.Serializable;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+
/**
* @version $Rev$ $Date$
*/
@@ -36,9 +38,11 @@
public static final Flag USER = new Flag("", false);
private String _name;
private boolean _system;
+
private Flag(String name) {
this(name, false);
}
+
private Flag(String name, boolean system) {
if (name == null) {
throw new IllegalArgumentException("Flag name cannot be null");
@@ -46,36 +50,47 @@
_name = name;
_system = system;
}
+
private String getName() {
return _name;
}
+
private boolean isSystemFlag() {
return _system;
}
}
+
private static final Flag[] FLAG_ARRAY = new Flag[0];
private static final String[] STRING_ARRAY = new String[0];
private Map _map = new HashMap(4);
+
public Flags() {
}
+
public Flags(Flag flag) {
add(flag);
}
+
public Flags(Flags flags) {
add(flags);
}
+
public Flags(String name) {
add(name);
}
+
public void add(Flag flag) {
_map.put(flag.getName(), flag);
}
+
public void add(Flags flags) {
_map.putAll(flags._map);
}
+
public void add(String name) {
add(new Flag(name));
}
+
public Object clone() {
try {
Flags clone = (Flags) super.clone();
@@ -86,9 +101,11 @@
throw new AssertionError();
}
}
+
public boolean contains(Flag flag) {
return _map.containsKey(flag.getName());
}
+
public boolean contains(Flags flags) {
Iterator it = flags._map.keySet().iterator();
boolean result = true;
@@ -97,9 +114,11 @@
}
return result;
}
+
public boolean contains(String name) {
return _map.containsKey(name);
}
+
public boolean equals(Object other) {
if (other == null || other.getClass() != this.getClass()) {
return false;
@@ -107,6 +126,7 @@
Flags flags = (Flags) other;
return flags._map.equals(this._map);
}
+
public Flag[] getSystemFlags() {
List result = new LinkedList();
Iterator it = _map.values().iterator();
@@ -118,6 +138,7 @@
}
return (Flag[]) result.toArray(FLAG_ARRAY);
}
+
public String[] getUserFlags() {
List result = new LinkedList();
Iterator it = _map.values().iterator();
@@ -129,21 +150,26 @@
}
return (String[]) result.toArray(STRING_ARRAY);
}
+
public int hashCode() {
return _map.keySet().hashCode();
}
+
public void remove(Flag flag) {
_map.remove(flag.getName());
}
+
public void remove(Flags flags) {
Iterator it = flags._map.keySet().iterator();
while (it.hasNext()) {
_map.remove(it.next());
}
}
+
public void remove(String name) {
_map.remove(name);
}
+
public String toString() {
return _map.keySet().toString();
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/Folder.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/Folder.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/Folder.java Sun Oct 10 14:02:50 2004
@@ -16,6 +16,7 @@
*/
package javax.mail;
+
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
@@ -30,6 +31,7 @@
import javax.mail.event.MessageCountListener;
import javax.mail.event.TransportListener;
import javax.mail.search.SearchTerm;
+
/**
* @version $Rev$ $Date$
*/
@@ -47,46 +49,62 @@
private boolean _subscribed;
protected int mode;
protected Store store;
+
protected Folder(Store store) {
this.store = store;
}
+
public void addConnectionListener(ConnectionListener listener) {
_connectionListeners.add(listener);
}
+
public void addFolderListener(FolderListener listener) {
_folderListeners.add(listener);
}
+
public void addMessageChangedListener(MessageChangedListener listener) {
_messageChangedListeners.add(listener);
}
+
public void addMessageCountListener(MessageCountListener listener) {
_messageCountListeners.add(listener);
}
+
public abstract void appendMessages(Message[] messages)
- throws MessagingException;
+ throws MessagingException;
+
public abstract void close(boolean expunge) throws MessagingException;
+
public void copyMessages(Message[] messages, Folder folder)
- throws MessagingException {
+ throws MessagingException {
folder.appendMessages(messages);
}
+
public abstract boolean create(int type) throws MessagingException;
+
public abstract boolean delete(boolean recurse) throws MessagingException;
+
public abstract boolean exists() throws MessagingException;
+
public abstract Message[] expunge() throws MessagingException;
+
public void fetch(Message[] messages, FetchProfile profile)
- throws MessagingException {
+ throws MessagingException {
// default does not do anything
return;
}
+
protected void finalize() throws Throwable {
try {
super.finalize();
} finally {
}
}
+
private int getCount(Flag flag) throws MessagingException {
return getCount(flag, true);
}
+
private int getCount(Flag flag, boolean value) throws MessagingException {
if (isOpen()) {
Message[] messages = getMessages();
@@ -101,20 +119,26 @@
return -1;
}
}
+
public int getDeletedMessageCount() throws MessagingException {
return getCount(Flags.Flag.DELETED);
}
+
public abstract Folder getFolder(String name) throws MessagingException;
+
public abstract String getFullName();
+
public abstract Message getMessage(int id) throws MessagingException;
+
public abstract int getMessageCount() throws MessagingException;
+
public Message[] getMessages() throws MessagingException {
return getMessages(1, getMessageCount());
}
+
public Message[] getMessages(int from, int to) throws MessagingException {
if (to == -1 || to < from) {
- throw new IndexOutOfBoundsException(
- "Invalid message range: " + from + " to " + to);
+ throw new IndexOutOfBoundsException("Invalid message range: " + from + " to " + to);
}
Message[] result = new Message[to - from + 1];
for (int i = from; i <= to; i++) {
@@ -122,6 +146,7 @@
}
return result;
}
+
public Message[] getMessages(int ids[]) throws MessagingException {
Message[] result = new Message[ids.length];
for (int i = 0; i < ids.length; i++) {
@@ -129,41 +154,59 @@
}
return result;
}
+
public int getMode() {
return mode;
}
+
public abstract String getName();
+
public int getNewMessageCount() throws MessagingException {
return getCount(Flags.Flag.RECENT);
}
+
public abstract Folder getParent() throws MessagingException;
+
public abstract Flags getPermanentFlags();
+
public abstract char getSeparator() throws MessagingException;
+
public Store getStore() {
return store;
}
+
public abstract int getType() throws MessagingException;
+
public int getUnreadMessageCount() throws MessagingException {
return getCount(Flags.Flag.SEEN, false);
}
+
public URLName getURLName() throws MessagingException {
return store.getURLName();
}
+
public abstract boolean hasNewMessages() throws MessagingException;
+
public abstract boolean isOpen();
+
public boolean isSubscribed() {
return _subscribed;
}
+
public Folder[] list() throws MessagingException {
return list("%");
}
+
public abstract Folder[] list(String pattern) throws MessagingException;
+
public Folder[] listSubscribed() throws MessagingException {
return listSubscribed("%");
}
+
public Folder[] listSubscribed(String pattern) throws MessagingException {
return list(pattern);
}
+
protected void notifyConnectionListeners(int type) {
ConnectionEvent event = new ConnectionEvent(this, type);
Iterator it = _connectionListeners.iterator();
@@ -172,80 +215,89 @@
event.dispatch(listener);
}
}
+
protected void notifyFolderListeners(int type) {
Iterator it = _folderListeners.iterator();
- FolderEvent event = new FolderEvent(this,this,type);
+ FolderEvent event = new FolderEvent(this, this, type);
while (it.hasNext()) {
FolderListener listener = (FolderListener) it.next();
event.dispatch(listener);
}
}
- protected void notifyFolderRenamedListeners(
- Folder newFolder) {
+
+ protected void notifyFolderRenamedListeners(Folder newFolder) {
Iterator it = _folderListeners.iterator();
FolderEvent event =
- new FolderEvent(this, this, newFolder, FolderEvent.RENAMED);
+ new FolderEvent(this, this, newFolder, FolderEvent.RENAMED);
while (it.hasNext()) {
FolderListener listener = (FolderListener) it.next();
event.dispatch(listener);
}
}
+
protected void notifyMessageAddedListeners(Message[] messages) {
Iterator it = _messageChangedListeners.iterator();
MessageCountEvent event =
- new MessageCountEvent(
- this,
- MessageCountEvent.ADDED,
- false,
- messages);
+ new MessageCountEvent(this,
+ MessageCountEvent.ADDED,
+ false,
+ messages);
while (it.hasNext()) {
MessageCountEvent listener = (MessageCountEvent) it.next();
event.dispatch(listener);
}
}
+
protected void notifyMessageChangedListeners(int type, Message message) {
Iterator it = _messageChangedListeners.iterator();
MessageChangedEvent event =
- new MessageChangedEvent(this, type, message);
+ new MessageChangedEvent(this, type, message);
while (it.hasNext()) {
MessageCountEvent listener = (MessageCountEvent) it.next();
event.dispatch(listener);
}
}
- protected void notifyMessageRemovedListeners(
- boolean removed,
- Message[] messages) {
+
+ protected void notifyMessageRemovedListeners(boolean removed,
+ Message[] messages) {
Iterator it = _messageChangedListeners.iterator();
MessageCountEvent event =
- new MessageCountEvent(
- this,
- MessageCountEvent.REMOVED,
- removed,
- messages);
+ new MessageCountEvent(this,
+ MessageCountEvent.REMOVED,
+ removed,
+ messages);
while (it.hasNext()) {
MessageCountEvent listener = (MessageCountEvent) it.next();
event.dispatch(listener);
}
}
+
public abstract void open(int mode) throws MessagingException;
+
public void removeConnectionListener(ConnectionListener listener) {
_connectionListeners.remove(listener);
}
+
public void removeFolderListener(FolderListener listener) {
_folderListeners.remove(listener);
}
+
public void removeMessageChangedListener(MessageChangedListener listener) {
_messageChangedListeners.remove(listener);
}
+
public void removeMessageCountListener(MessageCountListener listener) {
_messageCountListeners.remove(listener);
}
+
public abstract boolean renameTo(Folder newName) throws MessagingException;
+
public Message[] search(SearchTerm term) throws MessagingException {
return search(term, getMessages());
}
+
public Message[] search(SearchTerm term, Message[] messages)
- throws MessagingException {
+ throws MessagingException {
List result = new LinkedList();
for (int i = 0; i < messages.length; i++) {
Message message = messages[i];
@@ -255,24 +307,29 @@
}
return (Message[]) result.toArray(MESSAGE_ARRAY);
}
+
public void setFlags(int from, int to, Flags flags, boolean value)
- throws MessagingException {
+ throws MessagingException {
setFlags(getMessages(from, to), flags, value);
}
+
public void setFlags(int ids[], Flags flags, boolean value)
- throws MessagingException {
+ throws MessagingException {
setFlags(getMessages(ids), flags, value);
}
+
public void setFlags(Message[] messages, Flags flags, boolean value)
- throws MessagingException {
+ throws MessagingException {
for (int i = 0; i < messages.length; i++) {
Message message = messages[i];
message.setFlags(flags, value);
}
}
+
public void setSubscribed(boolean subscribed) throws MessagingException {
_subscribed = subscribed;
}
+
public String toString() {
String name = getFullName();
if (name == null) {
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/FolderClosedException.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/FolderClosedException.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/FolderClosedException.java Sun Oct 10 14:02:50 2004
@@ -16,18 +16,22 @@
*/
package javax.mail;
+
/**
* @version $Rev$ $Date$
*/
public class FolderClosedException extends MessagingException {
private transient Folder _folder;
+
public FolderClosedException(Folder folder) {
this(folder, "Folder Closed: " + folder.getName());
}
+
public FolderClosedException(Folder folder, String message) {
super(message);
_folder = folder;
}
+
public Folder getFolder() {
return _folder;
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/FolderNotFoundException.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/FolderNotFoundException.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/FolderNotFoundException.java Sun Oct 10 14:02:50 2004
@@ -16,24 +16,30 @@
*/
package javax.mail;
+
/**
* @version $Rev$ $Date$
*/
public class FolderNotFoundException extends MessagingException {
private transient Folder _folder;
+
public FolderNotFoundException() {
super();
}
+
public FolderNotFoundException(Folder folder) {
this(folder, "Folder not found: " + folder.getName());
}
+
public FolderNotFoundException(Folder folder, String message) {
super(message);
_folder = folder;
}
+
public FolderNotFoundException(String message, Folder folder) {
this(folder, message);
}
+
public Folder getFolder() {
return _folder;
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/Header.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/Header.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/Header.java Sun Oct 10 14:02:50 2004
@@ -16,19 +16,23 @@
*/
package javax.mail;
+
/**
* @version $Rev$ $Date$
*/
public class Header {
private String _name;
private String _value;
+
public Header(String name, String value) {
_name = name;
_value = value;
}
+
public String getName() {
return _name;
}
+
public String getValue() {
return _value;
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/IllegalWriteException.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/IllegalWriteException.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/IllegalWriteException.java Sun Oct 10 14:02:50 2004
@@ -16,6 +16,7 @@
*/
package javax.mail;
+
/**
* @version $Rev$ $Date$
*/
@@ -23,6 +24,7 @@
public IllegalWriteException() {
super();
}
+
public IllegalWriteException(String message) {
super(message);
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/Message.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/Message.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/Message.java Sun Oct 10 14:02:50 2004
@@ -16,12 +16,14 @@
*/
package javax.mail;
+
import java.io.ObjectStreamException;
import java.io.Serializable;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
import javax.mail.search.SearchTerm;
+
/**
* @version $Rev$ $Date$
*/
@@ -31,9 +33,11 @@
public static final RecipientType CC = new RecipientType("Cc");
public static final RecipientType TO = new RecipientType("To");
protected String type;
+
protected RecipientType(String type) {
this.type = type;
}
+
protected Object readResolve() throws ObjectStreamException {
if (type.equals("To")) {
return TO;
@@ -45,32 +49,41 @@
return this;
}
}
+
public String toString() {
return type;
}
}
+
private static final Address[] ADDRESS_ARRAY = new Address[0];
protected boolean expunged;
protected Folder folder;
protected int msgnum;
protected Session session;
+
protected Message() {
}
+
protected Message(Folder folder, int number) {
this.folder = folder;
this.msgnum = number;
}
+
protected Message(Session session) {
this.session = session;
}
+
public abstract void addFrom(Address[] addresses)
- throws MessagingException;
+ throws MessagingException;
+
public void addRecipient(RecipientType type, Address address)
- throws MessagingException {
- addRecipients(type, new Address[] { address });
+ throws MessagingException {
+ addRecipients(type, new Address[]{address});
}
+
public abstract void addRecipients(RecipientType type, Address[] addresses)
- throws MessagingException;
+ throws MessagingException;
+
public Address[] getAllRecipients() throws MessagingException {
Address[] to = getRecipients(RecipientType.TO);
Address[] cc = getRecipients(RecipientType.CC);
@@ -87,39 +100,55 @@
}
return (Address[]) result.toArray(ADDRESS_ARRAY);
}
+
public abstract Flags getFlags() throws MessagingException;
+
public Folder getFolder() {
return folder;
}
+
public abstract Address[] getFrom() throws MessagingException;
+
public int getMessageNumber() {
return msgnum;
}
+
public abstract Date getReceivedDate() throws MessagingException;
+
public abstract Address[] getRecipients(RecipientType type)
- throws MessagingException;
+ throws MessagingException;
+
public Address[] getReplyTo() throws MessagingException {
return getFrom();
}
+
public abstract Date getSentDate() throws MessagingException;
+
public abstract String getSubject() throws MessagingException;
+
public boolean isExpunged() {
return expunged;
}
+
public boolean isSet(Flags.Flag flag) throws MessagingException {
return getFlags().contains(flag);
}
+
public boolean match(SearchTerm term) throws MessagingException {
return term.match(this);
}
+
public abstract Message reply(boolean replyToAll)
- throws MessagingException;
+ throws MessagingException;
+
public abstract void saveChanges() throws MessagingException;
+
protected void setExpunged(boolean expunged) {
this.expunged = expunged;
}
+
public void setFlag(Flags.Flag flag, boolean set)
- throws MessagingException {
+ throws MessagingException {
Flags flags = getFlags();
if (set) {
flags.add(flag);
@@ -127,22 +156,31 @@
flags.remove(flag);
}
}
+
public abstract void setFlags(Flags flags, boolean set)
- throws MessagingException;
+ throws MessagingException;
+
public abstract void setFrom() throws MessagingException;
+
public abstract void setFrom(Address address) throws MessagingException;
+
protected void setMessageNumber(int number) {
msgnum = number;
}
+
public void setRecipient(RecipientType type, Address address)
- throws MessagingException {
- setRecipients(type, new Address[] { address });
+ throws MessagingException {
+ setRecipients(type, new Address[]{address});
}
+
public abstract void setRecipients(RecipientType type, Address[] addresses)
- throws MessagingException;
+ throws MessagingException;
+
public void setReplyTo(Address[] addresses) throws MessagingException {
throw new MethodNotSupportedException("setReplyTo not implemented");
}
+
public abstract void setSentDate(Date sent) throws MessagingException;
+
public abstract void setSubject(String subject) throws MessagingException;
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/MessageAware.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/MessageAware.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/MessageAware.java Sun Oct 10 14:02:50 2004
@@ -16,6 +16,7 @@
*/
package javax.mail;
+
/**
* @version $Rev$ $Date$
*/
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/MessageContext.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/MessageContext.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/MessageContext.java Sun Oct 10 14:02:50 2004
@@ -16,33 +16,39 @@
*/
package javax.mail;
+
/**
* @version $Rev$ $Date$
*/
public class MessageContext {
private Part _part;
+
public MessageContext(Part part) {
_part = part;
}
+
public Message getMessage() {
return getMessageFrom(getPart());
}
+
private Message getMessageFrom(Part part) {
if (part instanceof Message) {
- return (Message)part;
+ return (Message) part;
} else if (part instanceof BodyPart) {
- Part parent = ((Multipart)part).getParent();
+ Part parent = ((Multipart) part).getParent();
return getMessageFrom(parent);
} else if (part instanceof Multipart) {
- Part parent = ((Multipart)part).getParent();
+ Part parent = ((Multipart) part).getParent();
return getMessageFrom(parent);
} else {
return null;
}
}
+
public Part getPart() {
return _part;
}
+
public Session getSession() {
Message message = getMessage();
if (message == null) {
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/MessageRemovedException.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/MessageRemovedException.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/MessageRemovedException.java Sun Oct 10 14:02:50 2004
@@ -16,6 +16,7 @@
*/
package javax.mail;
+
/**
* @version $Rev$ $Date$
*/
@@ -23,6 +24,7 @@
public MessageRemovedException() {
super();
}
+
public MessageRemovedException(String message) {
super(message);
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/MessagingException.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/MessagingException.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/MessagingException.java Sun Oct 10 14:02:50 2004
@@ -16,25 +16,31 @@
*/
package javax.mail;
+
/**
* @version $Rev$ $Date$
*/
public class MessagingException extends Exception {
// Required because serialization expects it to be here
private Exception next;
+
public MessagingException() {
super();
}
+
public MessagingException(String message) {
super(message);
}
+
public MessagingException(String message, Exception cause) {
super(message, cause);
next = cause;
}
+
public Exception getNextException() {
return next;
}
+
public synchronized boolean setNextException(Exception cause) {
if (next == null) {
initCause(cause);
@@ -46,17 +52,18 @@
return false;
}
}
+
public String getMessage() {
Exception next = getNextException();
if (next == null) {
return super.getMessage();
} else {
return super.getMessage()
- + " ("
- + next.getClass().getName()
- + ": "
- + next.getMessage()
- + ")";
+ + " ("
+ + next.getClass().getName()
+ + ": "
+ + next.getMessage()
+ + ")";
}
}
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/MethodNotSupportedException.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/MethodNotSupportedException.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/MethodNotSupportedException.java Sun Oct 10 14:02:50 2004
@@ -16,6 +16,7 @@
*/
package javax.mail;
+
/**
* @version $Rev$ $Date$
*/
@@ -23,6 +24,7 @@
public MethodNotSupportedException() {
super();
}
+
public MethodNotSupportedException(String message) {
super(message);
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/Multipart.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/Multipart.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/Multipart.java Sun Oct 10 14:02:50 2004
@@ -16,9 +16,11 @@
*/
package javax.mail;
+
import java.io.IOException;
import java.io.OutputStream;
import java.util.Vector;
+
/**
* @version $Rev$ $Date$
*/
@@ -26,34 +28,44 @@
protected String contentType;
protected Part parent;
protected Vector parts = new Vector();
+
protected Multipart() {
}
+
public void addBodyPart(BodyPart part) throws MessagingException {
parts.add(part);
}
+
public void addBodyPart(BodyPart part, int pos) throws MessagingException {
parts.add(pos, part);
}
+
public BodyPart getBodyPart(int index) throws MessagingException {
return (BodyPart) parts.get(index);
}
+
public String getContentType() {
return contentType;
}
+
public int getCount() throws MessagingException {
return parts.size();
}
+
public Part getParent() {
return parent;
}
+
public boolean removeBodyPart(BodyPart part) throws MessagingException {
return parts.remove(part);
}
+
public void removeBodyPart(int index) throws MessagingException {
parts.remove(index);
}
+
protected void setMultipartDataSource(MultipartDataSource mds)
- throws MessagingException {
+ throws MessagingException {
// TODO review implementation
contentType = mds.getContentType();
int size = mds.getCount();
@@ -61,9 +73,11 @@
addBodyPart(mds.getBodyPart(i));
}
}
+
public void setParent(Part part) {
parent = part;
}
+
public abstract void writeTo(OutputStream out)
- throws IOException, MessagingException;
+ throws IOException, MessagingException;
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/MultipartDataSource.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/MultipartDataSource.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/MultipartDataSource.java Sun Oct 10 14:02:50 2004
@@ -16,11 +16,14 @@
*/
package javax.mail;
+
import javax.activation.DataSource;
+
/**
* @version $Rev$ $Date$
*/
public interface MultipartDataSource extends DataSource {
public abstract BodyPart getBodyPart(int index) throws MessagingException;
+
public abstract int getCount();
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/NoSuchProviderException.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/NoSuchProviderException.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/NoSuchProviderException.java Sun Oct 10 14:02:50 2004
@@ -16,6 +16,7 @@
*/
package javax.mail;
+
/**
* @version $Rev$ $Date$
*/
@@ -23,6 +24,7 @@
public NoSuchProviderException() {
super();
}
+
public NoSuchProviderException(String message) {
super(message);
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/Part.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/Part.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/Part.java Sun Oct 10 14:02:50 2004
@@ -16,52 +16,79 @@
*/
package javax.mail;
+
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Enumeration;
import javax.activation.DataHandler;
+
/**
* @version $Rev$ $Date$
*/
public interface Part {
public static final String ATTACHMENT = "attachment";
public static final String INLINE = "inline";
+
public abstract void addHeader(String name, String value)
- throws MessagingException;
+ throws MessagingException;
+
public abstract Enumeration getAllHeaders() throws MessagingException;
+
public abstract Object getContent() throws IOException, MessagingException;
+
public abstract String getContentType() throws MessagingException;
+
public abstract DataHandler getDataHandler() throws MessagingException;
+
public abstract String getDescription() throws MessagingException;
+
public abstract String getDisposition() throws MessagingException;
+
public abstract String getFileName() throws MessagingException;
+
public abstract String[] getHeader(String name) throws MessagingException;
+
public abstract InputStream getInputStream()
- throws IOException, MessagingException;
+ throws IOException, MessagingException;
+
public abstract int getLineCount() throws MessagingException;
+
public abstract Enumeration getMatchingHeaders(String[] names)
- throws MessagingException;
+ throws MessagingException;
+
public abstract Enumeration getNonMatchingHeaders(String[] names)
- throws MessagingException;
+ throws MessagingException;
+
public abstract int getSize() throws MessagingException;
+
public abstract boolean isMimeType(String mimeType)
- throws MessagingException;
+ throws MessagingException;
+
public abstract void removeHeader(String name) throws MessagingException;
+
public abstract void setContent(Multipart content)
- throws MessagingException;
+ throws MessagingException;
+
public abstract void setContent(Object content, String type)
- throws MessagingException;
+ throws MessagingException;
+
public abstract void setDataHandler(DataHandler handler)
- throws MessagingException;
+ throws MessagingException;
+
public abstract void setDescription(String description)
- throws MessagingException;
+ throws MessagingException;
+
public abstract void setDisposition(String disposition)
- throws MessagingException;
+ throws MessagingException;
+
public abstract void setFileName(String name) throws MessagingException;
+
public abstract void setHeader(String name, String value)
- throws MessagingException;
+ throws MessagingException;
+
public abstract void setText(String content) throws MessagingException;
+
public abstract void writeTo(OutputStream out)
- throws IOException, MessagingException;
+ throws IOException, MessagingException;
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/PasswordAuthentication.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/PasswordAuthentication.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/PasswordAuthentication.java Sun Oct 10 14:02:50 2004
@@ -16,19 +16,23 @@
*/
package javax.mail;
+
/**
* @version $Rev$ $Date$
*/
public final class PasswordAuthentication {
private String _user;
private String _password;
+
public PasswordAuthentication(String user, String password) {
_user = user;
_password = password;
}
+
public String getUserName() {
return _user;
}
+
public String getPassword() {
return _password;
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/Provider.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/Provider.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/Provider.java Sun Oct 10 14:02:50 2004
@@ -16,29 +16,32 @@
*/
package javax.mail;
+
/**
* @version $Rev$ $Date$
*/
public class Provider {
- Provider(
- String protocol,
- String className,
- Type type,
- String vendor,
- String version) {
+ Provider(String protocol,
+ String className,
+ Type type,
+ String vendor,
+ String version) {
_protocol = protocol;
_className = className;
_type = type;
_vendor = vendor;
_version = version;
}
+
public static class Type {
private String _name;
public static final Type STORE = new Type("store");
public static final Type TRANSPORT = new Type("transport");
+
private Type(String name) {
_name = name;
}
+
static Type getType(String name) {
if (name.equals("store")) {
return STORE;
@@ -49,34 +52,41 @@
}
}
}
+
private String _className;
private String _protocol;
private Type _type;
private String _vendor;
private String _version;
+
public String getClassName() {
return _className;
}
+
public String getProtocol() {
return _protocol;
}
+
public Type getType() {
return _type;
}
+
public String getVendor() {
return _vendor;
}
+
public String getVersion() {
return _version;
}
+
public String toString() {
return "protocol="
- + _protocol
- + "; type="
- + _type
- + "; class="
- + _className
- + (_vendor == null ? "" : "; vendor=" + _vendor)
- + (_version == null ? "" : ";version=" + _version);
+ + _protocol
+ + "; type="
+ + _type
+ + "; class="
+ + _className
+ + (_vendor == null ? "" : "; vendor=" + _vendor)
+ + (_version == null ? "" : ";version=" + _version);
}
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/ReadOnlyFolderException.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/ReadOnlyFolderException.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/ReadOnlyFolderException.java Sun Oct 10 14:02:50 2004
@@ -16,18 +16,22 @@
*/
package javax.mail;
+
/**
* @version $Rev$ $Date$
*/
public class ReadOnlyFolderException extends MessagingException {
private transient Folder _folder;
+
public ReadOnlyFolderException(Folder folder) {
this(folder, "Folder not found: " + folder.getName());
}
+
public ReadOnlyFolderException(Folder folder, String message) {
super(message);
_folder = folder;
}
+
public Folder getFolder() {
return _folder;
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/SendFailedException.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/SendFailedException.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/SendFailedException.java Sun Oct 10 14:02:50 2004
@@ -16,6 +16,7 @@
*/
package javax.mail;
+
/**
* @version $Rev$ $Date$
*/
@@ -23,32 +24,38 @@
protected transient Address invalid[];
protected transient Address validSent[];
protected transient Address validUnsent[];
+
public SendFailedException() {
super();
}
+
public SendFailedException(String message) {
super(message);
}
+
public SendFailedException(String message, Exception cause) {
super(message, cause);
}
- public SendFailedException(
- String message,
- Exception cause,
- Address[] validSent,
- Address[] validUnsent,
- Address[] invalid) {
+
+ public SendFailedException(String message,
+ Exception cause,
+ Address[] validSent,
+ Address[] validUnsent,
+ Address[] invalid) {
this(message, cause);
this.invalid = invalid;
this.validSent = validSent;
this.validUnsent = validUnsent;
}
+
public Address[] getValidSentAddresses() {
return validSent;
}
+
public Address[] getValidUnsentAddresses() {
return validUnsent;
}
+
public Address[] getInvalidAddresses() {
return invalid;
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/Service.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/Service.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/Service.java Sun Oct 10 14:02:50 2004
@@ -16,6 +16,7 @@
*/
package javax.mail;
+
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Enumeration;
@@ -23,11 +24,11 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Vector;
-
import javax.mail.event.ConnectionEvent;
import javax.mail.event.ConnectionListener;
import javax.mail.event.MailEvent;
import javax.mail.event.TransportListener;
+
/**
* @version $Rev$ $Date$
*/
@@ -37,24 +38,29 @@
protected boolean debug;
protected Session session;
protected URLName url;
+
protected Service(Session session, URLName url) {
this.session = session;
this.url = url;
}
+
public void addConnectionListener(ConnectionListener listener) {
_connectionListeners.add(listener);
}
+
public void close() throws MessagingException {
// if we're not connected, ignore
setConnected(false);
}
+
public void connect() throws MessagingException {
String host = session.getProperty("mail.host");
String user = session.getProperty("mail.user");
connect(host, -1, user, null);
}
+
public void connect(String host, int port, String user, String password)
- throws MessagingException {
+ throws MessagingException {
if (_connected) {
throw new IllegalStateException("Already connected");
}
@@ -66,12 +72,11 @@
// TODO I18N
try {
PasswordAuthentication pa =
- session.requestPasswordAuthentication(
- InetAddress.getByName(host),
- port,
- null,
- "Please enter your password",
- user);
+ session.requestPasswordAuthentication(InetAddress.getByName(host),
+ port,
+ null,
+ "Please enter your password",
+ user);
password = pa.getPassword();
user = pa.getUserName();
} catch (UnknownHostException uhe) {
@@ -84,10 +89,12 @@
// In either case, this is safe.
setURLName(getURLName());
}
+
public void connect(String host, String user, String password)
- throws MessagingException {
+ throws MessagingException {
connect(host, -1, user, password);
}
+
protected void finalize() throws Throwable {
try {
super.finalize();
@@ -95,12 +102,15 @@
close();
}
}
+
public URLName getURLName() {
return url;
}
+
public boolean isConnected() {
return _connected;
}
+
protected void notifyConnectionListeners(int type) {
ConnectionEvent event = new ConnectionEvent(this, type);
Iterator it = _connectionListeners.iterator();
@@ -109,14 +119,15 @@
event.dispatch(listener);
}
}
- protected boolean protocolConnect(
- String host,
- int port,
- String user,
- String password)
- throws MessagingException {
+
+ protected boolean protocolConnect(String host,
+ int port,
+ String user,
+ String password)
+ throws MessagingException {
return false;
}
+
protected void queueEvent(MailEvent event, Vector listeners) {
Enumeration enumeration = listeners.elements();
while (enumeration.hasMoreElements()) {
@@ -124,9 +135,11 @@
event.dispatch(listeners);
}
}
+
public void removeConnectionListener(ConnectionListener listener) {
_connectionListeners.remove(listener);
}
+
protected void setConnected(boolean connected) {
boolean old = _connected;
_connected = connected;
@@ -138,9 +151,11 @@
}
}
}
+
protected void setURLName(URLName url) {
this.url = url;
}
+
public String toString() {
if (url == null) {
return super.toString();
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/Session.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/Session.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/Session.java Sun Oct 10 14:02:50 2004
@@ -16,6 +16,7 @@
*/
package javax.mail;
+
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
@@ -29,6 +30,7 @@
import javax.mail.Provider.Type;
import javax.mail.internet.ParameterList;
import javax.mail.internet.ParseException;
+
/**
* @version $Rev$ $Date$
*/
@@ -38,13 +40,15 @@
private static Authenticator DEFAULT_AUTHENTICATOR;
private static Session DEFAULT_SESSION;
private static final Provider[] PROVIDER_ARRAY = new Provider[0];
+
// Read in the files and configure the Providers
static {
loadProviders();
loadAddressMap();
}
- private Session(){}
+ private Session() {
+ }
public synchronized static Session getDefaultInstance(Properties properties) {
if (DEFAULT_SESSION == null) {
@@ -52,12 +56,12 @@
}
return DEFAULT_SESSION;
}
- public synchronized static Session getDefaultInstance(
- Properties properties,
- Authenticator authenticator) {
+
+ public synchronized static Session getDefaultInstance(Properties properties,
+ Authenticator authenticator) {
if (DEFAULT_AUTHENTICATOR == null
- || DEFAULT_AUTHENTICATOR == authenticator
- || DEFAULT_AUTHENTICATOR.getClass().getClassLoader()
+ || DEFAULT_AUTHENTICATOR == authenticator
+ || DEFAULT_AUTHENTICATOR.getClass().getClassLoader()
== authenticator.getClass().getClassLoader()) {
if (DEFAULT_SESSION == null) {
DEFAULT_SESSION = getInstance(properties, authenticator);
@@ -68,26 +72,26 @@
throw new SecurityException("Cannot access default instance with given authenticator");
}
}
+
public static Session getInstance(Properties properties) {
return getInstance(properties, null);
}
- public static Session getInstance(
- Properties properties,
- Authenticator authenticator) {
+
+ public static Session getInstance(Properties properties,
+ Authenticator authenticator) {
Session session = new Session();
session._authenticator = authenticator;
session._properties = new Properties(properties);
session._debug =
- Boolean.getBoolean(properties.getProperty("mail.debug", "false"));
+ Boolean.getBoolean(properties.getProperty("mail.debug", "false"));
return session;
}
+
private static void loadAddressMap() {
try {
String slash = System.getProperty("file.separator");
String home = System.getProperty("java.home");
- loadAddressMap(
- new FileInputStream(
- home + slash + "lib" + slash + "javamail.address.map"));
+ loadAddressMap(new FileInputStream(home + slash + "lib" + slash + "javamail.address.map"));
} catch (RuntimeException e) {
// continue; we are trying to load a non-existent file; doesn't matter if we get security/IO exceptions
} catch (IOException e) {
@@ -110,10 +114,12 @@
// continue; we are trying to load a non-existent file; doesn't matter if we get security/IO exceptions
}
}
+
private static void loadAddressMap(InputStream in) throws IOException {
if (in == null) {
return;
- };
+ }
+ ;
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String line;
while ((line = br.readLine()) != null) {
@@ -127,16 +133,16 @@
}
br.close();
}
+
private static void loadAddressMap(String file) throws IOException {
loadAddressMap(Session.class.getResourceAsStream(file));
}
+
private static void loadProviders() {
try {
String slash = System.getProperty("file.separator");
String home = System.getProperty("java.home");
- loadProviders(
- new FileInputStream(
- home + slash + "lib" + slash + "javamail.providers"));
+ loadProviders(new FileInputStream(home + slash + "lib" + slash + "javamail.providers"));
} catch (RuntimeException e) {
// continue; we are trying to load a non-existent file; doesn't matter if we get security/IO exceptions
} catch (IOException e) {
@@ -167,8 +173,9 @@
e.printStackTrace();
}
}
+
private static void loadProviders(InputStream in)
- throws IOException, ParseException {
+ throws IOException, ParseException {
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String line;
while ((line = br.readLine()) != null) {
@@ -185,90 +192,106 @@
String vendor = pl.get("vendor");
String version = pl.get("version");
Provider provider =
- new Provider(protocol, className, type, vendor, version);
+ new Provider(protocol, className, type, vendor, version);
_providers.put(typeString, provider);
}
br.close();
}
+
private static void loadProviders(String file)
- throws ParseException, IOException {
+ throws ParseException, IOException {
loadProviders(Session.class.getResourceAsStream(file));
}
+
private Authenticator _authenticator;
private boolean _debug;
private PrintStream _debugOut;
private Map _passwordAuthentications = new HashMap();
private Properties _properties = new Properties();
+
public boolean getDebug() {
return _debug;
}
+
public PrintStream getDebugOut() {
return System.err;
}
+
public Folder getFolder(URLName name) throws MessagingException {
// TODO Implement
return null;
}
+
public PasswordAuthentication getPasswordAuthentication(URLName name) {
return (PasswordAuthentication) _passwordAuthentications.get(name);
}
+
public Properties getProperties() {
return _properties;
}
+
public String getProperty(String property) {
return getProperties().getProperty(property);
}
+
public Provider getProvider(String name) throws NoSuchProviderException {
// TODO Implement
// Lookup from
return (Provider) _providers.get(name);
}
+
public Provider[] getProviders() {
return (Provider[]) _providers.values().toArray(PROVIDER_ARRAY);
}
+
public Store getStore() throws NoSuchProviderException {
return getStore(_properties.getProperty("mail.store.protocol"));
}
+
public Store getStore(Provider provider) throws NoSuchProviderException {
Store store;
try {
store =
- (Store) Class.forName(provider.getClassName()).newInstance();
+ (Store) Class.forName(provider.getClassName()).newInstance();
} catch (Exception e) {
throw new NoSuchProviderException(e.toString());
}
return store;
}
+
public Store getStore(String protocol) throws NoSuchProviderException {
if (protocol == null) {
throw new NoSuchProviderException("No protocol specified in mail.store.protocol property or none given");
}
Provider provider = (Provider) _providers.get(protocol);
if (provider == null) {
- throw new NoSuchProviderException(
- "Unknown protocol for " + protocol);
+ throw new NoSuchProviderException("Unknown protocol for " + protocol);
}
return getStore(provider);
}
+
public Store getStore(URLName url) throws NoSuchProviderException {
return getStore(url.getProtocol());
}
+
public Transport getTransport() throws NoSuchProviderException {
return getTransport(_properties.getProperty("mail.transport.protocol"));
}
+
public Transport getTransport(Address address)
- throws NoSuchProviderException {
+ throws NoSuchProviderException {
String type = address.getType();
// type is 'rfc822' -> 'smtp'
// type is 'news' -> 'nntp'
return getTransport((String) _addressMap.get(type));
}
+
public Transport getTransport(Provider provider)
- throws NoSuchProviderException {
+ throws NoSuchProviderException {
Transport transport;
try {
transport =
- (Transport) Class
+ (Transport) Class
.forName(provider.getClassName())
.newInstance();
} catch (Exception e) {
@@ -276,36 +299,41 @@
}
return transport;
}
+
public Transport getTransport(String protocol)
- throws NoSuchProviderException {
+ throws NoSuchProviderException {
// TODO Implement
Provider provider = null; // lookup
return getTransport(provider);
}
+
public Transport getTransport(URLName name)
- throws NoSuchProviderException {
+ throws NoSuchProviderException {
return getTransport(name.getProtocol());
}
- public PasswordAuthentication requestPasswordAuthentication(
- InetAddress host,
- int port,
- String protocol,
- String prompt,
- String defaultUserName) {
- // TODO Implement this, probably by showing a dialog box of some sorts?
- throw new UnsupportedOperationException("Method not yet implemented");
+
+ public PasswordAuthentication requestPasswordAuthentication(InetAddress host,
+ int port,
+ String protocol,
+ String prompt,
+ String defaultUserName) {
+ // TODO Implement this, probably by showing a dialog box of some sorts?
+ throw new UnsupportedOperationException("Method not yet implemented");
}
+
public void setDebug(boolean debug) {
_debug = debug;
}
+
public void setDebugOut(PrintStream out) {
_debugOut = out;
}
- public void setPasswordAuthentication(
- URLName name,
- PasswordAuthentication authenticator) {
+
+ public void setPasswordAuthentication(URLName name,
+ PasswordAuthentication authenticator) {
_passwordAuthentications.put(name, authenticator);
}
+
public void setProvider(Provider provider) throws NoSuchProviderException {
String protocol = provider.getProtocol();
_providers.put(protocol, provider);
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/Store.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/Store.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/Store.java Sun Oct 10 14:02:50 2004
@@ -16,6 +16,7 @@
*/
package javax.mail;
+
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
@@ -23,6 +24,7 @@
import javax.mail.event.FolderListener;
import javax.mail.event.StoreEvent;
import javax.mail.event.StoreListener;
+
/**
* @version $Rev$ $Date$
*/
@@ -30,27 +32,37 @@
private static final Folder[] FOLDER_ARRAY = new Folder[0];
private List _folderListeners = new LinkedList();
private List _storeListeners = new LinkedList();
+
protected Store(Session session, URLName name) {
- super(session,name);
+ super(session, name);
}
+
public void addFolderListener(FolderListener listener) {
_folderListeners.add(listener);
}
+
public void addStoreListener(StoreListener listener) {
_storeListeners.add(listener);
}
+
public abstract Folder getDefaultFolder() throws MessagingException;
+
public abstract Folder getFolder(String name) throws MessagingException;
+
public abstract Folder getFolder(URLName name) throws MessagingException;
+
public Folder[] getPersonalNamespaces() throws MessagingException {
- return new Folder[] { getDefaultFolder()};
+ return new Folder[]{getDefaultFolder()};
}
+
public Folder[] getSharedNamespaces() throws MessagingException {
return FOLDER_ARRAY;
}
+
public Folder[] getUserNamespaces(String name) throws MessagingException {
return FOLDER_ARRAY;
}
+
protected void notifyFolderListeners(int type, Folder folder) {
Iterator it = _folderListeners.iterator();
FolderEvent event = new FolderEvent(this, folder, type);
@@ -59,17 +71,18 @@
event.dispatch(listener);
}
}
- protected void notifyFolderRenamedListeners(
- Folder oldFolder,
- Folder newFolder) {
+
+ protected void notifyFolderRenamedListeners(Folder oldFolder,
+ Folder newFolder) {
Iterator it = _folderListeners.iterator();
FolderEvent event =
- new FolderEvent(this, oldFolder, newFolder, FolderEvent.RENAMED);
+ new FolderEvent(this, oldFolder, newFolder, FolderEvent.RENAMED);
while (it.hasNext()) {
FolderListener listener = (FolderListener) it.next();
event.dispatch(listener);
}
}
+
protected void notifyStoreListeners(int type, String message) {
Iterator it = _storeListeners.iterator();
StoreEvent event = new StoreEvent(this, type, message);
@@ -78,9 +91,11 @@
listener.notification(event);
}
}
+
public void removeFolderListener(FolderListener listener) {
_folderListeners.remove(listener);
}
+
public void removeStoreListener(StoreListener listener) {
_storeListeners.remove(listener);
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/StoreClosedException.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/StoreClosedException.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/StoreClosedException.java Sun Oct 10 14:02:50 2004
@@ -16,18 +16,22 @@
*/
package javax.mail;
+
/**
* @version $Rev$ $Date$
*/
public class StoreClosedException extends MessagingException {
private transient Store _store;
+
public StoreClosedException(Store store) {
super();
_store = store;
}
+
public StoreClosedException(Store store, String message) {
super(message);
}
+
public Store getStore() {
return _store;
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/Transport.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/Transport.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/Transport.java Sun Oct 10 14:02:50 2004
@@ -16,11 +16,13 @@
*/
package javax.mail;
+
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import javax.mail.event.TransportEvent;
import javax.mail.event.TransportListener;
+
/**
* @version $Rev$ $Date$
*/
@@ -28,42 +30,47 @@
public static void send(Message message) throws MessagingException {
send(message, message.getAllRecipients());
}
+
public static void send(Message message, Address[] addresses)
- throws MessagingException {
+ throws MessagingException {
// TODO Implement
Transport transport = null; // Lookup based on protocol?
transport.sendMessage(message, addresses);
}
+
private List _listeners = new LinkedList();
+
public Transport(Session session, URLName name) {
- super(session,name);
+ super(session, name);
}
+
public void addTransportListener(TransportListener listener) {
_listeners.add(listener);
}
- protected void notifyTransportListeners(
- int type,
- Address[] validSent,
- Address[] validUnsent,
- Address[] invalid,
- Message message) {
+
+ protected void notifyTransportListeners(int type,
+ Address[] validSent,
+ Address[] validUnsent,
+ Address[] invalid,
+ Message message) {
TransportEvent event =
- new TransportEvent(
- this,
- type,
- validSent,
- validUnsent,
- invalid,
- message);
+ new TransportEvent(this,
+ type,
+ validSent,
+ validUnsent,
+ invalid,
+ message);
Iterator it = _listeners.iterator();
while (it.hasNext()) {
TransportListener listener = (TransportListener) it.next();
event.dispatch(listener);
}
}
+
public void removeTransportListener(TransportListener listener) {
_listeners.remove(listener);
}
+
public abstract void sendMessage(Message message, Address[] addresses)
- throws MessagingException;
+ throws MessagingException;
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/UIDFolder.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/UIDFolder.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/UIDFolder.java Sun Oct 10 14:02:50 2004
@@ -16,21 +16,29 @@
*/
package javax.mail;
+
/**
* @version $Rev$ $Date$
*/
public interface UIDFolder {
public static final long LASTUID = -1;
+
public abstract long getUIDValidity() throws MessagingException;
+
public abstract Message getMessageByUID(long uid)
- throws MessagingException;
+ throws MessagingException;
+
public abstract Message[] getMessagesByUID(long start, long end)
- throws MessagingException;
+ throws MessagingException;
+
public abstract Message[] getMessagesByUID(long[] ids)
- throws MessagingException;
+ throws MessagingException;
+
public abstract long getUID(Message message) throws MessagingException;
+
public static class FetchProfileItem extends FetchProfile.Item {
public static final FetchProfileItem UID = new FetchProfileItem("Uid");
+
protected FetchProfileItem(String name) {
super(name);
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/event/ConnectionAdapter.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/event/ConnectionAdapter.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/event/ConnectionAdapter.java Sun Oct 10 14:02:50 2004
@@ -16,14 +16,17 @@
*/
package javax.mail.event;
+
/**
* @version $Rev$ $Date$
*/
public abstract class ConnectionAdapter implements ConnectionListener {
public void closed(ConnectionEvent event) {
}
+
public void disconnected(ConnectionEvent event) {
}
+
public void opened(ConnectionEvent event) {
}
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/event/ConnectionEvent.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/event/ConnectionEvent.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/event/ConnectionEvent.java Sun Oct 10 14:02:50 2004
@@ -16,6 +16,7 @@
*/
package javax.mail.event;
+
/**
* @version $Rev$ $Date$
*/
@@ -24,6 +25,7 @@
public static final int DISCONNECTED = 2;
public static final int OPENED = 1;
protected int type;
+
public ConnectionEvent(Object source, int type) {
super(source);
this.type = type;
@@ -31,6 +33,7 @@
throw new IllegalArgumentException("Unknown type " + type);
}
}
+
public void dispatch(Object listener) {
// assume that it is the right listener type
ConnectionListener l = (ConnectionListener) listener;
@@ -44,6 +47,7 @@
throw new IllegalArgumentException("Unknown type " + type);
}
}
+
public int getType() {
return type;
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/event/ConnectionListener.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/event/ConnectionListener.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/event/ConnectionListener.java Sun Oct 10 14:02:50 2004
@@ -16,12 +16,16 @@
*/
package javax.mail.event;
+
import java.util.EventListener;
+
/**
* @version $Rev$ $Date$
*/
public interface ConnectionListener extends EventListener {
public abstract void closed(ConnectionEvent event);
+
public abstract void disconnected(ConnectionEvent event);
+
public abstract void opened(ConnectionEvent event);
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/event/FolderAdapter.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/event/FolderAdapter.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/event/FolderAdapter.java Sun Oct 10 14:02:50 2004
@@ -16,14 +16,17 @@
*/
package javax.mail.event;
+
/**
* @version $Rev$ $Date$
*/
public abstract class FolderAdapter implements FolderListener {
public void folderCreated(FolderEvent event) {
}
+
public void folderDeleted(FolderEvent event) {
}
+
public void folderRenamed(FolderEvent event) {
}
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/event/FolderEvent.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/event/FolderEvent.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/event/FolderEvent.java Sun Oct 10 14:02:50 2004
@@ -16,7 +16,9 @@
*/
package javax.mail.event;
+
import javax.mail.Folder;
+
/**
* @version $Rev$ $Date$
*/
@@ -27,11 +29,11 @@
protected transient Folder folder;
protected transient Folder newFolder;
protected int type;
- public FolderEvent(
- Object source,
- Folder oldFolder,
- Folder newFolder,
- int type) {
+
+ public FolderEvent(Object source,
+ Folder oldFolder,
+ Folder newFolder,
+ int type) {
super(source);
folder = oldFolder;
this.newFolder = newFolder;
@@ -40,9 +42,11 @@
throw new IllegalArgumentException("Unknown type " + type);
}
}
+
public FolderEvent(Object source, Folder folder, int type) {
this(source, folder, null, type);
}
+
public void dispatch(Object listener) {
// assume that it is the right listener type
FolderListener l = (FolderListener) listener;
@@ -56,12 +60,15 @@
throw new IllegalArgumentException("Unknown type " + type);
}
}
+
public Folder getFolder() {
return folder;
}
+
public Folder getNewFolder() {
return newFolder;
}
+
public int getType() {
return type;
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/event/FolderListener.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/event/FolderListener.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/event/FolderListener.java Sun Oct 10 14:02:50 2004
@@ -16,12 +16,16 @@
*/
package javax.mail.event;
+
import java.util.EventListener;
+
/**
* @version $Rev$ $Date$
*/
public interface FolderListener extends EventListener {
public abstract void folderCreated(FolderEvent event);
+
public abstract void folderDeleted(FolderEvent event);
+
public abstract void folderRenamed(FolderEvent event);
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/event/MailEvent.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/event/MailEvent.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/event/MailEvent.java Sun Oct 10 14:02:50 2004
@@ -16,7 +16,9 @@
*/
package javax.mail.event;
+
import java.util.EventObject;
+
/**
* @version $Rev$ $Date$
*/
@@ -24,5 +26,6 @@
public MailEvent(Object source) {
super(source);
}
+
public abstract void dispatch(Object listener);
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/event/MessageChangedEvent.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/event/MessageChangedEvent.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/event/MessageChangedEvent.java Sun Oct 10 14:02:50 2004
@@ -16,7 +16,9 @@
*/
package javax.mail.event;
+
import javax.mail.Message;
+
/**
* @version $Rev$ $Date$
*/
@@ -25,6 +27,7 @@
public static final int FLAGS_CHANGED = 1;
protected transient Message msg;
protected int type;
+
public MessageChangedEvent(Object source, int type, Message message) {
super(source);
msg = message;
@@ -33,14 +36,17 @@
throw new IllegalArgumentException("Unknown type " + type);
}
}
+
public void dispatch(Object listener) {
// assume that it is the right listener type
MessageChangedListener l = (MessageChangedListener) listener;
l.messageChanged(this);
}
+
public Message getMessage() {
return msg;
}
+
public int getMessageChangeType() {
return type;
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/event/MessageChangedListener.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/event/MessageChangedListener.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/event/MessageChangedListener.java Sun Oct 10 14:02:50 2004
@@ -16,7 +16,9 @@
*/
package javax.mail.event;
+
import java.util.EventListener;
+
/**
* @version $Rev$ $Date$
*/
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/event/MessageCountAdapter.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/event/MessageCountAdapter.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/event/MessageCountAdapter.java Sun Oct 10 14:02:50 2004
@@ -16,12 +16,14 @@
*/
package javax.mail.event;
+
/**
* @version $Rev$ $Date$
*/
public abstract class MessageCountAdapter implements MessageCountListener {
public void messagesAdded(MessageCountEvent event) {
}
+
public void messagesRemoved(MessageCountEvent event) {
}
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/event/MessageCountEvent.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/event/MessageCountEvent.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/event/MessageCountEvent.java Sun Oct 10 14:02:50 2004
@@ -16,8 +16,10 @@
*/
package javax.mail.event;
+
import javax.mail.Folder;
import javax.mail.Message;
+
/**
* @version $Rev$ $Date$
*/
@@ -27,16 +29,17 @@
protected transient Message msgs[];
protected boolean removed;
protected int type;
- public MessageCountEvent(
- Folder folder,
- int type,
- boolean removed,
- Message messages[]) {
+
+ public MessageCountEvent(Folder folder,
+ int type,
+ boolean removed,
+ Message messages[]) {
super(folder);
msgs = messages;
this.type = type;
this.removed = removed;
}
+
public void dispatch(Object listener) {
// assume that it is the right listener type
MessageCountListener l = (MessageCountListener) listener;
@@ -48,12 +51,15 @@
throw new IllegalArgumentException("Unknown type " + type);
}
}
+
public Message[] getMessages() {
return msgs;
}
+
public int getType() {
return type;
}
+
public boolean isRemoved() {
return removed;
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/event/MessageCountListener.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/event/MessageCountListener.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/event/MessageCountListener.java Sun Oct 10 14:02:50 2004
@@ -16,11 +16,14 @@
*/
package javax.mail.event;
+
import java.util.EventListener;
+
/**
* @version $Rev$ $Date$
*/
public interface MessageCountListener extends EventListener {
public abstract void messagesAdded(MessageCountEvent event);
+
public abstract void messagesRemoved(MessageCountEvent event);
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/event/StoreEvent.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/event/StoreEvent.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/event/StoreEvent.java Sun Oct 10 14:02:50 2004
@@ -16,7 +16,9 @@
*/
package javax.mail.event;
+
import javax.mail.Store;
+
/**
* @version $Rev$ $Date$
*/
@@ -25,17 +27,21 @@
public static final int NOTICE = 2;
protected int type;
protected String message;
+
public StoreEvent(Store store, int type, String message) {
super(store);
this.type = type;
this.message = message;
}
+
public int getMessageType() {
return type;
}
+
public String getMessage() {
return message;
}
+
public void dispatch(Object listener) {
((StoreListener) listener).notification(this);
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/event/StoreListener.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/event/StoreListener.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/event/StoreListener.java Sun Oct 10 14:02:50 2004
@@ -16,7 +16,9 @@
*/
package javax.mail.event;
+
import java.util.EventListener;
+
/**
* @version $Rev$ $Date$
*/
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/event/TransportAdapter.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/event/TransportAdapter.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/event/TransportAdapter.java Sun Oct 10 14:02:50 2004
@@ -16,14 +16,17 @@
*/
package javax.mail.event;
+
/**
* @version $Rev$ $Date$
*/
public abstract class TransportAdapter implements TransportListener {
public void messageDelivered(TransportEvent event) {
}
+
public void messageNotDelivered(TransportEvent event) {
}
+
public void messagePartiallyDelivered(TransportEvent event) {
}
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/event/TransportEvent.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/event/TransportEvent.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/event/TransportEvent.java Sun Oct 10 14:02:50 2004
@@ -16,9 +16,11 @@
*/
package javax.mail.event;
+
import javax.mail.Address;
import javax.mail.Message;
import javax.mail.Transport;
+
/**
* @version $Rev$ $Date$
*/
@@ -31,39 +33,45 @@
protected transient Address[] validUnsent;
protected transient Address[] invalid;
protected transient Message msg;
- public TransportEvent(
- Transport transport,
- int type,
- Address[] validSent,
- Address[] validUnsent,
- Address[] invalid,
- Message message) {
+
+ public TransportEvent(Transport transport,
+ int type,
+ Address[] validSent,
+ Address[] validUnsent,
+ Address[] invalid,
+ Message message) {
super(transport);
this.type = type;
this.validSent = validSent;
this.validUnsent = validUnsent;
this.invalid = invalid;
if (type != MESSAGE_DELIVERED
- && type != MESSAGE_NOT_DELIVERED
- && type != MESSAGE_PARTIALLY_DELIVERED) {
+ && type != MESSAGE_NOT_DELIVERED
+ && type != MESSAGE_PARTIALLY_DELIVERED) {
throw new IllegalArgumentException("Unknown type " + type);
}
}
+
public Address[] getValidSentAddresses() {
return validSent;
}
+
public Address[] getValidUnsentAddresses() {
return validUnsent;
}
+
public Address[] getInvalidAddresses() {
return invalid;
}
+
public Message getMessage() {
return msg;
}
+
public int getType() {
return type;
}
+
public void dispatch(Object listener) {
// assume that it is the right listener type
TransportListener l = (TransportListener) listener;
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/event/TransportListener.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/event/TransportListener.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/event/TransportListener.java Sun Oct 10 14:02:50 2004
@@ -16,12 +16,16 @@
*/
package javax.mail.event;
+
import java.util.EventListener;
+
/**
* @version $Rev$ $Date$
*/
public interface TransportListener extends EventListener {
public abstract void messageDelivered(TransportEvent event);
+
public abstract void messageNotDelivered(TransportEvent event);
+
public abstract void messagePartiallyDelivered(TransportEvent event);
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/internet/AddressException.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/internet/AddressException.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/internet/AddressException.java Sun Oct 10 14:02:50 2004
@@ -16,32 +16,40 @@
*/
package javax.mail.internet;
+
/**
* @version $Rev$ $Date$
*/
public class AddressException extends ParseException {
protected int pos;
protected String ref;
+
public AddressException() {
this(null);
}
+
public AddressException(String message) {
this(message, null);
}
+
public AddressException(String message, String ref) {
this(message, null, -1);
}
+
public AddressException(String message, String ref, int pos) {
super(message);
this.ref = ref;
this.pos = pos;
}
+
public String getRef() {
return ref;
}
+
public int getPos() {
return pos;
}
+
public String toString() {
return super.toString() + " (" + ref + "," + pos + ")";
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/internet/ContentDisposition.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/internet/ContentDisposition.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/internet/ContentDisposition.java Sun Oct 10 14:02:50 2004
@@ -16,17 +16,21 @@
*/
package javax.mail.internet;
+
// http://www.faqs.org/rfcs/rfc2183.html
+
/**
* @version $Rev$ $Date$
*/
public class ContentDisposition {
private String _disposition;
private ParameterList _list;
+
public ContentDisposition() {
setDisposition(null);
setParameterList(null);
}
+
public ContentDisposition(String disposition) throws ParseException {
ParameterList list = null;
int semicolon;
@@ -37,13 +41,16 @@
setDisposition(disposition);
setParameterList(list);
}
+
public ContentDisposition(String disposition, ParameterList list) {
setDisposition(disposition);
setParameterList(list);
}
+
public String getDisposition() {
return _disposition;
}
+
public String getParameter(String name) {
if (_list == null) {
return null;
@@ -51,16 +58,20 @@
return _list.get(name);
}
}
+
public ParameterList getParameterList() {
return _list;
}
+
public void setDisposition(String string) {
_disposition = string;
}
+
public void setParameter(String name, String value) {
_list = new ParameterList();
_list.set(name, value);
}
+
public void setParameterList(ParameterList list) {
if (list == null) {
_list = new ParameterList();
@@ -68,11 +79,12 @@
_list = list;
}
}
+
public String toString() {
if (_disposition == null && _list.size() == 0) {
return null;
}
return (_disposition == null ? "" : _disposition)
- + (_list.size() == 0 ? "" : _list.toString());
+ + (_list.size() == 0 ? "" : _list.toString());
}
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/internet/ContentType.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/internet/ContentType.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/internet/ContentType.java Sun Oct 10 14:02:50 2004
@@ -16,7 +16,9 @@
*/
package javax.mail.internet;
+
// can be in the form major/minor; charset=jobby
+
/**
* @version $Rev$ $Date$
*/
@@ -24,14 +26,17 @@
private ParameterList _list;
private String _minor;
private String _major;
+
public ContentType() {
this("text", "plain", new ParameterList());
}
+
public ContentType(String major, String minor, ParameterList list) {
_major = major;
_minor = minor;
_list = list;
}
+
public ContentType(String type) throws ParseException {
final int slash = type.indexOf("/");
final int semi = type.indexOf(";");
@@ -47,45 +52,57 @@
throw new ParseException("Type invalid: " + type);
}
}
+
public String getPrimaryType() {
return _major;
}
+
public String getSubType() {
return _minor;
}
+
public String getBaseType() {
return _major + "/" + _minor;
}
+
public String getParameter(String name) {
return (_list == null ? null : _list.get(name));
}
+
public ParameterList getParameterList() {
return _list;
}
+
public void setPrimaryType(String major) {
_major = major;
}
+
public void setSubType(String minor) {
_minor = minor;
}
+
public void setParameter(String name, String value) {
if (_list == null) {
_list = new ParameterList();
}
_list.set(name, value);
}
+
public void setParameterList(ParameterList list) {
_list = list;
}
+
public String toString() {
return getBaseType() + (_list == null ? "" : ";" + _list.toString());
}
+
public boolean match(ContentType other) {
return _major.equals(other._major)
- && (_minor.equals(other._minor)
+ && (_minor.equals(other._minor)
|| _minor.equals("*")
|| other._minor.equals("*"));
}
+
public boolean match(String contentType) {
try {
return match(new ContentType(contentType));
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/internet/HeaderTokenizer.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/internet/HeaderTokenizer.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/internet/HeaderTokenizer.java Sun Oct 10 14:02:50 2004
@@ -16,6 +16,7 @@
*/
package javax.mail.internet;
+
/**
* @version $Rev$ $Date$
*/
@@ -28,17 +29,21 @@
public static final int QUOTEDSTRING = -2;
private int _type;
private String _value;
+
public Token(int type, String value) {
_type = type;
_value = value;
}
+
public int getType() {
return _type;
}
+
public String getValue() {
return _value;
}
}
+
private static final Token EOF = new Token(Token.EOF, null);
// characters not allowed in MIME
public static final String MIME = "()<>@,;:\\\"\t []/?=";
@@ -49,26 +54,31 @@
private String _header;
private boolean _skip;
private int pos;
+
public HeaderTokenizer(String header) {
this(header, RFC822);
}
+
public HeaderTokenizer(String header, String delimiters) {
this(header, delimiters, true);
}
- public HeaderTokenizer(
- String header,
- String delimiters,
- boolean skipComments) {
+
+ public HeaderTokenizer(String header,
+ String delimiters,
+ boolean skipComments) {
_skip = skipComments;
_header = header;
_delimiters = delimiters;
}
+
public String getRemainder() {
return _header.substring(pos);
}
+
public Token next() throws ParseException {
return readToken();
}
+
public Token peek() throws ParseException {
int start = pos;
try {
@@ -77,6 +87,7 @@
pos = start;
}
}
+
/**
* @return
*/
@@ -84,23 +95,25 @@
// skip to next delimiter
int start = pos;
while (++pos < _header.length()
- && _delimiters.indexOf(_header.charAt(pos)) == -1);
+ && _delimiters.indexOf(_header.charAt(pos)) == -1)
+ ;
return new Token(Token.ATOM, _header.substring(start, pos));
}
+
private Token readToken() throws ParseException {
if (pos >= _header.length()) {
return EOF;
} else {
char c = _header.charAt(pos);
if (c == '(') {
- Token comment = readUntil(')',Token.COMMENT);
+ Token comment = readUntil(')', Token.COMMENT);
if (_skip) {
return readToken();
} else {
return comment;
}
} else if (c == '\"') {
- return readUntil('\"',Token.QUOTEDSTRING);
+ return readUntil('\"', Token.QUOTEDSTRING);
} else if (WHITE.indexOf(c) != -1) {
eatWhiteSpace();
return readToken();
@@ -112,6 +125,7 @@
}
}
}
+
/**
* @return
*/
@@ -119,16 +133,19 @@
int start = ++pos;
// skip to end of comment/string
while (++pos < _header.length()
- && _header.charAt(pos) != end);
- String value = _header.substring(start,pos++);
- return new Token(type,value);
+ && _header.charAt(pos) != end)
+ ;
+ String value = _header.substring(start, pos++);
+ return new Token(type, value);
}
+
/**
* @return
*/
private void eatWhiteSpace() {
// skip to end of whitespace
while (++pos < _header.length()
- && WHITE.indexOf(_header.charAt(pos)) != -1);
+ && WHITE.indexOf(_header.charAt(pos)) != -1)
+ ;
}
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/internet/InternetAddress.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/internet/InternetAddress.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/internet/InternetAddress.java Sun Oct 10 14:02:50 2004
@@ -16,6 +16,7 @@
*/
package javax.mail.internet;
+
import java.io.UnsupportedEncodingException;
import java.net.InetAddress;
import java.util.LinkedList;
@@ -24,11 +25,13 @@
import java.util.StringTokenizer;
import javax.mail.Address;
import javax.mail.Session;
+
/**
* @version $Rev$ $Date$
*/
public class InternetAddress extends Address implements Cloneable {
private static final InternetAddress[] IA_ARRAY = new InternetAddress[0];
+
public static InternetAddress getLocalAddress(Session session) {
try {
Properties properties = session.getProperties();
@@ -54,12 +57,14 @@
return null;
}
}
+
public static InternetAddress[] parse(String address)
- throws AddressException {
+ throws AddressException {
return parse(address, true);
}
+
public static InternetAddress[] parse(String addresses, boolean strict)
- throws AddressException {
+ throws AddressException {
// split up address into component parts
// addresses are name <addr> or addr (name), sometimes with name in quotes
// comma separated
@@ -71,12 +76,13 @@
}
return (InternetAddress[]) result.toArray(IA_ARRAY);
}
- public static InternetAddress[] parseHeader(
- String addresses,
- boolean strict)
- throws AddressException {
+
+ public static InternetAddress[] parseHeader(String addresses,
+ boolean strict)
+ throws AddressException {
return parse(addresses, strict);
}
+
public static String toString(Address[] addresses) {
StringBuffer result = new StringBuffer();
boolean first = true;
@@ -91,6 +97,7 @@
}
return result.toString();
}
+
public static String toString(Address[] addresses, int used) {
String result = toString(addresses);
if (result.length() > used) {
@@ -98,11 +105,14 @@
}
return result;
}
+
protected String address;
protected String encodedPersonal;
protected String personal;
+
public InternetAddress() {
}
+
public InternetAddress(String address) throws AddressException {
int lt = address.indexOf("<");
int gt = address.indexOf(">");
@@ -110,8 +120,7 @@
setAddress(address.substring(lt + 1, gt));
// everyting else is the name
try {
- setPersonal(
- (address.substring(0, lt) + address.substring(gt + 1))
+ setPersonal((address.substring(0, lt) + address.substring(gt + 1))
.trim());
} catch (UnsupportedEncodingException e) {
throw new AddressException(e.getMessage());
@@ -120,20 +129,24 @@
setAddress(address);
}
}
+
public InternetAddress(String address, boolean strict)
- throws AddressException {
+ throws AddressException {
// parse address strictly?
}
+
public InternetAddress(String address, String personal)
- throws UnsupportedEncodingException {
+ throws UnsupportedEncodingException {
this(address, personal, MimeUtility.getDefaultJavaCharset());
}
+
public InternetAddress(String address, String personal, String charset)
- throws UnsupportedEncodingException {
+ throws UnsupportedEncodingException {
this.address = address;
this.personal = personal;
// TODO Encode personal with given charset
}
+
public Object clone() {
InternetAddress ia = new InternetAddress();
ia.address = address;
@@ -141,44 +154,54 @@
ia.encodedPersonal = encodedPersonal;
return ia;
}
+
public String getAddress() {
return address;
}
+
public InternetAddress[] getGroup(boolean strict) throws AddressException {
// TODO Not implemented
return null;
}
+
public String getPersonal() {
return personal;
}
+
public String getType() {
return "rfc822";
}
+
public boolean isGroup() {
// TODO Not implemented
return false;
}
+
public void setAddress(String address) {
this.address = address;
}
+
public void setPersonal(String name) throws UnsupportedEncodingException {
setPersonal(name, null);
}
+
public void setPersonal(String name, String encoding)
- throws UnsupportedEncodingException {
+ throws UnsupportedEncodingException {
encodedPersonal =
- MimeUtility.encodeText(
- name,
- MimeUtility.getDefaultJavaCharset(),
- encoding);
+ MimeUtility.encodeText(name,
+ MimeUtility.getDefaultJavaCharset(),
+ encoding);
personal = name;
}
+
public String toString() {
return encodedPersonal + " <" + address + ">";
}
+
public String toUnicodeString() {
return personal + " <" + address + ">";
}
+
public void validate() throws AddressException {
// TODO Not implemented
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/internet/InternetHeaders.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/internet/InternetHeaders.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/internet/InternetHeaders.java Sun Oct 10 14:02:50 2004
@@ -16,6 +16,7 @@
*/
package javax.mail.internet;
+
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
@@ -27,16 +28,18 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
-
import javax.mail.Header;
import javax.mail.MessagingException;
+
/**
* @version $Rev$ $Date$
*/
public class InternetHeaders {
private static final String[] STRING_ARRAY = new String[0];
+
/**
* Parse the line into a <code>Header</code?
+ *
* @param line in the form <code>To: Apache Geronimo Users <geronimo-user@apache.org></code>
* @return the parsed <code>Header</code>
*/
@@ -47,6 +50,7 @@
String value = line.substring(colon + 1).trim();
return new Header(name, value);
}
+
/**
* Stores the list of Headers, indexed by name (uppercased)
*/
@@ -59,18 +63,22 @@
* Stores the list of lines, in the order they were entered.
*/
private List _lines = new LinkedList();
+
public InternetHeaders() {
}
+
public InternetHeaders(InputStream in) throws MessagingException {
load(in);
}
+
/**
* Add the given header and original line into the store.
* A maximum of one of the arguments can be null; if it is, it
* is dynamically created from the other. If both are <code>null</code>,
* then a <code>NullPointerException</code> will be raised.
+ *
* @param header the pre-parsed header
- * @param line the header line
+ * @param line the header line
*/
private void add(Header header, String line) {
if (line == null) {
@@ -88,15 +96,19 @@
_lines.add(line);
_last = header;
}
+
public void addHeader(String name, String value) {
add(new Header(name, value), null);
}
+
public void addHeaderLine(String line) {
add(null, line);
}
+
public Enumeration getAllHeaderLines() {
return Collections.enumeration(_lines);
}
+
public Enumeration getAllHeaders() {
List result = new LinkedList();
Iterator it = _headers.values().iterator();
@@ -106,6 +118,7 @@
}
return Collections.enumeration(result);
}
+
public String[] getHeader(String name) {
List headers = getHeaderList(name);
if (headers == null) {
@@ -120,6 +133,7 @@
return (String[]) result.toArray(STRING_ARRAY);
}
}
+
public String getHeader(String name, String delimiter) {
List list = getHeaderList(name);
if (list == null || list.isEmpty()) {
@@ -144,9 +158,11 @@
return result.toString();
}
}
+
private List getHeaderList(String name) {
return (List) _headers.get(name.toUpperCase());
}
+
private Enumeration getHeaders(String[] names, boolean match) {
List matches = new ArrayList(names.length);
for (int i = 0; i < names.length; i++) {
@@ -162,6 +178,7 @@
}
return Collections.enumeration(result);
}
+
private Enumeration getLines(String[] names, boolean match) {
List matches = new ArrayList(names.length);
for (int i = 0; i < names.length; i++) {
@@ -180,18 +197,23 @@
}
return Collections.enumeration(result);
}
+
public Enumeration getMatchingHeaderLines(String[] names) {
return getLines(names, true);
}
+
public Enumeration getMatchingHeaders(String[] names) {
return getHeaders(names, true);
}
+
public Enumeration getNonMatchingHeaderLines(String[] names) {
return getLines(names, false);
}
+
public Enumeration getNonMatchingHeaders(String[] names) {
return getHeaders(names, false);
}
+
public void load(InputStream in) throws MessagingException {
try {
StringBuffer buffer = new StringBuffer();
@@ -245,6 +267,7 @@
throw new MessagingException(e.getMessage());
}
}
+
public void removeHeader(String name) {
String NAME = name.toUpperCase();
_headers.remove(NAME);
@@ -258,6 +281,7 @@
}
}
}
+
public void setHeader(String name, String value) {
removeHeader(name);
addHeader(name, value);
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/internet/MailDateFormat.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/internet/MailDateFormat.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/internet/MailDateFormat.java Sun Oct 10 14:02:50 2004
@@ -24,10 +24,11 @@
/**
* Parses dates of the form
- *
+ * <p/>
* <code>Wed, 02 Jan 2003 23:59:59 -0100 (GMT)</code>
- *
+ * <p/>
* <code>EEE, d MMM yyyy HH:mm:ss Z (z)</code>
+ *
* @version $Rev$ $Date$
*/
public class MailDateFormat extends SimpleDateFormat {
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/internet/MimeBodyPart.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/internet/MimeBodyPart.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/internet/MimeBodyPart.java Sun Oct 10 14:02:50 2004
@@ -16,6 +16,7 @@
*/
package javax.mail.internet;
+
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -24,6 +25,7 @@
import javax.mail.BodyPart;
import javax.mail.MessagingException;
import javax.mail.Multipart;
+
/**
* @version $Rev$ $Date$
*/
@@ -32,154 +34,199 @@
protected InputStream contentStream;
protected DataHandler dh;
protected InternetHeaders headers;
+
public MimeBodyPart() {
}
+
public MimeBodyPart(InputStream in) throws MessagingException {
this.contentStream = in;
}
+
public MimeBodyPart(InternetHeaders headers, byte[] content)
- throws MessagingException {
+ throws MessagingException {
this.headers = headers;
this.content = content;
}
+
public void addHeader(String name, String value)
- throws MessagingException {
+ throws MessagingException {
headers.addHeader(name, value);
}
+
public void addHeaderLine(String line) throws MessagingException {
headers.addHeaderLine(line);
}
+
public Enumeration getAllHeaderLines() throws MessagingException {
return headers.getAllHeaderLines();
}
+
public Enumeration getAllHeaders() throws MessagingException {
return headers.getAllHeaders();
}
+
public Object getContent() throws IOException, MessagingException {
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public String getContentID() throws MessagingException {
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public String[] getContentLanguage() throws MessagingException {
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public String getContentMD5() throws MessagingException {
throw new UnsupportedOperationException("Method not yet implemented");
}
+
protected InputStream getContentStream() throws MessagingException {
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public String getContentType() throws MessagingException {
return dh.getContentType();
}
+
public DataHandler getDataHandler() throws MessagingException {
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public String getDescription() throws MessagingException {
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public String getDisposition() throws MessagingException {
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public String getEncoding() throws MessagingException {
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public String getFileName() throws MessagingException {
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public String[] getHeader(String name) throws MessagingException {
return headers.getHeader(name);
}
+
public String getHeader(String name, String delimiter)
- throws MessagingException {
+ throws MessagingException {
return headers.getHeader(name, delimiter);
}
+
public InputStream getInputStream()
- throws IOException, MessagingException {
+ throws IOException, MessagingException {
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public int getLineCount() throws MessagingException {
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public Enumeration getMatchingHeaderLines(String[] names)
- throws MessagingException {
+ throws MessagingException {
return headers.getMatchingHeaderLines(names);
}
+
public Enumeration getMatchingHeaders(String[] name)
- throws MessagingException {
+ throws MessagingException {
return headers.getMatchingHeaders(name);
}
+
public Enumeration getNonMatchingHeaderLines(String[] names)
- throws MessagingException {
+ throws MessagingException {
return headers.getNonMatchingHeaderLines(names);
}
+
public Enumeration getNonMatchingHeaders(String[] name)
- throws MessagingException {
+ throws MessagingException {
return headers.getNonMatchingHeaders(name);
}
+
public InputStream getRawInputStream() throws MessagingException {
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public int getSize() throws MessagingException {
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public boolean isMimeType(String type) throws MessagingException {
ContentType c1 = new ContentType(type);
ContentType c2 = new ContentType(dh.getContentType());
return c1.match(c2);
}
+
public void removeHeader(String name) throws MessagingException {
headers.removeHeader(name);
}
+
public void setContent(Multipart content) throws MessagingException {
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public void setContent(Object content, String type)
- throws MessagingException {
+ throws MessagingException {
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public void setContentID(String cid) throws MessagingException {
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public void setContentLanguage(String[] languages)
- throws MessagingException {
+ throws MessagingException {
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public void setContentMD5(String md5) throws MessagingException {
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public void setDataHandler(DataHandler handler) throws MessagingException {
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public void setDescription(String description) throws MessagingException {
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public void setDescription(String description, String charset)
- throws MessagingException {
+ throws MessagingException {
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public void setDisposition(String disposition) throws MessagingException {
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public void setFileName(String name) throws MessagingException {
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public void setHeader(String name, String value)
- throws MessagingException {
+ throws MessagingException {
headers.setHeader(name, value);
}
+
public void setText(String text) throws MessagingException {
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public void setText(String text, String charset)
- throws MessagingException {
+ throws MessagingException {
throw new UnsupportedOperationException("Method not yet implemented");
}
+
protected void updateHeaders() throws MessagingException {
}
+
public void writeTo(OutputStream out)
- throws IOException, MessagingException {
+ throws IOException, MessagingException {
throw new UnsupportedOperationException("Method not yet implemented");
}
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/internet/MimeMessage.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/internet/MimeMessage.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/internet/MimeMessage.java Sun Oct 10 14:02:50 2004
@@ -16,6 +16,7 @@
*/
package javax.mail.internet;
+
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectStreamException;
@@ -30,19 +31,23 @@
import javax.mail.MessagingException;
import javax.mail.Multipart;
import javax.mail.Session;
+
// TODO there's a bunch of methods that overlap between MimeMessaeg and MimeBodyPart.
// If we can implement one in terms of the other it would be more efficient, and
// it's fairly likely that we can ...
+
/**
* @version $Rev$ $Date$
*/
public class MimeMessage extends Message implements MimePart {
public static class RecipientType extends Message.RecipientType {
public static final RecipientType NEWSGROUPS =
- new RecipientType("Newsgroups");
+ new RecipientType("Newsgroups");
+
protected RecipientType(String type) {
super(type);
}
+
protected Object readResolve() throws ObjectStreamException {
if (this.type.equals("Newsgroups")) {
return NEWSGROUPS;
@@ -51,6 +56,7 @@
}
}
}
+
protected byte content[];
protected InputStream contentStream;
protected DataHandler dh;
@@ -58,301 +64,377 @@
protected InternetHeaders headers;
protected boolean modified;
protected boolean saved;
+
protected MimeMessage(Folder folder, InputStream in, int number)
- throws MessagingException {
+ throws MessagingException {
}
+
protected MimeMessage(Folder folder, int number) {
}
- protected MimeMessage(
- Folder folder,
- InternetHeaders headers,
- byte[] content,
- int number)
- throws MessagingException {
+
+ protected MimeMessage(Folder folder,
+ InternetHeaders headers,
+ byte[] content,
+ int number)
+ throws MessagingException {
}
+
public MimeMessage(MimeMessage message) throws MessagingException {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public MimeMessage(Session session) {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public MimeMessage(Session session, InputStream in)
- throws MessagingException {
+ throws MessagingException {
this.session = session;
contentStream = in;
}
+
public void addFrom(Address[] address) throws MessagingException {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public void addHeader(String name, String value)
- throws MessagingException {
+ throws MessagingException {
headers.addHeader(name, value);
}
+
public void addHeaderLine(String line) throws MessagingException {
headers.addHeaderLine(line);
}
+
public void addRecipients(Message.RecipientType type, Address[] address)
- throws MessagingException {
+ throws MessagingException {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public void addRecipients(Message.RecipientType type, String address)
- throws MessagingException {
+ throws MessagingException {
addRecipients(type, InternetAddress.parse(address));
}
+
protected InternetHeaders createInternetHeaders(InputStream in)
- throws MessagingException {
+ throws MessagingException {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public Enumeration getAllHeaderLines() throws MessagingException {
return headers.getAllHeaderLines();
}
+
public Enumeration getAllHeaders() throws MessagingException {
return headers.getAllHeaders();
}
+
public Address[] getAllRecipients() throws MessagingException {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public Object getContent() throws MessagingException, IOException {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public String getContentID() throws MessagingException {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public String[] getContentLanguage() throws MessagingException {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public String getContentMD5() throws MessagingException {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
+
protected InputStream getContentStream() throws MessagingException {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public String getContentType() throws MessagingException {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public synchronized DataHandler getDataHandler()
- throws MessagingException {
+ throws MessagingException {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public String getDescription() throws MessagingException {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public String getDisposition() throws MessagingException {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public String getEncoding() throws MessagingException {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public String getFileName() throws MessagingException {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public synchronized Flags getFlags() throws MessagingException {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public Address[] getFrom() throws MessagingException {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public String[] getHeader(String name) throws MessagingException {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public String getHeader(String name, String delimiter)
- throws MessagingException {
+ throws MessagingException {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public InputStream getInputStream() throws MessagingException, IOException {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public int getLineCount() throws MessagingException {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public Enumeration getMatchingHeaderLines(String[] names)
- throws MessagingException {
+ throws MessagingException {
return headers.getMatchingHeaderLines(names);
}
+
public Enumeration getMatchingHeaders(String[] names)
- throws MessagingException {
+ throws MessagingException {
return getMatchingHeaders(names);
}
+
public String getMessageID() throws MessagingException {
return headers.getHeader("Message-ID", null);
}
+
public Enumeration getNonMatchingHeaderLines(String[] names)
- throws MessagingException {
+ throws MessagingException {
return headers.getNonMatchingHeaderLines(names);
}
+
public Enumeration getNonMatchingHeaders(String[] names)
- throws MessagingException {
+ throws MessagingException {
return headers.getNonMatchingHeaders(names);
}
+
public InputStream getRawInputStream() throws MessagingException {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public Date getReceivedDate() throws MessagingException {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public Address[] getRecipients(Message.RecipientType type)
- throws MessagingException {
+ throws MessagingException {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public Address[] getReplyTo() throws MessagingException {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public Address getSender() throws MessagingException {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public Date getSentDate() throws MessagingException {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public int getSize() throws MessagingException {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public String getSubject() throws MessagingException {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public boolean isMimeType(String type) throws MessagingException {
ContentType c1 = new ContentType(type);
ContentType c2 = new ContentType(dh.getContentType());
return c1.match(c2);
}
+
public synchronized boolean isSet(Flags.Flag flag)
- throws MessagingException {
+ throws MessagingException {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
+
protected void parse(InputStream in) throws MessagingException {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public void removeHeader(String name) throws MessagingException {
headers.removeHeader(name);
}
+
public Message reply(boolean replyToAll) throws MessagingException {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public void saveChanges() throws MessagingException {
updateHeaders();
}
+
public void setContent(Multipart part) throws MessagingException {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public void setContent(Object content, String type)
- throws MessagingException {
+ throws MessagingException {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public void setContentID(String cid) throws MessagingException {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public void setContentLanguage(String[] languages)
- throws MessagingException {
+ throws MessagingException {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public void setContentMD5(String md5) throws MessagingException {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public void setDataHandler(DataHandler handler) throws MessagingException {
dh = handler;
}
+
public void setDescription(String description) throws MessagingException {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public void setDescription(String description, String charset)
- throws MessagingException {
+ throws MessagingException {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public void setDisposition(String disposition) throws MessagingException {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public void setFileName(String name) throws MessagingException {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public synchronized void setFlags(Flags flags, boolean set)
- throws MessagingException {
+ throws MessagingException {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public void setFrom() throws MessagingException {
setFrom(InternetAddress.getLocalAddress(session));
}
+
public void setFrom(Address address) throws MessagingException {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public void setHeader(String name, String value)
- throws MessagingException {
+ throws MessagingException {
headers.setHeader(name, value);
}
+
public void setRecipients(Message.RecipientType type, Address[] address)
- throws MessagingException {
+ throws MessagingException {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public void setRecipients(Message.RecipientType type, String address)
- throws MessagingException {
+ throws MessagingException {
setRecipients(type, InternetAddress.parse(address));
}
+
public void setReplyTo(Address[] address) throws MessagingException {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public void setSentDate(Date sent) throws MessagingException {
}
+
public void setSubject(String subject) throws MessagingException {
}
+
public void setSubject(String subject, String charset)
- throws MessagingException {
+ throws MessagingException {
}
+
public void setText(String text) throws MessagingException {
}
+
public void setText(String text, String charset)
- throws MessagingException {
+ throws MessagingException {
}
+
protected void updateHeaders() throws MessagingException {
}
+
public void writeTo(OutputStream out) throws MessagingException, IOException {
}
+
public void writeTo(OutputStream out, String[] ignoreHeaders) throws MessagingException, IOException {
}
+
public void setSender(Address address) throws MessagingException {
}
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/internet/MimeMultipart.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/internet/MimeMultipart.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/internet/MimeMultipart.java Sun Oct 10 14:02:50 2004
@@ -16,6 +16,7 @@
*/
package javax.mail.internet;
+
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -23,68 +24,81 @@
import javax.mail.BodyPart;
import javax.mail.MessagingException;
import javax.mail.Multipart;
+
/**
* @version $Rev$ $Date$
*/
public class MimeMultipart extends Multipart {
protected DataSource ds;
protected boolean parsed;
+
public MimeMultipart() {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public MimeMultipart(DataSource dataSource) throws MessagingException {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public MimeMultipart(String subtype) {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
+
protected InternetHeaders createInternetHeaders(InputStream in)
- throws MessagingException {
+ throws MessagingException {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
+
protected MimeBodyPart createMimeBodyPart(InputStream in)
- throws MessagingException {
+ throws MessagingException {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
- protected MimeBodyPart createMimeBodyPart(
- InternetHeaders headers,
- byte[] data)
- throws MessagingException {
+
+ protected MimeBodyPart createMimeBodyPart(InternetHeaders headers,
+ byte[] data)
+ throws MessagingException {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public synchronized BodyPart getBodyPart(int part)
- throws MessagingException {
+ throws MessagingException {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public BodyPart getBodyPart(String cid) throws MessagingException {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public int getCount() throws MessagingException {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
+
protected void parse() throws MessagingException {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public void setSubType(String subtype) throws MessagingException {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
+
protected void updateHeaders() throws MessagingException {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
+
public void writeTo(OutputStream out)
- throws IOException, MessagingException {
+ throws IOException, MessagingException {
// TODO Implement method
throw new UnsupportedOperationException("Method not yet implemented");
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/internet/MimePart.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/internet/MimePart.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/internet/MimePart.java Sun Oct 10 14:02:50 2004
@@ -16,30 +16,44 @@
*/
package javax.mail.internet;
+
import java.util.Enumeration;
import javax.mail.MessagingException;
import javax.mail.Part;
+
/**
* @version $Rev$ $Date$
*/
public interface MimePart extends Part {
public abstract void addHeaderLine(String line) throws MessagingException;
+
public abstract Enumeration getAllHeaderLines() throws MessagingException;
+
public abstract String getContentID() throws MessagingException;
+
public abstract String[] getContentLanguage() throws MessagingException;
+
public abstract String getContentMD5() throws MessagingException;
+
public abstract String getEncoding() throws MessagingException;
+
public abstract String getHeader(String header, String delimiter)
- throws MessagingException;
+ throws MessagingException;
+
public abstract Enumeration getMatchingHeaderLines(String[] names)
- throws MessagingException;
+ throws MessagingException;
+
public abstract Enumeration getNonMatchingHeaderLines(String[] names)
- throws MessagingException;
+ throws MessagingException;
+
public abstract void setContentLanguage(String[] languages)
- throws MessagingException;
+ throws MessagingException;
+
public abstract void setContentMD5(String content)
- throws MessagingException;
+ throws MessagingException;
+
public abstract void setText(String text) throws MessagingException;
+
public abstract void setText(String text, String charset)
- throws MessagingException;
+ throws MessagingException;
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/internet/MimePartDataSource.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/internet/MimePartDataSource.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/internet/MimePartDataSource.java Sun Oct 10 14:02:50 2004
@@ -16,6 +16,7 @@
*/
package javax.mail.internet;
+
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -24,14 +25,17 @@
import javax.mail.MessageAware;
import javax.mail.MessageContext;
import javax.mail.MessagingException;
+
/**
* @version $Rev$ $Date$
*/
public class MimePartDataSource implements DataSource, MessageAware {
private MimePart _part;
+
public MimePartDataSource(MimePart part) {
_part = part;
}
+
public String getContentType() {
try {
return _part.getContentType();
@@ -39,6 +43,7 @@
throw new RuntimeException(e);
}
}
+
public InputStream getInputStream() throws IOException {
InputStream content;
try {
@@ -55,12 +60,15 @@
throw new IOException(e.toString());
}
}
+
public synchronized MessageContext getMessageContext() {
return new MessageContext(_part);
}
+
public String getName() {
return "";
}
+
public OutputStream getOutputStream() throws IOException {
throw new UnknownServiceException();
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/internet/MimeUtility.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/internet/MimeUtility.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/internet/MimeUtility.java Sun Oct 10 14:02:50 2004
@@ -16,96 +16,111 @@
*/
package javax.mail.internet;
+
import java.io.InputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import javax.activation.DataHandler;
import javax.activation.DataSource;
import javax.mail.MessagingException;
+
// encodings include "base64", "quoted-printable", "7bit", "8bit" and "binary".
-// In addition, "uuencode" is also supported. The
+// In addition, "uuencode" is also supported. The
+
/**
* @version $Rev$ $Date$
*/
public class MimeUtility {
- private MimeUtility(){
+ private MimeUtility() {
}
// From J2SE 1.4 API Docs (Constant Values)
public static final int ALL = -1;
+
public static InputStream decode(InputStream in, String encoding)
- throws MessagingException {
+ throws MessagingException {
// TODO - take account of encoding
return in;
}
+
public static String decodeText(String word)
- throws UnsupportedEncodingException {
+ throws UnsupportedEncodingException {
// TODO - take account of encoding
return word;
}
+
public static String decodeWord(String word)
- throws ParseException, UnsupportedEncodingException {
+ throws ParseException, UnsupportedEncodingException {
// TODO - take account of encoding
return word;
}
+
public static OutputStream encode(OutputStream out, String encoding)
- throws MessagingException {
+ throws MessagingException {
// TODO - take account of encoding
return out;
}
- public static OutputStream encode(
- OutputStream out,
- String encoding,
- String filename)
- throws MessagingException {
+
+ public static OutputStream encode(OutputStream out,
+ String encoding,
+ String filename)
+ throws MessagingException {
// TODO - take account of encoding
return out;
}
+
public static String encodeText(String word)
- throws UnsupportedEncodingException {
+ throws UnsupportedEncodingException {
// TODO - take account of encoding
return word;
}
- public static String encodeText(
- String word,
- String characterset,
- String encoding)
- throws UnsupportedEncodingException {
+
+ public static String encodeText(String word,
+ String characterset,
+ String encoding)
+ throws UnsupportedEncodingException {
// TODO - take account of encoding
return word;
}
+
public static String encodeWord(String word)
- throws UnsupportedEncodingException {
+ throws UnsupportedEncodingException {
// TODO - take account of encoding
return word;
}
- public static String encodeWord(
- String word,
- String characteset,
- String encoding)
- throws UnsupportedEncodingException {
+
+ public static String encodeWord(String word,
+ String characteset,
+ String encoding)
+ throws UnsupportedEncodingException {
// TODO - take account of encoding
return word;
}
+
public static String getDefaultJavaCharset() {
return "utf-8";
}
+
public static String getEncoding(DataHandler handler) {
// TODO figure what type of data it is
return "binary";
}
+
public static String getEncoding(DataSource source) {
// TODO figure what type of data it is
return "binary";
}
+
public static String javaCharset(String charset) {
// TODO Perform translations as appropriate
return charset;
}
+
public static String mimeCharset(String charset) {
// TODO Perform translations as appropriate
return charset;
}
+
public static String quote(String word, String specials) {
// TODO Check for specials
return word;
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/internet/NewsAddress.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/internet/NewsAddress.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/internet/NewsAddress.java Sun Oct 10 14:02:50 2004
@@ -16,17 +16,19 @@
*/
package javax.mail.internet;
+
import java.util.LinkedList;
import java.util.List;
import java.util.StringTokenizer;
-
import javax.mail.Address;
+
/**
* @version $Rev$ $Date$
*/
public class NewsAddress extends Address {
private static final String _separator = ",";
private static final NewsAddress[] NEWSADDRESS_ARRAY = new NewsAddress[0];
+
public static NewsAddress[] parse(String addresses) throws AddressException {
List result = new LinkedList();
StringTokenizer tokenizer = new StringTokenizer(addresses, ",");
@@ -36,6 +38,7 @@
}
return (NewsAddress[]) result.toArray(NEWSADDRESS_ARRAY);
}
+
public static String toString(Address[] addresses) {
// build up a comma separated list of addresses
StringBuffer result = new StringBuffer();
@@ -47,29 +50,38 @@
}
return result.toString();
}
+
protected String host;
protected String newsgroup;
+
public NewsAddress() {
}
+
public NewsAddress(String newsgroup) {
setNewsgroup(newsgroup);
}
+
public NewsAddress(String newsgroup, String host) {
setNewsgroup(newsgroup);
setHost(host);
}
+
public String getHost() {
return host;
}
+
public String getNewsgroup() {
return newsgroup;
}
+
public String getType() {
return "news";
}
+
public void setHost(String string) {
host = string;
}
+
public void setNewsgroup(String newsgroup) {
newsgroup = newsgroup.trim();
int at;
@@ -80,6 +92,7 @@
this.newsgroup = newsgroup;
}
}
+
public String toString() {
return newsgroup + (host == null ? "" : "@" + host);
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/internet/ParameterList.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/internet/ParameterList.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/internet/ParameterList.java Sun Oct 10 14:02:50 2004
@@ -16,23 +16,28 @@
*/
package javax.mail.internet;
+
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.StringTokenizer;
+
// Represents lists in things like
// Content-Type: text/plain;charset=klingon
//
// The ;charset=klingon is the parameter list, may have more of them with ';'
+
/**
* @version $Rev$ $Date$
*/
public class ParameterList {
private Map _parameters = new HashMap();
+
public ParameterList() {
}
+
public ParameterList(String list) throws ParseException {
if (list == null) {
return;
@@ -51,21 +56,27 @@
}
}
}
+
public int size() {
return _parameters.size();
}
+
public String get(String name) {
return (String) _parameters.get(name);
}
+
public void set(String name, String value) {
_parameters.put(name.trim(), value.trim());
}
+
public void remove(String name) {
_parameters.remove(name);
}
+
public Enumeration getNames() {
return Collections.enumeration(_parameters.keySet());
}
+
public String toString() {
Iterator it = _parameters.entrySet().iterator();
StringBuffer result = new StringBuffer();
@@ -79,6 +90,7 @@
return result.toString();
// TODO Return in same list as parsed format
}
+
public String toString(int lineBreak) {
// figure out where to break the line
String answer = toString();
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/internet/ParseException.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/internet/ParseException.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/internet/ParseException.java Sun Oct 10 14:02:50 2004
@@ -16,7 +16,9 @@
*/
package javax.mail.internet;
+
import javax.mail.MessagingException;
+
/**
* @version $Rev$ $Date$
*/
@@ -24,6 +26,7 @@
public ParseException() {
super();
}
+
public ParseException(String message) {
super(message);
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/internet/SharedInputStream.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/internet/SharedInputStream.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/internet/SharedInputStream.java Sun Oct 10 14:02:50 2004
@@ -16,11 +16,14 @@
*/
package javax.mail.internet;
+
import java.io.InputStream;
+
/**
* @version $Rev$ $Date$
*/
public interface SharedInputStream {
public abstract long getPosition();
+
public abstract InputStream newStream(long start, long end);
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/search/AddressStringTerm.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/search/AddressStringTerm.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/search/AddressStringTerm.java Sun Oct 10 14:02:50 2004
@@ -16,7 +16,9 @@
*/
package javax.mail.search;
+
import javax.mail.Address;
+
/**
* @version $Rev$ $Date$
*/
@@ -24,6 +26,7 @@
protected AddressStringTerm(String addressString) {
super(addressString);
}
+
protected boolean match(Address address) {
return match(address.toString());
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/search/AddressTerm.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/search/AddressTerm.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/search/AddressTerm.java Sun Oct 10 14:02:50 2004
@@ -16,25 +16,32 @@
*/
package javax.mail.search;
+
import javax.mail.Address;
+
/**
* @version $Rev$ $Date$
*/
public abstract class AddressTerm extends SearchTerm {
protected Address address;
+
protected AddressTerm(Address address) {
this.address = address;
}
+
public boolean equals(Object other) {
return super.equals(other)
- && ((AddressTerm) other).address.equals(address);
+ && ((AddressTerm) other).address.equals(address);
}
+
public Address getAddress() {
return address;
}
+
public int hashCode() {
return super.hashCode() + address.hashCode();
}
+
protected boolean match(Address address) {
return this.address.equals(address);
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/search/AndTerm.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/search/AndTerm.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/search/AndTerm.java Sun Oct 10 14:02:50 2004
@@ -16,29 +16,37 @@
*/
package javax.mail.search;
+
import java.util.Arrays;
import javax.mail.Message;
+
/**
* @version $Rev$ $Date$
*/
public final class AndTerm extends SearchTerm {
protected SearchTerm[] terms;
+
public AndTerm(SearchTerm a, SearchTerm b) {
- terms = new SearchTerm[] { a, b };
+ terms = new SearchTerm[]{a, b};
}
+
public AndTerm(SearchTerm[] terms) {
this.terms = terms;
}
+
public boolean equals(Object other) {
return super.equals(other)
- && Arrays.equals(terms, ((AndTerm) other).terms);
+ && Arrays.equals(terms, ((AndTerm) other).terms);
}
+
public SearchTerm[] getTerms() {
return terms;
}
+
public int hashCode() {
return super.hashCode() + terms.length * 37;
}
+
public boolean match(Message message) {
boolean result = true;
for (int i = 0; result && i < terms.length; i++) {
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/search/BodyTerm.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/search/BodyTerm.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/search/BodyTerm.java Sun Oct 10 14:02:50 2004
@@ -16,9 +16,11 @@
*/
package javax.mail.search;
+
import java.io.IOException;
import javax.mail.Message;
import javax.mail.MessagingException;
+
/**
* @version $Rev$ $Date$
*/
@@ -26,6 +28,7 @@
public BodyTerm(String body) {
super(body);
}
+
public boolean match(Message message) {
try {
return match((String) message.getContent());
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/search/ComparisonTerm.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/search/ComparisonTerm.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/search/ComparisonTerm.java Sun Oct 10 14:02:50 2004
@@ -16,6 +16,7 @@
*/
package javax.mail.search;
+
/**
* @version $Rev$ $Date$
*/
@@ -28,12 +29,15 @@
public static final int LT = 2;
public static final int NE = 4;
protected int comparison;
+
// Dozy idiots didn't provide a constructor with an int comparison argument
public ComparisonTerm() {
}
+
ComparisonTerm(int comparison) {
this.comparison = comparison;
}
+
boolean compare(int answer) {
if (answer == 0) {
return (comparison == EQ || comparison == LE || comparison == GE);
@@ -43,13 +47,16 @@
return (comparison == LE || comparison == LT || comparison == NE);
}
}
+
public boolean equals(Object other) {
return super.equals(other)
- && ((ComparisonTerm) other).comparison == comparison;
+ && ((ComparisonTerm) other).comparison == comparison;
}
+
int getComparison() {
return comparison;
}
+
public int hashCode() {
return super.hashCode() + comparison * 31;
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/search/DateTerm.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/search/DateTerm.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/search/DateTerm.java Sun Oct 10 14:02:50 2004
@@ -16,12 +16,15 @@
*/
package javax.mail.search;
+
import java.util.Date;
+
/**
* @version $Rev$ $Date$
*/
public abstract class DateTerm extends ComparisonTerm {
protected Date date;
+
protected DateTerm(int comparison, Date date) {
super(comparison);
if (date == null) {
@@ -29,18 +32,23 @@
}
this.date = date;
}
+
public boolean equals(Object other) {
return super.equals(other) && ((DateTerm) other).date.equals(date);
}
+
public int getComparison() {
return super.getComparison();
}
+
public Date getDate() {
return date;
}
+
public int hashCode() {
return super.hashCode() + date.hashCode();
}
+
protected boolean match(Date match) {
return compare(date.compareTo(match));
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/search/FlagTerm.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/search/FlagTerm.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/search/FlagTerm.java Sun Oct 10 14:02:50 2004
@@ -16,33 +16,41 @@
*/
package javax.mail.search;
+
import javax.mail.Flags;
import javax.mail.Message;
import javax.mail.MessagingException;
+
/**
* @version $Rev$ $Date$
*/
public final class FlagTerm extends SearchTerm {
protected Flags flags;
protected boolean set;
+
public FlagTerm(Flags flags, boolean set) {
this.set = set;
this.flags = flags;
}
+
public boolean equals(Object other) {
return super.equals(other)
- && ((FlagTerm) other).flags.equals(flags)
- && ((FlagTerm) other).set == set;
+ && ((FlagTerm) other).flags.equals(flags)
+ && ((FlagTerm) other).set == set;
}
+
public Flags getFlags() {
return flags;
}
+
public boolean getTestSet() {
return set;
}
+
public int hashCode() {
return super.hashCode() + flags.hashCode() + (set ? 99 : 234);
}
+
public boolean match(Message message) {
try {
return message.getFlags().contains(flags) == set;
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/search/FromStringTerm.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/search/FromStringTerm.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/search/FromStringTerm.java Sun Oct 10 14:02:50 2004
@@ -16,9 +16,11 @@
*/
package javax.mail.search;
+
import javax.mail.Address;
import javax.mail.Message;
import javax.mail.MessagingException;
+
/**
* @version $Rev$ $Date$
*/
@@ -26,6 +28,7 @@
public FromStringTerm(String string) {
super(string);
}
+
public boolean match(Message message) {
try {
Address from[] = message.getFrom();
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/search/FromTerm.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/search/FromTerm.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/search/FromTerm.java Sun Oct 10 14:02:50 2004
@@ -16,9 +16,11 @@
*/
package javax.mail.search;
+
import javax.mail.Address;
import javax.mail.Message;
import javax.mail.MessagingException;
+
/**
* @version $Rev$ $Date$
*/
@@ -26,6 +28,7 @@
public FromTerm(Address match) {
super(match);
}
+
public boolean match(Message message) {
try {
Address from[] = message.getFrom();
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/search/HeaderTerm.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/search/HeaderTerm.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/search/HeaderTerm.java Sun Oct 10 14:02:50 2004
@@ -16,27 +16,34 @@
*/
package javax.mail.search;
+
import javax.mail.Message;
import javax.mail.MessagingException;
+
/**
* @version $Rev$ $Date$
*/
public final class HeaderTerm extends StringTerm {
protected String headerName;
+
public HeaderTerm(String header, String pattern) {
super(pattern);
this.headerName = header;
}
+
public boolean equals(Object other) {
return super.equals(other)
- && ((HeaderTerm) other).headerName.equals(headerName);
+ && ((HeaderTerm) other).headerName.equals(headerName);
}
+
public String getHeaderName() {
return headerName;
}
+
public int hashCode() {
return super.hashCode() + headerName.hashCode();
}
+
public boolean match(Message message) {
try {
String values[] = message.getHeader(headerName);
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/search/IntegerComparisonTerm.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/search/IntegerComparisonTerm.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/search/IntegerComparisonTerm.java Sun Oct 10 14:02:50 2004
@@ -16,28 +16,35 @@
*/
package javax.mail.search;
+
/**
* @version $Rev$ $Date$
*/
public abstract class IntegerComparisonTerm extends ComparisonTerm {
protected int number;
+
protected IntegerComparisonTerm(int comparison, int number) {
super(comparison);
this.number = number;
}
+
public boolean equals(Object other) {
return super.equals(other)
- && ((IntegerComparisonTerm) other).number == number;
+ && ((IntegerComparisonTerm) other).number == number;
}
+
public int getComparison() {
return super.getComparison();
}
+
public int getNumber() {
return number;
}
+
public int hashCode() {
return super.hashCode() + number * 47;
}
+
protected boolean match(int match) {
return compare(number - match);
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/search/MessageIDTerm.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/search/MessageIDTerm.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/search/MessageIDTerm.java Sun Oct 10 14:02:50 2004
@@ -16,8 +16,10 @@
*/
package javax.mail.search;
+
import javax.mail.Message;
import javax.mail.MessagingException;
+
/**
* @version $Rev$ $Date$
*/
@@ -25,6 +27,7 @@
public MessageIDTerm(String id) {
super(id);
}
+
public boolean match(Message message) {
try {
String values[] = message.getHeader("Message-ID");
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/search/MessageNumberTerm.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/search/MessageNumberTerm.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/search/MessageNumberTerm.java Sun Oct 10 14:02:50 2004
@@ -16,7 +16,9 @@
*/
package javax.mail.search;
+
import javax.mail.Message;
+
/**
* @version $Rev$ $Date$
*/
@@ -24,6 +26,7 @@
public MessageNumberTerm(int number) {
super(EQ, number);
}
+
public boolean match(Message message) {
return match(message.getMessageNumber());
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/search/NotTerm.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/search/NotTerm.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/search/NotTerm.java Sun Oct 10 14:02:50 2004
@@ -16,24 +16,31 @@
*/
package javax.mail.search;
+
import javax.mail.Message;
+
/**
* @version $Rev$ $Date$
*/
public final class NotTerm extends SearchTerm {
protected SearchTerm term;
+
public NotTerm(SearchTerm term) {
this.term = term;
}
+
public boolean equals(Object other) {
return super.equals(other) && ((NotTerm) other).term.equals(term);
}
+
public SearchTerm getTerm() {
return term;
}
+
public int hashCode() {
return super.hashCode() + term.hashCode();
}
+
public boolean match(Message message) {
return !term.match(message);
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/search/OrTerm.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/search/OrTerm.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/search/OrTerm.java Sun Oct 10 14:02:50 2004
@@ -16,32 +16,40 @@
*/
package javax.mail.search;
+
import java.util.Arrays;
import javax.mail.Message;
+
/**
* @version $Rev$ $Date$
*/
public final class OrTerm extends SearchTerm {
protected SearchTerm[] terms;
+
public OrTerm(SearchTerm a, SearchTerm b) {
- terms = new SearchTerm[] { a, b };
+ terms = new SearchTerm[]{a, b};
}
+
public OrTerm(SearchTerm[] terms) {
this.terms = terms;
}
+
public boolean equals(Object other) {
return super.equals(other)
- && Arrays.equals(terms, ((OrTerm) other).terms);
+ && Arrays.equals(terms, ((OrTerm) other).terms);
}
+
public SearchTerm[] getTerms() {
return terms;
}
+
public int hashCode() {
return super.hashCode() + terms.length * 37;
}
+
public boolean match(Message message) {
boolean result = false;
- for (int i = 0;(!result) && i < terms.length; i++) {
+ for (int i = 0; (!result) && i < terms.length; i++) {
SearchTerm term = terms[i];
result = term.match(message);
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/search/ReceivedDateTerm.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/search/ReceivedDateTerm.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/search/ReceivedDateTerm.java Sun Oct 10 14:02:50 2004
@@ -16,9 +16,11 @@
*/
package javax.mail.search;
+
import java.util.Date;
import javax.mail.Message;
import javax.mail.MessagingException;
+
/**
* @version $Rev$ $Date$
*/
@@ -26,6 +28,7 @@
public ReceivedDateTerm(int comparison, Date date) {
super(comparison, date);
}
+
public boolean match(Message message) {
try {
return match(message.getReceivedDate());
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/search/RecipientStringTerm.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/search/RecipientStringTerm.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/search/RecipientStringTerm.java Sun Oct 10 14:02:50 2004
@@ -16,28 +16,35 @@
*/
package javax.mail.search;
+
import javax.mail.Address;
import javax.mail.Message;
import javax.mail.MessagingException;
+
/**
* @version $Rev$ $Date$
*/
public final class RecipientStringTerm extends AddressStringTerm {
private Message.RecipientType _type;
+
public RecipientStringTerm(Message.RecipientType type, String pattern) {
super(pattern);
this._type = type;
}
+
public boolean equals(Object other) {
return super.equals(other)
- && ((RecipientStringTerm) other)._type == _type;
+ && ((RecipientStringTerm) other)._type == _type;
}
+
public Message.RecipientType getRecipientType() {
return _type;
}
+
public int hashCode() {
return super.hashCode() + _type.hashCode();
}
+
public boolean match(Message message) {
try {
Address from[] = message.getFrom();
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/search/RecipientTerm.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/search/RecipientTerm.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/search/RecipientTerm.java Sun Oct 10 14:02:50 2004
@@ -16,27 +16,34 @@
*/
package javax.mail.search;
+
import javax.mail.Address;
import javax.mail.Message;
import javax.mail.MessagingException;
+
/**
* @version $Rev$ $Date$
*/
public final class RecipientTerm extends AddressTerm {
protected Message.RecipientType type;
+
public RecipientTerm(Message.RecipientType type, Address address) {
super(address);
this.type = type;
}
+
public boolean equals(Object other) {
return super.equals(other) && ((RecipientTerm) other).type.equals(type);
}
+
public Message.RecipientType getRecipientType() {
return type;
}
+
public int hashCode() {
return super.hashCode() + type.hashCode();
}
+
public boolean match(Message message) {
try {
Address from[] = message.getRecipients(type);
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/search/SearchException.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/search/SearchException.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/search/SearchException.java Sun Oct 10 14:02:50 2004
@@ -16,7 +16,9 @@
*/
package javax.mail.search;
+
import javax.mail.MessagingException;
+
/**
* @version $Rev$ $Date$
*/
@@ -24,6 +26,7 @@
public SearchException() {
super();
}
+
public SearchException(String message) {
super(message);
}
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/search/SearchTerm.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/search/SearchTerm.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/search/SearchTerm.java Sun Oct 10 14:02:50 2004
@@ -16,16 +16,20 @@
*/
package javax.mail.search;
+
import java.io.Serializable;
import javax.mail.Message;
+
/**
* @version $Rev$ $Date$
*/
public abstract class SearchTerm implements Serializable {
public abstract boolean match(Message message);
+
public boolean equals(Object other) {
return (other != null && other.getClass() == this.getClass());
}
+
public int hashCode() {
// need to provide a default, so that other terms
// doing 'super.hashCode' don't get an instance-specific hash.
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/search/SentDateTerm.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/search/SentDateTerm.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/search/SentDateTerm.java Sun Oct 10 14:02:50 2004
@@ -16,9 +16,11 @@
*/
package javax.mail.search;
+
import java.util.Date;
import javax.mail.Message;
import javax.mail.MessagingException;
+
/**
* @version $Rev$ $Date$
*/
@@ -26,6 +28,7 @@
public SentDateTerm(int comparison, Date date) {
super(comparison, date);
}
+
public boolean match(Message message) {
try {
return match(message.getSentDate());
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/search/SizeTerm.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/search/SizeTerm.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/search/SizeTerm.java Sun Oct 10 14:02:50 2004
@@ -16,8 +16,10 @@
*/
package javax.mail.search;
+
import javax.mail.Message;
import javax.mail.MessagingException;
+
/**
* @version $Rev$ $Date$
*/
@@ -25,6 +27,7 @@
public SizeTerm(int comparison, int size) {
super(comparison, size);
}
+
public boolean match(Message message) {
try {
return match(message.getSize());
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/search/StringTerm.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/search/StringTerm.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/search/StringTerm.java Sun Oct 10 14:02:50 2004
@@ -16,33 +16,41 @@
*/
package javax.mail.search;
+
/**
* @version $Rev$ $Date$
*/
public abstract class StringTerm extends SearchTerm {
protected boolean ignoreCase;
protected String pattern;
+
protected StringTerm(String pattern) {
this(pattern, true);
}
+
protected StringTerm(String pattern, boolean ignoreCase) {
this.pattern = pattern;
this.ignoreCase = ignoreCase;
}
+
public boolean equals(Object other) {
return super.equals(other)
- && ((StringTerm) other).pattern.equals(pattern)
- && ((StringTerm) other).ignoreCase == ignoreCase;
+ && ((StringTerm) other).pattern.equals(pattern)
+ && ((StringTerm) other).ignoreCase == ignoreCase;
}
+
public boolean getIgnoreCase() {
return ignoreCase;
}
+
public String getPattern() {
return pattern;
}
+
public int hashCode() {
return super.hashCode() + pattern.hashCode() + (ignoreCase ? 32 : 79);
}
+
protected boolean match(String match) {
String a = match;
String b = pattern;
Modified: geronimo/trunk/specs/javamail/src/java/javax/mail/search/SubjectTerm.java
==============================================================================
--- geronimo/trunk/specs/javamail/src/java/javax/mail/search/SubjectTerm.java (original)
+++ geronimo/trunk/specs/javamail/src/java/javax/mail/search/SubjectTerm.java Sun Oct 10 14:02:50 2004
@@ -16,8 +16,10 @@
*/
package javax.mail.search;
+
import javax.mail.Message;
import javax.mail.MessagingException;
+
/**
* @version $Rev$ $Date$
*/
@@ -25,6 +27,7 @@
public SubjectTerm(String subject) {
super(subject);
}
+
public boolean match(Message message) {
try {
return match(message.getSubject());