Skip to content

Commit

Permalink
JAMES-4077 Guice binding SearchSnippetGetMethod for only distributed app
Browse files Browse the repository at this point in the history
  • Loading branch information
vttranlina committed Oct 24, 2024
1 parent 5f04902 commit 8326bc4
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
import org.apache.james.data.UsersRepositoryModuleChooser;
import org.apache.james.eventsourcing.eventstore.EventNestedTypes;
import org.apache.james.jmap.JMAPListenerModule;
import org.apache.james.jmap.method.Method;
import org.apache.james.jmap.method.SearchSnippetGetMethod;
import org.apache.james.json.DTO;
import org.apache.james.json.DTOModule;
import org.apache.james.modules.BlobExportMechanismModule;
Expand Down Expand Up @@ -101,8 +103,10 @@
import org.apache.james.vault.VaultConfiguration;

import com.google.common.collect.ImmutableSet;
import com.google.inject.AbstractModule;
import com.google.inject.Module;
import com.google.inject.TypeLiteral;
import com.google.inject.multibindings.Multibinder;
import com.google.inject.name.Names;
import com.google.inject.util.Modules;

Expand All @@ -128,6 +132,13 @@ public class CassandraRabbitMQJamesServerMain implements JamesServerMain {
new MessagesRoutesModule(),
new WebAdminMailOverWebModule());

public static final Module JMAP_DISTRIBUTED_METHOD_SUPPORTED_MODULE = new AbstractModule() {
@Override
protected void configure() {
Multibinder.newSetBinder(binder(), Method.class).addBinding().to(SearchSnippetGetMethod.class);
}
};

public static final Module PROTOCOLS = Modules.combine(
new CassandraJmapModule(),
new CassandraVacationModule(),
Expand All @@ -138,6 +149,7 @@ public class CassandraRabbitMQJamesServerMain implements JamesServerMain {
new ProtocolHandlerModule(),
new SMTPServerModule(),
new JMAPServerModule(),
JMAP_DISTRIBUTED_METHOD_SUPPORTED_MODULE,
new JmapEventBusModule(),
WEBADMIN);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@

import org.apache.james.data.UsersRepositoryModuleChooser;
import org.apache.james.eventsourcing.eventstore.EventNestedTypes;
import org.apache.james.jmap.method.Method;
import org.apache.james.jmap.method.SearchSnippetGetMethod;
import org.apache.james.json.DTO;
import org.apache.james.json.DTOModule;
import org.apache.james.mailbox.NoACLMapper;
Expand Down Expand Up @@ -99,9 +101,11 @@
import org.apache.james.vault.VaultConfiguration;

import com.google.common.collect.ImmutableSet;
import com.google.inject.AbstractModule;
import com.google.inject.Module;
import com.google.inject.Scopes;
import com.google.inject.TypeLiteral;
import com.google.inject.multibindings.Multibinder;
import com.google.inject.name.Names;
import com.google.inject.util.Modules;

Expand All @@ -124,9 +128,17 @@ public class DistributedPOP3JamesServerMain implements JamesServerMain {
new WebAdminMailOverWebModule(),
new UserIdentityModule());

public static final Module JMAP_DISTRIBUTED_METHOD_SUPPORTED_MODULE = new AbstractModule() {
@Override
protected void configure() {
Multibinder.newSetBinder(binder(), Method.class).addBinding().to(SearchSnippetGetMethod.class);
}
};

public static final Module PROTOCOLS = Modules.combine(
new LMTPServerModule(),
new JMAPServerModule(),
JMAP_DISTRIBUTED_METHOD_SUPPORTED_MODULE,
new JMAPEventBusModule(),
new ManageSieveServerModule(),
new POP3ServerModule(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@
import org.apache.james.jmap.method.QuotaChangesMethod;
import org.apache.james.jmap.method.QuotaGetMethod;
import org.apache.james.jmap.method.QuotaQueryMethod;
import org.apache.james.jmap.method.SearchSnippetGetMethod;
import org.apache.james.jmap.method.SystemZoneIdProvider;
import org.apache.james.jmap.method.ThreadChangesMethod;
import org.apache.james.jmap.method.ThreadGetMethod;
Expand Down Expand Up @@ -172,7 +171,6 @@ protected void configure() {
methods.addBinding().to(DelegateSetMethod.class);
methods.addBinding().to(DelegatedAccountSetMethod.class);
methods.addBinding().to(MailboxQueryChangesMethod.class);
methods.addBinding().to(SearchSnippetGetMethod.class);

Multibinder<JMAPRoutes> routes = Multibinder.newSetBinder(binder(), JMAPRoutes.class);
routes.addBinding().to(SessionRoutes.class);
Expand Down

0 comments on commit 8326bc4

Please sign in to comment.