Examples of MailboxPath


Examples of org.apache.james.mailbox.model.MailboxPath

     * org.apache.james.imap.api.process.ImapSession, java.lang.String,
     * org.apache.james.imap.api.ImapCommand,
     * org.apache.james.imap.api.process.ImapProcessor.Responder)
     */
    protected void doProcess(StatusRequest request, ImapSession session, String tag, ImapCommand command, Responder responder) {
        final MailboxPath mailboxPath = buildFullPath(session, request.getMailboxName());
        final StatusDataItems statusDataItems = request.getStatusDataItems();
        final Logger logger = session.getLog();
        final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);

        try {
View Full Code Here

Examples of org.apache.james.mailbox.model.MailboxPath

            finalReferencename = "";
        }

        // Is the interpreted (combined) pattern relative?
        boolean isRelative = ((finalReferencename + mailboxName).charAt(0) != MailboxConstants.NAMESPACE_PREFIX_CHAR);
        MailboxPath basePath = null;
        if (isRelative) {
            basePath = new MailboxPath(MailboxConstants.USER_NAMESPACE, mailboxSession.getUser().getUserName(), CharsetUtil.decodeModifiedUTF7(finalReferencename));
        } else {
            basePath = buildFullPath(session, CharsetUtil.decodeModifiedUTF7(finalReferencename));
        }

        final MailboxQuery expression = new MailboxQuery(basePath, CharsetUtil.decodeModifiedUTF7(mailboxName), mailboxSession.getPathDelimiter());
View Full Code Here

Examples of org.apache.james.mailbox.model.MailboxPath

        String namespace = null;
        String name = null;
        final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);

        if (mailboxName == null || mailboxName.length() == 0) {
            return new MailboxPath("", "", "");
        }
        if (mailboxName.charAt(0) == MailboxConstants.NAMESPACE_PREFIX_CHAR) {
            int namespaceLength = mailboxName.indexOf(mailboxSession.getPathDelimiter());
            if (namespaceLength > -1) {
                namespace = mailboxName.substring(0, namespaceLength);
                if (mailboxName.length() > namespaceLength)
                    name = mailboxName.substring(++namespaceLength);
            } else {
                namespace = mailboxName;
            }
        } else {
            namespace = MailboxConstants.USER_NAMESPACE;
            name = mailboxName;
        }
        String user = null;
        // we only use the user as part of the MailboxPath if its a private user
        // namespace
        if (namespace.equals(MailboxConstants.USER_NAMESPACE)) {
            user = ImapSessionUtils.getUserName(session);
        }
       
        // use uppercase for INBOX
        //
        // See IMAP-349
        if (name.equalsIgnoreCase(MailboxConstants.INBOX)) {
            name = MailboxConstants.INBOX;
        }

        return new MailboxPath(namespace, user, name);
    }
View Full Code Here

Examples of org.apache.james.mailbox.model.MailboxPath

     * org.apache.james.imap.api.process.ImapSession, java.lang.String,
     * org.apache.james.imap.api.ImapCommand,
     * org.apache.james.imap.api.process.ImapProcessor.Responder)
     */
    protected void doProcess(DeleteRequest request, ImapSession session, String tag, ImapCommand command, Responder responder) {
        final MailboxPath mailboxPath = buildFullPath(session, request.getMailboxName());
        try {
            final SelectedMailbox selected = session.getSelected();
            if (selected != null && selected.getPath().equals(mailboxPath)) {
                session.deselect();
            }
View Full Code Here

Examples of org.apache.james.mailbox.model.MailboxPath

                    // non-rooted
                    referenceRoot = "";
                    isRelative = true;
                }
                // Get the mailbox for the reference name.
                final MailboxPath rootPath = new MailboxPath(referenceRoot, "", "");
                results = new ArrayList<MailboxMetaData>(1);
                results.add(new MailboxMetaData() {

                    /**
                     * @see org.apache.james.mailbox.MailboxMetaData#inferiors()
                     */
                    public Children inferiors() {
                        return Children.CHILDREN_ALLOWED_BUT_UNKNOWN;
                    }

                    /**
                     * @see org.apache.james.mailbox.MailboxMetaData#getSelectability()
                     */
                    public Selectability getSelectability() {
                        return Selectability.NOSELECT;
                    }

                    /**
                     * @see org.apache.james.mailbox.MailboxMetaData#getHierarchyDelimiter()
                     */
                    public char getHierarchyDelimiter() {
                        return mailboxSession.getPathDelimiter();
                    }

                    /**
                     * (non-Javadoc)
                     * @see org.apache.james.mailbox.MailboxMetaData#getPath()
                     */
                    public MailboxPath getPath() {
                        return rootPath;
                    }
                   
                });
            } else {
                // If the mailboxPattern is fully qualified, ignore the
                // reference name.
                String finalReferencename = referenceName;
                if (mailboxName.charAt(0) == MailboxConstants.NAMESPACE_PREFIX_CHAR) {
                    finalReferencename = "";
                }
                // Is the interpreted (combined) pattern relative?
                isRelative = ((finalReferencename + mailboxName).charAt(0) != MailboxConstants.NAMESPACE_PREFIX_CHAR);

                finalReferencename = CharsetUtil.decodeModifiedUTF7(finalReferencename);

                MailboxPath basePath = null;
                if (isRelative) {
                    basePath = new MailboxPath(MailboxConstants.USER_NAMESPACE, user, finalReferencename);
                } else {
                    basePath = buildFullPath(session, finalReferencename);
                }

                results = getMailboxManager().search(new MailboxQuery(basePath, CharsetUtil.decodeModifiedUTF7(mailboxName), mailboxSession.getPathDelimiter()), mailboxSession);
View Full Code Here

Examples of org.apache.james.mailbox.model.MailboxPath

            String id = session.getUser().getUserName();
            AtomicLong count = counts.get(id);
            if (count == null) {
                long mc = 0;
                List<Mailbox> mailboxes = factory.getMailboxMapper(session).findMailboxWithPathLike(new MailboxPath(session.getPersonalSpace(), id, "%"));
                for (int i = 0; i < mailboxes.size(); i++) {
                    mc += factory.getMessageMapper(session).countMessagesInMailbox(mailboxes.get(i));
                }
                AtomicLong c = counts.putIfAbsent(id, new AtomicLong(mc));
                if (c != null) {
View Full Code Here

Examples of org.apache.james.mailbox.model.MailboxPath

          String id = session.getUser().getUserName();
            AtomicLong size = sizes.get(id);
           
            if (size == null) {
                final AtomicLong mSizes = new AtomicLong(0);
                List<Mailbox> mailboxes = factory.getMailboxMapper(session).findMailboxWithPathLike(new MailboxPath(session.getPersonalSpace(), id, "%"));
                for (int i = 0; i < mailboxes.size(); i++) {
                  long messageSizes = 0;
                    Iterator<Message>  messages = mapper.findInMailbox(mailboxes.get(i), MessageRange.all(), FetchType.Metadata, -1);
                   
                    while(messages.hasNext()) {
View Full Code Here

Examples of org.apache.james.mailbox.model.MailboxPath

    /**
     * Receive the event and dispatch it to the right {@link MailboxListener} depending on
     * {@link org.apache.james.mailbox.MailboxListener.Event#getMailboxPath()}
     */
    public void event(Event event) {
        MailboxPath path = event.getMailboxPath();
        Map<MailboxPath, List<MailboxListener>> listeners = getListeners();
        synchronized (listeners) {
            List<MailboxListener> mListeners = listeners.get(path);
            if (mListeners != null && mListeners.isEmpty() == false) {
               
View Full Code Here

Examples of org.apache.james.mailbox.model.MailboxPath

                mapper.save(mailbox);

                dispatcher.mailboxRenamed(session, from, mailbox);

                // rename submailboxes
                final MailboxPath children = new MailboxPath(MailboxConstants.USER_NAMESPACE, from.getUser(), from.getName() + getDelimiter() + "%");
                locker.executeWithLock(session, children, new LockAwareExecution<Void>() {

                    public Void execute() 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);
                            sub.setName(subNewName);
                            mapper.save(sub);
                            dispatcher.mailboxRenamed(session, fromPath, sub);

                            if (log.isDebugEnabled())
View Full Code Here

Examples of org.apache.james.mailbox.model.MailboxPath

            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
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.