Save work in progress

This commit is contained in:
Max Dor
2019-03-01 17:51:33 +01:00
parent d5f9137056
commit de92e98f7d
4 changed files with 269 additions and 4 deletions

View File

@@ -25,9 +25,48 @@ import org.apache.commons.lang.StringUtils;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
public class ListenerConfig {
public static class Synpase {
private String registrationFile;
public String getRegistrationFile() {
return registrationFile;
}
public void setRegistrationFile(String registrationFile) {
this.registrationFile = registrationFile;
}
}
public static class UserTemplate {
private String type = "regex";
private String template;
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getTemplate() {
return template;
}
public void setTemplate(String template) {
this.template = template;
}
}
public static class Token {
private String as;
@@ -51,10 +90,22 @@ public class ListenerConfig {
}
private transient URL csUrl;
private String id = "appservice-mxisd";
private String url;
private String localpart;
private String localpart = "mxisd";
private Token token = new Token();
private List<UserTemplate> users = new ArrayList<>();
private Synpase synapse = new Synpase();
private transient URL csUrl;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public URL getUrl() {
return csUrl;
@@ -80,6 +131,22 @@ public class ListenerConfig {
this.token = token;
}
public List<UserTemplate> getUsers() {
return users;
}
public void setUsers(List<UserTemplate> users) {
this.users = users;
}
public Synpase getSynapse() {
return synapse;
}
public void setSynapse(Synpase synapse) {
this.synapse = synapse;
}
public void build() {
try {
if (StringUtils.isBlank(url)) {
@@ -88,6 +155,10 @@ public class ListenerConfig {
csUrl = new URL(url);
if (org.apache.commons.lang3.StringUtils.isBlank(getId())) {
throw new IllegalArgumentException("Matrix Listener ID is not set");
}
if (StringUtils.isBlank(getLocalpart())) {
throw new IllegalArgumentException("localpart for matrix listener is not set");
}