Skip to content

Commit

Permalink
JAMES-2114 Remove LOGGER from mailboxSession API
Browse files Browse the repository at this point in the history
  • Loading branch information
chibenwa committed Aug 24, 2017
1 parent b305e55 commit 1ff0af0
Show file tree
Hide file tree
Showing 81 changed files with 360 additions and 483 deletions.
Expand Up @@ -40,7 +40,6 @@
import org.apache.james.mailbox.model.MessageRange; import org.apache.james.mailbox.model.MessageRange;
import org.apache.james.mailbox.model.MultimailboxesSearchQuery; import org.apache.james.mailbox.model.MultimailboxesSearchQuery;
import org.apache.james.mailbox.model.SimpleMailboxACL; import org.apache.james.mailbox.model.SimpleMailboxACL;
import org.slf4j.Logger;


import com.google.common.base.Optional; import com.google.common.base.Optional;


Expand Down Expand Up @@ -260,20 +259,18 @@ enum SearchCapabilities {
/** /**
* Creates a new system session.<br> * Creates a new system session.<br>
* A system session is intended to be used for programmatic access.<br> * A system session is intended to be used for programmatic access.<br>
* Use {@link #login(String, String, Logger)} when accessing this API from a * Use {@link #login(String, String)} when accessing this API from a
* protocol. * protocol.
* *
* @param userName * @param userName
* the name of the user whose session is being created * the name of the user whose session is being created
* @param log
* context sensitive log
* @return <code>MailboxSession</code>, not null * @return <code>MailboxSession</code>, not null
* @throws BadCredentialsException * @throws BadCredentialsException
* when system access is not allowed for the given user * when system access is not allowed for the given user
* @throws MailboxException * @throws MailboxException
* when the creation fails for other reasons * when the creation fails for other reasons
*/ */
MailboxSession createSystemSession(String userName, Logger log) throws BadCredentialsException, MailboxException; MailboxSession createSystemSession(String userName) throws BadCredentialsException, MailboxException;


/** /**
* Autenticates the given user against the given password.<br> * Autenticates the given user against the given password.<br>
Expand All @@ -283,16 +280,14 @@ enum SearchCapabilities {
* user name * user name
* @param passwd * @param passwd
* password supplied * password supplied
* @param log
* context sensitive log
* @return a <code>MailboxSession</code> when the user is authenticated and * @return a <code>MailboxSession</code> when the user is authenticated and
* authorized to access * authorized to access
* @throws BadCredentialsException * @throws BadCredentialsException
* when system access is denied for the given user * when system access is denied for the given user
* @throws MailboxException * @throws MailboxException
* when the creation fails for other reasons * when the creation fails for other reasons
*/ */
MailboxSession login(String userid, String passwd, Logger log) throws BadCredentialsException, MailboxException; MailboxSession login(String userid, String passwd) throws BadCredentialsException, MailboxException;


/** /**
* Autenticates the given administrator against the given password, * Autenticates the given administrator against the given password,
Expand All @@ -305,16 +300,14 @@ enum SearchCapabilities {
* password supplied for the admin user * password supplied for the admin user
* @param otherUserId * @param otherUserId
* user name of the real user * user name of the real user
* @param log
* context sensitive log
* @return a <code>MailboxSession</code> for the real user * @return a <code>MailboxSession</code> for the real user
* when the admin is authenticated and authorized to access * when the admin is authenticated and authorized to access
* @throws BadCredentialsException * @throws BadCredentialsException
* when system access is denied for the given user * when system access is denied for the given user
* @throws MailboxException * @throws MailboxException
* when the creation fails for other reasons * when the creation fails for other reasons
*/ */
MailboxSession loginAsOtherUser(String adminUserId, String passwd, String otherUserId, Logger log) throws BadCredentialsException, MailboxException; MailboxSession loginAsOtherUser(String adminUserId, String passwd, String otherUserId) throws BadCredentialsException, MailboxException;


/** /**
* <p> * <p>
Expand Down
Expand Up @@ -24,8 +24,6 @@
import java.util.Locale; import java.util.Locale;
import java.util.Map; import java.util.Map;


import org.slf4j.Logger;

/** /**
* Mailbox session. * Mailbox session.
*/ */
Expand Down Expand Up @@ -75,13 +73,6 @@ enum SessionType {
*/ */
void close(); void close();


/**
* Gets the logger for this session context.
*
* @return not null
*/
Logger getLog();

/** /**
* Gets the user executing this session. * Gets the user executing this session.
* *
Expand Down
Expand Up @@ -39,7 +39,6 @@
import org.apache.james.mailbox.model.MailboxPath; import org.apache.james.mailbox.model.MailboxPath;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.slf4j.LoggerFactory;


import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;


Expand All @@ -63,7 +62,7 @@ public void testStressTest() throws InterruptedException, MailboxException {
final ExecutorService pool = Executors.newFixedThreadPool(APPEND_OPERATIONS / 2); final ExecutorService pool = Executors.newFixedThreadPool(APPEND_OPERATIONS / 2);
final List<MessageUid> uList = new ArrayList<>(); final List<MessageUid> uList = new ArrayList<>();
final String username = "username"; final String username = "username";
MailboxSession session = mailboxManager.createSystemSession(username, LoggerFactory.getLogger("Test")); MailboxSession session = mailboxManager.createSystemSession(username);
mailboxManager.startProcessingRequest(session); mailboxManager.startProcessingRequest(session);
final MailboxPath path = new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "INBOX"); final MailboxPath path = new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "INBOX");
mailboxManager.createMailbox(path, session); mailboxManager.createMailbox(path, session);
Expand Down Expand Up @@ -101,7 +100,7 @@ public void event(Event event) {




try { try {
MailboxSession mailboxSession = mailboxManager.createSystemSession(username, LoggerFactory.getLogger("Test")); MailboxSession mailboxSession = mailboxManager.createSystemSession(username);


mailboxManager.startProcessingRequest(mailboxSession); mailboxManager.startProcessingRequest(mailboxSession);
MessageManager m = mailboxManager.getMailbox(path, mailboxSession); MessageManager m = mailboxManager.getMailbox(path, mailboxSession);
Expand Down

0 comments on commit 1ff0af0

Please sign in to comment.