You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by rd...@apache.org on 2009/02/05 19:33:28 UTC
svn commit: r741222 [2/2] - in /james/protocols/imap/trunk:
deployment/src/test/java/org/apache/james/imap/functional/jpa/ jpa/
jpa/src/main/java/org/apache/james/imap/jpa/
jpa/src/main/java/org/apache/james/imap/jpa/mail/model/
mailbox/src/main/java/o...
Added: james/protocols/imap/trunk/store/src/test/java/org/apache/james/imap/store/SimpleProperty.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/store/src/test/java/org/apache/james/imap/store/SimpleProperty.java?rev=741222&view=auto
==============================================================================
--- james/protocols/imap/trunk/store/src/test/java/org/apache/james/imap/store/SimpleProperty.java (added)
+++ james/protocols/imap/trunk/store/src/test/java/org/apache/james/imap/store/SimpleProperty.java Thu Feb 5 18:33:27 2009
@@ -0,0 +1,51 @@
+/****************************************************************
+ * 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.imap.store;
+
+import org.apache.james.imap.store.mail.model.Property;
+
+/**
+ * Simple implementation suitable for testing.
+ */
+public class SimpleProperty implements Property {
+
+ public String localName;
+ public String namespace;
+ public String value;
+
+ public SimpleProperty(String namespace, String localName, String value) {
+ super();
+ this.localName = localName;
+ this.namespace = namespace;
+ this.value = value;
+ }
+
+ public String getLocalName() {
+ return localName;
+ }
+
+ public String getNamespace() {
+ return namespace;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+}
Modified: james/protocols/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/MimeDescriptorImpl.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/MimeDescriptorImpl.java?rev=741222&r1=741221&r2=741222&view=diff
==============================================================================
--- james/protocols/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/MimeDescriptorImpl.java (original)
+++ james/protocols/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/MimeDescriptorImpl.java Thu Feb 5 18:33:27 2009
@@ -23,9 +23,11 @@
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.TreeMap;
import org.apache.james.imap.mailbox.MessageResult;
import org.apache.james.imap.mailbox.MimeDescriptor;
@@ -48,7 +50,7 @@
private static MimeDescriptorImpl createDescriptor(
final MimeTokenStream parser) throws IOException, MimeException {
int next = parser.next();
- final Collection headers = new ArrayList();
+ final Collection<Header> headers = new ArrayList<Header>();
while (next != MimeTokenStream.T_BODY
&& next != MimeTokenStream.T_END_OF_STREAM
&& next != MimeTokenStream.T_START_MULTIPART) {
@@ -135,30 +137,24 @@
final String subType = descriptor.getSubType();
final String type = descriptor.getMediaType();
final String transferEncoding = descriptor.getTransferEncoding();
- final Collection contentTypeParameters = new ArrayList();
+ final Map<String, String> contentTypeParameters = new TreeMap<String, String>();
final Map valuesByName = descriptor.getContentTypeParameters();
for (final Iterator it = valuesByName.keySet().iterator(); it.hasNext();) {
final String name = (String) it.next();
final String value = (String) valuesByName.get(name);
- contentTypeParameters.add(new Header(name, value));
+ contentTypeParameters.put(name, value);
}
final String codeset = descriptor.getCharset();
- Header header;
if (codeset == null) {
if ("TEXT".equals(type)) {
- header = new Header("charset", "us-ascii");
- } else {
- header = null;
+ contentTypeParameters.put("charset", "us-ascii");
}
} else {
- header = new Header("charset", codeset);
- }
- if (header != null) {
- contentTypeParameters.add(header);
+ contentTypeParameters.put("charset", codeset);
}
final String boundary = descriptor.getBoundary();
if (boundary != null) {
- contentTypeParameters.add(new Header("boundary", boundary));
+ contentTypeParameters.put("boundary", boundary);
}
final List languages = descriptor.getContentLanguage();
final String disposition = descriptor.getContentDispositionType();
@@ -193,7 +189,7 @@
private final Collection<MessageResult.Header> headers;
- private final Collection<MessageResult.Header> contentTypeParameters;
+ private final Map<String, String> contentTypeParameters;
private final String disposition;
@@ -211,7 +207,7 @@
final String contentDescription, final String contentId,
final long lines, final String subType, final String type,
final String transferEncoding, final Collection headers,
- final Collection contentTypeParameters, final List languages,
+ final Map<String, String> contentTypeParameters, final List languages,
String disposition, Map dispositionParams,
final MimeDescriptor embeddedMessage, final Collection parts,
final String location, final String md5) {
@@ -234,8 +230,8 @@
this.md5 = md5;
}
- public Iterator<MessageResult.Header> contentTypeParameters() {
- return contentTypeParameters.iterator();
+ public Map<String, String> contentTypeParameters() {
+ return contentTypeParameters;
}
public MimeDescriptor embeddedMessage() {
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org