Commit f75f9b64 by Johannes Edmeier

Add getters so that config metadata is generated

Apparently we need some getters so that the metadata for the configuration properties is generated. fixes #391
parent 0fe2d989
......@@ -141,4 +141,8 @@ public class ApplicationDiscoveryListener {
public void setIgnoredServices(Set<String> ignoredServices) {
this.ignoredServices = ignoredServices;
}
public Set<String> getIgnoredServices() {
return ignoredServices;
}
}
......@@ -43,7 +43,15 @@ public class DefaultServiceInstanceConverter implements ServiceInstanceConverter
private static final String KEY_MANAGEMENT_PORT = "management.port";
private static final String KEY_MANAGEMENT_PATH = "management.context-path";
private static final String KEY_HEALTH_PATH = "health.path";
/**
* Default context-path to be appended to the url of the discovered service for the
* managment-url.
*/
private String managementContextPath = "";
/**
* Default path of the health-endpoint to be used for the health-url of the discovered service.
*/
private String healthEndpointPath = "health";
@Override
......@@ -106,22 +114,20 @@ public class DefaultServiceInstanceConverter implements ServiceInstanceConverter
return instance.getMetadata();
}
/**
* Default <code>management.context-path</code> to be appended to the url of the discovered
* service for the managment-url.
*
* @param managementContextPath the management context-path.
*/
public void setManagementContextPath(String managementContextPath) {
this.managementContextPath = managementContextPath;
}
/**
* Default path of the health-endpoint to be used for the health-url of the discovered service.
*
* @param healthEndpointPath the path for the health-endpoint.
*/
public String getManagementContextPath() {
return managementContextPath;
}
public void setHealthEndpointPath(String healthEndpointPath) {
this.healthEndpointPath = healthEndpointPath;
}
public String getHealthEndpointPath() {
return healthEndpointPath;
}
}
......@@ -55,4 +55,8 @@ public abstract class AbstractEventNotifier implements Notifier {
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public boolean isEnabled() {
return enabled;
}
}
\ No newline at end of file
......@@ -52,4 +52,7 @@ public abstract class AbstractStatusChangeNotifier extends AbstractEventNotifier
this.ignoreChanges = copy;
}
public String[] getIgnoreChanges() {
return ignoreChanges;
}
}
......@@ -115,22 +115,42 @@ public class HipchatNotifier extends AbstractStatusChangeNotifier {
this.url = url;
}
public URI getUrl() {
return url;
}
public void setAuthToken(String authToken) {
this.authToken = authToken;
}
public String getAuthToken() {
return authToken;
}
public void setRoomId(String roomId) {
this.roomId = roomId;
}
public String getRoomId() {
return roomId;
}
public void setNotify(boolean notify) {
this.notify = notify;
}
public boolean isNotify() {
return notify;
}
public void setDescription(String description) {
this.description = parser.parseExpression(description, ParserContext.TEMPLATE_EXPRESSION);
}
public String getDescription() {
return description.getExpressionString();
}
public void setRestTemplate(RestTemplate restTemplate) {
this.restTemplate = restTemplate;
}
......
......@@ -88,20 +88,40 @@ public class MailNotifier extends AbstractStatusChangeNotifier {
this.to = Arrays.copyOf(to, to.length);
}
public String[] getTo() {
return Arrays.copyOf(to, to.length);
}
public void setCc(String[] cc) {
this.cc = Arrays.copyOf(cc, cc.length);
}
public String[] getCc() {
return Arrays.copyOf(cc, cc.length);
}
public void setFrom(String from) {
this.from = from;
}
public String getFrom() {
return from;
}
public void setSubject(String subject) {
this.subject = parser.parseExpression(subject, ParserContext.TEMPLATE_EXPRESSION);
}
public String getSubject() {
return subject.getExpressionString();
}
public void setText(String text) {
this.text = parser.parseExpression(text, ParserContext.TEMPLATE_EXPRESSION);
}
public String getText() {
return text.getExpressionString();
}
}
......@@ -15,8 +15,9 @@
*/
package de.codecentric.boot.admin.notify;
import static java.util.Collections.singletonList;
import java.net.URI;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
......@@ -103,7 +104,7 @@ public class PagerdutyNotifier extends AbstractStatusChangeNotifier {
context.put("type", "link");
context.put("href", event.getApplication().getHealthUrl());
context.put("text", "Application health-endpoint");
result.put("contexts", Arrays.asList(context));
result.put("contexts", singletonList(context));
}
}
......@@ -127,22 +128,42 @@ public class PagerdutyNotifier extends AbstractStatusChangeNotifier {
this.url = url;
}
public URI getUrl() {
return url;
}
public void setClient(String client) {
this.client = client;
}
public String getClient() {
return client;
}
public void setClientUrl(URI clientUrl) {
this.clientUrl = clientUrl;
}
public URI getClientUrl() {
return clientUrl;
}
public void setServiceKey(String serviceKey) {
this.serviceKey = serviceKey;
}
public String getServiceKey() {
return serviceKey;
}
public void setDescription(String description) {
this.description = parser.parseExpression(description, ParserContext.TEMPLATE_EXPRESSION);
}
public String getDescription() {
return description.getExpressionString();
}
public void setRestTemplate(RestTemplate restTemplate) {
this.restTemplate = restTemplate;
}
......
......@@ -62,26 +62,6 @@ public class SlackNotifier extends AbstractStatusChangeNotifier {
this.restTemplate = restTemplate;
}
public void setWebhookUrl(URI webhookUrl) {
this.webhookUrl = webhookUrl;
}
public void setChannel(String channel) {
this.channel = channel;
}
public void setIcon(String icon) {
this.icon = icon;
}
public void setUsername(String username) {
this.username = username;
}
public void setMessage(String message) {
this.message = parser.parseExpression(message, ParserContext.TEMPLATE_EXPRESSION);
}
protected Object createMessage(ClientApplicationEvent event) {
Map<String, Object> messageJson = new HashMap<>();
messageJson.put("username", username);
......@@ -111,4 +91,44 @@ public class SlackNotifier extends AbstractStatusChangeNotifier {
return "#439FE0";
}
}
public URI getWebhookUrl() {
return webhookUrl;
}
public void setWebhookUrl(URI webhookUrl) {
this.webhookUrl = webhookUrl;
}
public String getChannel() {
return channel;
}
public void setChannel(String channel) {
this.channel = channel;
}
public String getIcon() {
return icon;
}
public void setIcon(String icon) {
this.icon = icon;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getMessage() {
return message.getExpressionString();
}
public void setMessage(String message) {
this.message = parser.parseExpression(message, ParserContext.TEMPLATE_EXPRESSION);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment