96 lines
3.8 KiB
Java
96 lines
3.8 KiB
Java
/****************************************************************
|
|
* 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.inmemory.mail;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
import java.util.concurrent.atomic.AtomicLong;
|
|
|
|
import org.apache.james.mailbox.exception.MailboxException;
|
|
import org.apache.james.mailbox.exception.MailboxNotFoundException;
|
|
import org.apache.james.mailbox.model.MailboxPath;
|
|
import org.apache.james.mailbox.store.mail.MailboxMapper;
|
|
import org.apache.james.mailbox.store.mail.model.Mailbox;
|
|
import org.apache.james.mailbox.store.mail.model.impl.SimpleMailbox;
|
|
|
|
public class InMemoryMailboxMapper implements MailboxMapper<Long> {
|
|
|
|
public InMemoryMailboxMapper() {
|
|
}
|
|
|
|
/**
|
|
* @see org.apache.james.mailbox.store.mail.MailboxMapper#delete(org.apache.james.mailbox.store.mail.model.Mailbox)
|
|
*/
|
|
public void delete(Mailbox<Long> mailbox) throws MailboxException {
|
|
throw new MailboxException ("delete not supported");
|
|
}
|
|
|
|
public void deleteAll() throws MailboxException {
|
|
throw new MailboxException ("deleteAll not supported");
|
|
}
|
|
|
|
/**
|
|
* @see org.apache.james.mailbox.store.mail.MailboxMapper#findMailboxByPath(org.apache.james.mailbox.model.MailboxPath)
|
|
*/
|
|
public synchronized Mailbox<Long> findMailboxByPath(MailboxPath path) throws MailboxException, MailboxNotFoundException {
|
|
return new SimpleMailbox<Long>(path, 0);
|
|
}
|
|
|
|
/**
|
|
* @see org.apache.james.mailbox.store.mail.MailboxMapper#findMailboxWithPathLike(org.apache.james.mailbox.model.MailboxPath)
|
|
*/
|
|
public List<Mailbox<Long>> findMailboxWithPathLike(MailboxPath path) throws MailboxException {
|
|
throw new MailboxException ("findMailboxWithPathLike not supported");
|
|
}
|
|
|
|
/**
|
|
* @see org.apache.james.mailbox.store.mail.MailboxMapper#save(org.apache.james.mailbox.store.mail.model.Mailbox)
|
|
*/
|
|
public void save(Mailbox<Long> mailbox) throws MailboxException {
|
|
}
|
|
|
|
/**
|
|
* Do nothing
|
|
*/
|
|
public void endRequest() {
|
|
}
|
|
|
|
/**
|
|
* @see org.apache.james.mailbox.store.mail.MailboxMapper#hasChildren(org.apache.james.mailbox.store.mail.model.Mailbox, char)
|
|
*/
|
|
public boolean hasChildren(Mailbox<Long> mailbox, char delimiter) throws MailboxException,
|
|
MailboxNotFoundException {
|
|
throw new MailboxException ("hasChildren not supported");
|
|
}
|
|
|
|
/**
|
|
* @see org.apache.james.mailbox.store.mail.MailboxMapper#list()
|
|
*/
|
|
public List<Mailbox<Long>> list() throws MailboxException {
|
|
return new ArrayList<Mailbox<Long>>();
|
|
}
|
|
|
|
public <T> T execute(Transaction<T> transaction) throws MailboxException {
|
|
return transaction.run();
|
|
}
|
|
|
|
}
|