Continue structural port from Spring Boot to Undertow

This commit is contained in:
Max Dor
2018-12-30 05:28:05 +01:00
parent 6a376db322
commit 7ad985fead
85 changed files with 1019 additions and 367 deletions

View File

@@ -24,7 +24,7 @@ import io.kamax.mxisd.as.IMatrixIdInvite;
import io.kamax.mxisd.invitation.IThreePidInviteReply;
import io.kamax.mxisd.threepid.session.IThreePidSession;
public interface INotificationHandler {
public interface NotificationHandler {
String getId();

View File

@@ -0,0 +1,29 @@
/*
* mxisd - Matrix Identity Server Daemon
* Copyright (C) 2018 Kamax Sarl
*
* https://www.kamax.io/
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package io.kamax.mxisd.notification;
import io.kamax.mxisd.Mxisd;
import java.util.function.Consumer;
public interface NotificationHandlerSupplier extends Consumer<Mxisd> {
}

View File

@@ -27,13 +27,13 @@ import java.util.stream.Collectors;
public class NotificationHandlers {
private static final List<Supplier<INotificationHandler>> suppliers = new ArrayList<>();
private static final List<Supplier<NotificationHandler>> suppliers = new ArrayList<>();
public static void register(Supplier<INotificationHandler> supplier) {
public static void register(Supplier<NotificationHandler> supplier) {
suppliers.add(supplier);
}
public static List<INotificationHandler> get() {
public static List<NotificationHandler> get() {
return suppliers.stream().map(Supplier::get).collect(Collectors.toList());
}

View File

@@ -37,9 +37,9 @@ public class NotificationManager {
private transient final Logger log = LoggerFactory.getLogger(NotificationManager.class);
private Map<String, INotificationHandler> handlers;
private Map<String, NotificationHandler> handlers;
public NotificationManager(NotificationConfig cfg, List<INotificationHandler> handlers) {
public NotificationManager(NotificationConfig cfg, List<NotificationHandler> handlers) {
this.handlers = new HashMap<>();
handlers.forEach(h -> {
log.info("Found handler {} for medium {}", h.getId(), h.getMedium());
@@ -53,8 +53,8 @@ public class NotificationManager {
this.handlers.forEach((k, v) -> log.info("\tHandler for {}: {}", k, v.getId()));
}
private INotificationHandler ensureMedium(String medium) {
INotificationHandler handler = handlers.get(medium);
private NotificationHandler ensureMedium(String medium) {
NotificationHandler handler = handlers.get(medium);
if (handler == null) {
throw new NotImplementedException(medium + " is not a supported 3PID medium type");
}
@@ -77,7 +77,7 @@ public class NotificationManager {
ensureMedium(session.getThreePid().getMedium()).sendForValidation(session);
}
public void sendforRemoteValidation(IThreePidSession session) {
public void sendForRemoteValidation(IThreePidSession session) {
ensureMedium(session.getThreePid().getMedium()).sendForRemoteValidation(session);
}