break;
}
case 'b': {
String opt = getopt.getOptarg();
InventoryManager inventoryManager = PluginContainer.getInstance().getInventoryManager();
DiscoveryComponentProxyFactory factory = inventoryManager.getDiscoveryComponentProxyFactory();
if (opt.equalsIgnoreCase("list")) {
HashSet<ResourceType> blacklist = factory.getResourceTypeBlacklist();
out.println(MSG.getMsg(AgentI18NResourceKeys.DISCOVERY_BLACKLIST_LIST, blacklist));
} else if (opt.equalsIgnoreCase("clear")) {
factory.clearResourceTypeBlacklist();
out.println(MSG.getMsg(AgentI18NResourceKeys.DISCOVERY_BLACKLIST_CLEAR));
} else {
out.println(MSG.getMsg(AgentI18NResourceKeys.HELP_SYNTAX_LABEL, getSyntax()));
}
return;
}
case 'v': {
verbose = true;
break;
}
}
}
if ((getopt.getOptind() + 1) < args.length) {
out.println(MSG.getMsg(AgentI18NResourceKeys.HELP_SYNTAX_LABEL, getSyntax()));
return;
}
if (full) {
// do a full discovery - we ignore the -p and -r and -i options and do everything
if (!agent.getClientCommandSender().isSending()) {
out.println(MSG.getMsg(AgentI18NResourceKeys.DISCOVERY_AGENT_NOT_CONNECTED_TO_SERVER));
}
InventoryManager inventoryManager = PluginContainer.getInstance().getInventoryManager();
if (inventoryManager.isDiscoveryScanInProgress()) {
out.println(MSG.getMsg(AgentI18NResourceKeys.DISCOVERY_SCAN_ALREADY_IN_PROGRESS));
return;
}
HashSet<ResourceType> blacklist = inventoryManager.getDiscoveryComponentProxyFactory()
.getResourceTypeBlacklist();
if (!blacklist.isEmpty()) {
out.println(MSG.getMsg(AgentI18NResourceKeys.DISCOVERY_BLACKLISTED_TYPES, blacklist));
}
long start = System.currentTimeMillis();
InventoryReport scan1 = inventoryManager.executeServerScanImmediately();
InventoryReport scan2 = inventoryManager.executeServiceScanImmediately();
out.println(MSG.getMsg(AgentI18NResourceKeys.DISCOVERY_FULL_RUN, (System.currentTimeMillis() - start)));
printInventoryReport(scan1, out, verbose);
printInventoryReport(scan2, out, verbose);
} else {
try {
if (resourceId == null) {
discovery(pcName, out, pluginName, resourceTypeName, verbose);
} else {
// specifying a resource ID implies we must ignore -r and -p (since type/plugin is determined by the resource)
InventoryManager im = PluginContainer.getInstance().getInventoryManager();
ResourceContainer resourceContainer = im.getResourceContainer(resourceId);
if (resourceContainer != null) {
Resource resource = resourceContainer.getResource();
PluginContainerConfiguration pcc = agentConfig.getPluginContainerConfiguration();
RuntimeDiscoveryExecutor scanner = new RuntimeDiscoveryExecutor(im, pcc, resource);
InventoryReport report = scanner.call();