void changed() {
    if (!changed) {
      changed = true;

      try {
        pcs.firePropertyChange(OptionsPanelController.PROP_CHANGED, false, true);
      } catch (Exception e) {
        logger.log(
            Level.SEVERE,
            "KeywordSearchOptionsPanelController listener threw exception",
            e); // NON-NLS
        MessageNotifyUtil.Notify.show(
            NbBundle.getMessage(this.getClass(), "KeywordSearchOptionsPanelController.moduleErr"),
            NbBundle.getMessage(
                this.getClass(), "KeywordSearchOptionsPanelController.moduleErr.msg1"),
            MessageNotifyUtil.MessageType.ERROR);
      }
    }
    try {
      pcs.firePropertyChange(OptionsPanelController.PROP_VALID, null, null);
    } catch (Exception e) {
      logger.log(
          Level.SEVERE,
          "KeywordSearchOptionsPanelController listener threw exception",
          e); // NON-NLS
      MessageNotifyUtil.Notify.show(
          NbBundle.getMessage(this.getClass(), "KeywordSearchOptionsPanelController.moduleErr"),
          NbBundle.getMessage(
              this.getClass(), "KeywordSearchOptionsPanelController.moduleErr.msg2"),
          MessageNotifyUtil.MessageType.ERROR);
    }
  }
Beispiel #2
0
    @Override
    protected void done() {
      hashDb.indexing = false;
      progress.finish();

      // see if we got any errors
      try {
        get();
      } catch (InterruptedException | ExecutionException ex) {
        logger.log(Level.SEVERE, "Error creating index", ex); // NON-NLS
        MessageNotifyUtil.Notify.show(
            NbBundle.getMessage(this.getClass(), "HashDbManager.errCreatingIndex.title"),
            NbBundle.getMessage(
                this.getClass(), "HashDbManager.errCreatingIndex.msg", ex.getMessage()),
            MessageNotifyUtil.MessageType.ERROR);
      } // catch and ignore if we were cancelled
      catch (java.util.concurrent.CancellationException ex) {
      }

      try {
        hashDb.propertyChangeSupport.firePropertyChange(
            HashDb.Event.INDEXING_DONE.toString(), null, hashDb);
        hashDb.propertyChangeSupport.firePropertyChange(
            HashDbManager.SetEvt.DB_INDEXED.toString(), null, hashDb.getHashSetName());
      } catch (Exception e) {
        logger.log(Level.SEVERE, "HashDbManager listener threw exception", e); // NON-NLS
        MessageNotifyUtil.Notify.show(
            NbBundle.getMessage(this.getClass(), "HashDbManager.moduleErr"),
            NbBundle.getMessage(this.getClass(), "HashDbManager.moduleErrorListeningToUpdatesMsg"),
            MessageNotifyUtil.MessageType.ERROR);
      }
    }
Beispiel #3
0
  /**
   * Removes a hash database from the set of hash databases used to classify files as known or known
   * bad. Does not save the configuration - the configuration is only saved on demand to support
   * cancellation of configuration panels.
   *
   * @throws TskCoreException
   */
  synchronized void removeHashDatabaseInternal(HashDb hashDb) {
    // Remove the database from whichever hash set list it occupies,
    // and remove its hash set name from the hash set used to ensure unique
    // hash set names are used, before undertaking These operations will succeed and constitute
    // a mostly effective removal, even if the subsequent operations fail.
    String hashSetName = hashDb.getHashSetName();
    knownHashSets.remove(hashDb);
    knownBadHashSets.remove(hashDb);
    hashSetNames.remove(hashSetName);

    // Now undertake the operations that could throw.
    try {
      hashSetPaths.remove(hashDb.getIndexPath());
    } catch (TskCoreException ex) {
      Logger.getLogger(HashDbManager.class.getName())
          .log(
              Level.SEVERE,
              "Error getting index path of "
                  + hashDb.getHashSetName()
                  + " hash database when removing the database",
              ex); // NON-NLS
    }
    try {
      if (!hashDb.hasIndexOnly()) {
        hashSetPaths.remove(hashDb.getDatabasePath());
      }
    } catch (TskCoreException ex) {
      Logger.getLogger(HashDbManager.class.getName())
          .log(
              Level.SEVERE,
              "Error getting database path of "
                  + hashDb.getHashSetName()
                  + " hash database when removing the database",
              ex); // NON-NLS
    }
    try {
      hashDb.close();
    } catch (TskCoreException ex) {
      Logger.getLogger(HashDbManager.class.getName())
          .log(
              Level.SEVERE,
              "Error closing "
                  + hashDb.getHashSetName()
                  + " hash database when removing the database",
              ex); // NON-NLS
    }

    // Let any external listeners know that a set has been deleted
    try {
      changeSupport.firePropertyChange(SetEvt.DB_DELETED.toString(), null, hashSetName);
    } catch (Exception e) {
      logger.log(Level.SEVERE, "HashDbManager listener threw exception", e); // NON-NLS
      MessageNotifyUtil.Notify.show(
          NbBundle.getMessage(this.getClass(), "HashDbManager.moduleErr"),
          NbBundle.getMessage(this.getClass(), "HashDbManager.moduleErrorListeningToUpdatesMsg"),
          MessageNotifyUtil.MessageType.ERROR);
    }
  }
  void fireViewerComplete() {

    try {
      firePropertyChange(BlackboardResultViewer.FINISHED_DISPLAY_EVT, 0, 1);
    } catch (Exception e) {
      logger.log(Level.SEVERE, "DirectoryTreeTopComponent listener threw exception", e); // NON-NLS
      MessageNotifyUtil.Notify.show(
          NbBundle.getMessage(this.getClass(), "DirectoryTreeTopComponent.moduleErr"),
          NbBundle.getMessage(this.getClass(), "DirectoryTreeTopComponent.moduleErr.msg"),
          MessageNotifyUtil.MessageType.ERROR);
    }
  }
Beispiel #5
0
  private HashDb addHashDatabase(
      int handle,
      String hashSetName,
      boolean searchDuringIngest,
      boolean sendIngestMessages,
      HashDb.KnownFilesType knownFilesType)
      throws TskCoreException {
    // Wrap an object around the handle.
    HashDb hashDb =
        new HashDb(handle, hashSetName, searchDuringIngest, sendIngestMessages, knownFilesType);

    // Get the indentity data before updating the collections since the
    // accessor methods may throw.
    String databasePath = hashDb.getDatabasePath();
    String indexPath = hashDb.getIndexPath();

    // Update the collections used to ensure that hash set names are unique
    // and the same database is not added to the configuration more than once.
    hashSetNames.add(hashDb.getHashSetName());
    if (!databasePath.equals("None")) { // NON-NLS
      hashSetPaths.add(databasePath);
    }
    if (!indexPath.equals("None")) { // NON-NLS
      hashSetPaths.add(indexPath);
    }

    // Add the hash database to the appropriate collection for its type.
    if (hashDb.getKnownFilesType() == HashDb.KnownFilesType.KNOWN) {
      knownHashSets.add(hashDb);
    } else {
      knownBadHashSets.add(hashDb);
    }

    // Let any external listeners know that there's a new set
    try {
      changeSupport.firePropertyChange(SetEvt.DB_ADDED.toString(), null, hashSetName);
    } catch (Exception e) {
      logger.log(Level.SEVERE, "HashDbManager listener threw exception", e); // NON-NLS
      MessageNotifyUtil.Notify.show(
          NbBundle.getMessage(this.getClass(), "HashDbManager.moduleErr"),
          NbBundle.getMessage(this.getClass(), "HashDbManager.moduleErrorListeningToUpdatesMsg"),
          MessageNotifyUtil.MessageType.ERROR);
    }
    return hashDb;
  }