-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move memory implementations in jmap-extensions to jmap-extensions-api (…
- Loading branch information
1 parent
409de91
commit 4ea92e3
Showing
24 changed files
with
186 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
.../main/java/com/linagora/tmail/james/app/modules/jmap/MemoryEmailAddressContactModule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package com.linagora.tmail.james.app.modules.jmap; | ||
|
||
import org.apache.james.events.EventBus; | ||
import org.apache.james.lifecycle.api.Startable; | ||
import org.apache.james.utils.InitializationOperation; | ||
import org.apache.james.utils.InitilizationOperationBuilder; | ||
|
||
import com.google.inject.AbstractModule; | ||
import com.google.inject.Provides; | ||
import com.google.inject.Singleton; | ||
import com.google.inject.multibindings.ProvidesIntoSet; | ||
import com.google.inject.name.Named; | ||
import com.linagora.tmail.james.jmap.EmailAddressContactInjectKeys; | ||
import com.linagora.tmail.james.jmap.contact.EmailAddressContactListener; | ||
import com.linagora.tmail.james.jmap.contact.InMemoryEmailAddressContactSearchEngineModule; | ||
|
||
public class MemoryEmailAddressContactModule extends AbstractModule { | ||
|
||
@Override | ||
protected void configure() { | ||
install(new InMemoryEmailAddressContactSearchEngineModule()); | ||
} | ||
|
||
@ProvidesIntoSet | ||
public InitializationOperation registerListener( | ||
@Named(EmailAddressContactInjectKeys.AUTOCOMPLETE) EventBus eventBus, | ||
EmailAddressContactListener emailAddressContactListener) { | ||
return InitilizationOperationBuilder | ||
.forClass(EmailAddressContactEventLoader.class) | ||
.init(() -> eventBus.register(emailAddressContactListener)); | ||
} | ||
|
||
@Provides | ||
@Singleton | ||
@Named(EmailAddressContactInjectKeys.AUTOCOMPLETE) | ||
public EventBus provideInVMEventBus(EventBus eventBus) { | ||
return eventBus; | ||
} | ||
|
||
public static class EmailAddressContactEventLoader implements Startable { | ||
|
||
} | ||
} | ||
|
||
|
22 changes: 22 additions & 0 deletions
22
...com/linagora/tmail/james/app/modules/jmap/MemoryFirebaseSubscriptionRepositoryModule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.linagora.tmail.james.app.modules.jmap; | ||
|
||
import org.apache.james.user.api.DeleteUserDataTaskStep; | ||
|
||
import com.google.inject.AbstractModule; | ||
import com.google.inject.Scopes; | ||
import com.google.inject.multibindings.Multibinder; | ||
import com.linagora.tmail.james.jmap.firebase.FirebaseSubscriptionRepository; | ||
import com.linagora.tmail.james.jmap.firebase.FirebaseSubscriptionUserDeletionTaskStep; | ||
import com.linagora.tmail.james.jmap.firebase.MemoryFirebaseSubscriptionRepository; | ||
|
||
public class MemoryFirebaseSubscriptionRepositoryModule extends AbstractModule { | ||
@Override | ||
protected void configure() { | ||
bind(MemoryFirebaseSubscriptionRepository.class).in(Scopes.SINGLETON); | ||
bind(FirebaseSubscriptionRepository.class).to(MemoryFirebaseSubscriptionRepository.class); | ||
|
||
Multibinder.newSetBinder(binder(), DeleteUserDataTaskStep.class) | ||
.addBinding() | ||
.to(FirebaseSubscriptionUserDeletionTaskStep.class); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...in/java/com/linagora/tmail/james/app/modules/jmap/MemoryJmapSettingsRepositoryModule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.linagora.tmail.james.app.modules.jmap; | ||
|
||
import org.apache.james.user.api.DeleteUserDataTaskStep; | ||
import org.apache.james.user.api.UsernameChangeTaskStep; | ||
|
||
import com.google.inject.AbstractModule; | ||
import com.google.inject.Scopes; | ||
import com.google.inject.multibindings.Multibinder; | ||
import com.linagora.tmail.james.jmap.settings.JmapSettingsRepository; | ||
import com.linagora.tmail.james.jmap.settings.JmapSettingsUserDeletionTaskStep; | ||
import com.linagora.tmail.james.jmap.settings.JmapSettingsUsernameChangeTaskStep; | ||
import com.linagora.tmail.james.jmap.settings.MemoryJmapSettingsRepository; | ||
|
||
public class MemoryJmapSettingsRepositoryModule extends AbstractModule { | ||
@Override | ||
protected void configure() { | ||
bind(MemoryJmapSettingsRepository.class).in(Scopes.SINGLETON); | ||
bind(JmapSettingsRepository.class).to(MemoryJmapSettingsRepository.class) | ||
.in(Scopes.SINGLETON); | ||
|
||
Multibinder.newSetBinder(binder(), UsernameChangeTaskStep.class) | ||
.addBinding() | ||
.to(JmapSettingsUsernameChangeTaskStep.class); | ||
|
||
Multibinder.newSetBinder(binder(), DeleteUserDataTaskStep.class) | ||
.addBinding() | ||
.to(JmapSettingsUserDeletionTaskStep.class); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
.../src/main/java/com/linagora/tmail/james/app/modules/jmap/MemoryLabelRepositoryModule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.linagora.tmail.james.app.modules.jmap; | ||
|
||
import org.apache.james.user.api.DeleteUserDataTaskStep; | ||
import org.apache.james.user.api.UsernameChangeTaskStep; | ||
|
||
import com.google.inject.AbstractModule; | ||
import com.google.inject.Scopes; | ||
import com.google.inject.multibindings.Multibinder; | ||
import com.linagora.tmail.james.jmap.label.LabelChangeRepository; | ||
import com.linagora.tmail.james.jmap.label.LabelRepository; | ||
import com.linagora.tmail.james.jmap.label.LabelUserDeletionTaskStep; | ||
import com.linagora.tmail.james.jmap.label.LabelUsernameChangeTaskStep; | ||
import com.linagora.tmail.james.jmap.label.MemoryLabelChangeRepository; | ||
import com.linagora.tmail.james.jmap.label.MemoryLabelRepository; | ||
|
||
public class MemoryLabelRepositoryModule extends AbstractModule { | ||
@Override | ||
protected void configure() { | ||
bind(LabelRepository.class).to(MemoryLabelRepository.class); | ||
bind(MemoryLabelRepository.class).in(Scopes.SINGLETON); | ||
|
||
Multibinder.newSetBinder(binder(), UsernameChangeTaskStep.class) | ||
.addBinding() | ||
.to(LabelUsernameChangeTaskStep.class); | ||
|
||
Multibinder.newSetBinder(binder(), DeleteUserDataTaskStep.class) | ||
.addBinding() | ||
.to(LabelUserDeletionTaskStep.class); | ||
|
||
bind(LabelChangeRepository.class).to(MemoryLabelChangeRepository.class); | ||
bind(MemoryLabelChangeRepository.class).in(Scopes.SINGLETON); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...ory/src/main/java/com/linagora/tmail/james/app/modules/jmap/PublicAssetsMemoryModule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.linagora.tmail.james.app.modules.jmap; | ||
|
||
import com.google.inject.AbstractModule; | ||
import com.google.inject.Scopes; | ||
import com.linagora.tmail.james.jmap.publicAsset.MemoryPublicAssetRepository; | ||
import com.linagora.tmail.james.jmap.publicAsset.PublicAssetRepository; | ||
|
||
public class PublicAssetsMemoryModule extends AbstractModule { | ||
@Override | ||
protected void configure() { | ||
bind(MemoryPublicAssetRepository.class).in(Scopes.SINGLETON); | ||
bind(PublicAssetRepository.class).to(MemoryPublicAssetRepository.class); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 0 additions & 31 deletions
31
...src/main/scala/com/linagora/tmail/james/jmap/contact/EmailAddressContactEventModule.scala
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
...xtensions-api/src/main/scala/com/linagora/tmail/james/jmap/ticket/MemoryTicketStore.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.linagora.tmail.james.jmap.ticket | ||
|
||
import reactor.core.scala.publisher.SMono | ||
|
||
import scala.collection.mutable | ||
|
||
class MemoryTicketStore extends TicketStore { | ||
private val map: mutable.Map[TicketValue, Ticket] = mutable.Map() | ||
|
||
override def persist(ticket: Ticket): SMono[Unit] = | ||
SMono.fromCallable(() => map.put(ticket.value, ticket)) | ||
.`then` | ||
|
||
override def retrieve(value: TicketValue): SMono[Ticket] = map.get(value) | ||
.map(SMono.just) | ||
.getOrElse(SMono.empty) | ||
|
||
override def delete(ticketValue: TicketValue): SMono[Unit] = | ||
SMono.fromCallable(() => map.remove(ticketValue)) | ||
.`then` | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
Oops, something went wrong.