org.rhq.plugins.byteman.BytemanRuleDiscoveryComponent Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rhq-byteman-plugin Show documentation
Show all versions of rhq-byteman-plugin Show documentation
a plugin for managing VMs with a byteman agent installed
package org.rhq.plugins.byteman;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.jboss.byteman.agent.submit.Submit;
import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails;
import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent;
import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
public class BytemanRuleDiscoveryComponent implements ResourceDiscoveryComponent {
public Set discoverResources(ResourceDiscoveryContext context)
throws Exception {
Set details = new HashSet();
Submit client = context.getParentResourceComponent().getBytemanClient();
List rules = context.getParentResourceComponent().getRules();
if (rules != null && !rules.isEmpty()) {
for (String rule : rules) {
String ruleName = client.determineRuleName(rule);
details.add(new DiscoveredResourceDetails(context.getResourceType(), ruleName, ruleName, "unversioned",
"A rule defined in a Byteman script", null, null));
}
}
return details;
}
}