* @see org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent#discoverResources(org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext)
*/
public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext<OneWireAdapterComponent> context)
throws InvalidPluginConfigurationException, Exception {
DSPortAdapter adapter = context.getParentResourceComponent().getAdapter();
Set<DiscoveredResourceDetails> results = new HashSet<DiscoveredResourceDetails>();
OneWireContainer cont = adapter.getFirstDeviceContainer();
while (cont != null) {
if (cont instanceof OneWireContainer10) {
String descr = cont.getDescription();
if (descr.length() > 50) { // Shorten. The device can have a really long description
int pos = descr.indexOf(".");
if (pos > 0) {
descr = descr.substring(0, pos);
descr += "...";
}
}
DiscoveredResourceDetails detail = new DiscoveredResourceDetails(context.getResourceType(), // Resource type
cont.getAddressAsString(), // unique address from device
cont.getName(), // the typ of device
"", // version
descr, // description
context.getDefaultPluginConfiguration(), // plugin config
null); // no physical info
results.add(detail);
}
cont = adapter.getNextDeviceContainer();
}
return results;
}