// See how many agentProps there are with ResourceID
// For each one, create a DiskResource and register it
int discoveredCount = 0;
for ( int i = 0; i < agentProps.length; i++ )
{
DiscoveryAgentProperty agentProp = agentProps[i];
if ( agentProp.getId( ).equals( "ResourceID" ) )
{
DiskWsdmServiceWSResource resource = null;
try
{
String resourceId = agentProp.getValue( );
resource = new DiskWsdmServiceWSResource( resourceId );
resource.getPropertiesManager( ).setReadOnly( ExampleConstants.RESOURCE_PROP_QNAME_CAPACITY, true );
discoveredCount++;
}
catch ( Throwable t )
{
LOG.error( "Discovery failed for DiskWsdmServiceWSResource with Id " + agentProp.getId( ), t );
continue;
}
LOG.info( "Attempting to register an instance of DiskWsdmServiceWSResource ResourceID="
+ agentProp.getValue( ) );
try
{
registrationManager.register( resource );
}
catch ( RegistrationFailureException rfe )
{
LOG.error( "Discovery failed to register " + agentProp.getId( ), rfe );
}
}
}
//Just for conveniance, if nothing was discovered, write that to the log.