MAILBOX-268 Introduce AttachmentMapper interfaces
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/321ad9af Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/321ad9af Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/321ad9af Branch: refs/heads/master Commit: 321ad9afb0abb8f0a1e48ee6db280bd1d4173124 Parents: 31ae6de Author: Antoine Duprat <adup...@linagora.com> Authored: Tue May 24 11:32:28 2016 +0200 Committer: Antoine Duprat <antdup...@gmail.com> Committed: Fri May 27 10:01:52 2016 +0200 ---------------------------------------------------------------------- .../exception/AttachmentNotFoundException.java | 33 ++++++++++++++++++++ .../mailbox/store/mail/AttachmentMapper.java | 32 +++++++++++++++++++ .../store/mail/AttachmentMapperFactory.java | 27 ++++++++++++++++ .../mailbox/store/mail/model/AttachmentId.java | 23 ++++++++++++++ 4 files changed, 115 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/james-project/blob/321ad9af/mailbox/api/src/main/java/org/apache/james/mailbox/exception/AttachmentNotFoundException.java ---------------------------------------------------------------------- diff --git a/mailbox/api/src/main/java/org/apache/james/mailbox/exception/AttachmentNotFoundException.java b/mailbox/api/src/main/java/org/apache/james/mailbox/exception/AttachmentNotFoundException.java new file mode 100644 index 0000000..10b7737 --- /dev/null +++ b/mailbox/api/src/main/java/org/apache/james/mailbox/exception/AttachmentNotFoundException.java @@ -0,0 +1,33 @@ +/**************************************************************** + * 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.mailbox.exception; + +public class AttachmentNotFoundException extends MailboxException { + + private final String attachmentId; + + public AttachmentNotFoundException(String attachmentId) { + this.attachmentId = attachmentId; + } + + public final String getAttachmentId() { + return attachmentId; + } +} http://git-wip-us.apache.org/repos/asf/james-project/blob/321ad9af/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/AttachmentMapper.java ---------------------------------------------------------------------- diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/AttachmentMapper.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/AttachmentMapper.java new file mode 100644 index 0000000..e720a80 --- /dev/null +++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/AttachmentMapper.java @@ -0,0 +1,32 @@ +/**************************************************************** + * 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.mailbox.store.mail; + +import org.apache.james.mailbox.exception.AttachmentNotFoundException; +import org.apache.james.mailbox.exception.MailboxException; +import org.apache.james.mailbox.store.mail.model.Attachment; +import org.apache.james.mailbox.store.mail.model.AttachmentId; +import org.apache.james.mailbox.store.transaction.Mapper; + +public interface AttachmentMapper extends Mapper { + + Attachment getAttachment(AttachmentId attachmentId) throws AttachmentNotFoundException; + + void storeAttachment(Attachment attachment) throws MailboxException; +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/james-project/blob/321ad9af/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/AttachmentMapperFactory.java ---------------------------------------------------------------------- diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/AttachmentMapperFactory.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/AttachmentMapperFactory.java new file mode 100644 index 0000000..3d08131 --- /dev/null +++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/AttachmentMapperFactory.java @@ -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 org.apache.james.mailbox.store.mail; + +import org.apache.james.mailbox.MailboxSession; +import org.apache.james.mailbox.exception.MailboxException; + +public interface AttachmentMapperFactory { + + AttachmentMapper getAttachmentMapper(MailboxSession session) throws MailboxException; +} http://git-wip-us.apache.org/repos/asf/james-project/blob/321ad9af/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/AttachmentId.java ---------------------------------------------------------------------- diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/AttachmentId.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/AttachmentId.java new file mode 100644 index 0000000..dc87bf1 --- /dev/null +++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/AttachmentId.java @@ -0,0 +1,23 @@ +/**************************************************************** + * 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.mailbox.store.mail.model; + +public interface AttachmentId { + String serialize(); +} --------------------------------------------------------------------- To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org