public Map<String, String> getRuntimeAttributes(InetAddress address) { return WmiPeerFactory.getInstance().getAgentConfig(address).toMap(); }
/** * Reload the config from the default config file * * @exception java.io.IOException * Thrown if the specified config file cannot be * read/loaded * @throws java.io.IOException * if any. */ public static void reload() throws IOException { init(); getInstance().update(); }
/** * Load the config from the default config file and create the singleton * instance of this factory. * * @exception java.io.IOException * Thrown if the specified config file cannot be read * @throws java.io.IOException * if any. */ public static synchronized void init() throws IOException { if (m_loaded) { // init already called - return // to reload, reload() will need to be called return; } WmiPeerFactory factory = new WmiPeerFactory(new FileSystemResource(ConfigFileConstants.getFile(ConfigFileConstants.WMI_CONFIG_FILE_NAME))); factory.afterPropertiesSet(); setInstance(factory); }
private void setWmiAgentConfig(WmiAgentConfig agentConfig, Definition def) { setCommonAttributes(agentConfig, def); agentConfig.setPassword(determinePassword(def)); }
/** * This is a helper method to set all the common attributes in the agentConfig. * * @param agentConfig * @param def */ private void setCommonAttributes(WmiAgentConfig agentConfig, Definition def) { agentConfig.setRetries(determineRetries(def)); agentConfig.setTimeout((int)determineTimeout(def)); agentConfig.setUsername(determineUsername(def)); agentConfig.setPassword(determinePassword(def)); agentConfig.setDomain(determineDomain(def)); }
private void initWMIPeerFactory() { LOG.debug("initialize: Initializing WmiPeerFactory"); try { WmiPeerFactory.init(); } catch (final IOException e) { LOG.error("initialize: Error reading configuration.", e); throw new UndeclaredThrowableException(e); } }
private void initWMIPeerFactory() { LOG.debug("initialize: Initializing WmiPeerFactory"); try { WmiPeerFactory.init(); } catch (final IOException e) { LOG.error("initialize: Error reading configuration.", e); throw new UndeclaredThrowableException(e); } }
public Map<String, String> getRuntimeAttributes(InetAddress address) { return WmiPeerFactory.getInstance().getAgentConfig(address).toMap(); }
@Override public Map<String, Object> getRuntimeAttributes(CollectionAgent agent, Map<String, Object> parameters) { final Map<String, Object> runtimeAttributes = new HashMap<>(); final String collectionName = ParameterMap.getKeyedString(parameters, "collection", ParameterMap.getKeyedString(parameters, "wmi-collection", null)); final WmiCollection collection = WmiDataCollectionConfigFactory.getInstance().getWmiCollection(collectionName); runtimeAttributes.put(WMI_COLLECTION_KEY, collection); final WmiAgentConfig agentConfig = WmiPeerFactory.getInstance().getAgentConfig(agent.getAddress()); runtimeAttributes.put(WMI_AGENT_CONFIG_KEY, agentConfig); return runtimeAttributes; }
@Override public Map<String, Object> getRuntimeAttributes(CollectionAgent agent, Map<String, Object> parameters) { final Map<String, Object> runtimeAttributes = new HashMap<>(); final String collectionName = ParameterMap.getKeyedString(parameters, "collection", ParameterMap.getKeyedString(parameters, "wmi-collection", null)); final WmiCollection collection = WmiDataCollectionConfigFactory.getInstance().getWmiCollection(collectionName); runtimeAttributes.put(WMI_COLLECTION_KEY, collection); final WmiAgentConfig agentConfig = WmiPeerFactory.getInstance().getAgentConfig(agent.getAddress()); runtimeAttributes.put(WMI_AGENT_CONFIG_KEY, agentConfig); return runtimeAttributes; }
final InetAddress ipAddr = svc.getAddress(); final WmiAgentConfig agentConfig = WmiPeerFactory.getInstance().getAgentConfig(ipAddr); String matchType = DEFAULT_WMI_MATCH_TYPE; String compVal = DEFAULT_WMI_COMP_VAL;
final InetAddress ipAddr = svc.getAddress(); final WmiAgentConfig agentConfig = WmiPeerFactory.getInstance().getAgentConfig(ipAddr); String matchType = DEFAULT_WMI_MATCH_TYPE; String compVal = DEFAULT_WMI_COMP_VAL;