@Override public void run() { StringBuilder sb = new StringBuilder("\nWaveformStartTask run:"); try { waveformProviders = new WaveformModuleProvider[systems.length]; waveformObjects = new DOFObject[systems.length]; for (int i = 0; i < systems.length; i++) { SystemConfig systemConfig = nodeConfig.getSystemConfig(fdn, systems[i]); if (systemConfig == null) log.error("Invalid ccsc fdn: " + fdn + " and/or system name: " + systems[i]); else { DOFSystem system = systemConfig.getSystem(); String creds = systemConfig.credentials.toString(); waveformProviders[i] = new WaveformModuleProvider(serviceOids[i], creds); waveformObjects[i] = system.createObject(DOFObjectID.create(serviceOids[i])); waveformProviders[i].beginProvider(waveformObjects[i]); } } statusTracker.setStatus(moduleName, Status.Ok); node.setModuleStatus(WaveformModule.this, ModuleStatus.Started); log.debug(sb.toString()); } catch (Exception e) { log.debug(sb.toString()); log.error("\n" + getClass().getName() + " failed to start", e); node.setModuleStatus(WaveformModule.this, ModuleStatus.Failed); } }
/* ************************************************************************* * Module implementation **************************************************************************/ @Override public void init(Configuration config) throws Exception { String msg = "ok"; try { nodeConfig = (NodeConfig) config; nodeConfig.tabLevel.set(3); nodeConfig.sb.append("\n"); nodeConfig.toSb(getClass().getName(), " init:"); nodeConfig.tabLevel.incrementAndGet(); List<Entry<String, String>> list = NodeConfiguration.getPropertiesForBaseKey(PropertyFileNameKey, nodeConfig.properties); Entry<String, String> entry = list.get(index); String value = entry.getValue(); nodeConfig.toSb(entry.getKey(), "=", value); NodeConfiguration.loadProperties(nodeConfig, value); fdn = nodeConfig.properties.getProperty(NodeConfiguration.FdnKey); nodeConfig.toSb(NodeConfiguration.FdnKey, "=", fdn); String systemNames = nodeConfig.properties.getProperty(SystemNameKey); nodeConfig.toSb(SystemNameKey, "=", systemNames); systems = systemNames.split(" "); String services = nodeConfig.properties.getProperty(ServiceIdKey); nodeConfig.toSb(ServiceIdKey, "=", services); String[] serviceIds = services.split(" "); serviceOids = new DOFObjectID[serviceIds.length]; int i = 0; for (String sid : serviceIds) { msg = "invalid service oid: " + sid; serviceOids[i++] = DOFObjectID.create(sid); } nodeConfig.properties.remove(PropertyFileNameKey); nodeConfig.properties.remove(ServiceIdKey); nodeConfig.properties.remove(SystemNameKey); nodeConfig.properties.remove(NodeConfiguration.FdnKey); } catch (Exception e) { nodeConfig.toSb(msg); log.error(nodeConfig.sb.toString(), e); throw e; } }