org.zodiac.actuate.application.maintenance.AppOnlineMaintenanceOperator Maven / Gradle / Ivy
The newest version!
package org.zodiac.actuate.application.maintenance;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.ApplicationEventPublisherAware;
import org.springframework.lang.NonNull;
import org.springframework.web.bind.annotation.RequestMethod;
import org.zodiac.core.event.context.AppOnlineEvent;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
public class AppOnlineMaintenanceOperator implements AppMaintenanceOperator, ApplicationEventPublisherAware {
private ApplicationEventPublisher publisher;
private final List supportedMethods;
public AppOnlineMaintenanceOperator() {
supportedMethods = Arrays.asList(RequestMethod.DELETE, RequestMethod.POST, RequestMethod.PUT);
}
@Override
public String getOperatorName() {
return "app-online";
}
@Override
public void process(Map params) {
AppOnlineEvent serviceOnlineEvent = new AppOnlineEvent();
publisher.publishEvent(serviceOnlineEvent);
}
@Override
public Object getStatus() {
return null;
}
@Override
public void setApplicationEventPublisher(@NonNull ApplicationEventPublisher applicationEventPublisher) {
this.publisher = applicationEventPublisher;
}
@Override
public List supportedMethods() {
return supportedMethods;
}
}