protected long getDeviceStats(String USN, String stat_key) { String key = "upnp.device.stats." + stat_key; PluginConfig pc = plugin_interface.getPluginconfig(); Map counts = pc.getPluginMapParameter(key, new HashMap()); Long count = (Long) counts.get(USN); if (count == null) { return (0); } return (count.longValue()); }
protected long incrementDeviceStats(String USN, String stat_key) { String key = "upnp.device.stats." + stat_key; PluginConfig pc = plugin_interface.getPluginconfig(); Map counts = pc.getPluginMapParameter(key, new HashMap()); Long count = (Long) counts.get(USN); if (count == null) { count = new Long(1); } else { count = new Long(count.longValue() + 1); } counts.put(USN, count); pc.getPluginMapParameter(key, counts); return (count.longValue()); }