All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.rhq.plugins.byteman.BytemanRuleDiscoveryComponent Maven / Gradle / Ivy

There is a newer version: 4.13.0
Show newest version
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;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy