// 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);