You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by bt...@apache.org on 2025/10/03 07:11:50 UTC
(james-project) 09/14: [REMOVAL] Remove now unused CassandraJamesServerMain and friends
This is an automated email from the ASF dual-hosted git repository.
btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git
commit d423c6a3acf054e6476ea84873593953d7743a68
Author: Benoit TELLIER <bt...@linagora.com>
AuthorDate: Tue Sep 30 08:01:42 2025 +0200
[REMOVAL] Remove now unused CassandraJamesServerMain and friends
---
.../org/apache/james/BlobStoreConfiguration.java | 181 ----------------
.../org/apache/james/BlobStoreModulesChooser.java | 114 ----------
.../org/apache/james/CassandraBlobStoreModule.java | 45 ----
.../james/CassandraJamesServerConfiguration.java | 238 ---------------------
.../org/apache/james/CassandraJamesServerMain.java | 236 --------------------
.../TestingDistributedJamesServerBuilder.java | 39 ----
6 files changed, 853 deletions(-)
diff --git a/server/apps/cassandra-app/src/main/java/org/apache/james/BlobStoreConfiguration.java b/server/apps/cassandra-app/src/main/java/org/apache/james/BlobStoreConfiguration.java
deleted file mode 100644
index 3c2648dd71..0000000000
--- a/server/apps/cassandra-app/src/main/java/org/apache/james/BlobStoreConfiguration.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/****************************************************************
- * 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;
-
-import java.io.FileNotFoundException;
-import java.util.Objects;
-import java.util.Optional;
-
-import org.apache.commons.configuration2.Configuration;
-import org.apache.commons.configuration2.ex.ConfigurationException;
-import org.apache.james.blob.aes.CryptoConfig;
-import org.apache.james.modules.mailbox.ConfigurationComponent;
-import org.apache.james.server.blob.deduplication.StorageStrategy;
-import org.apache.james.server.core.filesystem.FileSystemImpl;
-import org.apache.james.utils.PropertiesProvider;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.MoreObjects;
-
-import io.vavr.control.Try;
-
-/**
- * See https://issues.apache.org/jira/browse/JAMES-3767
- *
- * Cassandra APP will be removed after 3.8.0 release.
- *
- * Please migrate to the distributed APP.
- */
-@Deprecated(forRemoval = true)
-public class BlobStoreConfiguration {
- private static final Logger LOGGER = LoggerFactory.getLogger(BlobStoreConfiguration.class);
-
- @FunctionalInterface
- public interface RequireStoringStrategy {
- RequireCryptoConfig strategy(StorageStrategy storageStrategy);
-
- default RequireCryptoConfig passthrough() {
- return strategy(StorageStrategy.PASSTHROUGH);
- }
-
- default RequireCryptoConfig deduplication() {
- return strategy(StorageStrategy.DEDUPLICATION);
- }
- }
-
- @FunctionalInterface
- public interface RequireCryptoConfig {
- BlobStoreConfiguration cryptoConfig(Optional<CryptoConfig> cryptoConfig);
-
- default BlobStoreConfiguration noCryptoConfig() {
- return cryptoConfig(Optional.empty());
- }
-
- default BlobStoreConfiguration cryptoConfig(CryptoConfig cryptoConfig) {
- return cryptoConfig(Optional.of(cryptoConfig));
- }
- }
-
- public static RequireStoringStrategy builder() {
- return storageStrategy -> cryptoConfig ->
- new BlobStoreConfiguration(storageStrategy, cryptoConfig);
- }
-
- static final String ENCRYPTION_ENABLE_PROPERTY = "encryption.aes.enable";
- static final String ENCRYPTION_PASSWORD_PROPERTY = "encryption.aes.password";
- static final String ENCRYPTION_SALT_PROPERTY = "encryption.aes.salt";
- static final String ENCRYPTION_PRIVATE_KEY_ALGORITHM_PROPERTY = "encryption.aes.private.key.algorithm";
- static final String DEDUPLICATION_ENABLE_PROPERTY = "deduplication.enable";
-
- public static BlobStoreConfiguration parse(org.apache.james.server.core.configuration.Configuration configuration) throws ConfigurationException {
- PropertiesProvider propertiesProvider = new PropertiesProvider(new FileSystemImpl(configuration.directories()),
- configuration.configurationPath());
-
- return parse(propertiesProvider);
- }
-
- public static BlobStoreConfiguration parse(PropertiesProvider propertiesProvider) throws ConfigurationException {
- try {
- Configuration configuration = propertiesProvider.getConfigurations(ConfigurationComponent.NAMES);
- return BlobStoreConfiguration.from(configuration);
- } catch (FileNotFoundException e) {
- LOGGER.warn("Could not find " + ConfigurationComponent.NAME + " configuration file, using deduplicating blobstore as the default");
- return BlobStoreConfiguration.builder()
- .deduplication()
- .noCryptoConfig();
- }
- }
-
- static BlobStoreConfiguration from(Configuration configuration) {
- boolean deduplicationEnabled = Try.ofCallable(() -> configuration.getBoolean(DEDUPLICATION_ENABLE_PROPERTY))
- .getOrElseThrow(() -> new IllegalStateException("deduplication.enable property is missing please use one of the supported values in: true, false\n" +
- "If you choose to enable deduplication, the mails with the same content will be stored only once.\n" +
- "Warning: Once this feature is enabled, there is no turning back as turning it off will lead to the deletion of all\n" +
- "the mails sharing the same content once one is deleted.\n" +
- "Upgrade note: If you are upgrading from James 3.5 or older, the deduplication was enabled."));
- Optional<CryptoConfig> cryptoConfig = parseCryptoConfig(configuration);
-
- if (deduplicationEnabled) {
- return builder()
- .deduplication()
- .cryptoConfig(cryptoConfig);
- } else {
- return builder()
- .passthrough()
- .cryptoConfig(cryptoConfig);
- }
- }
-
- private static Optional<CryptoConfig> parseCryptoConfig(Configuration configuration) {
- final boolean enabled = configuration.getBoolean(ENCRYPTION_ENABLE_PROPERTY, false);
- if (enabled) {
- return Optional.of(CryptoConfig.builder()
- .password(Optional.ofNullable(configuration.getString(ENCRYPTION_PASSWORD_PROPERTY, null)).map(String::toCharArray).orElse(null))
- .salt(configuration.getString(ENCRYPTION_SALT_PROPERTY, null))
- .privateKeyAlgorithm(Optional.ofNullable(configuration.getString(ENCRYPTION_PRIVATE_KEY_ALGORITHM_PROPERTY, null)))
- .build());
- }
- return Optional.empty();
- }
-
-
- private final StorageStrategy storageStrategy;
- private final Optional<CryptoConfig> cryptoConfig;
-
- BlobStoreConfiguration(StorageStrategy storageStrategy, Optional<CryptoConfig> cryptoConfig) {
-
- this.storageStrategy = storageStrategy;
- this.cryptoConfig = cryptoConfig;
- }
-
-
- public StorageStrategy storageStrategy() {
- return storageStrategy;
- }
-
- public Optional<CryptoConfig> getCryptoConfig() {
- return cryptoConfig;
- }
-
- @Override
- public final boolean equals(Object o) {
- if (o instanceof BlobStoreConfiguration) {
- BlobStoreConfiguration that = (BlobStoreConfiguration) o;
-
- return Objects.equals(this.storageStrategy, that.storageStrategy)
- && Objects.equals(this.cryptoConfig, that.cryptoConfig);
- }
- return false;
- }
-
- @Override
- public final int hashCode() {
- return Objects.hash(storageStrategy, cryptoConfig);
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(this)
- .add("storageStrategy", storageStrategy.name())
- .add("cryptoConfig", cryptoConfig)
- .toString();
- }
-}
diff --git a/server/apps/cassandra-app/src/main/java/org/apache/james/BlobStoreModulesChooser.java b/server/apps/cassandra-app/src/main/java/org/apache/james/BlobStoreModulesChooser.java
deleted file mode 100644
index 16d5506f05..0000000000
--- a/server/apps/cassandra-app/src/main/java/org/apache/james/BlobStoreModulesChooser.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/****************************************************************
- * 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;
-
-import static org.apache.james.blob.api.MetricableBlobStore.BLOB_STORE_IMPLEMENTATION;
-
-import java.util.List;
-import java.util.Optional;
-
-import org.apache.james.blob.aes.AESBlobStoreDAO;
-import org.apache.james.blob.aes.CryptoConfig;
-import org.apache.james.blob.api.BlobStore;
-import org.apache.james.blob.api.BlobStoreDAO;
-import org.apache.james.modules.blobstore.BlobDeduplicationGCModule;
-import org.apache.james.modules.blobstore.validation.BlobStoreConfigurationValidationStartUpCheck;
-import org.apache.james.modules.mailbox.BlobStoreAPIModule;
-import org.apache.james.server.blob.deduplication.DeDuplicationBlobStore;
-import org.apache.james.server.blob.deduplication.PassThroughBlobStore;
-import org.apache.james.server.blob.deduplication.StorageStrategy;
-
-import com.google.common.collect.ImmutableList;
-import com.google.inject.AbstractModule;
-import com.google.inject.Module;
-import com.google.inject.Provides;
-import com.google.inject.Singleton;
-import com.google.inject.name.Named;
-import com.google.inject.name.Names;
-
-/**
- * See https://issues.apache.org/jira/browse/JAMES-3767
- *
- * Cassandra APP will be removed after 3.8.0 release.
- *
- * Please migrate to the distributed APP.
- */
-@Deprecated(forRemoval = true)
-public class BlobStoreModulesChooser {
- static final String UNENCRYPTED = "unencrypted";
-
- static class NoEncryptionModule extends AbstractModule {
- @Provides
- @Singleton
- BlobStoreDAO blobStoreDAO(@Named(UNENCRYPTED) BlobStoreDAO unencrypted) {
- return unencrypted;
- }
- }
-
- static class EncryptionModule extends AbstractModule {
- private final CryptoConfig cryptoConfig;
-
- EncryptionModule(CryptoConfig cryptoConfig) {
- this.cryptoConfig = cryptoConfig;
- }
-
- @Provides
- @Singleton
- BlobStoreDAO blobStoreDAO(@Named(UNENCRYPTED) BlobStoreDAO unencrypted) {
- return new AESBlobStoreDAO(unencrypted, cryptoConfig);
- }
-
- @Provides
- CryptoConfig cryptoConfig() {
- return cryptoConfig;
- }
- }
-
- public static List<Module> chooseModules(BlobStoreConfiguration choosingConfiguration) {
- return ImmutableList.<Module>builder()
- .add(chooseEncryptionModule(choosingConfiguration.getCryptoConfig()))
- .addAll(chooseStoragePolicyModule(choosingConfiguration.storageStrategy()))
- .add(binder -> binder.bind(BlobStoreConfiguration.class).toInstance(choosingConfiguration))
- .add(binder -> binder.bind(BlobStoreConfigurationValidationStartUpCheck.StorageStrategySupplier.class).toInstance(choosingConfiguration::storageStrategy))
- .build();
- }
-
- public static Module chooseEncryptionModule(Optional<CryptoConfig> cryptoConfig) {
- Optional<Module> encryptionModule = cryptoConfig.map(EncryptionModule::new);
- return encryptionModule.orElse(new NoEncryptionModule());
- }
-
- private static List<Module> chooseStoragePolicyModule(StorageStrategy storageStrategy) {
- switch (storageStrategy) {
- case DEDUPLICATION:
- Module deduplicationBlobModule = binder -> binder.bind(BlobStore.class)
- .annotatedWith(Names.named(BLOB_STORE_IMPLEMENTATION))
- .to(DeDuplicationBlobStore.class);
- return ImmutableList.of(new BlobDeduplicationGCModule(), deduplicationBlobModule);
- case PASSTHROUGH:
- Module passThroughBlobModule = binder -> binder.bind(BlobStore.class)
- .annotatedWith(Names.named(BLOB_STORE_IMPLEMENTATION))
- .to(PassThroughBlobStore.class);
- return ImmutableList.of(new BlobStoreAPIModule(), passThroughBlobModule);
- default:
- throw new RuntimeException("Unknown storage strategy " + storageStrategy.name());
- }
- }
-}
diff --git a/server/apps/cassandra-app/src/main/java/org/apache/james/CassandraBlobStoreModule.java b/server/apps/cassandra-app/src/main/java/org/apache/james/CassandraBlobStoreModule.java
deleted file mode 100644
index f960e8ecff..0000000000
--- a/server/apps/cassandra-app/src/main/java/org/apache/james/CassandraBlobStoreModule.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/****************************************************************
- * 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;
-
-import static org.apache.james.BlobStoreModulesChooser.UNENCRYPTED;
-
-import org.apache.james.blob.api.BlobStoreDAO;
-import org.apache.james.blob.cassandra.CassandraBlobStoreDAO;
-
-import com.google.inject.AbstractModule;
-import com.google.inject.Scopes;
-import com.google.inject.name.Names;
-
-/**
- * See https://issues.apache.org/jira/browse/JAMES-3767
- *
- * Cassandra APP will be removed after 3.8.0 release.
- *
- * Please migrate to the distributed APP.
- */
-@Deprecated(forRemoval = true)
-public class CassandraBlobStoreModule extends AbstractModule {
- @Override
- protected void configure() {
- bind(CassandraBlobStoreDAO.class).in(Scopes.SINGLETON);
- bind(BlobStoreDAO.class).annotatedWith(Names.named(UNENCRYPTED)).to(CassandraBlobStoreDAO.class);
- }
-}
diff --git a/server/apps/cassandra-app/src/main/java/org/apache/james/CassandraJamesServerConfiguration.java b/server/apps/cassandra-app/src/main/java/org/apache/james/CassandraJamesServerConfiguration.java
deleted file mode 100644
index 6a9006abf5..0000000000
--- a/server/apps/cassandra-app/src/main/java/org/apache/james/CassandraJamesServerConfiguration.java
+++ /dev/null
@@ -1,238 +0,0 @@
-/****************************************************************
- * 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;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.util.Optional;
-
-import org.apache.commons.configuration2.ex.ConfigurationException;
-import org.apache.james.data.UsersRepositoryModuleChooser;
-import org.apache.james.filesystem.api.FileSystem;
-import org.apache.james.filesystem.api.JamesDirectoriesProvider;
-import org.apache.james.jmap.JMAPModule;
-import org.apache.james.server.core.JamesServerResourceLoader;
-import org.apache.james.server.core.MissingArgumentException;
-import org.apache.james.server.core.configuration.Configuration;
-import org.apache.james.server.core.configuration.FileConfigurationProvider;
-import org.apache.james.server.core.filesystem.FileSystemImpl;
-import org.apache.james.utils.PropertiesProvider;
-import org.apache.james.vault.VaultConfiguration;
-
-import com.github.fge.lambdas.Throwing;
-
-/**
- * See https://issues.apache.org/jira/browse/JAMES-3767
- *
- * Cassandra APP will be removed after 3.8.0 release.
- *
- * Please migrate to the distributed APP.
- */
-@Deprecated(forRemoval = true)
-public class CassandraJamesServerConfiguration implements Configuration {
- public static class Builder {
- private Optional<SearchConfiguration> searchConfiguration;
- private Optional<String> rootDirectory;
- private Optional<ConfigurationPath> configurationPath;
- private Optional<BlobStoreConfiguration> blobStoreConfiguration;
- private Optional<UsersRepositoryModuleChooser.Implementation> usersRepositoryImplementation;
- private Optional<VaultConfiguration> vaultConfiguration;
- private Optional<Boolean> jmapEnabled;
- private Optional<Boolean> quotaCompatibilityMode;
-
- private Builder() {
- rootDirectory = Optional.empty();
- configurationPath = Optional.empty();
- searchConfiguration = Optional.empty();
- usersRepositoryImplementation = Optional.empty();
- blobStoreConfiguration = Optional.empty();
- vaultConfiguration = Optional.empty();
- jmapEnabled = Optional.empty();
- quotaCompatibilityMode = Optional.empty();
- }
-
- public Builder workingDirectory(String path) {
- rootDirectory = Optional.of(path);
- return this;
- }
-
- public Builder workingDirectory(File file) {
- rootDirectory = Optional.of(file.getAbsolutePath());
- return this;
- }
-
- public Builder useWorkingDirectoryEnvProperty() {
- rootDirectory = Optional.ofNullable(System.getProperty(WORKING_DIRECTORY));
- if (!rootDirectory.isPresent()) {
- throw new MissingArgumentException("Server needs a working.directory env entry");
- }
- return this;
- }
-
- public Builder configurationPath(ConfigurationPath path) {
- configurationPath = Optional.of(path);
- return this;
- }
-
- public Builder configurationFromClasspath() {
- configurationPath = Optional.of(new ConfigurationPath(FileSystem.CLASSPATH_PROTOCOL));
- return this;
- }
-
- public Builder blobStore(BlobStoreConfiguration blobStoreConfiguration) {
- this.blobStoreConfiguration = Optional.of(blobStoreConfiguration);
- return this;
- }
-
- public Builder searchConfiguration(SearchConfiguration searchConfiguration) {
- this.searchConfiguration = Optional.of(searchConfiguration);
- return this;
- }
-
- public Builder usersRepository(UsersRepositoryModuleChooser.Implementation implementation) {
- this.usersRepositoryImplementation = Optional.of(implementation);
- return this;
- }
-
- public Builder vaultConfiguration(VaultConfiguration vaultConfiguration) {
- this.vaultConfiguration = Optional.of(vaultConfiguration);
- return this;
- }
-
- public Builder quotaCompatibilityModeEnabled(boolean value) {
- this.quotaCompatibilityMode = Optional.of(value);
- return this;
- }
-
- public CassandraJamesServerConfiguration build() {
- ConfigurationPath configurationPath = this.configurationPath.orElse(new ConfigurationPath(FileSystem.FILE_PROTOCOL_AND_CONF));
- JamesServerResourceLoader directories = new JamesServerResourceLoader(rootDirectory
- .orElseThrow(() -> new MissingArgumentException("Server needs a working.directory env entry")));
-
- FileSystemImpl fileSystem = new FileSystemImpl(directories);
- PropertiesProvider propertiesProvider = new PropertiesProvider(fileSystem, configurationPath);
- SearchConfiguration searchConfiguration = this.searchConfiguration.orElseGet(Throwing.supplier(
- () -> SearchConfiguration.parse(propertiesProvider)));
-
- BlobStoreConfiguration blobStoreConfiguration = this.blobStoreConfiguration.orElseGet(Throwing.supplier(
- () -> BlobStoreConfiguration.parse(propertiesProvider)));
-
- FileConfigurationProvider configurationProvider = new FileConfigurationProvider(fileSystem, Basic.builder()
- .configurationPath(configurationPath)
- .workingDirectory(directories.getRootDirectory())
- .build());
- UsersRepositoryModuleChooser.Implementation usersRepositoryChoice = usersRepositoryImplementation.orElseGet(
- () -> UsersRepositoryModuleChooser.Implementation.parse(configurationProvider));
-
- VaultConfiguration vaultConfiguration = this.vaultConfiguration.orElseGet(() -> {
- try {
- return VaultConfiguration.from(propertiesProvider.getConfiguration("deletedMessageVault"));
- } catch (FileNotFoundException e) {
- return VaultConfiguration.DEFAULT;
- } catch (ConfigurationException e) {
- throw new RuntimeException(e);
- }
- });
-
- boolean quotaCompatibilityMode = this.quotaCompatibilityMode.orElseGet(() -> {
- try {
- return propertiesProvider.getConfiguration("cassandra").getBoolean("quota.compatibility.mode", false);
- } catch (FileNotFoundException e) {
- return false;
- } catch (ConfigurationException e) {
- throw new RuntimeException(e);
- }
- });
-
- boolean jmapEnabled = this.jmapEnabled.orElseGet(() -> {
- try {
- return JMAPModule.parseConfiguration(propertiesProvider).isEnabled();
- } catch (FileNotFoundException e) {
- return false;
- } catch (ConfigurationException e) {
- throw new RuntimeException(e);
- }
- });
-
- return new CassandraJamesServerConfiguration(configurationPath, directories, searchConfiguration, blobStoreConfiguration, usersRepositoryChoice, vaultConfiguration, jmapEnabled, quotaCompatibilityMode);
- }
- }
-
- public static CassandraJamesServerConfiguration.Builder builder() {
- return new Builder();
- }
-
- private final ConfigurationPath configurationPath;
- private final JamesDirectoriesProvider directories;
- private final SearchConfiguration searchConfiguration;
- private final BlobStoreConfiguration blobStoreConfiguration;
- private final UsersRepositoryModuleChooser.Implementation usersRepositoryImplementation;
- private final VaultConfiguration vaultConfiguration;
- private final boolean jmapEnabled;
- private final boolean quotaCompatibilityMode;
-
- private CassandraJamesServerConfiguration(ConfigurationPath configurationPath, JamesDirectoriesProvider directories,
- SearchConfiguration searchConfiguration, BlobStoreConfiguration blobStoreConfiguration,
- UsersRepositoryModuleChooser.Implementation usersRepositoryImplementation,
- VaultConfiguration vaultConfiguration, boolean jmapEnabled, boolean quotaCompatibilityMode) {
- this.configurationPath = configurationPath;
- this.directories = directories;
- this.searchConfiguration = searchConfiguration;
- this.blobStoreConfiguration = blobStoreConfiguration;
- this.usersRepositoryImplementation = usersRepositoryImplementation;
- this.vaultConfiguration = vaultConfiguration;
- this.jmapEnabled = jmapEnabled;
- this.quotaCompatibilityMode = quotaCompatibilityMode;
- }
-
- @Override
- public ConfigurationPath configurationPath() {
- return configurationPath;
- }
-
- @Override
- public JamesDirectoriesProvider directories() {
- return directories;
- }
-
- public SearchConfiguration searchConfiguration() {
- return searchConfiguration;
- }
-
- public VaultConfiguration getVaultConfiguration() {
- return vaultConfiguration;
- }
-
- public UsersRepositoryModuleChooser.Implementation getUsersRepositoryImplementation() {
- return usersRepositoryImplementation;
- }
-
- public BlobStoreConfiguration getBlobStoreConfiguration() {
- return blobStoreConfiguration;
- }
-
- public boolean isJmapEnabled() {
- return jmapEnabled;
- }
-
- public boolean isQuotaCompatibilityMode() {
- return quotaCompatibilityMode;
- }
-}
diff --git a/server/apps/cassandra-app/src/main/java/org/apache/james/CassandraJamesServerMain.java b/server/apps/cassandra-app/src/main/java/org/apache/james/CassandraJamesServerMain.java
deleted file mode 100644
index 80dd87884d..0000000000
--- a/server/apps/cassandra-app/src/main/java/org/apache/james/CassandraJamesServerMain.java
+++ /dev/null
@@ -1,236 +0,0 @@
-/****************************************************************
- * 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;
-
-import java.util.Set;
-
-import org.apache.james.data.UsersRepositoryModuleChooser;
-import org.apache.james.eventsourcing.eventstore.EventNestedTypes;
-import org.apache.james.jmap.JMAPListenerModule;
-import org.apache.james.jmap.JMAPModule;
-import org.apache.james.json.DTOModule;
-import org.apache.james.modules.BlobExportMechanismModule;
-import org.apache.james.modules.CassandraConsistencyTaskSerializationModule;
-import org.apache.james.modules.MailboxModule;
-import org.apache.james.modules.MailetProcessingModule;
-import org.apache.james.modules.data.CassandraDLPConfigurationStoreModule;
-import org.apache.james.modules.data.CassandraDelegationStoreModule;
-import org.apache.james.modules.data.CassandraDomainListModule;
-import org.apache.james.modules.data.CassandraJmapModule;
-import org.apache.james.modules.data.CassandraRecipientRewriteTableModule;
-import org.apache.james.modules.data.CassandraSieveQuotaLegacyModule;
-import org.apache.james.modules.data.CassandraSieveQuotaModule;
-import org.apache.james.modules.data.CassandraSieveRepositoryModule;
-import org.apache.james.modules.data.CassandraUsersRepositoryModule;
-import org.apache.james.modules.data.CassandraVacationModule;
-import org.apache.james.modules.eventstore.CassandraEventStoreModule;
-import org.apache.james.modules.mailbox.CassandraBlobStoreDependenciesModule;
-import org.apache.james.modules.mailbox.CassandraDeletedMessageVaultModule;
-import org.apache.james.modules.mailbox.CassandraMailboxModule;
-import org.apache.james.modules.mailbox.CassandraMailboxQuotaLegacyModule;
-import org.apache.james.modules.mailbox.CassandraMailboxQuotaModule;
-import org.apache.james.modules.mailbox.CassandraQuotaMailingModule;
-import org.apache.james.modules.mailbox.CassandraSessionModule;
-import org.apache.james.modules.mailbox.DefaultBucketModule;
-import org.apache.james.modules.mailbox.TikaMailboxModule;
-import org.apache.james.modules.mailrepository.CassandraMailRepositoryModule;
-import org.apache.james.modules.metrics.CassandraMetricsModule;
-import org.apache.james.modules.protocols.IMAPServerModule;
-import org.apache.james.modules.protocols.JMAPServerModule;
-import org.apache.james.modules.protocols.JmapEventBusModule;
-import org.apache.james.modules.protocols.LMTPServerModule;
-import org.apache.james.modules.protocols.ManageSieveServerModule;
-import org.apache.james.modules.protocols.POP3ServerModule;
-import org.apache.james.modules.protocols.ProtocolHandlerModule;
-import org.apache.james.modules.protocols.SMTPServerModule;
-import org.apache.james.modules.queue.activemq.ActiveMQQueueModule;
-import org.apache.james.modules.server.DKIMMailetModule;
-import org.apache.james.modules.server.DLPRoutesModule;
-import org.apache.james.modules.server.DataRoutesModules;
-import org.apache.james.modules.server.InconsistencyQuotasSolvingRoutesModule;
-import org.apache.james.modules.server.JMXServerModule;
-import org.apache.james.modules.server.JmapTasksModule;
-import org.apache.james.modules.server.JmapUploadCleanupModule;
-import org.apache.james.modules.server.MailQueueRoutesModule;
-import org.apache.james.modules.server.MailRepositoriesRoutesModule;
-import org.apache.james.modules.server.MailboxRoutesModule;
-import org.apache.james.modules.server.MailboxesExportRoutesModule;
-import org.apache.james.modules.server.MessagesRoutesModule;
-import org.apache.james.modules.server.SieveRoutesModule;
-import org.apache.james.modules.server.TaskManagerModule;
-import org.apache.james.modules.server.UserIdentityModule;
-import org.apache.james.modules.server.VacationRoutesModule;
-import org.apache.james.modules.server.WebAdminMailOverWebModule;
-import org.apache.james.modules.server.WebAdminReIndexingTaskSerializationModule;
-import org.apache.james.modules.server.WebAdminServerModule;
-import org.apache.james.modules.vault.DeletedMessageVaultRoutesModule;
-import org.apache.james.modules.webadmin.CassandraRoutesModule;
-import org.apache.james.modules.webadmin.InconsistencySolvingRoutesModule;
-import org.apache.james.vault.VaultConfiguration;
-
-import com.google.common.collect.ImmutableSet;
-import com.google.inject.Module;
-import com.google.inject.TypeLiteral;
-import com.google.inject.name.Names;
-import com.google.inject.util.Modules;
-
-/**
- * See https://issues.apache.org/jira/browse/JAMES-3767
- *
- * Cassandra APP will be removed after 3.8.0 release.
- *
- * Please migrate to the distributed APP.
- */
-@Deprecated(forRemoval = true)
-public class CassandraJamesServerMain implements JamesServerMain {
-
- public static final Module WEBADMIN = Modules.combine(
- new CassandraRoutesModule(),
- new DataRoutesModules(),
- new VacationRoutesModule(),
- new DLPRoutesModule(),
- new InconsistencyQuotasSolvingRoutesModule(),
- new InconsistencySolvingRoutesModule(),
- new JmapUploadCleanupModule(),
- new UserIdentityModule(),
- new JmapTasksModule(),
- new MailboxesExportRoutesModule(),
- new MailboxRoutesModule(),
- new MailQueueRoutesModule(),
- new MailRepositoriesRoutesModule(),
- new SieveRoutesModule(),
- new WebAdminServerModule(),
- new WebAdminReIndexingTaskSerializationModule(),
- new MessagesRoutesModule(),
- new WebAdminMailOverWebModule());
-
- public static final Module PROTOCOLS = Modules.combine(
- new CassandraJmapModule(),
- new CassandraVacationModule(),
- new IMAPServerModule(),
- new LMTPServerModule(),
- new ManageSieveServerModule(),
- new POP3ServerModule(),
- new ProtocolHandlerModule(),
- new SMTPServerModule(),
- new JMAPServerModule(),
- JMAPModule.INSTANCE,
- new JmapEventBusModule(),
- WEBADMIN);
-
- public static final Module PLUGINS = new CassandraQuotaMailingModule();
-
- private static final Module BLOB_MODULE = new BlobExportMechanismModule();
-
- private static final Module CASSANDRA_EVENT_STORE_JSON_SERIALIZATION_DEFAULT_MODULE = binder ->
- binder.bind(new TypeLiteral<Set<DTOModule<?, ? extends org.apache.james.json.DTO>>>() {}).annotatedWith(Names.named(EventNestedTypes.EVENT_NESTED_TYPES_INJECTION_NAME))
- .toInstance(ImmutableSet.of());
-
- public static final Module CASSANDRA_SERVER_CORE_MODULE = Modules.combine(
- new ActiveMQQueueModule(),
- new CassandraDelegationStoreModule(),
- new CassandraBlobStoreDependenciesModule(),
- new CassandraDomainListModule(),
- new CassandraDLPConfigurationStoreModule(),
- new CassandraEventStoreModule(),
- new CassandraMailRepositoryModule(),
- new CassandraMetricsModule(),
- new CassandraRecipientRewriteTableModule(),
- new CassandraSessionModule(),
- new CassandraSieveRepositoryModule(),
- BLOB_MODULE,
- CASSANDRA_EVENT_STORE_JSON_SERIALIZATION_DEFAULT_MODULE);
-
- public static final Module CASSANDRA_MAILBOX_MODULE = Modules.combine(
- new CassandraConsistencyTaskSerializationModule(),
- new CassandraMailboxModule(),
- new MailboxModule(),
- new TikaMailboxModule());
-
- public static final Module REQUIRE_TASK_MANAGER_MODULE = Modules.combine(
- CASSANDRA_SERVER_CORE_MODULE,
- CASSANDRA_MAILBOX_MODULE,
- PROTOCOLS,
- PLUGINS,
- new DKIMMailetModule());
-
- protected static final Module ALL_BUT_JMX_CASSANDRA_MODULE = Modules.combine(
- new MailetProcessingModule(),
- new DefaultBucketModule(),
- new CassandraBlobStoreModule(),
- REQUIRE_TASK_MANAGER_MODULE,
- new TaskManagerModule(),
- CASSANDRA_EVENT_STORE_JSON_SERIALIZATION_DEFAULT_MODULE
- );
-
- public static void main(String[] args) throws Exception {
- ExtraProperties.initialize();
-
- CassandraJamesServerConfiguration configuration = CassandraJamesServerConfiguration.builder()
- .useWorkingDirectoryEnvProperty()
- .build();
-
- LOGGER.info("Loading configuration {}", configuration.toString());
- GuiceJamesServer server = createServer(configuration)
- .combineWith(new JMXServerModule());
-
- JamesServerMain.main(server);
- }
-
- public static GuiceJamesServer createServer(CassandraJamesServerConfiguration configuration) {
- return GuiceJamesServer.forConfiguration(configuration)
- .combineWith(ALL_BUT_JMX_CASSANDRA_MODULE)
- .combineWith(BlobStoreModulesChooser.chooseModules(configuration.getBlobStoreConfiguration()))
- .combineWith(SearchModuleChooser.chooseModules(configuration.searchConfiguration()))
- .combineWith(new UsersRepositoryModuleChooser(new CassandraUsersRepositoryModule())
- .chooseModules(configuration.getUsersRepositoryImplementation()))
- .combineWith(chooseDeletedMessageVault(configuration.getVaultConfiguration()))
- .combineWith(chooseQuotaModule(configuration))
- .combineWith(chooseJmapModule(configuration));
- }
-
- private static Module chooseDeletedMessageVault(VaultConfiguration vaultConfiguration) {
- if (vaultConfiguration.isEnabled()) {
- return Modules.combine(
- new CassandraDeletedMessageVaultModule(),
- new DeletedMessageVaultRoutesModule());
- }
- return binder -> {
-
- };
- }
-
- private static Module chooseJmapModule(CassandraJamesServerConfiguration configuration) {
- if (configuration.isJmapEnabled()) {
- return new JMAPListenerModule();
- }
- return binder -> {
-
- };
- }
-
- private static Module chooseQuotaModule(CassandraJamesServerConfiguration configuration) {
- if (configuration.isQuotaCompatibilityMode()) {
- return Modules.combine(new CassandraMailboxQuotaLegacyModule(), new CassandraSieveQuotaLegacyModule());
- } else {
- return Modules.combine(new CassandraMailboxQuotaModule(), new CassandraSieveQuotaModule());
- }
- }
-}
diff --git a/server/apps/cassandra-app/src/test/java/org/apache/james/TestingDistributedJamesServerBuilder.java b/server/apps/cassandra-app/src/test/java/org/apache/james/TestingDistributedJamesServerBuilder.java
deleted file mode 100644
index 211ef78e23..0000000000
--- a/server/apps/cassandra-app/src/test/java/org/apache/james/TestingDistributedJamesServerBuilder.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/****************************************************************
- * 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;
-
-public class TestingDistributedJamesServerBuilder {
- @FunctionalInterface
- interface ConfigurationSpecification {
- CassandraJamesServerConfiguration.Builder customize(CassandraJamesServerConfiguration.Builder configuration);
- }
-
- public static JamesServerBuilder<CassandraJamesServerConfiguration> forConfiguration(ConfigurationSpecification configurationSpecification) {
- return new JamesServerBuilder<>(tmpDir ->
- configurationSpecification.customize(CassandraJamesServerConfiguration.builder()
- .workingDirectory(tmpDir)
- .configurationFromClasspath())
- .build());
- }
-
- public static JamesServerBuilder<CassandraJamesServerConfiguration> withSearchConfiguration(SearchConfiguration searchConfiguration) {
- return forConfiguration(configuration -> configuration.searchConfiguration(searchConfiguration));
- }
-}
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org