Author: norman
Date: Fri Sep 30 14:52:07 2011
New Revision: 1177684
URL: http://svn.apache.org/viewvc?rev=1177684&view=rev
Log:
Allow to disable caps via spring config. See IMAP-322
Modified:
james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/CapabilityProcessor.java
james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/DefaultProcessorChain.java
james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/main/DefaultImapProcessorFactory.java
Modified:
james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/CapabilityProcessor.java
URL:
http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/CapabilityProcessor.java?rev=1177684&r1=1177683&r2=1177684&view=diff
==============================================================================
---
james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/CapabilityProcessor.java
(original)
+++
james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/CapabilityProcessor.java
Fri Sep 30 14:52:07 2011
@@ -60,16 +60,19 @@ public class CapabilityProcessor extends
}
private static final List<CapabilityImplementingProcessor> capabilities =
new ArrayList<CapabilityImplementingProcessor>();
+ private static final Set<String> disabledCaps = new HashSet<String>();
- public CapabilityProcessor(final ImapProcessor next, final MailboxManager
mailboxManager, final StatusResponseFactory factory, final
List<CapabilityImplementingProcessor> capabilities) {
- this(next, mailboxManager, factory);
+ public CapabilityProcessor(final ImapProcessor next, final MailboxManager
mailboxManager, final StatusResponseFactory factory, final
List<CapabilityImplementingProcessor> capabilities, final Set<String>
disabledCaps) {
+ this(next, mailboxManager, factory, disabledCaps);
CapabilityProcessor.capabilities.addAll(capabilities);
}
- public CapabilityProcessor(final ImapProcessor next, final MailboxManager
mailboxManager, final StatusResponseFactory factory) {
+ public CapabilityProcessor(final ImapProcessor next, final MailboxManager
mailboxManager, final StatusResponseFactory factory,final Set<String>
disabledCaps) {
super(CapabilityRequest.class, next, mailboxManager, factory);
- capabilities.add(this);
+ CapabilityProcessor.disabledCaps.addAll(disabledCaps);
+ capabilities.add(this);
+
}
/*
@@ -120,6 +123,7 @@ public class CapabilityProcessor extends
for (int i = 0; i < capabilities.size(); i++) {
caps.addAll(capabilities.get(i).getImplementedCapabilities(session));
}
+ caps.removeAll(disabledCaps);
return caps;
}
Modified:
james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/DefaultProcessorChain.java
URL:
http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/DefaultProcessorChain.java?rev=1177684&r1=1177683&r2=1177684&view=diff
==============================================================================
---
james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/DefaultProcessorChain.java
(original)
+++
james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/DefaultProcessorChain.java
Fri Sep 30 14:52:07 2011
@@ -19,6 +19,7 @@
package org.apache.james.imap.processor;
+import java.util.Set;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
@@ -34,11 +35,11 @@ import org.apache.james.mailbox.Subscrip
*/
public class DefaultProcessorChain {
- public static final ImapProcessor createDefaultChain(final ImapProcessor
chainEndProcessor, final MailboxManager mailboxManager, final
SubscriptionManager subscriptionManager, final StatusResponseFactory
statusResponseFactory, MailboxTyper mailboxTyper, int batchSize, long
idleKeepAlive, TimeUnit milliseconds) {
+ public static final ImapProcessor createDefaultChain(final ImapProcessor
chainEndProcessor, final MailboxManager mailboxManager, final
SubscriptionManager subscriptionManager, final StatusResponseFactory
statusResponseFactory, MailboxTyper mailboxTyper, int batchSize, long
idleKeepAlive, TimeUnit milliseconds, Set<String> disabledCaps) {
final SystemMessageProcessor systemProcessor = new
SystemMessageProcessor(chainEndProcessor, mailboxManager);
final LogoutProcessor logoutProcessor = new
LogoutProcessor(systemProcessor, mailboxManager, statusResponseFactory);
- final CapabilityProcessor capabilityProcessor = new
CapabilityProcessor(logoutProcessor, mailboxManager, statusResponseFactory);
+ final CapabilityProcessor capabilityProcessor = new
CapabilityProcessor(logoutProcessor, mailboxManager, statusResponseFactory,
disabledCaps);
final CheckProcessor checkProcessor = new
CheckProcessor(capabilityProcessor, mailboxManager, statusResponseFactory);
final LoginProcessor loginProcessor = new
LoginProcessor(checkProcessor, mailboxManager, statusResponseFactory);
// so it can announce the LOGINDISABLED if needed
Modified:
james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/main/DefaultImapProcessorFactory.java
URL:
http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/main/DefaultImapProcessorFactory.java?rev=1177684&r1=1177683&r2=1177684&view=diff
==============================================================================
---
james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/main/DefaultImapProcessorFactory.java
(original)
+++
james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/main/DefaultImapProcessorFactory.java
Fri Sep 30 14:52:07 2011
@@ -19,6 +19,8 @@
package org.apache.james.imap.processor.main;
+import java.util.HashSet;
+import java.util.Set;
import java.util.concurrent.TimeUnit;
import org.apache.james.imap.api.ImapConstants;
@@ -39,21 +41,21 @@ import org.apache.james.mailbox.Subscrip
public class DefaultImapProcessorFactory {
public static final ImapProcessor createDefaultProcessor(final
MailboxManager mailboxManager, final SubscriptionManager subscriptionManager) {
- return createXListSupportingProcessor(mailboxManager,
subscriptionManager, null, ImapConstants.DEFAULT_BATCH_SIZE,
IdleProcessor.DEFAULT_HEARTBEAT_INTERVAL_IN_SECONDS);
+ return createXListSupportingProcessor(mailboxManager,
subscriptionManager, null, ImapConstants.DEFAULT_BATCH_SIZE,
IdleProcessor.DEFAULT_HEARTBEAT_INTERVAL_IN_SECONDS, new HashSet<String>());
}
public static final ImapProcessor createDefaultProcessor(final
MailboxManager mailboxManager, final SubscriptionManager subscriptionManager,
int batchSize, long idleKeepAlive) {
- return createXListSupportingProcessor(mailboxManager,
subscriptionManager, null, batchSize, idleKeepAlive);
+ return createXListSupportingProcessor(mailboxManager,
subscriptionManager, null, batchSize, idleKeepAlive, new HashSet<String>());
}
public static final ImapProcessor createXListSupportingProcessor(final
MailboxManager mailboxManager, final SubscriptionManager subscriptionManager,
MailboxTyper mailboxTyper) {
- return createXListSupportingProcessor(mailboxManager,
subscriptionManager, mailboxTyper, ImapConstants.DEFAULT_BATCH_SIZE,
IdleProcessor.DEFAULT_HEARTBEAT_INTERVAL_IN_SECONDS);
+ return createXListSupportingProcessor(mailboxManager,
subscriptionManager, mailboxTyper, ImapConstants.DEFAULT_BATCH_SIZE,
IdleProcessor.DEFAULT_HEARTBEAT_INTERVAL_IN_SECONDS, new HashSet<String>());
}
- public static final ImapProcessor createXListSupportingProcessor(final
MailboxManager mailboxManager, final SubscriptionManager subscriptionManager,
MailboxTyper mailboxTyper, int batchSize, long idleKeepAlive) {
+ public static final ImapProcessor createXListSupportingProcessor(final
MailboxManager mailboxManager, final SubscriptionManager subscriptionManager,
MailboxTyper mailboxTyper, int batchSize, long idleKeepAlive, Set<String>
disabledCaps) {
final StatusResponseFactory statusResponseFactory = new
UnpooledStatusResponseFactory();
final UnknownRequestProcessor unknownRequestImapProcessor = new
UnknownRequestProcessor(statusResponseFactory);
- final ImapProcessor imap4rev1Chain =
DefaultProcessorChain.createDefaultChain(unknownRequestImapProcessor,
mailboxManager, subscriptionManager, statusResponseFactory, mailboxTyper,
batchSize, idleKeepAlive, TimeUnit.SECONDS);
+ final ImapProcessor imap4rev1Chain =
DefaultProcessorChain.createDefaultChain(unknownRequestImapProcessor,
mailboxManager, subscriptionManager, statusResponseFactory, mailboxTyper,
batchSize, idleKeepAlive, TimeUnit.SECONDS, disabledCaps);
final ImapProcessor result = new
ImapResponseMessageProcessor(imap4rev1Chain);
return result;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]