as discussed before, the approach i'm taking in supporting the parsing
of RFC standard headers is to add them to the MaximalContentDescriptor
interface and then factor out an interface named from the RFC in
question. if anyone has any opinions, suggestions or improvements,
please jump in.

- robert

On Sat, Jun 21, 2008 at 10:07 AM,  <[EMAIL PROTECTED]> wrote:
> Author: rdonkin
> Date: Sat Jun 21 02:07:28 2008
> New Revision: 670167
>
> URL: http://svn.apache.org/viewvc?rev=670167&view=rev
> Log:
> Factored RFC2045 properties into interface
>
> Added:
>    
> james/mime4j/trunk/src/main/java/org/apache/james/mime4j/RFC2045Descriptor.java
> Modified:
>    
> james/mime4j/trunk/src/main/java/org/apache/james/mime4j/MaximalBodyDescriptor.java
>
> Modified: 
> james/mime4j/trunk/src/main/java/org/apache/james/mime4j/MaximalBodyDescriptor.java
> URL: 
> http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/MaximalBodyDescriptor.java?rev=670167&r1=670166&r2=670167&view=diff
> ==============================================================================
> --- 
> james/mime4j/trunk/src/main/java/org/apache/james/mime4j/MaximalBodyDescriptor.java
>  (original)
> +++ 
> james/mime4j/trunk/src/main/java/org/apache/james/mime4j/MaximalBodyDescriptor.java
>  Sat Jun 21 02:07:28 2008
> @@ -28,7 +28,7 @@
>  * Parses and stores values for standard MIME header values.
>  *
>  */
> -public class MaximalBodyDescriptor extends DefaultBodyDescriptor {
> +public class MaximalBodyDescriptor extends DefaultBodyDescriptor implements 
> RFC2045Descriptor {
>
>     private static final int DEFAULT_MINOR_VERSION = 0;
>     private static final int DEFAULT_MAJOR_VERSION = 1;
> @@ -107,46 +107,35 @@
>     }
>
>     /**
> -     * Gets the MIME major version
> -     * as specified by the <code>MIME-Version</code>
> -     * header.
> -     * Defaults to one.
> -     * @return positive integer
> +     * @see org.apache.james.mime4j.RFC2045Descriptor#getMimeMajorVersion()
>      */
>     public int getMimeMajorVersion() {
>         return mimeMajorVersion;
>     }
>
>     /**
> -     * Gets the MIME minor version
> -     * as specified by the <code>MIME-Version</code>
> -     * header.
> -     * Defaults to zero.
> -     * @return positive integer
> +     * @see org.apache.james.mime4j.RFC2045Descriptor#getMimeMinorVersion()
>      */
>     public int getMimeMinorVersion() {
>         return mimeMinorVersion;
>     }
>
> +    /**
> +     * @see 
> org.apache.james.mime4j.RFC2045Descriptor#getMimeVersionParseException()
> +     */
>     public MimeException getMimeVersionParseException() {
>         return mimeVersionException;
>     }
>
>     /**
> -     * Gets the value of the <a 
> href='http://www.faqs.org/rfcs/rfc2045'>RFC</a>
> -     * <code>Content-Description</code> header.
> -     * @return value of the <code>Content-Description</code> when present,
> -     * null otherwise
> +     * @see org.apache.james.mime4j.RFC2045Descriptor#getContentDescription()
>      */
>     public String getContentDescription() {
>         return contentDescription;
>     }
>
>     /**
> -     * Gets the value of the <a 
> href='http://www.faqs.org/rfcs/rfc2045'>RFC</a>
> -     * <code>Content-ID</code> header.
> -     * @return value of the <code>Content-ID</code> when present,
> -     * null otherwise
> +     * @see org.apache.james.mime4j.RFC2045Descriptor#getContentId()
>      */
>     public String getContentId() {
>         return contentId;
>
> Added: 
> james/mime4j/trunk/src/main/java/org/apache/james/mime4j/RFC2045Descriptor.java
> URL: 
> http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/RFC2045Descriptor.java?rev=670167&view=auto
> ==============================================================================
> --- 
> james/mime4j/trunk/src/main/java/org/apache/james/mime4j/RFC2045Descriptor.java
>  (added)
> +++ 
> james/mime4j/trunk/src/main/java/org/apache/james/mime4j/RFC2045Descriptor.java
>  Sat Jun 21 02:07:28 2008
> @@ -0,0 +1,69 @@
> +/*
> + * 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 org.apache.james.mime4j;
> +
> +/**
> + * Describes standard <a href='http://www.faqs.org/rfcs/rfc2045.html' 
> rel='tag'>RFC2045</a>
> + * headers.
> + */
> +public interface RFC2045Descriptor extends ContentDescriptor {
> +
> +    /**
> +     * Gets the MIME major version
> +     * as specified by the <code>MIME-Version</code>
> +     * header.
> +     * Defaults to one.
> +     * @return positive integer
> +     */
> +    public abstract int getMimeMajorVersion();
> +
> +    /**
> +     * Gets the MIME minor version
> +     * as specified by the <code>MIME-Version</code>
> +     * header.
> +     * Defaults to zero.
> +     * @return positive integer
> +     */
> +    public abstract int getMimeMinorVersion();
> +
> +    /**
> +     * When the MIME version header exists but cannot be parsed
> +     * this field will be contain the exception.
> +     * @return <code>MimeException</code> if the mime header cannot
> +     * be parsed, null otherwise
> +     */
> +    public abstract MimeException getMimeVersionParseException();
> +
> +    /**
> +     * Gets the value of the <a 
> href='http://www.faqs.org/rfcs/rfc2045'>RFC</a>
> +     * <code>Content-Description</code> header.
> +     * @return value of the <code>Content-Description</code> when present,
> +     * null otherwise
> +     */
> +    public abstract String getContentDescription();
> +
> +    /**
> +     * Gets the value of the <a 
> href='http://www.faqs.org/rfcs/rfc2045'>RFC</a>
> +     * <code>Content-ID</code> header.
> +     * @return value of the <code>Content-ID</code> when present,
> +     * null otherwise
> +     */
> +    public abstract String getContentId();
> +
> +}
> \ No newline at end of file
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to