Java tutorial
/* Copyright (C) 2006 NTT DATA Corporation 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.performance.monitor.factory; import java.text.NumberFormat; import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import com.clustercontrol.bean.HinemosModuleConstant; import com.clustercontrol.collect.bean.Sample; import com.clustercontrol.collect.util.CollectDataUtil; import com.clustercontrol.commons.util.ObjectSharingService; import com.clustercontrol.fault.FacilityNotFound; import com.clustercontrol.fault.HinemosUnknown; import com.clustercontrol.fault.InvalidRole; import com.clustercontrol.fault.MonitorNotFound; import com.clustercontrol.monitor.run.bean.MonitorRunResultInfo; import com.clustercontrol.monitor.run.factory.RunMonitor; import com.clustercontrol.monitor.run.factory.RunMonitorNumericValueType; import com.clustercontrol.monitor.run.model.MonitorInfo; import com.clustercontrol.monitor.run.util.NodeToMonitorCache; import com.clustercontrol.notify.bean.OutputBasicInfo; import com.clustercontrol.notify.model.NotifyRelationInfo; import com.clustercontrol.notify.session.NotifyControllerBean; import com.clustercontrol.performance.bean.CollectedDataErrorTypeConstant; import com.clustercontrol.performance.bean.CollectorItemInfo; import com.clustercontrol.performance.monitor.model.PerfCheckInfo; import com.clustercontrol.performance.monitor.util.PerfDataQueue; import com.clustercontrol.performance.monitor.util.QueryUtil; import com.clustercontrol.performance.operator.Operator; import com.clustercontrol.performance.operator.Operator.CollectedDataNotFoundException; import com.clustercontrol.performance.util.CalculationMethod; import com.clustercontrol.performance.util.PollingDataManager; import com.clustercontrol.performance.util.code.CollectorItemCodeTable; import com.clustercontrol.poller.IPoller; import com.clustercontrol.poller.bean.PollerProtocolConstant; import com.clustercontrol.poller.impl.Snmp4jPollerImpl; import com.clustercontrol.poller.impl.WbemPollerImpl; import com.clustercontrol.poller.util.DataTable; import com.clustercontrol.repository.model.NodeDeviceInfo; import com.clustercontrol.repository.model.NodeInfo; import com.clustercontrol.repository.session.RepositoryControllerBean; import com.clustercontrol.util.HinemosTime; import com.clustercontrol.util.MessageConstant; /** * ? * * @version 4.0.0 * @since 2.0.0 */ public class RunMonitorPerformance extends RunMonitorNumericValueType { private static Log m_log = LogFactory.getLog(RunMonitorPerformance.class); /** */ private PerfCheckInfo m_perf = null; /** ??? */ private String m_itemName = null; /** ? */ private NodeDeviceInfo m_deviceData = null; /** */ private String m_errorMessage = null; /** * * */ public RunMonitorPerformance() { super(); } /** * ???CallableTask??????? * * @see com.clustercontrol.monitor.run.factory.RunMonitor#runMonitorInfo() * @see com.clustercontrol.monitor.run.util.MonitorExecuteTask */ @Override protected RunMonitor createMonitorInstance() { return new RunMonitorPerformance(); } /** * @see runMonitorAggregateByNode */ protected boolean runMonitorInfo() throws FacilityNotFound, MonitorNotFound, InvalidRole, HinemosUnknown { // ??????????????????????? // runMonitorInfo ????? runMonitorInfoAggregatedByNode ???? throw new UnsupportedOperationException(); } /** * ?SNMP?????????? * ??RunMonitor??? * @throws HinemosUnknown * @throws FacilityNotFound */ @Override protected Object preCollect(Set<Integer> execMonitorIntervals) throws HinemosUnknown, FacilityNotFound { final RepositoryControllerBean repository = new RepositoryControllerBean(); NodeInfo node = null; try { node = repository.getNode(m_facilityId); } catch (FacilityNotFound | HinemosUnknown e) { m_log.warn("preCollect() : failed to execute repository.getNode(). facilityId = " + m_facilityId, e); return null; } if (!m_isMonitorJob) { // ??????????SNMP?OID?? final Map<String, Set<String>> target = getPollingTarget(execMonitorIntervals); // ???????????allResponse??????? final Map<String, DataTable> allResponse = new HashMap<>(); for (final Map.Entry<String, Set<String>> targetEntry : target.entrySet()) { final String collectMethod = targetEntry.getKey(); switch (collectMethod) { case PollerProtocolConstant.PROTOCOL_SNMP: { final DataTable snmpResponse = Snmp4jPollerImpl.getInstance().polling( node.getAvailableIpAddress(), node.getSnmpPort(), node.getSnmpVersion(), node.getSnmpCommunity(), node.getSnmpRetryCount(), node.getSnmpTimeout(), targetEntry.getValue(), node.getSnmpSecurityLevel(), node.getSnmpUser(), node.getSnmpAuthPassword(), node.getSnmpPrivPassword(), node.getSnmpAuthProtocol(), node.getSnmpPrivProtocol()); allResponse.put(PollerProtocolConstant.PROTOCOL_SNMP, snmpResponse); break; } case PollerProtocolConstant.PROTOCOL_WBEM: { // WBEM??????? WbemPollerImpl poller = new WbemPollerImpl(); DataTable wbemResponse = poller.polling(node.getAvailableIpAddress(), node.getWbemPort(), node.getWbemProtocol(), node.getWbemUser(), node.getWbemUserPassword(), node.getWbemNameSpace(), node.getWbemRetryCount(), node.getWbemTimeout(), targetEntry.getValue()); allResponse.put(PollerProtocolConstant.PROTOCOL_WBEM, wbemResponse); break; } default: { // ***************************** // ?poller? // pollingTargetMap?KEY?? // SNMP SNMP?(?) // WBEM WBEM?(?) // VM. VM?(VmPollerImplInterface) (ex. VM.XEN) // CLOUD. ?(ICloudPoller) (ex. CLOUD.AWS) // ***************************** //// // ????? // IPoller??????????????ObjectSharingService? // ???????????? // ??JAR??Plugin??????? // 20138??VM?2???? //// IPoller poller; try { poller = ObjectSharingService.objectRegistry().get(IPoller.class, collectMethod); } catch (InstantiationException | IllegalAccessException e) { m_log.warn( String.format("polling() : %s, %s", e.getClass().getSimpleName(), e.getMessage()), e); continue; } if (poller == null) { m_log.warn("polling : unknown pollerProtocol. facilityId = " + node.getFacilityId() + ", protocol = " + collectMethod); continue; } // ?????????? // ?????nodeinfo?pollingTarget?????? // 3?Object??????? // ???????pollerProtocol??????? // ????????????????????????? final DataTable pluginResponse = poller.polling(node, targetEntry.getValue(), null); allResponse.put(collectMethod, pluginResponse); } } } // ???? final Map<Integer, Map<String, Set<String>>> pollingTarget = new HashMap<>(); for (final int interval : execMonitorIntervals) { // TODO ????????????????????? // TODO ???????????????????????????????? pollingTarget.put(interval, getPollingTarget(Collections.singleton(interval))); } PerfDataQueue.getInstance(m_facilityId).pushNewData(pollingTarget, allResponse); return null; } else { // ???SNMP?OID?? final Map<String, Set<String>> target = getPollingTarget(null); // ???????? if (target.containsKey(PollerProtocolConstant.PROTOCOL_SNMP)) { m_curData = Snmp4jPollerImpl.getInstance().polling(node.getAvailableIpAddress(), node.getSnmpPort(), node.getSnmpVersion(), node.getSnmpCommunity(), node.getSnmpRetryCount(), node.getSnmpTimeout(), target.get(PollerProtocolConstant.PROTOCOL_SNMP), node.getSnmpSecurityLevel(), node.getSnmpUser(), node.getSnmpAuthPassword(), node.getSnmpPrivPassword(), node.getSnmpAuthProtocol(), node.getSnmpPrivProtocol()); } else if (target.containsKey(PollerProtocolConstant.PROTOCOL_WBEM)) { // WBEM??????? WbemPollerImpl poller = new WbemPollerImpl(); m_curData = poller.polling(node.getAvailableIpAddress(), node.getWbemPort(), node.getWbemProtocol(), node.getWbemUser(), node.getWbemUserPassword(), node.getWbemNameSpace(), node.getWbemRetryCount(), node.getWbemTimeout(), target.get(PollerProtocolConstant.PROTOCOL_WBEM)); } else { // ***************************** // ?poller? // pollingTargetMap?KEY?? // SNMP SNMP?(?) // WBEM WBEM?(?) // VM. VM?(VmPollerImplInterface) (ex. VM.XEN) // CLOUD. ?(ICloudPoller) (ex. CLOUD.AWS) // ***************************** //// // ????? // IPoller??????????????ObjectSharingService? // ???????????? // ??JAR??Plugin??????? // 20138??VM?2???? //// IPoller poller = null; Map.Entry<String, Set<String>> matchedEntry = null; for (final Map.Entry<String, Set<String>> targetEntry : target.entrySet()) { try { poller = ObjectSharingService.objectRegistry().get(IPoller.class, targetEntry.getKey()); if (poller != null) { matchedEntry = targetEntry; break; } } catch (InstantiationException | IllegalAccessException e) { m_log.warn( String.format("polling() : %s, %s", e.getClass().getSimpleName(), e.getMessage()), e); } } if (poller != null) { // ?????????? // ?????nodeinfo?pollingTarget?????? // 3?Object??????? // ???????pollerProtocol??????? // ????????????????????????? m_curData = poller.polling(node, matchedEntry.getValue(), null); } else { m_log.debug("polling() : not found plugin poller."); } } return null; } } @Override protected void checkMultiMonitorInfoData(final Object preCollectData, final List<RunMonitor> runMonitorList) { List<Sample> sampleList = new ArrayList<Sample>(); /** * ???? * pre????????????????????? * ??????????????? */ for (final RunMonitor runMonitor : runMonitorList) { final List<MonitorRunResultInfo> resultNotifyList = new ArrayList<>(); final RunMonitorPerformance runMonitorPerf = (RunMonitorPerformance) runMonitor; List<MonitorRunResultInfo> resultList; try { resultList = runMonitorPerf.collectList(); } catch (FacilityNotFound e) { // TODO nagatsumas ?INTERNAL?? return; } Sample sample = null; if (runMonitorPerf.getMonitorInfo().getCollectorFlg().booleanValue()) { sample = new Sample(HinemosTime.getDateInstance(), runMonitor.getMonitorInfo().getMonitorId()); } // 1????????????????? for (MonitorRunResultInfo result : resultList) { m_nodeDate = result.getNodeDate(); // ????? if (m_isMonitorJob || result.getMonitorFlg()) { resultNotifyList.add(result); } // ??????? if (sample != null) { if (result.getCollectorFlg()) { int errorCode = 0; if (result.isCollectorResult()) { errorCode = CollectedDataErrorTypeConstant.NOT_ERROR; } else { errorCode = CollectedDataErrorTypeConstant.UNKNOWN; } sample.set(m_facilityId, result.getItemName(), result.getValue(), errorCode, result.getDisplayName()); } } } // ??????????? if (!m_isMonitorJob) { notify(runMonitor.getMonitorInfo(), m_facilityId, resultNotifyList); } else { m_monitorRunResultInfo = new MonitorRunResultInfo(); m_monitorRunResultInfo.setNodeDate(m_nodeDate); m_monitorRunResultInfo.setCurData(m_curData); if (resultNotifyList != null && resultNotifyList.size() > 0) { m_monitorRunResultInfo.setPriority(resultNotifyList.get(0).getPriority()); m_monitorRunResultInfo.setMessageOrg(makeJobOrgMessage(resultNotifyList.get(0).getMessageOrg(), resultNotifyList.get(0).getMessage())); } } if (sample != null) { sampleList.add(sample); } } if (!sampleList.isEmpty()) { CollectDataUtil.put(sampleList); } } /** * ???collect???collectList???? */ @Override public boolean collect(String facilityId) { throw new UnsupportedOperationException(); } /** * preCollect??????????????????? * @throws FacilityNotFound */ public List<MonitorRunResultInfo> collectList() throws FacilityNotFound { m_log.debug("collectList() monitorTypeId = " + m_monitorTypeId + ",monitorId = " + m_monitorId + ", facilityId = " + m_facilityId); //// // ?ItemCodeList/deviceType/deviceList? //// boolean breakdownFlg = m_perf.getBreakdownFlg(); final PollingDataManager dataManager = new PollingDataManager(m_facilityId, m_perf.getItemCode(), breakdownFlg); final List<String> itemCodeList = dataManager.getItemCodeList(); final List<? extends NodeDeviceInfo> deviceList = dataManager.getDeviceList(); final List<MonitorRunResultInfo> resultList = new ArrayList<>(); final String facilityName = dataManager.getFacilityName(); final String platform = dataManager.getPlatformId(); final String subPlatform = dataManager.getSubPlatformId(); for (String itemCode : itemCodeList) { // ?displayName?ALL??????????? if (m_perf.getDeviceDisplayName() != null && (PollingDataManager.ALL_DEVICE_NAME).equals(m_perf.getDeviceDisplayName())) { for (final NodeDeviceInfo deviceInfo : deviceList) { m_deviceData = deviceInfo; final MonitorRunResultInfo result = calcValue(facilityName, platform, subPlatform, itemCode, deviceInfo.getDeviceName()); if (result != null) { resultList.add(result); } } } // ?displayName??????????? else if (m_perf.getDeviceDisplayName().length() > 0) { for (NodeDeviceInfo deviceInfo : deviceList) { if (m_perf.getDeviceDisplayName().equals(deviceInfo.getDeviceDisplayName())) { m_deviceData = deviceInfo; final MonitorRunResultInfo result = calcValue(facilityName, platform, subPlatform, itemCode, deviceInfo.getDeviceName()); if (result != null) { resultList.add(result); } break; } } } // ????? else { m_deviceData = null; final MonitorRunResultInfo result = calcValue(facilityName, platform, subPlatform, itemCode, ""); if (result != null) { resultList.add(result); } } } return resultList; } /** * * @param facilityName * @param platform * @param subPlatform * @param itemCode * @param deviceName * @return ???MonitorRunResultInfo??Queue???????????null? */ private MonitorRunResultInfo calcValue(String facilityName, String platform, String subPlatform, String itemCode, String deviceName) { m_log.debug("calcEachValue() monitorId = " + m_monitorId + ", itemCode = " + itemCode + " , displayName = " + deviceName); final MonitorRunResultInfo result = new MonitorRunResultInfo(); result.setFacilityId(m_facilityId); final CollectorItemInfo itemInfo = new CollectorItemInfo(m_monitorId, itemCode, deviceName); m_itemName = CollectorItemCodeTable.getFullItemName(itemInfo.getItemCode(), itemInfo.getDisplayName()); DataTable curTable = null; DataTable prvTable = null; if (!m_isMonitorJob) { curTable = PerfDataQueue.getInstance(m_facilityId).getCurrentData(getMonitorInfo().getRunInterval()); prvTable = PerfDataQueue.getInstance(m_facilityId).getPrevData(getMonitorInfo().getRunInterval()); } else { curTable = (DataTable) m_curData; prvTable = (DataTable) m_prvData; } if (curTable == null || curTable.keySet().size() == 0 || prvTable == null || prvTable.keySet().size() == 0) { // DataTalbe2???????????null???? m_log.info("calcValue() : polling have not done enough count."); return null; } boolean ret; try { m_value = CalculationMethod.getPerformance(platform, subPlatform, itemInfo, deviceName, curTable, prvTable); ret = true; } catch (CollectedDataNotFoundException | IllegalStateException | Operator.InvalidValueException e) { m_value = Double.NaN; m_errorMessage = e.getMessage(); } catch (Exception e) { m_log.warn("getPerformance() : " + e.getClass().getSimpleName() + ", " + e.getMessage(), e); // ?NaN?? m_value = Double.NaN; m_errorMessage = e.getMessage(); } if (!Double.isNaN(m_value)) { ret = true; } else { ret = false; } result.setValue(m_value); result.setCollectorResult(ret); int checkResult = getCheckResult(ret); if (m_perf.getItemCode().equals(itemInfo.getItemCode())) { result.setMonitorFlg(true); } else { result.setMonitorFlg(false); } result.setCollectorFlg(true); if (m_now != null) { result.setNodeDate(m_now.getTime()); } result.setMessage(getMessage(checkResult)); result.setMessageOrg(getMessageOrg(checkResult)); result.setPriority(checkResult); result.setNotifyGroupId(getNotifyGroupId()); result.setItemCode(itemInfo.getItemCode()); result.setItemName(m_itemName); result.setDisplayName(itemInfo.getDisplayName()); return result; } /** * ????????????????? * @param intervalSecSet ?Set * @return ??SNMPWBEM??SNMP???OID?Set * @throws HinemosUnknown * @throws FacilityNotFound */ public Map<String, Set<String>> getPollingTarget(final Set<Integer> intervalSecSet) throws HinemosUnknown, FacilityNotFound { final Map<String, Set<String>> returnMap = new HashMap<>(); Set<MonitorInfo> currentAllMonitor = new HashSet<>(); if (!m_isMonitorJob) { final NodeToMonitorCache node2monitor = NodeToMonitorCache .getInstance(HinemosModuleConstant.MONITOR_PERFORMANCE); final Map<Integer, Set<MonitorInfo>> currentMonitors = node2monitor .getMonitorsWithCalendar(m_facilityId, intervalSecSet); for (final Set<MonitorInfo> monitors : currentMonitors.values()) { currentAllMonitor.addAll(monitors); } } else { currentAllMonitor.add(m_monitor); } for (final MonitorInfo monitor : currentAllMonitor) { final PerfCheckInfo perfCheckInfo = monitor.getPerfCheckInfo(); final PollingDataManager dataManager = new PollingDataManager(m_facilityId, perfCheckInfo.getItemCode(), perfCheckInfo.getBreakdownFlg()); // ?????? final String collectMethod = dataManager.getCollectMethod(); Set<String> target = returnMap.get(collectMethod); if (target == null) { target = new HashSet<String>(); returnMap.put(collectMethod, target); } for (String pollingTarget : dataManager.getPollingTargets()) { if (pollingTarget != null && !pollingTarget.equals("")) { target.add(pollingTarget); } } } return returnMap; } private static void notify(MonitorInfo monitorInfo, String facilityId, List<MonitorRunResultInfo> notifyResultList) { if (monitorInfo.getMonitorFlg().booleanValue() == false) { return; } // ID??????????? List<NotifyRelationInfo> notifyRelationList = monitorInfo.getNotifyRelationList(); if (notifyRelationList == null || notifyRelationList.size() == 0) { return; } ArrayList<OutputBasicInfo> outputBasicInfoList = new ArrayList<OutputBasicInfo>(notifyResultList.size()); for (MonitorRunResultInfo resultInfo : notifyResultList) { // OutputBasicInfo outputBasicInfo = new OutputBasicInfo(); outputBasicInfo.setPluginId(monitorInfo.getMonitorTypeId()); outputBasicInfo.setMonitorId(monitorInfo.getMonitorId()); outputBasicInfo.setApplication(monitorInfo.getApplication()); // ? if (resultInfo.getDisplayName() != null && !"".equals(resultInfo.getDisplayName())) { // ??????????????? outputBasicInfo.setSubKey(resultInfo.getDisplayName()); } outputBasicInfo.setFacilityId(facilityId); outputBasicInfo.setScopeText(facilityId); outputBasicInfo.setPriority(resultInfo.getPriority()); outputBasicInfo.setMessage(resultInfo.getMessage()); outputBasicInfo.setMessageOrg(resultInfo.getMessageOrg()); outputBasicInfo.setGenerationDate(resultInfo.getNodeDate()); outputBasicInfoList.add(outputBasicInfo); } new NotifyControllerBean().notify(outputBasicInfoList, monitorInfo.getNotifyGroupId()); } /** * */ @Override protected void notify(boolean isNode, String facilityId, int result, Date generationDate, MonitorRunResultInfo resultInfo) throws HinemosUnknown { // for debug if (m_log.isDebugEnabled()) { m_log.debug("notify() isNode = " + isNode + ", facilityId = " + facilityId + ", result = " + result + ", generationDate = " + generationDate.toString() + ", resultInfo = " + resultInfo.getMessage()); } // ?????? if (!m_monitor.getMonitorFlg()) { m_log.debug("notify() isNode = " + isNode + ", facilityId = " + facilityId + ", result = " + result + ", generationDate = " + generationDate.toString() + ", resultInfo = " + resultInfo.getMessage() + ", monitorFlg is false"); return; } // ID??????????? String notifyGroupId = resultInfo.getNotifyGroupId(); if (notifyGroupId == null || "".equals(notifyGroupId)) { return; } // OutputBasicInfo notifyInfo = new OutputBasicInfo(); notifyInfo.setPluginId(m_monitorTypeId); notifyInfo.setMonitorId(m_monitorId); notifyInfo.setApplication(m_monitor.getApplication()); // ? if (resultInfo.getDisplayName() != null && !"".equals(resultInfo.getDisplayName())) { // ??????????????? notifyInfo.setSubKey(resultInfo.getDisplayName()); } String facilityPath = new RepositoryControllerBean().getFacilityPath(facilityId, null); notifyInfo.setFacilityId(facilityId); notifyInfo.setScopeText(facilityPath); int priority = resultInfo.getPriority(); String message = resultInfo.getMessage(); String messageOrg = resultInfo.getMessageOrg(); notifyInfo.setPriority(priority); notifyInfo.setMessage(message); notifyInfo.setMessageOrg(messageOrg); if (generationDate == null) { notifyInfo.setGenerationDate(null); } else { notifyInfo.setGenerationDate(generationDate.getTime()); } // for debug if (m_log.isDebugEnabled()) { m_log.debug("notify() priority = " + priority + " , message = " + message + " , messageOrg = " + messageOrg + ", generationDate = " + generationDate); } // ? if (m_log.isDebugEnabled()) { m_log.debug("sending message" + " : priority=" + notifyInfo.getPriority() + " generationDate=" + notifyInfo.getGenerationDate() + " pluginId=" + notifyInfo.getPluginId() + " monitorId=" + notifyInfo.getMonitorId() + " facilityId=" + notifyInfo.getFacilityId() + " subKey=" + notifyInfo.getSubKey() + ")"); } new NotifyControllerBean().notify(notifyInfo, notifyGroupId); } /** * ??? * @see com.clustercontrol.monitor.run.factory.OperationNumericValueInfo#setMonitorAdditionInfo() */ @Override protected void setCheckInfo() throws MonitorNotFound { // ?? if (!m_isMonitorJob) { m_perf = QueryUtil.getMonitorPerfInfoPK(m_monitorId); } else { m_perf = QueryUtil.getMonitorPerfInfoPK(m_monitor.getMonitorId()); } } /** * ???? */ @Override public String getMessage(int result) { String valueString; if (Double.isNaN(m_value)) { valueString = MessageConstant.MESSAGE_COULD_NOT_GET_VALUE_PERFORMANCE.getMessage(); } else { valueString = NumberFormat.getNumberInstance().format(m_value); } return m_itemName + " : " + valueString; } /** * ???? */ @Override protected String getMessageForScope(int result) { String valueString; if (Double.isNaN(m_value)) { valueString = MessageConstant.TIME_OUT.getMessage(); } else { valueString = NumberFormat.getNumberInstance().format(m_value); } return m_itemName + " : " + valueString; } /** * ???? */ @Override public String getMessageOrg(int result) { String valueString; if (Double.isNaN(m_value)) { valueString = "NaN"; if (m_errorMessage != null) { valueString = valueString + "\n" + m_errorMessage; } } else { valueString = NumberFormat.getNumberInstance().format(m_value); m_log.debug("RunMonitorPerf messageOrg : " + valueString); // ? if (m_deviceData != null) { valueString = valueString + "\n" + MessageConstant.DEVICE_NAME.getMessage() + " : " + m_deviceData.getDeviceName() + "\n" + MessageConstant.DEVICE_INDEX.getMessage() + " : " + m_deviceData.getDeviceIndex(); m_log.debug("RunMonitorPerf add DeviceInfo : " + valueString); } } return m_itemName + " : " + valueString; } /** * ???? */ @Override protected String getMessageOrgForScope(int result) { String valueString; if (Double.isNaN(m_value)) { valueString = "NaN"; } else { valueString = NumberFormat.getNumberInstance().format(m_value); } return m_itemName + " : " + valueString; } @Override protected String makeJobOrgMessage(String orgMsg, String msg) { String[] args = { m_itemName }; return MessageConstant.MESSAGE_JOB_MONITOR_ORGMSG_PERFORMANCE.getMessage(args) + "\n" + msg; } // @Override // protected boolean setMonitorInfo(String monitorTypeId, String monitorId) throws MonitorNotFound, HinemosUnknown{ // boolean ret = super.setMonitorInfo(monitorTypeId, monitorId); // // // ???????? // if(!m_isInCalendarTerm && m_isInNextCalendarTerm){ // try{ // RepositoryControllerBean repository = new RepositoryControllerBean(); // if(m_perf == null){ // setCheckInfo(); // } // // ModifyPollingSchedule schedule = new ModifyPollingSchedule(); // if(repository.isNode(m_facilityId)){ // // ?? // m_log.info("pre-schedule : monitorId = " + m_monitorId + ", facilityId = " + m_facilityId); // schedule.addNodeSchedule(m_facilityId, m_monitorId, m_monitor.getMonitorTypeId(), m_monitor.getRunInterval(), m_perf); // } // else{ // // ?? // ArrayList<String> facilityList = repository.getExecTargetFacilityIdList(m_facilityId, m_monitor.getOwnerRoleId()); // if (facilityList.size() == 0) { // m_log.info("pre-schedule : monitorId = " + m_monitorId + ", facilityId is null"); // return true; // } // // for (String facilityId : facilityList) { // m_log.info("pre-schedule : monitorId = " + m_monitorId + ", facilityId = " + facilityId); // schedule.addNodeSchedule(facilityId, m_monitorId, m_monitor.getMonitorTypeId(), m_monitor.getRunInterval(), m_perf); // } // } // // } catch (FacilityNotFound e) { // m_log.warn("setMonitorInfo() : fail to addSchedule . m_monitorId = " + m_monitorId, e); // } catch (InvalidRole e) { // m_log.warn("setMonitorInfo() : fail to addSchedule . m_monitorId = " + m_monitorId, e); // } // } // // return ret; // } }