@Override public String toString() { return getServer() + ": " + getPlugins(); } }
public synchronized List<String> getPluginNames() { Set<String> names = new HashSet<String>(); for (PluginSet pSet : getPlugins()) { for (PluginDescriptor p : pSet.getPlugins()) { names.add(p.getName()); } } List<String> pluginNames = new ArrayList<String>(names); sort(pluginNames); return pluginNames; }
@Override public boolean equals(Object obj) { if (obj == null) return false; if (this == obj) return true; if (getClass() != obj.getClass()) return false; PluginSet other = (PluginSet) obj; return ObjectUtil.typedEquals(getServer(), other.getServer()) && ListUtil.compareCollections(getPlugins(), other.getPlugins()) ; }
public synchronized List<PluginDescriptor> getPluginsFor(ServerResource server) { if (server.equals(me)) { return new ArrayList<PluginDescriptor>(dashPlugins.getPlugins()); } ActiveAgent agent = agentRepo.getActiveAgentMap().get(server); if (agent == null) { return Collections.emptyList(); } InsightAgentRuntimeState state = agent.getConfig(); if (state == null) { return Collections.emptyList(); } return new ArrayList<PluginDescriptor>(state.getPlugins()); }
@Override public int hashCode() { // do not use plugins hash code since it may vary according to order of plugins rather than content return ObjectUtil.hashCode(getServer()) + ListUtil.size(getPlugins()) ; }
/** * @deprecated for backwards compatibility */ @Deprecated public synchronized void addPluginSet(PluginSet pluginSet) { ActiveAgent agent = agentRepo.getActiveAgentMap().get(pluginSet.getServer()); if (agent == null) { return; } InsightAgentRuntimeState pluginState = new InsightAgentRuntimeState(); for (PluginDescriptor p : pluginSet.getPlugins()) pluginState = pluginState.withPlugin(p); agent.updateConfig(pluginState); }