@Command public void onNewIndex() throws SearchLibException, InterruptedException, IOException, NamingException { String msg = null; if (indexName == null) msg = "Please enter a valid name for the new index"; else if (indexName.length() == 0) msg = "Please enter a valid name for the new index"; else if (ClientCatalog.exists(getLoggedUser(), indexName)) msg = "The name already exists"; if (msg != null) { new AlertController(msg); return; } ClientCatalog.createIndex(getLoggedUser(), indexName, indexTemplate.getTemplate(), null); setClient(ClientCatalog.getClient(indexName)); }
/** * Create a new index. * * @param indexName The name of the index. * @param templateName The name of the template (EMPTY_INDEX, WEB_CRAWLER, FILE_CRAWLER) * @param remoteURI the remote URI * @throws IOException inherited error * @throws SearchLibException inherited error */ public static void createIndex(String indexName, String templateName, URI remoteURI) throws SearchLibException, IOException { TemplateAbstract template = TemplateList.findTemplate(templateName); if (template == null) throw new SearchLibException("Template not found: " + templateName); createIndex(null, indexName, template, remoteURI); }