
org.rhq.plugins.byteman.BytemanScriptDiscoveryComponent 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
The newest version!
package org.rhq.plugins.byteman;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails;
import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent;
import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
public class BytemanScriptDiscoveryComponent implements ResourceDiscoveryComponent {
public Set discoverResources(ResourceDiscoveryContext context)
throws Exception {
Set details = new HashSet();
Map allScripts = context.getParentResourceComponent().getAllKnownScripts();
if (allScripts != null && !allScripts.isEmpty()) {
for (String scriptName : allScripts.keySet()) {
int startShortName = scriptName.lastIndexOf("\\");
if (startShortName == -1) {
startShortName = scriptName.lastIndexOf("/");
}
String shortScriptName = scriptName.substring(startShortName + 1); // script names never end with \ or /, so this is OK
details.add(new DiscoveredResourceDetails(context.getResourceType(), scriptName, shortScriptName,
"unversioned", "A script with Byteman rules", null, null));
}
}
return details;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy