Java tutorial
/* This program is free software; you can redistribute it and/or Modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ package com.clustercontrol.custom.factory; import java.util.ArrayList; import java.util.List; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import com.clustercontrol.commons.util.NotifyGroupIdGenerator; import com.clustercontrol.custom.bean.CommandResultDTO; import com.clustercontrol.fault.CustomInvalid; import com.clustercontrol.fault.HinemosUnknown; import com.clustercontrol.fault.MonitorNotFound; import com.clustercontrol.jobmanagement.bean.MonitorJobEndNode; import com.clustercontrol.monitor.run.model.MonitorInfo; import com.clustercontrol.notify.bean.OutputBasicInfo; import com.clustercontrol.notify.session.NotifyControllerBean; /** * ??<br/> * * @version 6.0.0 * @since 6.0.0 */ public abstract class RunCustomBase { private static Log m_log = LogFactory.getLog(RunCustom.class);; protected CommandResultDTO result = null; protected List<MonitorJobEndNode> monitorJobEndNodeList = new ArrayList<>(); /** * ????<br/> * * @throws HinemosUnknown * ?????? * @throws MonitorNotFound * ?????? * @throws CustomInvalid * ?????? */ public abstract void monitor() throws HinemosUnknown, MonitorNotFound, CustomInvalid; /** * ???????<br/> * * @param priority * ????(PriorityConstant.INFO??) * @param monitor * ??MonitorInfo * @param facilityId * ???ID * @param facilityPath * ID?? * @param msg * ??? * @param msgOrig * ??? * @param pluginID * PluginID * @throws HinemosUnknown * ?????? * @throws CustomInvalid * ?????? */ protected void notify(int priority, MonitorInfo monitor, String facilityId, String facilityPath, String subKey, String msg, String msgOrig, String pluginID) throws HinemosUnknown, CustomInvalid { // Local Variable OutputBasicInfo notifyInfo = null; notifyInfo = new OutputBasicInfo(); notifyInfo.setMonitorId(monitor.getMonitorId()); notifyInfo.setPluginId(pluginID); // ?????????? notifyInfo.setSubKey(subKey == null ? "" : subKey); notifyInfo.setPriority(priority); notifyInfo.setApplication(monitor.getApplication()); notifyInfo.setFacilityId(facilityId); notifyInfo.setScopeText(facilityPath); notifyInfo.setGenerationDate(result.getCollectDate()); notifyInfo.setMessage(msg); notifyInfo.setMessageOrg(msgOrig); try { // ? new NotifyControllerBean().notify(notifyInfo, NotifyGroupIdGenerator.generate(monitor)); } catch (Exception e) { m_log.warn("notify() : " + e.getClass().getSimpleName() + ", " + e.getMessage(), e); throw new HinemosUnknown("unexpected internal failure occurred. [" + result + "]", e); } } /** * ??? * * @return ?? */ public List<MonitorJobEndNode> getMonitorJobEndNodeList() { return this.monitorJobEndNodeList; } }