com.shinesolutions.aemorchestrator.config.MappingConfig Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aem-orchestrator Show documentation
Show all versions of aem-orchestrator Show documentation
Java application for orchestrating AEM infrastructure created using aem-aws-stack-builder
package com.shinesolutions.aemorchestrator.config;
import java.util.HashMap;
import java.util.Map;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.shinesolutions.aemorchestrator.actions.Action;
import com.shinesolutions.aemorchestrator.actions.ScaleDownAuthorDispatcherAction;
import com.shinesolutions.aemorchestrator.actions.ScaleDownPublishAction;
import com.shinesolutions.aemorchestrator.actions.ScaleDownPublishDispatcherAction;
import com.shinesolutions.aemorchestrator.actions.ScaleUpAuthorDispatcherAction;
import com.shinesolutions.aemorchestrator.actions.ScaleUpPublishAction;
import com.shinesolutions.aemorchestrator.actions.ScaleUpPublishDispatcherAction;
import com.shinesolutions.aemorchestrator.handler.AlarmMessageHandler;
import com.shinesolutions.aemorchestrator.handler.AutoScalingLaunchEventHandler;
import com.shinesolutions.aemorchestrator.handler.AutoScalingTerminateEventHandler;
import com.shinesolutions.aemorchestrator.handler.MessageHandler;
import com.shinesolutions.aemorchestrator.handler.TestNotificationEventHandler;
import com.shinesolutions.aemorchestrator.model.EnvironmentValues;
import com.shinesolutions.aemorchestrator.model.EventType;
@Configuration
public class MappingConfig {
@Bean
public Map eventTypeHandlerMappings(
final AutoScalingTerminateEventHandler scaleDownEventHandler,
final AutoScalingLaunchEventHandler scaleUpEventHandler,
final TestNotificationEventHandler testNotificationEventHandler,
final AlarmMessageHandler alarmMessageHandler) {
Map mappings = new HashMap();
mappings.put(EventType.AUTOSCALING_EC2_INSTANCE_TERMINATE.getValue(), scaleDownEventHandler);
mappings.put(EventType.AUTOSCALING_EC2_INSTANCE_LAUNCH.getValue(), scaleUpEventHandler);
mappings.put(EventType.AUTOSCALING_TEST_NOTIFICATION.getValue(), testNotificationEventHandler);
mappings.put(EventType.ALARM.getValue(), alarmMessageHandler);
return mappings;
}
@Bean(name="scaleDownAutoScaleGroupMappings")
public Map scaleDownAutoScaleGroupMappings(
final ScaleDownPublishDispatcherAction scaleDownPublishDispatcherAction,
final ScaleDownPublishAction scaleDownPublishAction,
final ScaleDownAuthorDispatcherAction scaleDownAuthorDispatcherAction,
final EnvironmentValues envValues) {
Map mappings = new HashMap();
mappings.put(envValues.getAutoScaleGroupNameForPublishDispatcher(), scaleDownPublishDispatcherAction);
mappings.put(envValues.getAutoScaleGroupNameForPublish(), scaleDownPublishAction);
mappings.put(envValues.getAutoScaleGroupNameForAuthorDispatcher(), scaleDownAuthorDispatcherAction);
return mappings;
}
@Bean(name="scaleUpAutoScaleGroupMappings")
public Map scaleUpAutoScaleGroupMappings(
final ScaleUpPublishDispatcherAction scaleUpPublishDispatcherAction,
final ScaleUpPublishAction scaleUpPublishAction,
final ScaleUpAuthorDispatcherAction scaleUpAuthorDispatcherAction,
final EnvironmentValues envValues) {
Map mappings = new HashMap();
mappings.put(envValues.getAutoScaleGroupNameForPublishDispatcher(), scaleUpPublishDispatcherAction);
mappings.put(envValues.getAutoScaleGroupNameForPublish(), scaleUpPublishAction);
mappings.put(envValues.getAutoScaleGroupNameForAuthorDispatcher(), scaleUpAuthorDispatcherAction);
return mappings;
}
}