You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
2.1 KiB
60 lines
2.1 KiB
/* |
|
* Copyright (C), 2018-2021 |
|
* Project: starter |
|
* FileName: PluginMonitor |
|
* Author: Louis |
|
* Date: 2021/3/30 15:10 |
|
*/ |
|
package com.fr.plugin.hdmu; |
|
|
|
import com.fanruan.api.log.LogKit; |
|
import com.fr.plugin.context.PluginContext; |
|
import com.fr.plugin.hdmu.config.SsoConfig; |
|
import com.fr.plugin.hdmu.helper.SsoUserScheduleHelper; |
|
import com.fr.plugin.observer.inner.AbstractPluginLifecycleMonitor; |
|
|
|
import static com.fr.plugin.hdmu.helper.SsoUserScheduleHelper.*; |
|
|
|
|
|
/** |
|
* <Function Description><br> |
|
* <PluginMonitor> |
|
* |
|
* @author fr.open |
|
* @since 1.0.0 |
|
*/ |
|
public class PluginMonitor extends AbstractPluginLifecycleMonitor { |
|
public PluginMonitor() { |
|
} |
|
|
|
@Override |
|
public void afterRun(PluginContext pluginContext) { |
|
SsoConfig.getInstance(); |
|
this.reStartSchedule(); |
|
// 测试执行 |
|
// try { |
|
// SsoUserManager.getInstance().synSSODepartments(); |
|
// } catch (Exception e) { |
|
// LogKit.error(e.getMessage(), e); |
|
// } |
|
} |
|
|
|
@Override |
|
public void beforeStop(PluginContext pluginContext) { |
|
SsoUserScheduleHelper.getInstance().stopSchedule(SSO_USER_SCHEDULE_SYN_MEMBER_JOB_NAME, SSO_USER_SCHEDULE_SYN_MEMBER_GROUP); |
|
SsoUserScheduleHelper.getInstance().stopSchedule(SSO_USER_SCHEDULE_CHECK_IAM_JOB_NAME, SSO_USER_SCHEDULE_CHECK_IAM_GROUP); |
|
} |
|
|
|
private void reStartSchedule() { |
|
try { |
|
SsoUserScheduleHelper.getInstance().stopSchedule(SSO_USER_SCHEDULE_SYN_MEMBER_JOB_NAME, SSO_USER_SCHEDULE_SYN_MEMBER_GROUP); |
|
SsoUserScheduleHelper.getInstance().stopSchedule(SSO_USER_SCHEDULE_CHECK_IAM_JOB_NAME, SSO_USER_SCHEDULE_CHECK_IAM_GROUP); |
|
String cronCondition = SsoConfig.getInstance().getCronCondition(); |
|
String checkIamCron = SsoConfig.getInstance().getCheckIamCron(); |
|
SsoUserScheduleHelper.getInstance().startSynMemberSchedule(cronCondition); |
|
SsoUserScheduleHelper.getInstance().startCheckIamSchedule(checkIamCron); |
|
} catch (Exception e) { |
|
LogKit.error(e.getMessage(), e); |
|
} |
|
} |
|
} |