Continue structural port from Spring Boot to Undertow
This commit is contained in:
@@ -25,12 +25,12 @@ import io.kamax.matrix.json.GsonUtil;
|
||||
import io.kamax.mxisd.config.ExecConfig;
|
||||
import io.kamax.mxisd.config.MatrixConfig;
|
||||
import io.kamax.mxisd.config.MxisdConfig;
|
||||
import io.kamax.mxisd.directory.IDirectoryProvider;
|
||||
import io.kamax.mxisd.directory.DirectoryProvider;
|
||||
import io.kamax.mxisd.http.io.UserDirectorySearchRequest;
|
||||
import io.kamax.mxisd.http.io.UserDirectorySearchResult;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
public class ExecDirectoryStore extends ExecStore implements IDirectoryProvider {
|
||||
public class ExecDirectoryStore extends ExecStore implements DirectoryProvider {
|
||||
|
||||
private ExecConfig.Directory cfg;
|
||||
private MatrixConfig mxCfg;
|
||||
@@ -44,11 +44,6 @@ public class ExecDirectoryStore extends ExecStore implements IDirectoryProvider
|
||||
this.mxCfg = mxCfg;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return cfg.isEnabled();
|
||||
}
|
||||
|
||||
private UserDirectorySearchResult search(ExecConfig.Process cfg, UserDirectorySearchRequest request) {
|
||||
if (StringUtils.isEmpty(cfg.getCommand())) {
|
||||
return UserDirectorySearchResult.empty();
|
||||
|
||||
@@ -63,11 +63,6 @@ public class ExecIdentityStore extends ExecStore implements IThreePidProvider {
|
||||
this.mxCfg = mxCfg;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return cfg.isEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLocal() {
|
||||
return true;
|
||||
|
||||
@@ -45,11 +45,6 @@ public class ExecProfileStore extends ExecStore implements ProfileProvider {
|
||||
this.cfg = cfg;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return cfg.isEnabled();
|
||||
}
|
||||
|
||||
private Optional<JsonProfileResult> getFull(_MatrixID userId, ExecConfig.Process cfg) {
|
||||
Processor<Optional<JsonProfileResult>> p = new Processor<>(cfg);
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ package io.kamax.mxisd.backend.ldap;
|
||||
|
||||
import io.kamax.mxisd.config.MatrixConfig;
|
||||
import io.kamax.mxisd.config.ldap.LdapConfig;
|
||||
import io.kamax.mxisd.directory.IDirectoryProvider;
|
||||
import io.kamax.mxisd.directory.DirectoryProvider;
|
||||
import io.kamax.mxisd.exception.InternalServerError;
|
||||
import io.kamax.mxisd.http.io.UserDirectorySearchResult;
|
||||
import io.kamax.mxisd.util.GsonUtil;
|
||||
@@ -40,7 +40,7 @@ import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class LdapDirectoryProvider extends LdapBackend implements IDirectoryProvider {
|
||||
public class LdapDirectoryProvider extends LdapBackend implements DirectoryProvider {
|
||||
|
||||
private transient final Logger log = LoggerFactory.getLogger(LdapDirectoryProvider.class);
|
||||
|
||||
@@ -48,11 +48,6 @@ public class LdapDirectoryProvider extends LdapBackend implements IDirectoryProv
|
||||
super(cfg, mxCfg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return getCfg().isEnabled();
|
||||
}
|
||||
|
||||
protected UserDirectorySearchResult search(String query, List<String> attributes) {
|
||||
UserDirectorySearchResult result = new UserDirectorySearchResult();
|
||||
result.setLimited(false);
|
||||
|
||||
@@ -51,11 +51,6 @@ public class LdapProfileProvider extends LdapBackend implements ProfileProvider
|
||||
super(cfg, mxCfg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return getCfg().isEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<String> getDisplayName(_MatrixID userId) {
|
||||
String uid = buildUidFromMatrixId(userId);
|
||||
|
||||
@@ -51,11 +51,6 @@ public class LdapThreePidProvider extends LdapBackend implements IThreePidProvid
|
||||
super(cfg, mxCfg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return getCfg().isEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLocal() {
|
||||
return true;
|
||||
|
||||
@@ -31,7 +31,7 @@ import io.kamax.mxisd.config.MatrixConfig;
|
||||
import io.kamax.mxisd.config.memory.MemoryIdentityConfig;
|
||||
import io.kamax.mxisd.config.memory.MemoryStoreConfig;
|
||||
import io.kamax.mxisd.config.memory.MemoryThreePid;
|
||||
import io.kamax.mxisd.directory.IDirectoryProvider;
|
||||
import io.kamax.mxisd.directory.DirectoryProvider;
|
||||
import io.kamax.mxisd.http.io.UserDirectorySearchResult;
|
||||
import io.kamax.mxisd.lookup.SingleLookupReply;
|
||||
import io.kamax.mxisd.lookup.SingleLookupRequest;
|
||||
@@ -49,7 +49,7 @@ import java.util.Optional;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
public class MemoryIdentityStore implements AuthenticatorProvider, IDirectoryProvider, IThreePidProvider, ProfileProvider {
|
||||
public class MemoryIdentityStore implements AuthenticatorProvider, DirectoryProvider, IThreePidProvider, ProfileProvider {
|
||||
|
||||
private transient final Logger logger = LoggerFactory.getLogger(MemoryIdentityStore.class);
|
||||
|
||||
|
||||
@@ -23,19 +23,18 @@ package io.kamax.mxisd.backend.rest;
|
||||
import io.kamax.matrix.MatrixID;
|
||||
import io.kamax.mxisd.config.MatrixConfig;
|
||||
import io.kamax.mxisd.config.rest.RestBackendConfig;
|
||||
import io.kamax.mxisd.directory.IDirectoryProvider;
|
||||
import io.kamax.mxisd.directory.DirectoryProvider;
|
||||
import io.kamax.mxisd.exception.InternalServerError;
|
||||
import io.kamax.mxisd.http.io.UserDirectorySearchRequest;
|
||||
import io.kamax.mxisd.http.io.UserDirectorySearchResult;
|
||||
import io.kamax.mxisd.util.RestClientUtils;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
public class RestDirectoryProvider extends RestProvider implements IDirectoryProvider {
|
||||
public class RestDirectoryProvider extends RestProvider implements DirectoryProvider {
|
||||
|
||||
private MatrixConfig mxCfg;
|
||||
|
||||
@@ -44,11 +43,6 @@ public class RestDirectoryProvider extends RestProvider implements IDirectoryPro
|
||||
this.mxCfg = mxCfg;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return cfg.isEnabled() && StringUtils.isNotBlank(cfg.getEndpoints().getDirectory());
|
||||
}
|
||||
|
||||
private UserDirectorySearchResult search(String by, String query) {
|
||||
UserDirectorySearchRequest request = new UserDirectorySearchRequest(query);
|
||||
request.setBy(by);
|
||||
|
||||
@@ -55,11 +55,6 @@ public class RestProfileProvider extends RestProvider implements ProfileProvider
|
||||
super(cfg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return cfg.isEnabled() && cfg.getEndpoints().getProfile().isPresent();
|
||||
}
|
||||
|
||||
private <T> Optional<T> doRequest(
|
||||
_MatrixID userId,
|
||||
Function<RestBackendConfig.ProfileEndpoints, Optional<String>> endpoint,
|
||||
|
||||
@@ -62,11 +62,6 @@ public class RestThreePidProvider extends RestProvider implements IThreePidProvi
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return cfg.isEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLocal() {
|
||||
return true;
|
||||
|
||||
@@ -50,11 +50,6 @@ public abstract class SqlProfileProvider implements ProfileProvider {
|
||||
this.pool = new SqlConnectionPool(cfg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return cfg.isEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<String> getDisplayName(_MatrixID user) {
|
||||
String stmtSql = cfg.getDisplayName().getQuery();
|
||||
|
||||
@@ -54,11 +54,6 @@ public abstract class SqlThreePidProvider implements IThreePidProvider {
|
||||
this.mxCfg = mxCfg;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return cfg.isEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLocal() {
|
||||
return true;
|
||||
|
||||
@@ -25,7 +25,7 @@ import io.kamax.mxisd.backend.sql.SqlConnectionPool;
|
||||
import io.kamax.mxisd.config.MatrixConfig;
|
||||
import io.kamax.mxisd.config.sql.SqlConfig;
|
||||
import io.kamax.mxisd.config.sql.generic.GenericSqlProviderConfig;
|
||||
import io.kamax.mxisd.directory.IDirectoryProvider;
|
||||
import io.kamax.mxisd.directory.DirectoryProvider;
|
||||
import io.kamax.mxisd.exception.InternalServerError;
|
||||
import io.kamax.mxisd.http.io.UserDirectorySearchResult;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
@@ -40,7 +40,7 @@ import java.util.Optional;
|
||||
|
||||
import static io.kamax.mxisd.http.io.UserDirectorySearchResult.Result;
|
||||
|
||||
public class GenericSqlDirectoryProvider implements IDirectoryProvider {
|
||||
public class GenericSqlDirectoryProvider implements DirectoryProvider {
|
||||
|
||||
private transient final Logger log = LoggerFactory.getLogger(GenericSqlDirectoryProvider.class);
|
||||
|
||||
@@ -55,11 +55,6 @@ public class GenericSqlDirectoryProvider implements IDirectoryProvider {
|
||||
this.mxCfg = mxCfg;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return cfg.getDirectory().isEnabled();
|
||||
}
|
||||
|
||||
protected void setParameters(PreparedStatement stmt, String searchTerm) throws SQLException {
|
||||
for (int i = 1; i <= stmt.getParameterMetaData().getParameterCount(); i++) {
|
||||
stmt.setString(i, searchTerm);
|
||||
|
||||
@@ -23,7 +23,7 @@ package io.kamax.mxisd.backend.wordpress;
|
||||
import io.kamax.matrix.MatrixID;
|
||||
import io.kamax.mxisd.config.MatrixConfig;
|
||||
import io.kamax.mxisd.config.wordpress.WordpressConfig;
|
||||
import io.kamax.mxisd.directory.IDirectoryProvider;
|
||||
import io.kamax.mxisd.directory.DirectoryProvider;
|
||||
import io.kamax.mxisd.exception.InternalServerError;
|
||||
import io.kamax.mxisd.http.io.UserDirectorySearchResult;
|
||||
import org.slf4j.Logger;
|
||||
@@ -35,7 +35,7 @@ import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Optional;
|
||||
|
||||
public class WordpressDirectoryProvider implements IDirectoryProvider {
|
||||
public class WordpressDirectoryProvider implements DirectoryProvider {
|
||||
|
||||
private transient final Logger log = LoggerFactory.getLogger(WordpressDirectoryProvider.class);
|
||||
|
||||
@@ -49,11 +49,6 @@ public class WordpressDirectoryProvider implements IDirectoryProvider {
|
||||
this.mxCfg = mxCfg;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return wordpress.isEnabled();
|
||||
}
|
||||
|
||||
protected void setParameters(PreparedStatement stmt, String searchTerm) throws SQLException {
|
||||
for (int i = 1; i <= stmt.getParameterMetaData().getParameterCount(); i++) {
|
||||
stmt.setString(i, "%" + searchTerm + "%");
|
||||
|
||||
@@ -54,11 +54,6 @@ public class WordpressThreePidProvider implements IThreePidProvider {
|
||||
this.wordpress = wordpress;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return wordpress.isEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLocal() {
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user