/** Initializes the AccessControl member. */
  private static synchronized AccessControl getaccessControl() {
    if (accessControl == null) {
      accessControl = SpringUtil.getAccessControl();
    }

    return accessControl;
  }
Esempio n. 2
0
  // command line utility
  public static void main(String[] args) throws IOException, DaoException {

    if (args.length != 2) {
      System.out.printf(
          "command line usage:  importGistic.pl <gistic-data-file.txt> <cancer-study-id>\n"
              + "\t <gistic-data-file.txt> Note that gistic-data-file.txt must be a massaged file, it does not come straight from the Broad\n"
              + "\t <cancer-study-id> e.g. 'tcga_gbm'");
      return;
    }
    SpringUtil.initDataSource();
    GisticReader gisticReader = new GisticReader();

    File gistic_f = new File(args[0]);
    int cancerStudyInternalId = gisticReader.getCancerStudyInternalId(args[1]);

    ProgressMonitor.setConsoleMode(false);

    System.out.println("Reading data from: " + gistic_f.getAbsolutePath());
    System.out.println("CancerStudyId: " + cancerStudyInternalId);

    int lines = FileUtil.getNumLines(gistic_f);
    System.out.println(" --> total number of lines: " + lines);
    ProgressMonitor.setMaxValue(lines);

    ArrayList<Gistic> gistics = null;

    gistics = gisticReader.parse(gistic_f, cancerStudyInternalId);

    if (gistics == null) {
      System.out.println("Error: didn't get any data");
      return;
    }

    // add to CGDS database
    for (Gistic g : gistics) {
      try {
        DaoGistic.addGistic(g);
      } catch (validationException e) {
        // only catching validationException, not DaoException
        logger.debug(e);
      } catch (DaoException e) {
        System.err.println(e);
      }
    }
    ConsoleUtil.showWarnings();
  }
 /**
  * Initializes the servlet.
  *
  * @throws ServletException Serlvet Init Error.
  */
 public void init() throws ServletException {
   super.init();
   accessControl = SpringUtil.getAccessControl();
 }