Example #1
0
  @Override
  public void startUp(IngestJobContext context) throws IngestModuleException {
    this.context = context;
    refCounter.incrementAndGet(context.getJobId());

    synchronized (SampleFileIngestModule.class) {
      if (attrId == -1) {
        // For this sample, make a new attribute type to use to post
        // results to the blackboard. There are many standard blackboard
        // artifact and attribute types and you should use them instead
        // creating new ones to facilitate use of your results by other
        // modules.
        Case autopsyCase = Case.getCurrentCase();
        SleuthkitCase sleuthkitCase = autopsyCase.getSleuthkitCase();
        try {
          // See if the attribute type has already been defined.
          attrId = sleuthkitCase.getAttrTypeID("ATTR_SAMPLE");
          if (attrId == -1) {
            attrId = sleuthkitCase.addAttrType("ATTR_SAMPLE", "Sample Attribute");
          }
        } catch (TskCoreException ex) {
          IngestServices ingestServices = IngestServices.getInstance();
          Logger logger = ingestServices.getLogger(SampleIngestModuleFactory.getModuleName());
          logger.log(Level.SEVERE, "Failed to create blackboard attribute", ex);
          attrId = -1;
          throw new IngestModuleException(ex.getLocalizedMessage());
        }
      }
    }
  }
Example #2
0
 static synchronized void reportBlackboardPostCount(long ingestJobId) {
   Long refCount = refCounter.decrementAndGet(ingestJobId);
   if (refCount == 0) {
     Long filesCount = artifactCountsForIngestJobs.remove(ingestJobId);
     String msgText = String.format("Posted %d times to the blackboard", filesCount);
     IngestMessage message =
         IngestMessage.createMessage(
             IngestMessage.MessageType.INFO, SampleIngestModuleFactory.getModuleName(), msgText);
     IngestServices.getInstance().postMessage(message);
   }
 }
 /** @inheritDoc */
 @Override
 public void shutDown() {
   if (context != null) {
     if (refCounter.decrementAndGet(this.context.getJobId()) == 0) {
       // Shutting down the last instance of this module for this ingest
       // job, so discard the interesting file sets definitions snapshot
       // for the job.
       FilesIdentifierIngestModule.interestingFileSetsByJob.remove(this.context.getJobId());
     }
   }
 }