/** Call EMC connect service API to generate event files */ public void callEMCHome() { try { if (licenseInfo == null) { _log.warn("License information cannot be null. Returning without sending event."); return; } synchronized (SendEvent.class) { _log.info("callEMCHome(): start "); _fileId = licenseInfo.getProductId(); // Construct main connect home object that holds the Alert file. EmaApiConnectHome alertFile = new EmaApiConnectHome(); // Setup the logging information EmaApiLogType log = new EmaApiLogType(); log.setLogToDirectory(LOG_PATH); log.setLogToFilename(LOG_FILE_NAME + _fileId + ".log"); // build the common identifier section. buildIdentifierSection(alertFile); // build the common identifier section. buildConnectionSection(alertFile); // build the event section buildAlertFile(alertFile, log); _log.info("callEMCHome(): end "); } } catch (APIException api) { throw api; } catch (Exception e) { _log.error("Error occurred while sending event. {}", e); throw APIException.internalServerErrors.sendEventError(e.getMessage()); } }
/** Builds the Identifier element of ConnectHome */ private void buildIdentifierSection(EmaApiConnectHome alertFile) throws EmaException { EmaApiIdentifierType identifier = new EmaApiIdentifierType(); EmaApiNode node = alertFile.getNode(); identifier.setClarifyID(licenseInfo.getProductId()); identifier.setDeviceType(_identifierManager.findDeviceType()); identifier.setDeviceState(_identifierManager.findDeviceState()); identifier.setModel(licenseInfo.getModelId()); identifier.setOS(_identifierManager.findOS()); identifier.setOSVER(_identifierManager.findOSVersion()); identifier.setVendor("EMC"); identifier.setSiteName(""); identifier.setSerialNumber(licenseInfo.getProductId()); identifier.setUcodeVer(_identifierManager.findPlatform()); identifier.setWWN(licenseInfo.getLicenseTypeIndicator()); node.setIdentifier(identifier); overrideIdentifierData(identifier); }
/** * Build the Device object using the controller license information. * * @param feature * @param device * @throws LocalRepositoryException */ private void buildDevice(LicenseInfoExt licenseInfo, Device device) throws LocalRepositoryException { if (licenseInfo != null) { LocalRepository localRepository = LocalRepository.getInstance(); // this is in the format of node1, node2, etc. We need to get the integer portion. String nodeId = _coordinator.getPropertyInfo().getProperties().get("node_id"); String node; if (nodeId != null) { node = nodeId.substring(4); } else { node = CallHomeConstants.STANDALONE; } device.setSerialNumber(licenseInfo.getProductId() + "-" + node); device.setModelName(getBaseModelId(licenseInfo.getModelId()) + MODEL_NAME_SUFFIX); device.setIpAddress(_networkIpAddress); } }