Examples of MailRepository


Examples of org.apache.james.mailrepository.api.MailRepository

        Collection<MailAddress> recipients = new HashSet<MailAddress>();
        recipients.add(recipient);
        MailImpl mail = new MailImpl(getId(), sender, recipients, message);
        try {
            MailRepository userInbox = getRepository(username);
            if (userInbox == null) {
                StringBuffer errorBuffer = new StringBuffer(128).append(
                        "The repository for user ").append(username).append(
                        " was not found on this server.");
                throw new MessagingException(errorBuffer.toString());
            }
            userInbox.store(mail);
        } finally {
            mail.dispose();
        }
    }
View Full Code Here

Examples of org.apache.james.mailrepository.api.MailRepository

        StringBuffer destinationBuffer = new StringBuffer(192).append(repositoryUrl).append(userName).append("/");
        String destination = destinationBuffer.toString();
        DefaultConfigurationBuilder mboxConf = new DefaultConfigurationBuilder();
        mboxConf.addProperty("[@destinationURL]", destination);
        mboxConf.addProperty("[@type]", repositoryType);
        MailRepository userInbox;
        try {
            userInbox = (MailRepository) store.select(mboxConf);
        } catch (Exception e) {
            log("Cannot open repository " + e);
            userInbox = null;
View Full Code Here

Examples of org.apache.james.mailrepository.api.MailRepository

        return mr;
    }

    // Try to write a unit test for JAMES-744. At the moment it seems that we cannot reproduce it.
    public void testReadMboxrdFile() throws Exception {
        MailRepository mr = getMailRepository();
       
        Iterator<String> keys = mr.list();
   
        assertTrue("Two messages in list", keys.hasNext());
        keys.next();
   
        assertTrue("One messages in list", keys.hasNext());
View Full Code Here

Examples of org.apache.james.mailrepository.api.MailRepository

        if (idx == -1)
            throw new MailRepositoryStoreException("Destination is malformed. Must be a valid URL: " + destination);
        String protocol = destination.substring(0, idx);

        String repID = destination;
        MailRepository reply = repositories.get(repID);
        StringBuffer logBuffer;
        if (reply != null) {
            if (getLogger().isDebugEnabled()) {
                logBuffer = new StringBuffer(128).append("obtained repository: ").append(repID).append(",").append(reply.getClass());
                getLogger().debug(logBuffer.toString());
            }
            return reply;
        } else {
            String repClass = classes.get(protocol);
View Full Code Here

Examples of org.apache.james.mailrepository.api.MailRepository

        Iterator<String> james23userRepositoryIterator = james23UsersRepository.list();

        while (james23userRepositoryIterator.hasNext()) {

            String userName23 = james23userRepositoryIterator.next();
            MailRepository mailRepository = mailRepositoryStore.select(james23MailRepositoryPath + "/" + userName23);
            Iterator<String> mailRepositoryIterator = mailRepository.list();

            String userName30 = convert23UserTo30(userName23);


            MailboxSession mailboxSession = mailboxManager.createSystemSession(userName30, log);
            MailboxPath mailboxPath = MailboxPath.inbox(mailboxSession);

            mailboxManager.startProcessingRequest(mailboxSession);
            try {
                mailboxManager.createMailbox(mailboxPath, mailboxSession);
            } catch (MailboxExistsException e) {
                // Do nothing, the mailbox already exists.
            }
            mailboxManager.endProcessingRequest(mailboxSession);

            MessageManager messageManager = mailboxManager.getMailbox(mailboxPath, mailboxSession);

            while (mailRepositoryIterator.hasNext()) {
                Mail mail = mailRepository.retrieve(mailRepositoryIterator.next());
                mailboxManager.startProcessingRequest(mailboxSession);
                messageManager.appendMessage(new MimeMessageInputStream(mail.getMessage()), new Date(), mailboxSession, isRecent, flags);
                mailboxManager.endProcessingRequest(mailboxSession);
            }
View Full Code Here

Examples of org.apache.james.mailrepository.api.MailRepository

    // Try to write a unit test for JAMES-744. At the moment it seems that we
    // cannot reproduce it.
    @Test
    public void testReadMboxrdFile() throws Exception {
        MailRepository mr = getMailRepository();

        Iterator<String> keys = mr.list();

        assertTrue("Two messages in list", keys.hasNext());
        keys.next();

        assertTrue("One messages in list", keys.hasNext());
View Full Code Here

Examples of org.apache.james.mailrepository.api.MailRepository

        m_storedObjectMap.put(url, obj);
    }

    @Override
    public MailRepository select(String url) throws MailRepositoryStoreException {
        MailRepository result = get(url);
        return result;
    }
View Full Code Here

Examples of org.apache.james.services.MailRepository

        try
        {
            String type = repConf.getAttribute("type");
            String repID = destination + type;
            MailRepository reply = (MailRepository) repositories.get(repID);
            if (reply != null) {
                getLogger().debug("obtained repository: " + repID
                                  + "," + reply.getClass());
                return (Component)reply;
            } else {
                String repClass = (String) classes.get( protocol + type );

                getLogger().debug( "Need instance of " + repClass +
View Full Code Here

Examples of org.apache.james.services.MailRepository

     *
     * @return the POP3 inbox for the user
     */
    public synchronized MailRepository getUserInbox( String userName )
    {
        MailRepository userInbox = ( MailRepository ) null;

        userInbox = ( MailRepository ) mailboxes.get( userName );

        if ( userInbox != null ) {
            return userInbox;
View Full Code Here

Examples of org.apache.james.services.MailRepository

        }
        else {
            Collection recipients = new HashSet();
            recipients.add( recipient );
            MailImpl mailImpl = new MailImpl( getId(), sender, recipients, message );
            MailRepository userInbox = getUserInbox( username );
            if ( userInbox == null ) {
                StringBuffer errorBuffer =
                        new StringBuffer( 128 )
                        .append( "The inbox for user " )
                        .append( username )
                        .append( " was not found on this server." );
                throw new MessagingException( errorBuffer.toString() );
            }
            userInbox.store( mailImpl );
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.