This is an automated email from the ASF dual-hosted git repository. rcordier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/james-project.git
commit a326b104058ddee41e60e64a7ca9b7191737ea11 Author: Tung Tran <[email protected]> AuthorDate: Fri Apr 5 13:36:11 2024 +0700 JAMES-4025 Relocate JMAPCommonModule -> JMAPDraftCommonModule + JMAPWithoutDraftCommonModule --- .../java/org/apache/james/jmap/JMAPModule.java | 5 +- .../james/jmap/JMAPWithoutDraftCommonModule.java | 57 ++++++++++++++++++++++ .../james/jmap/draft/DraftMethodsModule.java | 13 ----- ...ommonModule.java => JMAPDraftCommonModule.java} | 21 +------- 4 files changed, 62 insertions(+), 34 deletions(-) diff --git a/server/container/guice/protocols/jmap/src/main/java/org/apache/james/jmap/JMAPModule.java b/server/container/guice/protocols/jmap/src/main/java/org/apache/james/jmap/JMAPModule.java index 31210a9348..7f7ff399c2 100644 --- a/server/container/guice/protocols/jmap/src/main/java/org/apache/james/jmap/JMAPModule.java +++ b/server/container/guice/protocols/jmap/src/main/java/org/apache/james/jmap/JMAPModule.java @@ -48,7 +48,7 @@ import org.apache.james.jmap.core.SubmissionCapabilityFactory; import org.apache.james.jmap.core.VacationResponseCapabilityFactory$; import org.apache.james.jmap.core.WebSocketCapabilityFactory$; import org.apache.james.jmap.draft.DraftMethodsModule; -import org.apache.james.jmap.draft.JMAPCommonModule; +import org.apache.james.jmap.draft.JMAPDraftCommonModule; import org.apache.james.jmap.draft.JMAPDraftConfiguration; import org.apache.james.jmap.draft.methods.RequestHandler; import org.apache.james.jmap.mailet.filter.JMAPFiltering; @@ -120,7 +120,8 @@ public class JMAPModule extends AbstractModule { @Override protected void configure() { - install(new JMAPCommonModule()); + install(new JMAPDraftCommonModule()); + install(new JMAPWithoutDraftCommonModule()); install(new DraftMethodsModule()); install(new RFC8621MethodsModule()); install(binder -> binder diff --git a/server/container/guice/protocols/jmap/src/main/java/org/apache/james/jmap/JMAPWithoutDraftCommonModule.java b/server/container/guice/protocols/jmap/src/main/java/org/apache/james/jmap/JMAPWithoutDraftCommonModule.java new file mode 100644 index 0000000000..4bef219409 --- /dev/null +++ b/server/container/guice/protocols/jmap/src/main/java/org/apache/james/jmap/JMAPWithoutDraftCommonModule.java @@ -0,0 +1,57 @@ +/**************************************************************** + * Licensed to the Apache Software Foundation (ASF) under one * + * or more contributor license agreements. See the NOTICE file * + * distributed with this work for additional information * + * regarding copyright ownership. The ASF licenses this file * + * to you under the Apache License, Version 2.0 (the * + * "License"); you may not use this file except in compliance * + * with the License. You may obtain a copy of the License at * + * * + * http://www.apache.org/licenses/LICENSE-2.0 * + * * + * Unless required by applicable law or agreed to in writing, * + * software distributed under the License is distributed on an * + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * + * KIND, either express or implied. See the License for the * + * specific language governing permissions and limitations * + * under the License. * + ****************************************************************/ + +package org.apache.james.jmap; + +import org.apache.james.jmap.json.ObjectMapperFactory; +import org.apache.james.jmap.methods.BlobManager; +import org.apache.james.jmap.methods.BlobManagerImpl; +import org.apache.james.jmap.methods.JmapResponseWriter; +import org.apache.james.jmap.methods.JmapResponseWriterImpl; +import org.apache.james.jmap.model.message.view.MessageFastViewFactory; +import org.apache.james.jmap.model.message.view.MessageFullViewFactory; +import org.apache.james.jmap.model.message.view.MessageHeaderViewFactory; +import org.apache.james.jmap.model.message.view.MessageMetadataViewFactory; +import org.apache.james.util.date.DefaultZonedDateTimeProvider; +import org.apache.james.util.date.ZonedDateTimeProvider; +import org.apache.james.util.mime.MessageContentExtractor; + +import com.google.inject.AbstractModule; +import com.google.inject.Scopes; + +public class JMAPWithoutDraftCommonModule extends AbstractModule { + + @Override + protected void configure() { + bind(MessageFullViewFactory.class).in(Scopes.SINGLETON); + bind(MessageMetadataViewFactory.class).in(Scopes.SINGLETON); + bind(MessageHeaderViewFactory.class).in(Scopes.SINGLETON); + bind(MessageFastViewFactory.class).in(Scopes.SINGLETON); + + bind(MessageContentExtractor.class).in(Scopes.SINGLETON); + bind(DefaultZonedDateTimeProvider.class).in(Scopes.SINGLETON); + bind(ZonedDateTimeProvider.class).to(DefaultZonedDateTimeProvider.class); + + bind(BlobManagerImpl.class).in(Scopes.SINGLETON); + bind(BlobManager.class).to(BlobManagerImpl.class); + bind(ObjectMapperFactory.class).in(Scopes.SINGLETON); + bind(JmapResponseWriterImpl.class).in(Scopes.SINGLETON); + bind(JmapResponseWriter.class).to(JmapResponseWriterImpl.class); + } +} diff --git a/server/container/guice/protocols/jmap/src/main/java/org/apache/james/jmap/draft/DraftMethodsModule.java b/server/container/guice/protocols/jmap/src/main/java/org/apache/james/jmap/draft/DraftMethodsModule.java index ebaa64e44d..e9ccbb2866 100644 --- a/server/container/guice/protocols/jmap/src/main/java/org/apache/james/jmap/draft/DraftMethodsModule.java +++ b/server/container/guice/protocols/jmap/src/main/java/org/apache/james/jmap/draft/DraftMethodsModule.java @@ -48,11 +48,6 @@ import org.apache.james.jmap.http.Authenticator; import org.apache.james.jmap.http.InjectionKeys; import org.apache.james.jmap.http.JWTAuthenticationStrategy; import org.apache.james.jmap.http.QueryParameterAccessTokenAuthenticationStrategy; -import org.apache.james.jmap.json.ObjectMapperFactory; -import org.apache.james.jmap.methods.BlobManager; -import org.apache.james.jmap.methods.BlobManagerImpl; -import org.apache.james.jmap.methods.JmapResponseWriter; -import org.apache.james.jmap.methods.JmapResponseWriterImpl; import org.apache.james.jmap.methods.Method; import org.apache.james.metrics.api.MetricFactory; import org.apache.james.utils.ClassName; @@ -80,11 +75,7 @@ public class DraftMethodsModule extends AbstractModule { @Override protected void configure() { bind(JmapRequestParserImpl.class).in(Scopes.SINGLETON); - bind(JmapResponseWriterImpl.class).in(Scopes.SINGLETON); - bind(ObjectMapperFactory.class).in(Scopes.SINGLETON); - bind(JmapRequestParser.class).to(JmapRequestParserImpl.class); - bind(JmapResponseWriter.class).to(JmapResponseWriterImpl.class); bindConstant().annotatedWith(Names.named(GetMessageListMethod.MAXIMUM_LIMIT)).to(GetMessageListMethod.DEFAULT_MAXIMUM_LIMIT); @@ -111,10 +102,6 @@ public class DraftMethodsModule extends AbstractModule { setMessagesProcessors.addBinding().to(SetMessagesCreationProcessor.class); setMessagesProcessors.addBinding().to(SetMessagesDestructionProcessor.class); setMessagesProcessors.addBinding().to(SendMDNProcessor.class); - - - bind(BlobManagerImpl.class).in(Scopes.SINGLETON); - bind(BlobManager.class).to(BlobManagerImpl.class); } @Provides diff --git a/server/container/guice/protocols/jmap/src/main/java/org/apache/james/jmap/draft/JMAPCommonModule.java b/server/container/guice/protocols/jmap/src/main/java/org/apache/james/jmap/draft/JMAPDraftCommonModule.java similarity index 79% rename from server/container/guice/protocols/jmap/src/main/java/org/apache/james/jmap/draft/JMAPCommonModule.java rename to server/container/guice/protocols/jmap/src/main/java/org/apache/james/jmap/draft/JMAPDraftCommonModule.java index 8abd462792..5b4f147ff6 100644 --- a/server/container/guice/protocols/jmap/src/main/java/org/apache/james/jmap/draft/JMAPCommonModule.java +++ b/server/container/guice/protocols/jmap/src/main/java/org/apache/james/jmap/draft/JMAPDraftCommonModule.java @@ -32,15 +32,8 @@ import org.apache.james.jmap.draft.crypto.SignedTokenFactory; import org.apache.james.jmap.draft.crypto.SignedTokenManager; import org.apache.james.jmap.draft.model.MailboxFactory; import org.apache.james.jmap.draft.send.MailSpool; -import org.apache.james.jmap.model.message.view.MessageFastViewFactory; -import org.apache.james.jmap.model.message.view.MessageFullViewFactory; -import org.apache.james.jmap.model.message.view.MessageHeaderViewFactory; -import org.apache.james.jmap.model.message.view.MessageMetadataViewFactory; import org.apache.james.lifecycle.api.ConfigurationSanitizer; import org.apache.james.lifecycle.api.StartUpCheck; -import org.apache.james.util.date.DefaultZonedDateTimeProvider; -import org.apache.james.util.date.ZonedDateTimeProvider; -import org.apache.james.util.mime.MessageContentExtractor; import org.apache.james.utils.InitializationOperation; import org.apache.james.utils.InitilizationOperationBuilder; @@ -50,37 +43,27 @@ import com.google.inject.multibindings.Multibinder; import com.google.inject.multibindings.ProvidesIntoSet; import com.google.inject.name.Names; -public class JMAPCommonModule extends AbstractModule { +public class JMAPDraftCommonModule extends AbstractModule { private static final long DEFAULT_TOKEN_EXPIRATION_IN_MS = TimeUnit.MILLISECONDS.convert(15, TimeUnit.MINUTES); @Override protected void configure() { bind(JamesSignatureHandler.class).in(Scopes.SINGLETON); - bind(DefaultZonedDateTimeProvider.class).in(Scopes.SINGLETON); bind(SignedTokenManager.class).in(Scopes.SINGLETON); bind(AccessTokenManagerImpl.class).in(Scopes.SINGLETON); bind(MailSpool.class).in(Scopes.SINGLETON); bind(MailboxFactory.class).in(Scopes.SINGLETON); - - bind(MessageFullViewFactory.class).in(Scopes.SINGLETON); - bind(MessageMetadataViewFactory.class).in(Scopes.SINGLETON); - bind(MessageHeaderViewFactory.class).in(Scopes.SINGLETON); - bind(MessageFastViewFactory.class).in(Scopes.SINGLETON); - - bind(MessageContentExtractor.class).in(Scopes.SINGLETON); bind(SecurityKeyLoader.class).in(Scopes.SINGLETON); bind(SignatureHandler.class).to(JamesSignatureHandler.class); - bind(ZonedDateTimeProvider.class).to(DefaultZonedDateTimeProvider.class); + bind(SimpleTokenManager.class).to(SignedTokenManager.class); bind(SimpleTokenFactory.class).to(SignedTokenFactory.class); bindConstant().annotatedWith(Names.named(AccessTokenRepository.TOKEN_EXPIRATION_IN_MS)).to(DEFAULT_TOKEN_EXPIRATION_IN_MS); bind(AccessTokenManager.class).to(AccessTokenManagerImpl.class); - - Multibinder.newSetBinder(binder(), StartUpCheck.class) .addBinding().to(JMAPConfigurationStartUpCheck.class); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
