chibenwa commented on code in PR #2256:
URL: https://github.com/apache/james-project/pull/2256#discussion_r1610790466


##########
server/mailet/droplists-cassandra/src/main/java/org/apache/james/droplists/cassandra/CassandraDropListsModule.java:
##########
@@ -0,0 +1,36 @@
+/****************************************************************
+ * 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.droplists.cassandra;
+
+import org.apache.james.droplists.api.DropList;
+import org.apache.james.webadmin.routes.DropListRoutes;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.Scopes;
+
+public class CassandraDropListsModule extends AbstractModule {
+    @Override
+    protected void configure() {
+        bind(CassandraDropList.class).in(Scopes.SINGLETON);
+        bind(DropList.class).to(CassandraDropList.class);
+
+        bind(DropListRoutes.class).in(Scopes.SINGLETON);
+    }
+}

Review Comment:
   Question here: CassandraModules are not declared. THis means that James 
would not manage their lifecycle.
   
   We would need to register them for James to manage them.
   
   Actually there is a further issue: child injectors are not able to modify 
the parent injector. THis means the module likely cannot register them easily...
   
   The way I would see it would be:
    - A/ Accept an external lifecycle for the cassandra extensions. In such 
case we need to document the CQL code to create the table to the minimum.... 
    - B/ Allow registration of UserDefinedCassandraModule. Those would subclass 
cassandra modules and be explicitly registered into cassandra.properties. The 
guice wiring would then assemble the "core" cassandraModules and the user 
defined ones. Boiler plate but doable. Could then be reused for other 
extensions.
    - C/ Decide that the extension is core enough to get a module chooser. We 
would have a config toogle to turn it on/off. And we would not encounter this 
limitation as the guice modules would then be combined. This would be nice as 
separate routes for instance won't need extra registration. As everything is 
already on the classpath, impact is limited.
    - D/ Bind everything directly in each and every app. I do not like it as we 
should allow users to not have too many cassandra tables and disable those of 
features he do not uses...
    
    Do you see other options? Any preference / thoughts?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to