예제 #1
0
 public ClientCatalogItem getClientName() throws SearchLibException {
   Client client = getClient();
   if (client == null) return null;
   if (selectedClientCatalogItem == null) return null;
   if (!selectedClientCatalogItem.getIndexName().equals(client.getIndexName())) return null;
   return selectedClientCatalogItem;
 }
예제 #2
0
 public FileManager getFileManager() throws SearchLibException {
   synchronized (this) {
     Client client = getClient();
     if (client == null) return null;
     return client.getFileManager();
   }
 }
예제 #3
0
 private void onTask(TaskFileManagerAction taskFileManagerAction)
     throws SearchLibException, InterruptedException {
   Client client = getClient();
   if (client == null) return;
   TaskItem taskItem = new TaskItem(client, taskFileManagerAction);
   TaskManager.executeTask(client, taskItem, null);
   client.getFileManager().waitForTask(taskFileManagerAction, 30);
 }
 public List<String> getSearchRequests() throws SearchLibException {
   Client client = getClient();
   if (client == null) return null;
   List<String> nameList = new ArrayList<String>();
   client
       .getRequestMap()
       .getNameList(nameList, RequestTypeEnum.SearchFieldRequest, RequestTypeEnum.SearchRequest);
   return nameList;
 }
예제 #5
0
 public List<SchemaField> getIndexFieldList() throws SearchLibException {
   synchronized (this) {
     Client client = getClient();
     if (client == null) return null;
     List<SchemaField> list = client.getSchema().getFieldList().getList();
     if (list.size() > 0 && selectedIndexField == null) selectedIndexField = list.get(0);
     return list;
   }
 }
예제 #6
0
 public FieldMap getFieldMap() {
   try {
     Client client = getClient();
     if (client == null) return null;
     return client.getWebCrawlerFieldMap();
   } catch (SearchLibException e) {
     throw new RuntimeException(e);
   }
 }
 @Command
 @NotifyChange("*")
 public void onSave()
     throws InterruptedException, SearchLibException, TransformerConfigurationException,
         IOException, SAXException {
   Client client = getClient();
   client.getReplicationList().save(selectedItem, currentItem);
   client.saveReplicationList();
   onCancel();
 }
예제 #8
0
 public List<String> getRepositoryList() throws SearchLibException {
   synchronized (this) {
     Client client = getClient();
     if (client == null) return null;
     List<String> list = new ArrayList<String>();
     list.add("");
     client.getFilePathManager().getAllFilePathsString(list);
     return list;
   }
 }
 @Command
 @NotifyChange("*")
 public void onSave()
     throws WrongValueException, TransformerConfigurationException, XPathExpressionException,
         IOException, SAXException, ParserConfigurationException, SearchLibException {
   Client client = getClient();
   if (client == null) return;
   ApiManager apiManager = client.getApiManager();
   apiManager.createNewApi(new Api("opensearch", searchTemplate, openSearchApiList));
 }
 @Command
 @NotifyChange("*")
 public void onDelete()
     throws SearchLibException, TransformerConfigurationException, IOException, SAXException {
   Client client = getClient();
   if (client == null) return;
   client.getReplicationList().save(selectedItem, null);
   client.saveReplicationList();
   onCancel();
 }
 public List<String> getFieldList() throws SearchLibException, InterruptedException {
   if (fieldType == null) return null;
   Client client = getClient();
   if (client == null) return null;
   if (searchTemplate == null) new AlertController("Please Select an Query Template");
   AbstractSearchRequest request =
       (AbstractSearchRequest) client.getRequestMap().get(searchTemplate);
   if (request == null) return null;
   List<String> nameList = new ArrayList<String>();
   nameList.add(null);
   if (fieldType == OpenSearchTypes.FIELD) request.getReturnFieldList().toNameList(nameList);
   else if (fieldType == OpenSearchTypes.SNIPPET)
     request.getSnippetFieldList().toNameList(nameList);
   return nameList;
 }
 public List<String> getSnippetFieldLeft() throws SearchLibException {
   synchronized (this) {
     Client client = getClient();
     if (client == null) return null;
     AbstractSearchRequest request = (AbstractSearchRequest) getRequest();
     if (request == null) return null;
     if (snippetFieldLeft != null) return snippetFieldLeft;
     snippetFieldLeft = new ArrayList<String>();
     SnippetFieldList snippetFields = request.getSnippetFieldList();
     for (SchemaField field : client.getSchema().getFieldList())
       if (field.checkStored(Stored.YES, Stored.COMPRESS))
         if (field.getTermVector() == TermVector.POSITIONS_OFFSETS)
           if (snippetFields.get(field.getName()) == null) {
             if (selectedSnippet == null) selectedSnippet = field.getName();
             snippetFieldLeft.add(field.getName());
           }
     return snippetFieldLeft;
   }
 }
 public void load() throws SearchLibException {
   Client client;
   try {
     openSearchApiList = new ArrayList<OpenSearchApi>();
     client = getClient();
     if (client == null) return;
     ApiManager apiManager = client.getApiManager();
     if (apiManager.isAvailable()) {
       if (apiManager.getFieldValue("opensearch") != null)
         searchTemplate = apiManager.getFieldValue("opensearch");
       openSearchApiList = apiManager.getOpenSearchFieldList("opensearch");
     }
   } catch (TransformerConfigurationException e) {
     throw new SearchLibException(e);
   } catch (XPathExpressionException e) {
     throw new SearchLibException(e);
   } catch (ParserConfigurationException e) {
     throw new SearchLibException(e);
   } catch (SAXException e) {
     throw new SearchLibException(e);
   } catch (IOException e) {
     throw new SearchLibException(e);
   }
 }
예제 #14
0
  @Command
  public void onGo()
      throws SearchLibException, IOException, TransformerConfigurationException, SAXException,
          InterruptedException {
    synchronized (this) {
      Client client = getClient();
      if (client == null) return;
      if (client.getFileCrawlMaster().isRunning()) {
        new AlertController("Please stop the File crawler first.");
        return;
      }

      if (batchCommand == null) return;
      switch (batchCommand) {
        case NOTHING:
          break;
        case SET_TO_UNFETCHED:
          onSetToUnfetched();
          break;
        case DELETE_ALL:
          onDeleteAll();
          break;
        case OPTIMIZE:
          onOptimize();
          break;
        case DELETE_SELECTION:
          onDeleteSelection();
          break;
        case SYNCHRONIZE_INDEX:
          onSynchronizeIndex();
          break;
      }
      batchCommand = BatchCommandEnum.NOTHING;
      reload();
    }
  }
 public ReplicationList getReplicationList() throws SearchLibException {
   Client client = getClient();
   if (client == null) return null;
   return client.getReplicationList();
 }
 public Set<String> getRequestList() throws SearchLibException {
   Client client = getClient();
   if (client == null) return null;
   return client.getRequestMap().getNameList();
 }
 private ReplicationMaster getReplicationMaster() throws SearchLibException {
   Client client = getClient();
   if (client == null) return null;
   return client.getReplicationMaster();
 }