Package org.apache.james.mailbox

Examples of org.apache.james.mailbox.MailboxPath


        log(arg0.toString(), arg1);
      }
         
        });
        manager.startProcessingRequest(session);
        MessageManager mailbox = manager.getMailbox(new MailboxPath(MailboxConstants.USER_NAMESPACE,
                                            session.getUser().getUserName(), "INBOX"),
                                            session);
        Iterator<MessageResult> results = mailbox.getMessages(MessageRange.all(), new FetchGroupImpl(FetchGroup.MINIMAL), session);
       
        while (results.hasNext()) {
View Full Code Here


                    if (destination == null || "".equals(destination)) {
                        destination = "INBOX";
                    }
                    if (destination.startsWith(MailboxConstants.DEFAULT_DELIMITER_STRING))
                        destination = destination.substring(1);
                    final MailboxPath path = new MailboxPath(MailboxConstants.USER_NAMESPACE, user, destination);
                    try {
                        if ("INBOX".equalsIgnoreCase(destination) && !(mailboxManager.mailboxExists(path, session))) {
                            mailboxManager.createMailbox(path, session);
                        }
                        final MessageManager mailbox = mailboxManager.getMailbox(path, session);
View Full Code Here

        POP3MessageInfo[] list = m_pop3Protocol.listUniqueIdentifiers();
        assertEquals("Found unexpected messages", 0, list.length);

        m_pop3Protocol.disconnect();
        MailboxPath mailboxPath = new MailboxPath(MailboxConstants.USER_NAMESPACE, "foo", "INBOX");
        MailboxSession session = manager.login("foo", "bar", new SimpleLog("Test"));
        if (manager.mailboxExists(mailboxPath, session) == false) {
            manager.createMailbox(mailboxPath, session);
        }
        setupTestMails(session,manager.getMailbox(mailboxPath, session));
View Full Code Here

        m_pop3Protocol = new POP3Client();
        m_pop3Protocol.connect("127.0.0.1",m_pop3ListenerPort);

        m_usersRepository.addUser("foo2", "bar2");

        MailboxPath mailboxPath = new MailboxPath(MailboxConstants.USER_NAMESPACE, "foo2", "INBOX");
        MailboxSession session = manager.login("foo2", "bar2", new SimpleLog("Test"));
       
        if (manager.mailboxExists(mailboxPath, session) == false) {
            manager.createMailbox(mailboxPath, session);
        }
View Full Code Here

                MailboxSession mSession = mailboxManager.login(session.getUser(), passArg, session.getLogger());
               
                // explicit call start processing because it was not stored before in the session
                mailboxManager.startProcessingRequest(mSession);
               
                MailboxPath mailboxPath = MailboxPath.inbox(session.getUser());
               
                // check if mailbox exists.. if not just create it
                if (mailboxManager.mailboxExists(mailboxPath, mSession) == false) {
                    mailboxManager.createMailbox(mailboxPath, mSession);
                }
View Full Code Here

            SMTPResponse response;
           
            try {
               
                MailboxSession mailboxSession = mailboxManager.createSystemSession(username, session.getLogger());
                MailboxPath inbox = MailboxPath.inbox(username);
               
                mailboxManager.startProcessingRequest(mailboxSession);
               
                // create inbox if not exist
                if (mailboxManager.mailboxExists(inbox, mailboxSession) == false) {
View Full Code Here

        final CountDownLatch latch = new CountDownLatch(APPEND_OPERATIONS);
        final ExecutorService pool = Executors.newFixedThreadPool(APPEND_OPERATIONS/2);
       
        MailboxSession session = getMailboxManager().createSystemSession("test", LoggerFactory.getLogger("Test"));
        getMailboxManager().startProcessingRequest(session);
        final MailboxPath path = new MailboxPath(MailboxConstants.USER_NAMESPACE, "username", "INBOX");
        getMailboxManager().createMailbox(path, session);
        getMailboxManager().endProcessingRequest(session);
        getMailboxManager().logout(session, false);
        final AtomicBoolean fail = new AtomicBoolean(false);
       
View Full Code Here

                mapper.save(mailbox);

                dispatcher.mailboxRenamed(session, from, to);

                // rename submailboxes
                final MailboxPath children = new MailboxPath(MailboxConstants.USER_NAMESPACE, from.getUser(), from.getName() + getDelimiter() + "%");
                locker.executeWithLock(session, children, new LockAwareExecution() {
                   
                    public void execute(MailboxSession session, MailboxPath children) throws MailboxException {
                        final List<Mailbox<Id>> subMailboxes = mapper.findMailboxWithPathLike(children);
                        for (Mailbox<Id> sub : subMailboxes) {
                            final String subOriginalName = sub.getName();
                            final String subNewName = to.getName() + subOriginalName.substring(from.getName().length());
                            final MailboxPath fromPath = new MailboxPath(children, subOriginalName);
                            final MailboxPath toPath = new MailboxPath(children, subNewName);

                            sub.setName(subNewName);
                            mapper.save(sub);
                            dispatcher.mailboxRenamed(session, fromPath, toPath);
View Full Code Here

            baseLength = baseName.length();
        }
        final String combinedName = mailboxExpression.getCombinedName()
                                    .replace(freeWildcard, SQL_WILDCARD_CHAR)
                                    .replace(localWildcard, SQL_WILDCARD_CHAR);
        final MailboxPath search = new MailboxPath(mailboxExpression.getBase(), combinedName);

        final MailboxMapper<Id> mapper = mailboxSessionMapperFactory.getMailboxMapper(session);
        final List<Mailbox<Id>> mailboxes = mapper.findMailboxWithPathLike(search);
        final List<MailboxMetaData> results = new ArrayList<MailboxMetaData>(mailboxes.size());
        for (Mailbox<Id> mailbox: mailboxes) {
            final String name = mailbox.getName();
            if (name.startsWith(baseName)) {
                final String match = name.substring(baseLength);
                if (mailboxExpression.isExpressionMatch(match)) {
                    final MailboxMetaData.Children inferiors;
                    if (mapper.hasChildren(mailbox, session.getPathDelimiter())) {
                        inferiors = MailboxMetaData.Children.HAS_CHILDREN;
                    } else {
                        inferiors = MailboxMetaData.Children.HAS_NO_CHILDREN;
                    }
                    MailboxPath mailboxPath = new MailboxPath(mailbox.getNamespace(), mailbox.getUser(), name);
                    results.add(new SimpleMailboxMetaData(mailboxPath, getDelimiter(), inferiors, Selectability.NONE));
                }
            }
        }
        Collections.sort(results, new StandardMailboxMetaDataComparator());
View Full Code Here

    public List<MailboxPath> list(MailboxSession session) throws MailboxException {
        List<MailboxPath> mList = new ArrayList<MailboxPath>();
        List<Mailbox<Id>> mailboxes = mailboxSessionMapperFactory.getMailboxMapper(session).list();
        for (int i = 0; i < mailboxes.size(); i++) {
            Mailbox<Id> m = mailboxes.get(i);
            mList.add(new MailboxPath(m.getNamespace(), m.getUser(), m.getName()));
        }
        return Collections.unmodifiableList(mList);
       
    }
View Full Code Here

TOP

Related Classes of org.apache.james.mailbox.MailboxPath

Copyright © 2018 www.massapicom. 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.