Examples of ChannelImporter


Examples of com.denimgroup.threadfix.importer.interop.ChannelImporter

        if (channel == null) {
            LOG.warn("The ApplicationChannel could not be loaded.");
            return new ScanCheckResultBean(ScanImportStatus.OTHER_ERROR);
        }

        ChannelImporter importer = channelImporterFactory.getChannelImporter(channel);

        if (importer == null) {
            LOG.warn("No importer could be loaded for the ApplicationChannel.");
            return new ScanCheckResultBean(ScanImportStatus.OTHER_ERROR);
        }

        importer.setFileName(fileName);

        ScanCheckResultBean result = importer.checkFile();

        if ((!result.getScanCheckResult().equals(ScanImportStatus.SUCCESSFUL_SCAN)
                && !result.getScanCheckResult().equals(ScanImportStatus.EMPTY_SCAN_ERROR))) {
            importer.deleteScanFile();
        }

        Calendar scanQueueDate = applicationChannelDao.getMostRecentQueueScanTime(channel.getId());
   
    if (scanQueueDate != null && result.getTestDate() != null &&
View Full Code Here

Examples of com.denimgroup.threadfix.importer.interop.ChannelImporter

      log.warn("Invalid Application Channel, unable to find a ChannelImporter implementation.");
      return null;
    }
 
    // pick the appropriate parser
    ChannelImporter importer = channelImporterFactory.getChannelImporter(applicationChannel);
 
    if (importer == null) {
      log.warn("Unable to find suitable ChannelImporter implementation for "
          + applicationChannel.getChannelType().getName()
          + ". Returning null.");
      return null;
    }
 
    updateJobStatus(statusId, "Parsing findings from " +
        applicationChannel.getChannelType().getName() + " scan file.");
    log.info("Processing file " + fileName + " on channel "
        + applicationChannel.getChannelType().getName() + ".");
 
    importer.setFileName(fileName);
   
    Scan scan = importer.parseInput();
   
    if (scan == null) {
      log.warn("The " + applicationChannel.getChannelType().getName()
          + " import failed for file " + fileName + ".");
      return null;
    }
 
    updateJobStatus(statusId, "Findings successfully parsed, starting channel merge.");
   
    scanMerger.merge(scan, applicationChannel);

        scanDao.saveOrUpdate(scan);

        vulnerabilityFilterService.updateVulnerabilities(
        applicationChannel.getApplication().getOrganization().getId(),
        applicationChannel.getApplication().getId());
   
    importer.deleteScanFile();

        vulnerabilityService.updateVulnerabilityReport(applicationChannel.getApplication());

        return scan;
  }
View Full Code Here

Examples of com.denimgroup.threadfix.importer.interop.ChannelImporter

        String scannerName = applicationChannel.getChannelType().getName();

        Class<?> channelImporterClass = classMap.get(scannerName);

        ChannelImporter importer;

        try {
            assert channelImporterClass != null : "Got null class for key " + scannerName;

            Constructor<?>[] constructors = channelImporterClass.getConstructors();

            assert constructors.length == 1 : "Got " + constructors.length + " constructors.";

            Object maybeImporter = constructors[0].newInstance();

            if (maybeImporter instanceof ChannelImporter) {
                importer = (ChannelImporter) maybeImporter;
            } else {
                throw new IllegalStateException(channelImporterClass +
                        " didn't implement ChannelImporter. Fix your code and try again.");
            }

        } catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
            e.printStackTrace();
            throw new IllegalStateException(e);
        }

        importer.setChannel(applicationChannel);

        return importer;
    }
View Full Code Here

Examples of com.denimgroup.threadfix.importer.interop.ChannelImporter

        return scanTypeCalculationService.getScannerType(file);
    }

    public ScanCheckResultBean testScan(ScannerType type, File inputFile) {
        ChannelImporter importer = getImporter(type);

        importer.setFileName(inputFile.getAbsolutePath());

      try {
            return importer.checkFile();
      } catch (RestIOException e) {
        LOG.warn("Received exception for file " +
            inputFile.getAbsolutePath() +
            ", returning invalid format bean.", e);
        return new ScanCheckResultBean(ScanImportStatus.WRONG_FORMAT_ERROR);
View Full Code Here

Examples of com.denimgroup.threadfix.importer.interop.ChannelImporter

            e.printStackTrace();
        }
    }

    public Scan getScan(ScannerType type, File inputFile) {
        ChannelImporter importer = getImporter(type);

        importer.setFileName(inputFile.getAbsolutePath());

        return importer.parseInput();
    }
View Full Code Here

Examples of com.denimgroup.threadfix.importer.interop.ChannelImporter

        ApplicationChannel channel = new ApplicationChannel();
        channel.setChannelType(new ChannelType());
        channel.getChannelType().setName(type.getDbName());

        ChannelImporter importer = factory.getChannelImporter(channel);

        if (importer == null) {
            throw new IllegalArgumentException("The supplied ScannerType should produce a " +
                    "valid ChannelImporter implementation. Fix the code.");
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.