001/****************************************************************
002 * Licensed to the Apache Software Foundation (ASF) under one   *
003 * or more contributor license agreements.  See the NOTICE file *
004 * distributed with this work for additional information        *
005 * regarding copyright ownership.  The ASF licenses this file   *
006 * to you under the Apache License, Version 2.0 (the            *
007 * "License"); you may not use this file except in compliance   *
008 * with the License.  You may obtain a copy of the License at   *
009 *                                                              *
010 *   http://www.apache.org/licenses/LICENSE-2.0                 *
011 *                                                              *
012 * Unless required by applicable law or agreed to in writing,   *
013 * software distributed under the License is distributed on an  *
014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
015 * KIND, either express or implied.  See the License for the    *
016 * specific language governing permissions and limitations      *
017 * under the License.                                           *
018 ****************************************************************/
019package org.apache.james.mailbox.maildir;
020
021import org.apache.james.mailbox.MailboxSession;
022import org.apache.james.mailbox.exception.MailboxException;
023import org.apache.james.mailbox.exception.SubscriptionException;
024import org.apache.james.mailbox.maildir.mail.MaildirMailboxMapper;
025import org.apache.james.mailbox.maildir.mail.MaildirMessageMapper;
026import org.apache.james.mailbox.maildir.user.MaildirSubscriptionMapper;
027import org.apache.james.mailbox.store.MailboxSessionMapperFactory;
028import org.apache.james.mailbox.store.mail.MailboxMapper;
029import org.apache.james.mailbox.store.mail.MessageMapper;
030import org.apache.james.mailbox.store.user.SubscriptionMapper;
031
032public class MaildirMailboxSessionMapperFactory extends
033        MailboxSessionMapperFactory<Integer> {
034
035    private final MaildirStore store;
036
037    
038    public MaildirMailboxSessionMapperFactory(MaildirStore store) {
039        this.store = store;
040    }
041    
042    
043    @Override
044    protected MailboxMapper<Integer> createMailboxMapper(MailboxSession session)
045            throws MailboxException {
046        return new MaildirMailboxMapper(store, session);
047    }
048
049    @Override
050    protected MessageMapper<Integer> createMessageMapper(MailboxSession session)
051            throws MailboxException {
052        return new MaildirMessageMapper(session, store);
053    }
054
055    @Override
056    protected SubscriptionMapper createSubscriptionMapper(MailboxSession session)
057            throws SubscriptionException {
058        return new MaildirSubscriptionMapper(store);
059    }
060
061}