* @param servers List of IService handles to reset
* @param monitor Progress Monitor used to interrupt the command if needed
*/
public static void reset( List<IService> servers, IProgressMonitor monitor ) {
IServiceFactory serviceFactory = CatalogPlugin.getDefault().getServiceFactory();
ICatalog catalog = CatalogPlugin.getDefault().getLocalCatalog();
for( IService original : servers ) {
try {
final ID id = original.getID();
CatalogUIPlugin.trace("Reset service " + original.getIdentifier()); //$NON-NLS-1$
Map<java.lang.String, java.io.Serializable>
connectionParams = original.getConnectionParams();
IService replacement = null; // unknown
TEST: for( IService candidate : serviceFactory.createService(connectionParams) ) {
try {
CatalogUIPlugin.trace(id + " : connecting"); //$NON-NLS-1$
IServiceInfo info = candidate.getInfo(monitor);
CatalogUIPlugin.trace(id + " : found " + info.getTitle()); //$NON-NLS-1$
replacement = candidate;
break TEST;
} catch (Throwable t) {
CatalogUIPlugin.trace(id + " : ... " + t.getLocalizedMessage()); //$NON-NLS-1$
}
}
if (replacement == null) {
CatalogUIPlugin.log("Could not reset "+id+" - as we could not connect!",null); //$NON-NLS-1$ //$NON-NLS-2$
continue; // skip - too bad we cannot update status the original
}
catalog.replace(id, replacement);
} catch (Throwable failed) {
CatalogUIPlugin.log("Reset failed", failed); //$NON-NLS-1$
}
}
}