You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jl...@apache.org on 2022/05/03 12:22:12 UTC

svn commit: r1900504 [5/22] - in /geronimo/specs/trunk: ./ geronimo-activation_2.0_spec/ geronimo-activation_2.0_spec/src/ geronimo-activation_2.0_spec/src/main/ geronimo-activation_2.0_spec/src/main/java/ geronimo-activation_2.0_spec/src/main/java/jak...

Added: geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/MailSessionDefinition.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/MailSessionDefinition.java?rev=1900504&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/MailSessionDefinition.java (added)
+++ geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/MailSessionDefinition.java Tue May  3 12:22:08 2022
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package jakarta.mail;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Repeatable;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation used by Java EE applications to define a MailSession
+ * to be registered within JNDI.
+ * The annotation is used to configure the commonly used Session
+ * properties.
+ * Additional standard and vendor-specific properties may be
+ * specified using the properties element.
+ * 
+ * The session will be registered under the JNDI name specified in the
+ * name element.  It may be defined to be in any valid
+ * Java EE namespace, and will determine the accessibility of
+ * the session from other components.
+ *
+ * @since JavaMail 1.5
+ */
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Repeatable(MailSessionDefinitions.class)
+public @interface MailSessionDefinition {
+
+    /**
+     * Description of this mail session.
+     */
+    String description() default "";
+
+    /**
+     * JNDI name by which the mail session will be registered.
+     */
+    String name();
+
+    /**
+     * Store protocol name.
+     */
+    String storeProtocol() default "";
+
+    /**
+     * Transport protocol name.
+     */
+    String transportProtocol() default "";
+
+    /**
+     * Host name for the mail server.
+     */
+    String host() default "";
+
+    /**
+     * User name to use for authentication.
+     */
+    String user() default "";
+
+    /**
+     * Password to use for authentication.
+     */
+    String password() default "";
+
+    /**
+     * From address for the user.
+     */
+    String from() default "";
+
+    /**
+     * Properties to include in the Session.
+     * Properties are specified using the format:
+     * propertyName=propertyValue with one property per array element.
+     */
+    String[] properties() default {};
+}

Added: geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/MailSessionDefinitions.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/MailSessionDefinitions.java?rev=1900504&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/MailSessionDefinitions.java (added)
+++ geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/MailSessionDefinitions.java Tue May  3 12:22:08 2022
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package jakarta.mail;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Declares MailSessionDefinition annotations.
+ *
+ * @see MailSessionDefinition
+ * @since JavaMail 1.5
+ */
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface MailSessionDefinitions {
+    MailSessionDefinition[] value();
+}
\ No newline at end of file

Added: geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/Message.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/Message.java?rev=1900504&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/Message.java (added)
+++ geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/Message.java Tue May  3 12:22:08 2022
@@ -0,0 +1,446 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package jakarta.mail;
+
+import jakarta.mail.search.SearchTerm;
+
+import java.io.InvalidObjectException;
+import java.io.ObjectStreamException;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public abstract class Message implements Part {
+    /**
+     * Enumeration of types of recipients allowed by the Message class.
+     */
+    public static class RecipientType implements Serializable {
+        /**
+         * A "To" or primary recipient.
+         */
+        public static final RecipientType TO = new RecipientType("To");
+        /**
+         * A "Cc" or carbon-copy recipient.
+         */
+        public static final RecipientType CC = new RecipientType("Cc");
+        /**
+         * A "Bcc" or blind carbon-copy recipient.
+         */
+        public static final RecipientType BCC = new RecipientType("Bcc");
+        protected String type;
+
+        protected RecipientType(final String type) {
+            this.type = type;
+        }
+
+        protected Object readResolve() throws ObjectStreamException {
+            if (type.equals("To")) {
+                return TO;
+            } else if (type.equals("Cc")) {
+                return CC;
+            } else if (type.equals("Bcc")) {
+                return BCC;
+            } else {
+                throw new InvalidObjectException("Invalid RecipientType: " + type);
+            }
+        }
+
+        @Override
+        public String toString() {
+            return type;
+        }
+    }
+
+    /**
+     * The index of a message within its folder, or zero if the message was not retrieved from a folder.
+     */
+    protected int msgnum;
+    /**
+     * True if this message has been expunged from the Store.
+     */
+    protected boolean expunged;
+    /**
+     * The {@link Folder} that contains this message, or null if it was not obtained from a folder.
+     */
+    protected Folder folder;
+    /**
+     * The {@link Session} associated with this message.
+     */
+    protected Session session;
+
+    /**
+     * Default constructor.
+     */
+    protected Message() {
+    }
+
+    /**
+     * Constructor initializing folder and message msgnum; intended to be used by implementations of Folder.
+     *
+     * @param folder the folder that contains the message
+     * @param msgnum the message index within the folder
+     */
+    protected Message(final Folder folder, final int msgnum) {
+        this.folder = folder;
+        this.msgnum = msgnum;
+        // make sure we copy the session information from the folder.
+        this.session = folder.getStore().getSession();
+    }
+
+    /**
+     * Constructor initializing the session; intended to by used by client created instances.
+     *
+     * @param session the session associated with this message
+     */
+    protected Message(final Session session) {
+        this.session = session;
+    }
+
+    /**
+     * Return the "From" header indicating the identity of the person the message is from;
+     * in some circumstances this may be different than the actual sender.
+     *
+     * @return a list of addresses this message is from; may be empty if the header is present but empty, or null
+     *         if the header is not present
+     * @throws MessagingException if there was a problem accessing the Store
+     */
+    public abstract Address[] getFrom() throws MessagingException;
+
+    /**
+     * Set the "From" header for this message to the value of the "mail.user" property,
+     * or if that property is not set, to the value of the system property "user.name"
+     *
+     * @throws MessagingException if there was a problem accessing the Store
+     */
+    public abstract void setFrom() throws MessagingException;
+
+    /**
+     * Set the "From" header to the supplied address.
+     *
+     * @param address the address of the person the message is from
+     * @throws MessagingException if there was a problem accessing the Store
+     */
+    public abstract void setFrom(Address address) throws MessagingException;
+
+    /**
+     * Add multiple addresses to the "From" header.
+     *
+     * @param addresses the addresses to add
+     * @throws MessagingException if there was a problem accessing the Store
+     */
+    public abstract void addFrom(Address[] addresses) throws MessagingException;
+
+    /**
+     * Get all recipients of the given type.
+     *
+     * @param type the type of recipient to get
+     * @return a list of addresses; may be empty if the header is present but empty,
+     *         or null if the header is not present
+     * @throws MessagingException if there was a problem accessing the Store
+     * @see RecipientType
+     */
+    public abstract Address[] getRecipients(RecipientType type) throws MessagingException;
+
+    /**
+     * Get all recipients of this message.
+     * The default implementation extracts the To, Cc, and Bcc recipients using {@link #getRecipients(Message.RecipientType)}
+     * and then concatentates the results into a single array; it returns null if no headers are defined.
+     *
+     * @return an array containing all recipients
+     * @throws MessagingException if there was a problem accessing the Store
+     */
+    public Address[] getAllRecipients() throws MessagingException {
+        final Address[] to = getRecipients(RecipientType.TO);
+        final Address[] cc = getRecipients(RecipientType.CC);
+        final Address[] bcc = getRecipients(RecipientType.BCC);
+        if (to == null && cc == null && bcc == null) {
+            return null;
+        }
+        final int length = (to != null ? to.length : 0) + (cc != null ? cc.length : 0) + (bcc != null ? bcc.length : 0);
+        final Address[] result = new Address[length];
+        int j = 0;
+        if (to != null) {
+            for (int i = 0; i < to.length; i++) {
+                result[j++] = to[i];
+            }
+        }
+        if (cc != null) {
+            for (int i = 0; i < cc.length; i++) {
+                result[j++] = cc[i];
+            }
+        }
+        if (bcc != null) {
+            for (int i = 0; i < bcc.length; i++) {
+                result[j++] = bcc[i];
+            }
+        }
+        return result;
+    }
+
+    /**
+     * Set the list of recipients for the specified type.
+     *
+     * @param type      the type of recipient
+     * @param addresses the new addresses
+     * @throws MessagingException if there was a problem accessing the Store
+     */
+    public abstract void setRecipients(RecipientType type, Address[] addresses) throws MessagingException;
+
+    /**
+     * Set the list of recipients for the specified type to a single address.
+     *
+     * @param type    the type of recipient
+     * @param address the new address
+     * @throws MessagingException if there was a problem accessing the Store
+     */
+    public void setRecipient(final RecipientType type, final Address address) throws MessagingException {
+        setRecipients(type, new Address[]{address});
+    }
+
+    /**
+     * Add recipents of a specified type.
+     *
+     * @param type      the type of recipient
+     * @param addresses the addresses to add
+     * @throws MessagingException if there was a problem accessing the Store
+     */
+    public abstract void addRecipients(RecipientType type, Address[] addresses) throws MessagingException;
+
+    /**
+     * Add a recipent of a specified type.
+     *
+     * @param type    the type of recipient
+     * @param address the address to add
+     * @throws MessagingException if there was a problem accessing the Store
+     */
+    public void addRecipient(final RecipientType type, final Address address) throws MessagingException {
+        addRecipients(type, new Address[]{address});
+    }
+
+    /**
+     * Get the addresses to which replies should be directed.
+     * <p/>
+     * As the most common behavior is to return to sender, the default implementation
+     * simply calls {@link #getFrom()}.
+     *
+     * @return a list of addresses to which replies should be directed
+     * @throws MessagingException if there was a problem accessing the Store
+     */
+    public Address[] getReplyTo() throws MessagingException {
+        return getFrom();
+    }
+
+    /**
+     * Set the addresses to which replies should be directed.
+     * <p/>
+     * The default implementation throws a MethodNotSupportedException.
+     *
+     * @param addresses to which replies should be directed
+     * @throws MessagingException if there was a problem accessing the Store
+     */
+    public void setReplyTo(final Address[] addresses) throws MessagingException {
+        throw new MethodNotSupportedException("setReplyTo not supported");
+    }
+
+    /**
+     * Get the subject for this message.
+     *
+     * @return the subject
+     * @throws MessagingException if there was a problem accessing the Store
+     */
+    public abstract String getSubject() throws MessagingException;
+
+    /**
+     * Set the subject of this message
+     *
+     * @param subject the subject
+     * @throws MessagingException if there was a problem accessing the Store
+     */
+    public abstract void setSubject(String subject) throws MessagingException;
+
+    /**
+     * Return the date that this message was sent.
+     *
+     * @return the date this message was sent
+     * @throws MessagingException if there was a problem accessing the Store
+     */
+    public abstract Date getSentDate() throws MessagingException;
+
+    /**
+     * Set the date this message was sent.
+     *
+     * @param sent the date when this message was sent
+     * @throws MessagingException if there was a problem accessing the Store
+     */
+    public abstract void setSentDate(Date sent) throws MessagingException;
+    
+    /**
+     * Return the Session used when this message was created.
+     *
+     * @return      the message's Session
+     * @since       JavaMail 1.5
+     */
+    public Session getSession() {
+        return this.session;
+    }
+
+    /**
+     * Return the date this message was received.
+     *
+     * @return the date this message was received
+     * @throws MessagingException if there was a problem accessing the Store
+     */
+    public abstract Date getReceivedDate() throws MessagingException;
+
+    /**
+     * Return a copy the flags associated with this message.
+     *
+     * @return a copy of the flags for this message
+     * @throws MessagingException if there was a problem accessing the Store
+     */
+    public abstract Flags getFlags() throws MessagingException;
+
+    /**
+     * Check whether the supplied flag is set.
+     * The default implementation checks the flags returned by {@link #getFlags()}.
+     *
+     * @param flag the flags to check for
+     * @return true if the flags is set
+     * @throws MessagingException if there was a problem accessing the Store
+     */
+    public boolean isSet(final Flags.Flag flag) throws MessagingException {
+        return getFlags().contains(flag);
+    }
+
+    /**
+     * Set the flags specified to the supplied value; flags not included in the
+     * supplied {@link Flags} parameter are not affected.
+     *
+     * @param flags the flags to modify
+     * @param set   the new value of those flags
+     * @throws MessagingException if there was a problem accessing the Store
+     */
+    public abstract void setFlags(Flags flags, boolean set) throws MessagingException;
+
+    /**
+     * Set a flag to the supplied value.
+     * The default implmentation uses {@link #setFlags(Flags, boolean)}.
+     *
+     * @param flag the flag to set
+     * @param set  the value for that flag
+     * @throws MessagingException if there was a problem accessing the Store
+     */
+    public void setFlag(final Flags.Flag flag, final boolean set) throws MessagingException {
+        setFlags(new Flags(flag), set);
+    }
+
+    /**
+     * Return the message number for this Message.
+     * This number refers to the relative position of this message in a Folder; the message
+     * number for any given message can change during a session if the Folder is expunged.
+     * Message numbers for messages in a folder start at one; the value zero indicates that
+     * this message does not belong to a folder.
+     *
+     * @return the message number
+     */
+    public int getMessageNumber() {
+        return msgnum;
+    }
+
+    /**
+     * Set the message number for this Message.
+     * This must be invoked by implementation classes when the message number changes.
+     *
+     * @param number the new message number
+     */
+    protected void setMessageNumber(final int number) {
+        msgnum = number;
+    }
+
+    /**
+     * Return the folder containing this message. If this is a new or nested message
+     * then this method returns null.
+     *
+     * @return the folder containing this message
+     */
+    public Folder getFolder() {
+        return folder;
+    }
+
+    /**
+     * Checks to see if this message has been expunged. If true, all methods other than
+     * {@link #getMessageNumber()} are invalid.
+     *
+     * @return true if this method has been expunged
+     */
+    public boolean isExpunged() {
+        return expunged;
+    }
+
+    /**
+     * Set the expunged flag for this message.
+     *
+     * @param expunged true if this message has been expunged
+     */
+    protected void setExpunged(final boolean expunged) {
+        this.expunged = expunged;
+    }
+
+    /**
+     * Create a new message suitable as a reply to this message with all headers set
+     * up appropriately. The message body will be empty.
+     * <p/>
+     * if replyToAll is set then the new message will be addressed to all recipients
+     * of this message; otherwise the reply will be addressed only to the sender as
+     * returned by {@link #getReplyTo()}.
+     * <p/>
+     * The subject field will be initialized with the subject field from the orginal
+     * message; the text "Re:" will be prepended unless it is already present.
+     *
+     * @param replyToAll if true, indciates the message should be addressed to all recipients not just the sender
+     * @return a new message suitable as a reply to this message
+     * @throws MessagingException if there was a problem accessing the Store
+     */
+    public abstract Message reply(boolean replyToAll) throws MessagingException;
+
+    /**
+     * To ensure changes are saved to the Store, this message should be invoked
+     * before its containing Folder is closed. Implementations may save modifications
+     * immediately but are free to defer such updates to they may be sent to the server
+     * in one batch; if saveChanges is not called then such changes may not be made
+     * permanent.
+     *
+     * @throws MessagingException if there was a problem accessing the Store
+     */
+    public abstract void saveChanges() throws MessagingException;
+
+    /**
+     * Apply the specified search criteria to this message
+     *
+     * @param term the search criteria
+     * @return true if this message matches the search criteria.
+     * @throws MessagingException if there was a problem accessing the Store
+     */
+    public boolean match(final SearchTerm term) throws MessagingException {
+        return term.match(this);
+    }
+}

Added: geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/MessageAware.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/MessageAware.java?rev=1900504&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/MessageAware.java (added)
+++ geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/MessageAware.java Tue May  3 12:22:08 2022
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package jakarta.mail;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface MessageAware {
+    public abstract MessageContext getMessageContext();
+}

Added: geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/MessageContext.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/MessageContext.java?rev=1900504&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/MessageContext.java (added)
+++ geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/MessageContext.java Tue May  3 12:22:08 2022
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package jakarta.mail;
+
+/**
+ * The context in which a piece of message content is contained.
+ *
+ * @version $Rev$ $Date$
+ */
+public class MessageContext {
+    private final Part part;
+
+    /**
+     * Create a MessageContext object describing the context of the supplied Part.
+     *
+     * @param part the containing part
+     */
+    public MessageContext(final Part part) {
+        this.part = part;
+    }
+
+    /**
+     * Return the {@link Part} that contains the content.
+     *
+     * @return the part
+     */
+    public Part getPart() {
+        return part;
+    }
+
+    /**
+     * Return the message that contains the content; if the Part is a {@link Multipart}
+     * then recurse up the chain until a {@link Message} is found.
+     *
+     * @return
+     */
+    public Message getMessage() {
+        return getMessageFrom(part);
+    }
+
+    /**
+     * Return the session associated with the Message containing this Part.
+     *
+     * @return the session associated with this context's root message
+     */
+    public Session getSession() {
+        final Message message = getMessage();
+        if (message == null) {
+            return null;
+        } else {
+            return message.session;
+        }
+    }
+
+    /**
+     * recurse up the chain of MultiPart/BodyPart parts until we hit a message
+     * 
+     * @param p      The starting part.
+     * 
+     * @return The encountered Message or null if no Message parts
+     *         are found.
+     */
+    private Message getMessageFrom(Part p) {
+        while (p != null) {
+            if (p instanceof Message) {
+                return (Message) p;
+            }
+            final Multipart mp = ((BodyPart) p).getParent();
+            if (mp == null) {
+                return null;
+            }
+            p = mp.getParent();
+        }
+        return null;
+    }
+}

Added: geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/MessageRemovedException.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/MessageRemovedException.java?rev=1900504&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/MessageRemovedException.java (added)
+++ geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/MessageRemovedException.java Tue May  3 12:22:08 2022
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package jakarta.mail;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class MessageRemovedException extends MessagingException {
+	
+	private static final long serialVersionUID = 1951292550679528690L;
+	
+    public MessageRemovedException() {
+        super();
+    }
+
+    public MessageRemovedException(final String message) {
+        super(message);
+    }
+    
+    /**
+     * Constructs a MessageRemovedException with the specified
+     * detail message and embedded exception.  The exception is chained
+     * to this exception.
+     *
+     * @param s      The detailed error message
+     * @param e      The embedded exception
+     * @since        JavaMail 1.5
+     */
+    public MessageRemovedException(final String s, final Exception e) {
+        super(s, e);
+    }
+}

Added: geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/MessagingException.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/MessagingException.java?rev=1900504&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/MessagingException.java (added)
+++ geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/MessagingException.java Tue May  3 12:22:08 2022
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package jakarta.mail;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class MessagingException extends Exception {
+
+    private static final long serialVersionUID = -7569192289819959253L;
+
+    // Required because serialization expects it to be here
+    private Exception next;
+
+    public MessagingException() {
+        super();
+    }
+
+    public MessagingException(final String message) {
+        super(message);
+    }
+
+    public MessagingException(final String message, final Exception cause) {
+        super(message, cause);
+        next = cause;
+    }
+
+    public synchronized Exception getNextException() {
+        return next;
+    }
+
+    public synchronized boolean setNextException(final Exception cause) {
+        if (next == null) {
+            next = cause;
+            return true;
+        } else if (next instanceof MessagingException) {
+            return ((MessagingException) next).setNextException(cause);
+        } else {
+            return false;
+        }
+    }
+
+    @Override
+    public String getMessage() {
+        final Exception next = getNextException();
+        if (next == null) {
+            return super.getMessage();
+        } else {
+            return super.getMessage()
+                    + " ("
+                    + next.getClass().getName()
+                    + ": "
+                    + next.getMessage()
+                    + ")";
+        }
+    }
+    
+    /**
+     * MessagingException uses the nextException to provide a legacy chained throwable.
+     * override the getCause method to return the nextException.
+     */
+    @Override
+    public synchronized  Throwable getCause() {
+        return next;
+    }
+}

Added: geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/MethodNotSupportedException.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/MethodNotSupportedException.java?rev=1900504&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/MethodNotSupportedException.java (added)
+++ geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/MethodNotSupportedException.java Tue May  3 12:22:08 2022
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package jakarta.mail;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class MethodNotSupportedException extends MessagingException {
+	
+	private static final long serialVersionUID = -3757386618726131322L;
+	
+    public MethodNotSupportedException() {
+        super();
+    }
+
+    public MethodNotSupportedException(final String message) {
+        super(message);
+    }
+    
+    /**
+     * Constructs a MethodNotSupportedException with the specified
+     * detail message and embedded exception.  The exception is chained
+     * to this exception.
+     *
+     * @param s      The detailed error message
+     * @param e      The embedded exception
+     * @since        JavaMail 1.5
+     */
+    public MethodNotSupportedException(final String s, final Exception e) {
+        super(s, e);
+    }
+}

Added: geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/Multipart.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/Multipart.java?rev=1900504&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/Multipart.java (added)
+++ geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/Multipart.java Tue May  3 12:22:08 2022
@@ -0,0 +1,166 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package jakarta.mail;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Vector;
+
+/**
+ * A container for multiple {@link BodyPart BodyParts}.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class Multipart {
+    /**
+     * Vector of sub-parts.
+     */
+    protected Vector<BodyPart> parts = new Vector<>();
+
+    /**
+     * The content type of this multipart object; defaults to "multipart/mixed"
+     */
+    protected String contentType = "multipart/mixed";
+
+    /**
+     * The Part that contains this multipart.
+     */
+    protected Part parent;
+
+    protected Multipart() {
+    }
+
+    /**
+     * Initialize this multipart object from the supplied data source.
+     * This adds any {@link BodyPart BodyParts} into this object and initializes the content type.
+     *
+     * @param mds the data source
+     * @throws MessagingException
+     */
+    protected void setMultipartDataSource(final MultipartDataSource mds) throws MessagingException {
+        parts.clear();
+        contentType = mds.getContentType();
+        final int size = mds.getCount();
+        for (int i = 0; i < size; i++) {
+            parts.add(mds.getBodyPart(i));
+        }
+    }
+
+    /**
+     * Return the content type.
+     *
+     * @return the content type
+     */
+    public String getContentType() {
+        return contentType;
+    }
+
+    /**
+     * Return the number of enclosed parts
+     *
+     * @return the number of parts
+     * @throws MessagingException
+     */
+    public int getCount() throws MessagingException {
+        return parts.size();
+    }
+
+    /**
+     * Get the specified part; numbering starts at zero.
+     *
+     * @param index the part to get
+     * @return the part
+     * @throws MessagingException
+     */
+    public BodyPart getBodyPart(final int index) throws MessagingException {
+        return (BodyPart) parts.get(index);
+    }
+
+    /**
+     * Remove the supplied part from the list.
+     *
+     * @param part the part to remove
+     * @return true if the part was removed
+     * @throws MessagingException
+     */
+    public boolean removeBodyPart(final BodyPart part) throws MessagingException {
+        return parts.remove(part);
+    }
+
+    /**
+     * Remove the specified part; all others move down one
+     *
+     * @param index the part to remove
+     * @throws MessagingException
+     */
+    public void removeBodyPart(final int index) throws MessagingException {
+        parts.remove(index);
+    }
+
+    /**
+     * Add a part to the end of the list.
+     *
+     * @param part the part to add
+     * @throws MessagingException
+     */
+    public void addBodyPart(final BodyPart part) throws MessagingException {
+        parts.add(part);
+    }
+
+    /**
+     * Insert a part into the list at a designated point; all subsequent parts move down
+     *
+     * @param part the part to add
+     * @param pos  the index of the new part
+     * @throws MessagingException
+     */
+    public void addBodyPart(final BodyPart part, final int pos) throws MessagingException {
+        parts.add(pos, part);
+    }
+
+    /**
+     * Encode and write this multipart to the supplied OutputStream; the encoding
+     * used is determined by the implementation.
+     *
+     * @param out the stream to write to
+     * @throws IOException
+     * @throws MessagingException
+     */
+    public abstract void writeTo(OutputStream out) throws IOException, MessagingException;
+
+    /**
+     * Return the Part containing this Multipart object or null if unknown.
+     *
+     * @return this Multipart's parent
+     */
+    public Part getParent() {
+        return parent;
+    }
+
+    /**
+     * Set the parent of this Multipart object
+     *
+     * @param part this object's parent
+     */
+    public void setParent(final Part part) {
+        parent = part;
+    }
+
+}

Added: geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/MultipartDataSource.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/MultipartDataSource.java?rev=1900504&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/MultipartDataSource.java (added)
+++ geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/MultipartDataSource.java Tue May  3 12:22:08 2022
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package jakarta.mail;
+
+import jakarta.activation.DataSource;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface MultipartDataSource extends DataSource {
+    public abstract BodyPart getBodyPart(int index) throws MessagingException;
+
+    public abstract int getCount();
+}

Added: geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/NoSuchProviderException.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/NoSuchProviderException.java?rev=1900504&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/NoSuchProviderException.java (added)
+++ geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/NoSuchProviderException.java Tue May  3 12:22:08 2022
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package jakarta.mail;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class NoSuchProviderException extends MessagingException {
+	
+	private static final long serialVersionUID = 8058319293154708827L;
+	
+    public NoSuchProviderException() {
+        super();
+    }
+
+    public NoSuchProviderException(final String message) {
+        super(message);
+    }
+    
+    /**
+     * Constructs a NoSuchProviderException with the specified
+     * detail message and embedded exception.  The exception is chained
+     * to this exception.
+     *
+     * @param message    The detailed error message
+     * @param e      The embedded exception
+     * @since        JavaMail 1.5
+     */
+    public NoSuchProviderException(final String message, final Exception e) {
+        super(message, e);
+    }
+}

Added: geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/Part.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/Part.java?rev=1900504&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/Part.java (added)
+++ geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/Part.java Tue May  3 12:22:08 2022
@@ -0,0 +1,316 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package jakarta.mail;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.Enumeration;
+
+import jakarta.activation.DataHandler;
+
+/**
+ * Note: Parts are used in Collections so implementing classes must provide
+ * a suitable implementation of equals and hashCode.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Part {
+    /**
+     * This part should be presented as an attachment.
+     */
+    public static final String ATTACHMENT = "attachment";
+    /**
+     * This part should be presented or rendered inline.
+     */
+    public static final String INLINE = "inline";
+
+    /**
+     * Add this value to the existing headers with the given name.  This method 
+     * does not replace any headers that may already exist.
+     * 
+     * @param name   The name of the target header.
+     * @param value  The value to be added to the header set.
+     * 
+     * @exception MessagingException
+     */
+    public abstract void addHeader(String name, String value) throws MessagingException;
+
+    /**
+     * Return all headers as an Enumeration of Header objects.
+     * 
+     * @return An Enumeration containing all of the current Header objects. 
+     * @exception MessagingException
+     */
+    public abstract Enumeration<Header> getAllHeaders() throws MessagingException;
+
+    /**
+     * Return a content object for this Part.  The 
+     * content object type is dependent upon the 
+     * DataHandler for the Part.
+     * 
+     * @return A content object for this Part.
+     * @exception IOException
+     * @exception MessagingException
+     */
+    public abstract Object getContent() throws IOException, MessagingException;
+
+    /**
+     * Get the ContentType for this part, or null if the 
+     * ContentType has not been set.  The ContentType 
+     * is expressed using the MIME typing system.
+     * 
+     * @return The ContentType for this part. 
+     * @exception MessagingException
+     */
+    public abstract String getContentType() throws MessagingException;
+
+    /**
+     * Returns a DataHandler instance for the content
+     * with in the Part.  
+     * 
+     * @return A DataHandler appropriate for the Part content.
+     * @exception MessagingException
+     */
+    public abstract DataHandler getDataHandler() throws MessagingException;
+
+    /**
+     * Returns a description string for this Part.  Returns
+     * null if a description has not been set.
+     * 
+     * @return The description string. 
+     * @exception MessagingException
+     */
+    public abstract String getDescription() throws MessagingException;
+
+    /**
+     * Return the disposition of the part.  The disposition 
+     * determines how the part should be presented to the 
+     * user.  Two common disposition values are ATTACHMENT
+     * and INLINE. 
+     * 
+     * @return The current disposition value. 
+     * @exception MessagingException
+     */
+    public abstract String getDisposition() throws MessagingException;
+
+    /**
+     * Get a file name associated with this part.  The 
+     * file name is useful for presenting attachment 
+     * parts as their original source.  The file names 
+     * are generally simple names without containing 
+     * any directory information.  Returns null if the 
+     * filename has not been set. 
+     * 
+     * @return The string filename, if any. 
+     * @exception MessagingException
+     */
+    public abstract String getFileName() throws MessagingException;
+
+    /**
+     * Get all Headers for this header name.  Returns null if no headers with 
+     * the given name exist.
+     * 
+     * @param name   The target header name.
+     * 
+     * @return An array of all matching header values, or null if the given header 
+     *         does not exist.
+     * @exception MessagingException
+     */
+    public abstract String[] getHeader(String name) throws MessagingException;
+
+    /**
+     * Return an InputStream for accessing the Part 
+     * content.  Any mail-related transfer encodings 
+     * will be removed, so the data presented with 
+     * be the actual part content. 
+     * 
+     * @return An InputStream for accessing the part content. 
+     * @exception IOException
+     * @exception MessagingException
+     */
+    public abstract InputStream getInputStream() throws IOException, MessagingException;
+
+    /**
+     * Return the number of lines in the content, or 
+     * -1 if the line count cannot be determined.
+     * 
+     * @return The estimated number of lines in the content. 
+     * @exception MessagingException
+     */
+    public abstract int getLineCount() throws MessagingException;
+
+    /**
+     * Return all headers that match the list of names as an Enumeration of 
+     * Header objects.
+     * 
+     * @param names  An array of names of the desired headers.
+     * 
+     * @return An Enumeration of Header objects containing the matching headers.
+     * @exception MessagingException
+     */
+    public abstract Enumeration<Header> getMatchingHeaders(String[] names) throws MessagingException;
+
+    /**
+     * Return an Enumeration of all Headers except those that match the names 
+     * given in the exclusion list.
+     * 
+     * @param names  An array of String header names that will be excluded from the return
+     *               Enumeration set.
+     * 
+     * @return An Enumeration of Headers containing all headers except for those named 
+     *         in the exclusion list.
+     * @exception MessagingException
+     */
+    public abstract Enumeration<Header> getNonMatchingHeaders(String[] names) throws MessagingException;
+
+    /**
+     * Return the size of this part, or -1 if the size
+     * cannot be reliably determined.
+     * 
+     * Note:  the returned size does not take into account 
+     * internal encodings, nor is it an estimate of 
+     * how many bytes are required to transfer this 
+     * part across a network.  This value is intended
+     * to give email clients a rough idea of the amount 
+     * of space that might be required to present the
+     * item.
+     * 
+     * @return The estimated part size, or -1 if the size 
+     *         information cannot be determined.
+     * @exception MessagingException
+     */
+    public abstract int getSize() throws MessagingException;
+
+    /**
+     * Tests if the part is of the specified MIME type.
+     * Only the primaryPart and subPart of the MIME 
+     * type are used for the comparison;  arguments are 
+     * ignored.  The wildcard value of "*" may be used 
+     * to match all subTypes.
+     * 
+     * @param mimeType The target MIME type.
+     * 
+     * @return true if the part matches the input MIME type, 
+     *         false if it is not of the requested type.
+     * @exception MessagingException
+     */
+    public abstract boolean isMimeType(String mimeType) throws MessagingException;
+
+    /**
+     * Remove all headers with the given name from the Part.
+     * 
+     * @param name   The target header name used for removal.
+     * 
+     * @exception MessagingException
+     */
+    public abstract void removeHeader(String name) throws MessagingException;
+
+    public abstract void setContent(Multipart content) throws MessagingException;
+
+    /**
+     * Set a content object for this part.  Internally, 
+     * the Part will use the MIME type encoded in the 
+     * type argument to wrap the provided content object.
+     * In order for this to work properly, an appropriate 
+     * DataHandler must be installed in the Java Activation 
+     * Framework.
+     * 
+     * @param content The content object.
+     * @param type    The MIME type for the inserted content Object.
+     * 
+     * @exception MessagingException
+     */
+    public abstract void setContent(Object content, String type) throws MessagingException;
+
+    /**
+     * Set a DataHandler for this part that defines the 
+     * Part content.  The DataHandler is used to access 
+     * all Part content.
+     * 
+     * @param handler The DataHandler instance.
+     * 
+     * @exception MessagingException
+     */
+    public abstract void setDataHandler(DataHandler handler) throws MessagingException;
+
+    /**
+     * Set a descriptive string for this part.
+     * 
+     * @param description
+     *               The new description.
+     * 
+     * @exception MessagingException
+     */
+    public abstract void setDescription(String description) throws MessagingException;
+
+    /**
+     * Set the disposition for this Part.
+     * 
+     * @param disposition
+     *               The disposition string.
+     * 
+     * @exception MessagingException
+     */
+    public abstract void setDisposition(String disposition) throws MessagingException;
+
+    /**
+     * Set a descriptive file name for this part.  The 
+     * name should be a simple name that does not include 
+     * directory information.
+     * 
+     * @param name   The new name value.
+     * 
+     * @exception MessagingException
+     */
+    public abstract void setFileName(String name) throws MessagingException;
+
+    /**
+     * Sets a value for the given header.  This operation will replace all 
+     * existing headers with the given name.
+     * 
+     * @param name   The name of the target header.
+     * @param value  The new value for the indicated header.
+     * 
+     * @exception MessagingException
+     */
+    public abstract void setHeader(String name, String value) throws MessagingException;
+
+    /**
+     * Set the Part content as text.  This is a convenience method that sets 
+     * the content to a MIME type of "text/plain".
+     * 
+     * @param content The new text content, as a String object.
+     * 
+     * @exception MessagingException
+     */
+    public abstract void setText(String content) throws MessagingException;
+
+    /**
+     * Write the Part content out to the provided OutputStream as a byte
+     * stream using an encoding appropriate to the Part content.
+     * 
+     * @param out    The target OutputStream.
+     * 
+     * @exception IOException
+     * @exception MessagingException
+     */
+    public abstract void writeTo(OutputStream out) throws IOException, MessagingException;
+}

Added: geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/PasswordAuthentication.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/PasswordAuthentication.java?rev=1900504&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/PasswordAuthentication.java (added)
+++ geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/PasswordAuthentication.java Tue May  3 12:22:08 2022
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package jakarta.mail;
+
+/**
+ * A data holder used by Authenticator to contain a username and password.
+ *
+ * @version $Rev$ $Date$
+ */
+public final class PasswordAuthentication {
+    private final String user;
+    private final String password;
+
+    public PasswordAuthentication(final String user, final String password) {
+        this.user = user;
+        this.password = password;
+    }
+
+    public String getUserName() {
+        return user;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+}

Added: geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/Provider.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/Provider.java?rev=1900504&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/Provider.java (added)
+++ geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/Provider.java Tue May  3 12:22:08 2022
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package jakarta.mail;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class Provider {
+    /**
+     * A enumeration inner class that defines Provider types.
+     */
+    public static class Type {
+        /**
+         * A message store provider such as POP3 or IMAP4.
+         */
+        public static final Type STORE = new Type();
+
+        /**
+         * A message transport provider such as SMTP.
+         */
+        public static final Type TRANSPORT = new Type();
+
+        private Type() {
+        }
+    }
+
+    private final String className;
+    private final String protocol;
+    private final Type type;
+    private final String vendor;
+    private final String version;
+
+    public Provider(final Type type, final String protocol, final String className, final String vendor, final String version) {
+        this.protocol = protocol;
+        this.className = className;
+        this.type = type;
+        this.vendor = vendor;
+        this.version = 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;
+    }
+
+    @Override
+    public String toString() {
+        return "protocol="
+                + protocol
+                + "; type="
+                + type
+                + "; class="
+                + className
+                + (vendor == null ? "" : "; vendor=" + vendor)
+                + (version == null ? "" : ";version=" + version);
+    }
+}

Added: geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/Quota.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/Quota.java?rev=1900504&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/Quota.java (added)
+++ geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/Quota.java Tue May  3 12:22:08 2022
@@ -0,0 +1,128 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package jakarta.mail;
+
+/**
+ * A representation of a Quota item for a given quota root.
+ *
+ * @version $Rev$ $Date$
+ */
+public class Quota {
+    /**
+     * The name of the quota root.
+     */
+    public String quotaRoot;
+
+    /**
+     * The resources associated with this quota root.
+     */
+    public Resource[] resources;
+
+
+    /**
+     * Create a Quota with the given name and no resources.
+     *
+     * @param quotaRoot The quota root name.
+     */
+    public Quota(final String quotaRoot) {
+        this.quotaRoot = quotaRoot;
+    }
+
+    /**
+     * Set a limit value for a resource.  If the resource is not
+     * currently associated with this Quota, a new Resource item is
+     * added to the resources list.
+     *
+     * @param name   The target resource name.
+     * @param limit  The new limit value for the resource.
+     */
+    public void setResourceLimit(final String name, final long limit) {
+        final Resource target = findResource(name);
+        target.limit = limit;
+    }
+
+    /**
+     * Locate a particular named resource, adding one to the list
+     * if it does not exist.
+     *
+     * @param name   The target resource name.
+     *
+     * @return A Resource item for this named resource (either existing or new).
+     */
+    private Resource findResource(final String name) {
+        // no resources yet?  Make it so.
+        if (resources == null) {
+            final Resource target = new Resource(name, 0, 0);
+            resources = new Resource[] { target };
+            return target;
+        }
+
+        // see if this one exists and return it.
+        for (int i = 0; i < resources.length; i++) {
+            final Resource current = resources[i];
+            if (current.name.equalsIgnoreCase(name)) {
+                return current;
+            }
+        }
+
+        // have to extend the array...this is a pain.
+        final Resource[] newResources = new Resource[resources.length + 1];
+        System.arraycopy(resources, 0, newResources, 0, resources.length);
+        final Resource target = new Resource(name, 0, 0);
+        newResources[resources.length] = target;
+        resources = newResources;
+        return target;
+    }
+
+
+
+    /**
+     * A representation of a given resource definition.
+     */
+    public static class Resource {
+        /**
+         * The resource name.
+         */
+        public String name;
+        /**
+         * The current resource usage.
+         */
+        public long usage;
+        /**
+         * The limit value for this resource.
+         */
+        public long limit;
+
+
+        /**
+         * Construct a Resource object from the given name and usage/limit
+         * information.
+         *
+         * @param name   The Resource name.
+         * @param usage  The current resource usage.
+         * @param limit  The Resource limit value.
+         */
+        public Resource(final String name, final long usage, final long limit) {
+            this.name = name;
+            this.usage = usage;
+            this.limit = limit;
+        }
+    }
+}

Added: geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/QuotaAwareStore.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/QuotaAwareStore.java?rev=1900504&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/QuotaAwareStore.java (added)
+++ geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/QuotaAwareStore.java Tue May  3 12:22:08 2022
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package jakarta.mail;
+
+/**
+ * An interface for Store implementations to support the IMAP RFC 2087 Quota extension.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface QuotaAwareStore {
+    
+    /**
+     * Get the quotas for the specified root element.
+     *
+     * @param root   The root name for the quota information.
+     *
+     * @return An array of Quota objects defined for the root.
+     * @throws MessagingException if the quotas cannot be retrieved
+     */
+    public Quota[] getQuota(String root) throws MessagingException;
+
+    /**
+     * Set a quota item.  The root contained in the Quota item identifies
+     * the quota target.
+     *
+     * @param quota  The source quota item.
+     * @throws MessagingException if the quota cannot be set
+     */
+    public void setQuota(Quota quota) throws MessagingException;
+}
+
+

Added: geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/ReadOnlyFolderException.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/ReadOnlyFolderException.java?rev=1900504&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/ReadOnlyFolderException.java (added)
+++ geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/ReadOnlyFolderException.java Tue May  3 12:22:08 2022
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package jakarta.mail;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ReadOnlyFolderException extends MessagingException {
+	
+	private static final long serialVersionUID = 5711829372799039325L;
+	
+    private transient Folder _folder;
+
+    public ReadOnlyFolderException(final Folder folder) {
+        this(folder, "Folder not found: " + folder.getName());
+    }
+
+    public ReadOnlyFolderException(final Folder folder, final String message) {
+        super(message);
+        _folder = folder;
+    }
+
+    /**
+     * Constructs a ReadOnlyFolderException with the specified
+     * detail message and embedded exception.  The exception is chained
+     * to this exception.
+     *
+     * @param folder     The Folder
+     * @param message    The detailed error message
+     * @param e      The embedded exception
+     * @since        JavaMail 1.5
+     */
+    public ReadOnlyFolderException(final Folder folder, final String message, final Exception e) { 
+        super(message, e);
+        _folder = folder;
+    }
+    
+    public Folder getFolder() {
+        return _folder;
+    }
+}

Added: geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/SendFailedException.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/SendFailedException.java?rev=1900504&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/SendFailedException.java (added)
+++ geronimo/specs/trunk/geronimo-jakartamail_2.1_spec/src/main/java/jakarta/mail/SendFailedException.java Tue May  3 12:22:08 2022
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package jakarta.mail;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SendFailedException extends MessagingException {
+	
+	private static final long serialVersionUID = -6457531621682372913L;
+	
+    protected transient Address invalid[];
+    protected transient Address validSent[];
+    protected transient Address validUnsent[];
+
+    public SendFailedException() {
+        super();
+    }
+
+    public SendFailedException(final String message) {
+        super(message);
+    }
+
+    public SendFailedException(final String message, final Exception cause) {
+        super(message, cause);
+    }
+
+    public SendFailedException(final String message,
+                               final Exception cause,
+                               final Address[] validSent,
+                               final Address[] validUnsent,
+                               final 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;
+    }
+}