james-mime4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject svn commit: r897169 [2/2] - in /james/mime4j/branches/cycleclean: benchmark/src/main/java/org/apache/james/mime4j/ core/src/main/java/org/apache/james/mime4j/dom/ core/src/main/java/org/apache/james/mime4j/message/ core/src/main/java/org/apache/james/m...
Date Fri, 08 Jan 2010 11:20:28 GMT
Added: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/MultipartImpl.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/MultipartImpl.java?rev=897169&view=auto
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/MultipartImpl.java (added)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/MultipartImpl.java Fri Jan  8 11:20:17 2010
@@ -0,0 +1,155 @@
+/****************************************************************
+ * 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.message;
+
+import org.apache.james.mime4j.dom.Entity;
+import org.apache.james.mime4j.dom.Multipart;
+import org.apache.james.mime4j.util.ByteSequence;
+import org.apache.james.mime4j.util.ContentUtil;
+
+/**
+ * Represents a MIME multipart body (see RFC 2045).A multipart body has a
+ * ordered list of body parts. The multipart body also has a preamble and
+ * epilogue. The preamble consists of whatever characters appear before the
+ * first body part while the epilogue consists of whatever characters come after
+ * the last body part.
+ */
+public class MultipartImpl extends Multipart {
+
+    private ByteSequence preamble;
+    private transient String preambleStrCache;
+    private ByteSequence epilogue;
+    private transient String epilogueStrCache;
+
+    /**
+     * Creates a new empty <code>Multipart</code> instance.
+     */
+    public MultipartImpl(String subType) {
+        super(subType);
+        preamble = ByteSequence.EMPTY;
+        preambleStrCache = "";
+        epilogue = ByteSequence.EMPTY;
+        epilogueStrCache = "";
+    }
+
+    /**
+     * Creates a new <code>Multipart</code> from the specified
+     * <code>Multipart</code>. The <code>Multipart</code> instance is
+     * initialized with copies of preamble, epilogue, sub type and the list of
+     * body parts of the specified <code>Multipart</code>. The parent entity
+     * of the new multipart is <code>null</code>.
+     * 
+     * @param other
+     *            multipart to copy.
+     * @throws UnsupportedOperationException
+     *             if <code>other</code> contains a {@link SingleBody} that
+     *             does not support the {@link SingleBody#copy() copy()}
+     *             operation.
+     * @throws IllegalArgumentException
+     *             if <code>other</code> contains a <code>Body</code> that
+     *             is neither a {@link Message}, {@link Multipart} or
+     *             {@link SingleBody}.
+     */
+    public MultipartImpl(Multipart other) {
+    	super(other.getSubType());
+
+    	for (Entity otherBodyPart : other.getBodyParts()) {
+    		Entity bodyPartCopy = new BodyPart(otherBodyPart);
+            addBodyPart(bodyPartCopy);
+        }
+
+    	if (other instanceof MultipartImpl) {
+	        preamble = ((MultipartImpl) other).preamble;
+	        epilogue = ((MultipartImpl) other).epilogue;
+	        preambleStrCache = ((MultipartImpl) other).preambleStrCache;
+	        epilogueStrCache = ((MultipartImpl) other).epilogueStrCache;
+    	} else {
+    		setPreamble(other.getPreamble());
+    		setEpilogue(other.getEpilogue());
+    	}
+    }
+
+    // package private for now; might become public someday
+    public ByteSequence getPreambleRaw() {
+        return preamble;
+    }
+
+    public void setPreambleRaw(ByteSequence preamble) {
+        this.preamble = preamble;
+        this.preambleStrCache = null;
+    }
+
+    /**
+     * Gets the preamble.
+     * 
+     * @return the preamble.
+     */
+    public String getPreamble() {
+        if (preambleStrCache == null) {
+            preambleStrCache = ContentUtil.decode(preamble);
+        }
+        return preambleStrCache;
+    }
+
+    /**
+     * Sets the preamble.
+     * 
+     * @param preamble
+     *            the preamble.
+     */
+    public void setPreamble(String preamble) {
+        this.preamble = ContentUtil.encode(preamble);
+        this.preambleStrCache = preamble;
+    }
+
+    // package private for now; might become public someday
+    public ByteSequence getEpilogueRaw() {
+        return epilogue;
+    }
+
+    public void setEpilogueRaw(ByteSequence epilogue) {
+        this.epilogue = epilogue;
+        this.epilogueStrCache = null;
+    }
+
+    /**
+     * Gets the epilogue.
+     * 
+     * @return the epilogue.
+     */
+    public String getEpilogue() {
+        if (epilogueStrCache == null) {
+            epilogueStrCache = ContentUtil.decode(epilogue);
+        }
+        return epilogueStrCache;
+    }
+
+    /**
+     * Sets the epilogue.
+     * 
+     * @param epilogue
+     *            the epilogue.
+     */
+    public void setEpilogue(String epilogue) {
+        this.epilogue = ContentUtil.encode(epilogue);
+        this.epilogueStrCache = epilogue;
+    }
+
+}

Propchange: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/MultipartImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/MultipartImpl.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/SimpleContentHandler.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/SimpleContentHandler.java?rev=897169&view=auto
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/SimpleContentHandler.java (added)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/SimpleContentHandler.java Fri Jan  8 11:20:17 2010
@@ -0,0 +1,74 @@
+/****************************************************************
+ * 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.message;
+
+import org.apache.james.mime4j.MimeException;
+import org.apache.james.mime4j.dom.Header;
+import org.apache.james.mime4j.field.Field;
+import org.apache.james.mime4j.field.impl.DefaultFieldParser;
+import org.apache.james.mime4j.stream.AbstractContentHandler;
+import org.apache.james.mime4j.stream.RawField;
+
+/**
+ * Abstract implementation of ContentHandler that automates common
+ * tasks. Currently performs header parsing.
+ *
+ * Older versions of this class performed decoding of content streams.
+ * This can be now easily achieved by calling setContentDecoding(true) on the MimeStreamParser.
+ */
+public abstract class SimpleContentHandler extends  AbstractContentHandler {
+
+    /**
+     * Called after headers are parsed.
+     */
+    public abstract void headers(Header header);
+
+    /* Implement introduced callbacks. */
+
+    private Header currHeader;
+
+    /**
+     * @see org.apache.james.mime4j.stream.AbstractContentHandler#startHeader()
+     */
+    @Override
+    public final void startHeader() {
+        currHeader = new Header();
+    }
+
+    /**
+     * @see org.apache.james.mime4j.stream.AbstractContentHandler#field(Field)
+     */
+    @Override
+    public final void field(RawField field) throws MimeException {
+        Field parsedField = DefaultFieldParser.parse(field.getRaw()); 
+        currHeader.addField(parsedField);
+    }
+
+    /**
+     * @see org.apache.james.mime4j.stream.AbstractContentHandler#endHeader()
+     */
+    @Override
+    public final void endHeader() {
+        Header tmp = currHeader;
+        currHeader = null;
+        headers(tmp);
+    }
+
+}

Propchange: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/SimpleContentHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/StorageBinaryBody.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/StorageBinaryBody.java?rev=897169&view=auto
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/StorageBinaryBody.java (added)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/StorageBinaryBody.java Fri Jan  8 11:20:17 2010
@@ -0,0 +1,76 @@
+/****************************************************************
+ * 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.message;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import org.apache.james.mime4j.codec.CodecUtil;
+import org.apache.james.mime4j.dom.BinaryBody;
+import org.apache.james.mime4j.storage.MultiReferenceStorage;
+
+/**
+ * Binary body backed by a
+ * {@link org.apache.james.mime4j.storage.Storage}
+ */
+class StorageBinaryBody extends BinaryBody {
+
+    private MultiReferenceStorage storage;
+
+    public StorageBinaryBody(final MultiReferenceStorage storage) {
+        this.storage = storage;
+    }
+
+    @Override
+    public InputStream getInputStream() throws IOException {
+        return storage.getInputStream();
+    }
+
+    @Override
+    public void writeTo(OutputStream out) throws IOException {
+        if (out == null)
+            throw new IllegalArgumentException();
+
+        InputStream in = storage.getInputStream();
+        CodecUtil.copy(in, out);
+        in.close();
+    }
+
+    @Override
+    public StorageBinaryBody copy() {
+        storage.addReference();
+        return new StorageBinaryBody(storage);
+    }
+
+    /**
+     * Deletes the Storage that holds the content of this binary body.
+     *
+     * @see org.apache.james.mime4j.dom.Disposable#dispose()
+     */
+    @Override
+    public void dispose() {
+        if (storage != null) {
+            storage.delete();
+            storage = null;
+        }
+    }
+
+}

Propchange: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/StorageBinaryBody.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/StorageTextBody.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/StorageTextBody.java?rev=897169&view=auto
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/StorageTextBody.java (added)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/StorageTextBody.java Fri Jan  8 11:20:17 2010
@@ -0,0 +1,79 @@
+/****************************************************************
+ * 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.message;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.nio.charset.Charset;
+
+import org.apache.james.mime4j.dom.TextBody;
+import org.apache.james.mime4j.storage.MultiReferenceStorage;
+import org.apache.james.mime4j.util.CharsetUtil;
+
+/**
+ * Text body backed by a {@link org.apache.james.mime4j.storage.Storage}.
+ */
+class StorageTextBody extends TextBody {
+
+    private MultiReferenceStorage storage;
+    private Charset charset;
+
+    public StorageTextBody(MultiReferenceStorage storage, Charset charset) {
+        this.storage = storage;
+        this.charset = charset;
+    }
+
+    @Override
+    public String getMimeCharset() {
+        return CharsetUtil.toMimeCharset(charset.name());
+    }
+
+    @Override
+    public Reader getReader() throws IOException {
+        return new InputStreamReader(storage.getInputStream(), charset);
+    }
+
+    @Override
+    public InputStream getInputStream() throws IOException {
+        return storage.getInputStream();
+    }
+
+    @Override
+    public StorageTextBody copy() {
+        storage.addReference();
+        return new StorageTextBody(storage, charset);
+    }
+
+    /**
+     * Deletes the Storage that holds the content of this text body.
+     *
+     * @see org.apache.james.mime4j.dom.Disposable#dispose()
+     */
+    @Override
+    public void dispose() {
+        if (storage != null) {
+            storage.delete();
+            storage = null;
+        }
+    }
+
+}

Propchange: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/StorageTextBody.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/StringTextBody.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/StringTextBody.java?rev=897169&view=auto
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/StringTextBody.java (added)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/StringTextBody.java Fri Jan  8 11:20:17 2010
@@ -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 org.apache.james.mime4j.message;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Reader;
+import java.io.StringReader;
+import java.io.Writer;
+import java.nio.charset.Charset;
+
+import org.apache.james.mime4j.dom.TextBody;
+import org.apache.james.mime4j.util.CharsetUtil;
+
+/**
+ * Text body backed by a <code>String</code>.
+ */
+class StringTextBody extends TextBody {
+
+    private final String text;
+    private final Charset charset;
+
+    public StringTextBody(final String text, Charset charset) {
+        this.text = text;
+        this.charset = charset;
+    }
+
+    @Override
+    public String getMimeCharset() {
+        return CharsetUtil.toMimeCharset(charset.name());
+    }
+
+    @Override
+    public InputStream getInputStream() throws IOException {
+        return new ByteArrayInputStream(text.getBytes(charset.name()));
+    }
+
+    @Override
+    public Reader getReader() throws IOException {
+        return new StringReader(text);
+    }
+
+    @Override
+    public void writeTo(OutputStream out) throws IOException {
+        if (out == null)
+            throw new IllegalArgumentException();
+
+        Reader reader = new StringReader(text);
+        Writer writer = new OutputStreamWriter(out, charset);
+
+        char buffer[] = new char[1024];
+        while (true) {
+            int nChars = reader.read(buffer);
+            if (nChars == -1)
+                break;
+
+            writer.write(buffer, 0, nChars);
+        }
+
+        reader.close();
+        writer.flush();
+    }
+
+    @Override
+    public StringTextBody copy() {
+        return new StringTextBody(text, charset);
+    }
+
+}

Propchange: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/message/StringTextBody.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/util/StringArrayMap.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/util/StringArrayMap.java?rev=897169&r1=897168&r2=897169&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/util/StringArrayMap.java (original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/util/StringArrayMap.java Fri Jan  8 11:20:17 2010
@@ -35,7 +35,7 @@
  * maps values are strings (single value), lists, or arrays.
  * <p>
  * Note that this class is not directly used anywhere in Mime4j.
- * Instead a user might choose to use it instead of {@link org.apache.james.mime4j.message.Header}
+ * Instead a user might choose to use it instead of {@link org.apache.james.mime4j.dom.Header}
  * and {@link org.apache.james.mime4j.field.Field} in a custom {@link org.apache.james.mime4j.stream.ContentHandler} implementation.
  * See also MIME4j-24.
  */

Copied: james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/dom/CopyConstructorTest.java (from r897165, james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/CopyConstructorTest.java)
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/dom/CopyConstructorTest.java?p2=james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/dom/CopyConstructorTest.java&p1=james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/CopyConstructorTest.java&r1=897165&r2=897169&rev=897169&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/CopyConstructorTest.java (original)
+++ james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/dom/CopyConstructorTest.java Fri Jan  8 11:20:17 2010
@@ -17,17 +17,21 @@
  * under the License.                                           *
  ****************************************************************/
 
-package org.apache.james.mime4j.message;
+package org.apache.james.mime4j.dom;
 
 import java.util.Arrays;
 import java.util.List;
 
+import org.apache.james.mime4j.dom.Body;
+import org.apache.james.mime4j.dom.Entity;
+import org.apache.james.mime4j.dom.Header;
+import org.apache.james.mime4j.dom.Multipart;
 import org.apache.james.mime4j.field.Field;
 import org.apache.james.mime4j.field.impl.DefaultFieldParser;
-import org.apache.james.mime4j.message.impl.BodyFactory;
-import org.apache.james.mime4j.message.impl.BodyPart;
-import org.apache.james.mime4j.message.impl.MessageImpl;
-import org.apache.james.mime4j.message.impl.MultipartImpl;
+import org.apache.james.mime4j.message.BodyFactory;
+import org.apache.james.mime4j.message.BodyPart;
+import org.apache.james.mime4j.message.MessageImpl;
+import org.apache.james.mime4j.message.MultipartImpl;
 
 import junit.framework.TestCase;
 

Propchange: james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/dom/CopyConstructorTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/dom/EntityTest.java (from r897165, james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/EntityTest.java)
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/dom/EntityTest.java?p2=james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/dom/EntityTest.java&p1=james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/EntityTest.java&r1=897165&r2=897169&rev=897169&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/EntityTest.java (original)
+++ james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/dom/EntityTest.java Fri Jan  8 11:20:17 2010
@@ -17,12 +17,14 @@
  * under the License.                                           *
  ****************************************************************/
 
-package org.apache.james.mime4j.message;
+package org.apache.james.mime4j.dom;
 
+import org.apache.james.mime4j.dom.Body;
+import org.apache.james.mime4j.dom.Entity;
+import org.apache.james.mime4j.dom.Header;
 import org.apache.james.mime4j.field.impl.DefaultFieldParser;
-import org.apache.james.mime4j.message.Entity;
-import org.apache.james.mime4j.message.impl.BodyFactory;
-import org.apache.james.mime4j.message.impl.BodyPart;
+import org.apache.james.mime4j.message.BodyFactory;
+import org.apache.james.mime4j.message.BodyPart;
 
 import junit.framework.TestCase;
 

Propchange: james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/dom/EntityTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/dom/ExampleMessagesRoundtripTest.java (from r897165, james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/ExampleMessagesRoundtripTest.java)
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/dom/ExampleMessagesRoundtripTest.java?p2=james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/dom/ExampleMessagesRoundtripTest.java&p1=james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/ExampleMessagesRoundtripTest.java&r1=897165&r2=897169&rev=897169&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/ExampleMessagesRoundtripTest.java (original)
+++ james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/dom/ExampleMessagesRoundtripTest.java Fri Jan  8 11:20:17 2010
@@ -17,7 +17,7 @@
  * under the License.                                           *
  ****************************************************************/
 
-package org.apache.james.mime4j.message;
+package org.apache.james.mime4j.dom;
 
 import java.io.ByteArrayOutputStream;
 import java.io.File;
@@ -33,7 +33,8 @@
 import junit.framework.TestSuite;
 
 import org.apache.james.mime4j.codec.CodecUtil;
-import org.apache.james.mime4j.message.impl.MessageImpl;
+import org.apache.james.mime4j.dom.Message;
+import org.apache.james.mime4j.message.MessageImpl;
 import org.apache.james.mime4j.stream.MimeEntityConfig;
 import org.apache.log4j.BasicConfigurator;
 

Propchange: james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/dom/ExampleMessagesRoundtripTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/dom/ExampleMessagesRoundtripTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Copied: james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/dom/HeaderTest.java (from r897165, james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/HeaderTest.java)
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/dom/HeaderTest.java?p2=james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/dom/HeaderTest.java&p1=james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/HeaderTest.java&r1=897165&r2=897169&rev=897169&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/HeaderTest.java (original)
+++ james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/dom/HeaderTest.java Fri Jan  8 11:20:17 2010
@@ -17,14 +17,15 @@
  * under the License.                                           *
  ****************************************************************/
 
-package org.apache.james.mime4j.message;
+package org.apache.james.mime4j.dom;
 
 import junit.framework.TestCase;
 
 import org.apache.commons.io.output.ByteArrayOutputStream;
+import org.apache.james.mime4j.dom.Header;
 import org.apache.james.mime4j.field.Field;
 import org.apache.james.mime4j.field.impl.DefaultFieldParser;
-import org.apache.james.mime4j.message.impl.MessageWriter;
+import org.apache.james.mime4j.message.MessageWriter;
 import org.apache.james.mime4j.util.CharsetUtil;
 
 public class HeaderTest extends TestCase {

Propchange: james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/dom/HeaderTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/dom/MessageCompleteMailTest.java (from r897165, james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/MessageCompleteMailTest.java)
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/dom/MessageCompleteMailTest.java?p2=james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/dom/MessageCompleteMailTest.java&p1=james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/MessageCompleteMailTest.java&r1=897165&r2=897169&rev=897169&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/MessageCompleteMailTest.java (original)
+++ james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/dom/MessageCompleteMailTest.java Fri Jan  8 11:20:17 2010
@@ -17,14 +17,15 @@
  * under the License.                                           *
  ****************************************************************/
 
-package org.apache.james.mime4j.message;
+package org.apache.james.mime4j.dom;
 
 import java.io.ByteArrayInputStream;
 
 import junit.framework.TestCase;
 
 import org.apache.james.mime4j.ExampleMail;
-import org.apache.james.mime4j.message.impl.MessageImpl;
+import org.apache.james.mime4j.dom.Multipart;
+import org.apache.james.mime4j.message.MessageImpl;
 
 public class MessageCompleteMailTest extends TestCase {
 

Propchange: james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/dom/MessageCompleteMailTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/dom/MessageHeadlessParserTest.java (from r897165, james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/MessageHeadlessParserTest.java)
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/dom/MessageHeadlessParserTest.java?p2=james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/dom/MessageHeadlessParserTest.java&p1=james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/MessageHeadlessParserTest.java&r1=897165&r2=897169&rev=897169&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/MessageHeadlessParserTest.java (original)
+++ james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/dom/MessageHeadlessParserTest.java Fri Jan  8 11:20:17 2010
@@ -17,16 +17,18 @@
  * under the License.                                           *
  ****************************************************************/
 
-package org.apache.james.mime4j.message;
+package org.apache.james.mime4j.dom;
 
 import java.io.BufferedReader;
 import java.io.ByteArrayInputStream;
 
 import junit.framework.TestCase;
 
+import org.apache.james.mime4j.dom.Multipart;
+import org.apache.james.mime4j.dom.TextBody;
 import org.apache.james.mime4j.field.ContentTypeField;
 import org.apache.james.mime4j.field.FieldName;
-import org.apache.james.mime4j.message.impl.MessageImpl;
+import org.apache.james.mime4j.message.MessageImpl;
 import org.apache.james.mime4j.stream.MimeEntityConfig;
 
 public class MessageHeadlessParserTest extends TestCase {

Propchange: james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/dom/MessageHeadlessParserTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/dom/MessageParserTest.java (from r897165, james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/MessageParserTest.java)
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/dom/MessageParserTest.java?p2=james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/dom/MessageParserTest.java&p1=james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/MessageParserTest.java&r1=897165&r2=897169&rev=897169&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/MessageParserTest.java (original)
+++ james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/dom/MessageParserTest.java Fri Jan  8 11:20:17 2010
@@ -17,7 +17,7 @@
  * under the License.                                           *
  ****************************************************************/
 
-package org.apache.james.mime4j.message;
+package org.apache.james.mime4j.dom;
 
 import java.io.BufferedInputStream;
 import java.io.File;
@@ -37,9 +37,14 @@
 import junit.framework.TestSuite;
 
 import org.apache.commons.io.IOUtils;
+import org.apache.james.mime4j.dom.BinaryBody;
+import org.apache.james.mime4j.dom.Body;
+import org.apache.james.mime4j.dom.Entity;
+import org.apache.james.mime4j.dom.Multipart;
+import org.apache.james.mime4j.dom.TextBody;
 import org.apache.james.mime4j.field.Field;
 import org.apache.james.mime4j.field.FieldsTest;
-import org.apache.james.mime4j.message.impl.MessageImpl;
+import org.apache.james.mime4j.message.MessageImpl;
 import org.apache.james.mime4j.stream.MimeEntityConfig;
 import org.apache.james.mime4j.util.CharsetUtil;
 import org.apache.log4j.BasicConfigurator;

Propchange: james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/dom/MessageParserTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/dom/MessageTest.java (from r897165, james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/MessageTest.java)
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/dom/MessageTest.java?p2=james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/dom/MessageTest.java&p1=james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/MessageTest.java&r1=897165&r2=897169&rev=897169&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/MessageTest.java (original)
+++ james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/dom/MessageTest.java Fri Jan  8 11:20:17 2010
@@ -17,7 +17,7 @@
  * under the License.                                           *
  ****************************************************************/
 
-package org.apache.james.mime4j.message;
+package org.apache.james.mime4j.dom;
 
 import java.io.BufferedReader;
 import java.io.ByteArrayInputStream;
@@ -33,14 +33,18 @@
 import junit.framework.TestCase;
 
 import org.apache.commons.io.IOUtils;
+import org.apache.james.mime4j.dom.Header;
+import org.apache.james.mime4j.dom.Message;
+import org.apache.james.mime4j.dom.Multipart;
+import org.apache.james.mime4j.dom.SingleBody;
 import org.apache.james.mime4j.field.address.Group;
 import org.apache.james.mime4j.field.address.Mailbox;
 import org.apache.james.mime4j.field.address.parser.AddressBuilder;
 import org.apache.james.mime4j.field.address.parser.GroupImpl;
 import org.apache.james.mime4j.field.impl.DefaultFieldParser;
-import org.apache.james.mime4j.message.impl.BodyPart;
-import org.apache.james.mime4j.message.impl.MessageImpl;
-import org.apache.james.mime4j.message.impl.MultipartImpl;
+import org.apache.james.mime4j.message.BodyPart;
+import org.apache.james.mime4j.message.MessageImpl;
+import org.apache.james.mime4j.message.MultipartImpl;
 
 public class MessageTest extends TestCase {
     private Header headerTextPlain = null;

Propchange: james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/dom/MessageTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/dom/MessageWriteToTest.java (from r897165, james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/MessageWriteToTest.java)
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/dom/MessageWriteToTest.java?p2=james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/dom/MessageWriteToTest.java&p1=james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/MessageWriteToTest.java&r1=897165&r2=897169&rev=897169&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/MessageWriteToTest.java (original)
+++ james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/dom/MessageWriteToTest.java Fri Jan  8 11:20:17 2010
@@ -17,13 +17,13 @@
  * under the License.                                           *
  ****************************************************************/
 
-package org.apache.james.mime4j.message;
+package org.apache.james.mime4j.dom;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 
 import org.apache.james.mime4j.ExampleMail;
-import org.apache.james.mime4j.message.impl.MessageImpl;
+import org.apache.james.mime4j.message.MessageImpl;
 
 import junit.framework.TestCase;
 

Propchange: james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/dom/MessageWriteToTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/dom/MultipartFormTest.java (from r897165, james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/MultipartFormTest.java)
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/dom/MultipartFormTest.java?p2=james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/dom/MultipartFormTest.java&p1=james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/MultipartFormTest.java&r1=897165&r2=897169&rev=897169&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/MultipartFormTest.java (original)
+++ james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/dom/MultipartFormTest.java Fri Jan  8 11:20:17 2010
@@ -17,18 +17,20 @@
  * under the License.                                           *
  ****************************************************************/
 
-package org.apache.james.mime4j.message;
+package org.apache.james.mime4j.dom;
 
 import java.io.ByteArrayOutputStream;
 
 import junit.framework.TestCase;
 
+import org.apache.james.mime4j.dom.Header;
+import org.apache.james.mime4j.dom.Multipart;
 import org.apache.james.mime4j.field.impl.DefaultFieldParser;
-import org.apache.james.mime4j.message.impl.BodyFactory;
-import org.apache.james.mime4j.message.impl.BodyPart;
-import org.apache.james.mime4j.message.impl.MessageImpl;
-import org.apache.james.mime4j.message.impl.MessageWriter;
-import org.apache.james.mime4j.message.impl.MultipartImpl;
+import org.apache.james.mime4j.message.BodyFactory;
+import org.apache.james.mime4j.message.BodyPart;
+import org.apache.james.mime4j.message.MessageImpl;
+import org.apache.james.mime4j.message.MessageWriter;
+import org.apache.james.mime4j.message.MultipartImpl;
 
 public class MultipartFormTest extends TestCase {
 

Propchange: james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/dom/MultipartFormTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/SingleBodyCopyTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/SingleBodyCopyTest.java?rev=897169&view=auto
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/SingleBodyCopyTest.java (added)
+++ james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/SingleBodyCopyTest.java Fri Jan  8 11:20:17 2010
@@ -0,0 +1,134 @@
+/****************************************************************
+ * 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.message;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+
+import junit.framework.TestCase;
+
+import org.apache.james.mime4j.dom.SingleBody;
+import org.apache.james.mime4j.message.MessageImpl;
+import org.apache.james.mime4j.message.StorageBinaryBody;
+import org.apache.james.mime4j.message.StorageTextBody;
+import org.apache.james.mime4j.message.StringTextBody;
+import org.apache.james.mime4j.storage.MemoryStorageProvider;
+import org.apache.james.mime4j.storage.MultiReferenceStorage;
+import org.apache.james.mime4j.storage.Storage;
+import org.apache.james.mime4j.util.CharsetUtil;
+
+public class SingleBodyCopyTest extends TestCase {
+
+    public void testCopyStorageBinaryBody() throws Exception {
+        Storage storage = new MemoryStorageProvider()
+                .store(new ByteArrayInputStream("test".getBytes()));
+        MultiReferenceStorage multiReferenceStorage = new MultiReferenceStorage(
+                storage);
+        SingleBody body = new StorageBinaryBody(multiReferenceStorage);
+        copyTest(body);
+    }
+
+    public void testCopyStorageTextBody() throws Exception {
+        Storage storage = new MemoryStorageProvider()
+                .store(new ByteArrayInputStream("test".getBytes()));
+        MultiReferenceStorage multiReferenceStorage = new MultiReferenceStorage(
+                storage);
+        SingleBody body = new StorageTextBody(multiReferenceStorage,
+                CharsetUtil.US_ASCII);
+        copyTest(body);
+    }
+
+    public void testCopyStringTextBody() throws Exception {
+        SingleBody body = new StringTextBody("test", CharsetUtil.US_ASCII);
+        copyTest(body);
+    }
+
+    public void testDisposeStorageBinaryBody() throws Exception {
+        Storage storage = new MemoryStorageProvider()
+                .store(new ByteArrayInputStream("test".getBytes()));
+        MultiReferenceStorage multiReferenceStorage = new MultiReferenceStorage(
+                storage);
+        SingleBody body = new StorageBinaryBody(multiReferenceStorage);
+        disposeTest(body, storage);
+    }
+
+    public void testDisposeStorageTextBody() throws Exception {
+        Storage storage = new MemoryStorageProvider()
+                .store(new ByteArrayInputStream("test".getBytes()));
+        MultiReferenceStorage multiReferenceStorage = new MultiReferenceStorage(
+                storage);
+        SingleBody body = new StorageTextBody(multiReferenceStorage,
+                CharsetUtil.US_ASCII);
+        disposeTest(body, storage);
+    }
+
+    private void copyTest(SingleBody body) throws Exception {
+        MessageImpl parent = new MessageImpl();
+        parent.setBody(body);
+
+        SingleBody copy = body.copy();
+        assertNotNull(copy);
+        assertNotSame(body, copy);
+
+        assertSame(parent, body.getParent());
+        assertNull(copy.getParent());
+
+        sameContentTest(body, copy);
+    }
+
+    private void sameContentTest(SingleBody expectedBody, SingleBody actualBody)
+            throws Exception {
+        ByteArrayOutputStream expBaos = new ByteArrayOutputStream();
+        expectedBody.writeTo(expBaos);
+        byte[] expected = expBaos.toByteArray();
+
+        ByteArrayOutputStream actBaos = new ByteArrayOutputStream();
+        actualBody.writeTo(actBaos);
+        byte[] actual = actBaos.toByteArray();
+
+        assertEquals(expected.length, actual.length);
+        for (int i = 0; i < expected.length; i++) {
+            assertEquals(expected[i], actual[i]);
+        }
+    }
+
+    private void disposeTest(SingleBody body, Storage storage) throws Exception {
+        assertTrue(storageIsReadable(storage));
+
+        SingleBody copy = body.copy();
+        assertTrue(storageIsReadable(storage));
+
+        body.dispose();
+        assertTrue(storageIsReadable(storage));
+
+        copy.dispose();
+        assertFalse(storageIsReadable(storage));
+    }
+
+    private boolean storageIsReadable(Storage storage) throws Exception {
+        try {
+            storage.getInputStream().close();
+            return true;
+        } catch (IllegalStateException e) {
+            return false;
+        }
+    }
+
+}

Propchange: james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/SingleBodyCopyTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: james/mime4j/branches/cycleclean/examples/src/main/java/org/apache/james/mime4j/samples/dom/MultipartMessage.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/examples/src/main/java/org/apache/james/mime4j/samples/dom/MultipartMessage.java?rev=897169&r1=897168&r2=897169&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/examples/src/main/java/org/apache/james/mime4j/samples/dom/MultipartMessage.java (original)
+++ james/mime4j/branches/cycleclean/examples/src/main/java/org/apache/james/mime4j/samples/dom/MultipartMessage.java Fri Jan  8 11:20:17 2010
@@ -29,14 +29,14 @@
 
 import javax.imageio.ImageIO;
 
+import org.apache.james.mime4j.dom.BinaryBody;
+import org.apache.james.mime4j.dom.Multipart;
+import org.apache.james.mime4j.dom.TextBody;
 import org.apache.james.mime4j.field.address.parser.AddressBuilder;
-import org.apache.james.mime4j.message.BinaryBody;
-import org.apache.james.mime4j.message.Multipart;
-import org.apache.james.mime4j.message.TextBody;
-import org.apache.james.mime4j.message.impl.BodyFactory;
-import org.apache.james.mime4j.message.impl.BodyPart;
-import org.apache.james.mime4j.message.impl.MessageImpl;
-import org.apache.james.mime4j.message.impl.MultipartImpl;
+import org.apache.james.mime4j.message.BodyFactory;
+import org.apache.james.mime4j.message.BodyPart;
+import org.apache.james.mime4j.message.MessageImpl;
+import org.apache.james.mime4j.message.MultipartImpl;
 import org.apache.james.mime4j.storage.Storage;
 import org.apache.james.mime4j.storage.StorageOutputStream;
 import org.apache.james.mime4j.storage.StorageProvider;

Modified: james/mime4j/branches/cycleclean/examples/src/main/java/org/apache/james/mime4j/samples/dom/TextPlainMessage.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/examples/src/main/java/org/apache/james/mime4j/samples/dom/TextPlainMessage.java?rev=897169&r1=897168&r2=897169&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/examples/src/main/java/org/apache/james/mime4j/samples/dom/TextPlainMessage.java (original)
+++ james/mime4j/branches/cycleclean/examples/src/main/java/org/apache/james/mime4j/samples/dom/TextPlainMessage.java Fri Jan  8 11:20:17 2010
@@ -22,11 +22,11 @@
 import java.io.IOException;
 import java.util.Date;
 
+import org.apache.james.mime4j.dom.TextBody;
 import org.apache.james.mime4j.field.address.parser.AddressBuilder;
 import org.apache.james.mime4j.field.address.parser.ParseException;
-import org.apache.james.mime4j.message.TextBody;
-import org.apache.james.mime4j.message.impl.BodyFactory;
-import org.apache.james.mime4j.message.impl.MessageImpl;
+import org.apache.james.mime4j.message.BodyFactory;
+import org.apache.james.mime4j.message.MessageImpl;
 
 /**
  * This example generates a message very similar to the one from RFC 5322

Modified: james/mime4j/branches/cycleclean/examples/src/main/java/org/apache/james/mime4j/samples/transform/TransformMessage.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/examples/src/main/java/org/apache/james/mime4j/samples/transform/TransformMessage.java?rev=897169&r1=897168&r2=897169&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/examples/src/main/java/org/apache/james/mime4j/samples/transform/TransformMessage.java (original)
+++ james/mime4j/branches/cycleclean/examples/src/main/java/org/apache/james/mime4j/samples/transform/TransformMessage.java Fri Jan  8 11:20:17 2010
@@ -24,17 +24,17 @@
 import java.util.Date;
 import java.util.Random;
 
+import org.apache.james.mime4j.dom.Body;
+import org.apache.james.mime4j.dom.Entity;
+import org.apache.james.mime4j.dom.Message;
+import org.apache.james.mime4j.dom.Multipart;
+import org.apache.james.mime4j.dom.TextBody;
 import org.apache.james.mime4j.field.address.parser.AddressBuilder;
 import org.apache.james.mime4j.field.ParseException;
-import org.apache.james.mime4j.message.Body;
-import org.apache.james.mime4j.message.Entity;
-import org.apache.james.mime4j.message.Message;
-import org.apache.james.mime4j.message.Multipart;
-import org.apache.james.mime4j.message.TextBody;
-import org.apache.james.mime4j.message.impl.BodyFactory;
-import org.apache.james.mime4j.message.impl.BodyPart;
-import org.apache.james.mime4j.message.impl.MessageImpl;
-import org.apache.james.mime4j.message.impl.MultipartImpl;
+import org.apache.james.mime4j.message.BodyFactory;
+import org.apache.james.mime4j.message.BodyPart;
+import org.apache.james.mime4j.message.MessageImpl;
+import org.apache.james.mime4j.message.MultipartImpl;
 import org.apache.james.mime4j.storage.DefaultStorageProvider;
 import org.apache.james.mime4j.storage.StorageProvider;
 import org.apache.james.mime4j.storage.TempFileStorageProvider;

Modified: james/mime4j/branches/cycleclean/examples/src/main/java/org/apache/james/mime4j/samples/tree/MessageTree.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/examples/src/main/java/org/apache/james/mime4j/samples/tree/MessageTree.java?rev=897169&r1=897168&r2=897169&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/examples/src/main/java/org/apache/james/mime4j/samples/tree/MessageTree.java (original)
+++ james/mime4j/branches/cycleclean/examples/src/main/java/org/apache/james/mime4j/samples/tree/MessageTree.java Fri Jan  8 11:20:17 2010
@@ -40,6 +40,12 @@
 import javax.swing.tree.DefaultMutableTreeNode;
 import javax.swing.tree.TreeSelectionModel;
 
+import org.apache.james.mime4j.dom.BinaryBody;
+import org.apache.james.mime4j.dom.Body;
+import org.apache.james.mime4j.dom.Entity;
+import org.apache.james.mime4j.dom.Header;
+import org.apache.james.mime4j.dom.Multipart;
+import org.apache.james.mime4j.dom.TextBody;
 import org.apache.james.mime4j.field.AddressListField;
 import org.apache.james.mime4j.field.ContentTypeField;
 import org.apache.james.mime4j.field.DateTimeField;
@@ -47,14 +53,8 @@
 import org.apache.james.mime4j.field.UnstructuredField;
 import org.apache.james.mime4j.field.address.Mailbox;
 import org.apache.james.mime4j.field.address.MailboxList;
-import org.apache.james.mime4j.message.BinaryBody;
-import org.apache.james.mime4j.message.Body;
-import org.apache.james.mime4j.message.Entity;
-import org.apache.james.mime4j.message.Header;
-import org.apache.james.mime4j.message.Multipart;
-import org.apache.james.mime4j.message.TextBody;
-import org.apache.james.mime4j.message.impl.BodyPart;
-import org.apache.james.mime4j.message.impl.MessageImpl;
+import org.apache.james.mime4j.message.BodyPart;
+import org.apache.james.mime4j.message.MessageImpl;
 
 /**
  * Displays a parsed Message in a window. The window will be divided into



Mime
View raw message