If a sql file is added/updated this can be called.
@param file
507958
private void addOrUpdateTable(File file) {
        try {
            String insertStmnt = FileUtils.readFileToString(file);
            DataSource ds = processSql(insertStmnt);
            DataSource existingDs = db().getDataSource(ds.getName());
            if (existingDs == null) {//We never saw this table before.
                db().addDataSource(ds);
                return;
            }
            // If startTime/endTime/templatePath changed then we should update the table.
            if (existingDs.getStartTime() != ds.getStartTime() || 
                    existingDs.getEndTime() != ds.getEndTime() ||
                    !existingDs.getTemplatePath().equals(ds.getTemplatePath())) {
                // We have to reuse the existing entity bean(else update will fail).
                existingDs.updateFrom(ds);
                db().updateDataSource(existingDs);
            }                 
        } catch (IOException ex) {
            log.error("Exception while loading druid sql file {} : {}", file, ex);
        }
    }
269723
public void addPatternFromFile(String file) throws IOException {

		File f = new File(file);
		addPatternFromReader(new FileReader(f));
	}
1067330
public void setPersistedFile(File file) throws FileNotFoundException
   {
      if (file instanceof SwapFile)
      {
         ((SwapFile)file).acquire(this);
      }

      this.file = file;

      // JCR-2326 Release the current ValueData from tempFile users before
      // setting its reference to null so it will be garbage collected.
      if (this.tempFile != null)
      {
         this.tempFile.release(this);
         this.tempFile = null;
      }

      this.stream = null;
   }
594913
public void addFile(final FileWidgetUpload file) {
		List<FileWidgetUpload> files = (List<FileWidgetUpload>) getData();
		if (files == null) {
			files = new ArrayList<>();
			setData(files);
		}
		files.add(file);
		MemoryUtil.checkSize(files.size(), this.getClass().getSimpleName());
	}
1187279
@Override
	public void saveTo(final File file) {
		if(file.exists())
			throw new IllegalArgumentException("File '" + file.toString() + "' already exists.");

		try {
			saveTo(new FileOutputStream(file));
		} catch (FileNotFoundException e) {
			throw MechanizeExceptionFactory.newException(e);
		}
	}
191177
void add(final File file) {
    if (file.isFile()) {
      if (this.fileNames.contains(file.getName())) {
        LOG.log(Level.FINEST, "A file with this name has already been added: {0}", file.getName());
      } else {
        this.fileNames.add(file.getName());
        this.theFiles.add(file);
      }
    } else {
      LOG.log(Level.FINEST, "Ignoring, because it is not a proper file: {0}", file);
    }
  }
975874
public void processFile(File file) {
    TreeReader tr = null;

    // SRL stuff
    CollectionValuedMap<Integer,String> srlMap = null;
    if (this.srlMap != null) {
      // there must be a better way ...
      String filename = file.getAbsolutePath();
      for (String suffix : this.srlMap.keySet()) {
        if (filename.endsWith(suffix)) {
          srlMap = this.srlMap.get(suffix);
          break;
        }
      }
      if (srlMap == null) {
        System.err.println("could not find SRL entries for file: "+file);
      }
    }

    try {
      // maybe print file name to stdout to get some feedback
      if (PRINT_FILENAMES) {
        System.err.println(file);
      }
      // could throw an IO exception if can't open for reading
      tr = treeReaderFactory().newTreeReader(new BufferedReader(new InputStreamReader(new FileInputStream(file), encoding())));
      int sentIndex=0;
      Tree pt;
      while ((pt = tr.readTree()) != null) {
        if (pt.label() instanceof HasIndex) { // so we can trace where this tree came from
          HasIndex hi = (HasIndex) pt.label();
          hi.setDocID(file.getName());
          hi.setSentIndex(sentIndex);
        }
        if (srlMap == null) {
          parseTrees.add(pt);
        } else {
          Collection<String> srls = srlMap.get(sentIndex);
//           pt.pennPrint();
//           System.err.println(srls);
          parseTrees.add(pt);
          if (srls.isEmpty()) {
//            parseTrees.add(pt);
          } else {
            for (String srl : srls) {
//              Tree t = pt.deepCopy();
              String[] bits = srl.split("\\s+");
              int verbIndex = Integer.parseInt(bits[0]);
              String lemma = bits[2].split("\\.")[0];
//              Tree verb = Trees.getTerminal(t, verbIndex);
              Tree verb = Trees.getTerminal(pt, verbIndex);
//              ((CoreLabel)verb.label()).set(SRLIDAnnotation.class, SRL_ID.REL);
              ((CoreLabel)verb.label()).set(CoreAnnotations.CoNLLPredicateAnnotation.class, true);
              for (int i = 4; i < bits.length; i++) {
                String arg = bits[i];
                String[] bits1;
                if (arg.indexOf("ARGM") >= 0) {
                  bits1 = arg.split("-");
                } else {
                  bits1 = arg.split("-");
                }
                String locs = bits1[0];
                String argType = bits1[1];
                if (argType.equals("rel")) {
                  continue;
                }
                for (String loc : locs.split("[*,]")) {
                  bits1 = loc.split(":");
                  int term = Integer.parseInt(bits1[0]);
                  int height = Integer.parseInt(bits1[1]);
//                  Tree t1 = Trees.getPreTerminal(t, term);
                  Tree t1 = Trees.getPreTerminal(pt, term);
                  for (int j = 0; j < height; j++) {
//                    t1 = t1.parent(t);
                    t1 = t1.parent(pt);
                  }
                  Map<Integer,String> roleMap = ((CoreLabel)t1.label()).get(CoreAnnotations.CoNLLSRLAnnotation.class);
                  if (roleMap == null) {
                    roleMap = new HashMap<Integer, String>();
                    ((CoreLabel)t1.label()).set(CoreAnnotations.CoNLLSRLAnnotation.class, roleMap);
                  }
                  roleMap.put(verbIndex, argType);
//                  ((CoreLabel)t1.label()).set(SRLIDAnnotation.class, SRL_ID.ARG);
                }
              }
//               for (Tree t1 : t) {
//                 if (t1.isLeaf()) { continue; }
//                 CoreLabel fl = (CoreLabel)t1.label();
//                 if (fl.value() == null) { continue; }
//                 if (!fl.has(SRLIDAnnotation.class)) {
//                   boolean allNone = true;
//                   for (Tree t2 : t1) {
//                     SRL_ID s = ((CoreLabel)t2.label()).get(SRLIDAnnotation.class);
//                     if (s == SRL_ID.ARG || s == SRL_ID.REL) {
//                       allNone = false;
//                       break;
//                     }
//                   }
//                   if (allNone) {
//                     fl.set(SRLIDAnnotation.class, SRL_ID.ALL_NO);
//                   } else {
//                     fl.set(SRLIDAnnotation.class, SRL_ID.NO);
//                   }
//                 }
//               }
//              parseTrees.add(t);
            }
          }
        }

        sentIndex++;
      }
    } catch (IOException e) {
      System.err.println("loadTree IO Exception: " + e + " in file " + file);
    } finally {
      try {
        if (tr != null) {
          tr.close();  // important: closes file even if error!
        }
      } catch (IOException e) {
        // do nothin'
      }
    }
  }
1093905
function onApply(file) {
      //console.log(file);
      dataValue.type = file.type;
      dataValue.id = file.id;
      dataValue.updatedAt = file.updatedAt;
      helpers.setFilePath(dataValue, file.location);
    }
177441
protected boolean doesFileMatch(final File file, final CSNodeWrapper node) {
        if (!node.getNodeType().equals(CommonConstants.CS_NODE_FILE)) return false;

        // If the unique id is not from the parser, in which case it will start with a number than use the unique id to compare
        if (file.getUniqueId() != null && file.getUniqueId().matches("^\\d.*")) {
            return file.getUniqueId().equals(Integer.toString(node.getId()));
        } else {
            // Since a content spec doesn't contain the database ids for the nodes use what is available to see if the files match
            return file.getId().equals(node.getEntityId());
        }
    }
180101
protected void check(File file) throws IOException {
        if(!file.exists()) {
            throw new FileNotFoundException(file.getAbsolutePath());
        }
        
        if(file.isDirectory()) {
            throw new IOException("Cannot open directory " + file.getAbsolutePath());
        }
    }
1267770
public void updateFromFile(MultipartFile file) {
        ObjectMapper objectMapper = ValidationObjUtil.getDefaultObjectMapper();

        try {
            String jsonStr = new String(file.getBytes(), "UTF-8");
            List<ValidationData> list = objectMapper.readValue(jsonStr, objectMapper.getTypeFactory().constructCollectionType(List.class, ValidationData.class));
            List<ReqUrl> reqUrls = ValidationReqUrlUtil.getUrlListFromValidationDatas(list);
            reqUrls.forEach(reqUrl -> {
                this.deleteValidationData(reqUrl);
            });
            Map<Long, Long> idsMap = new HashMap<>();
            List<ValidationData> saveList = new ArrayList<>();

            list.forEach(data -> {
                long oldId = data.getId();
                data.setId(null);
                data = this.validationDataRepository.save(data);
                idsMap.put(oldId, data.getId());
                saveList.add(data);
            });

            saveList.forEach(data -> {
                if (data.getParentId() != null) {
                    data.setParentId(idsMap.get(data.getParentId()));
                    this.validationDataRepository.save(data);
                }
            });

        } catch (IOException e) {
            log.info("file io exception : " + e.getMessage());
        }
    }
1039278
protected function importSqlFile($file)
    {
        if (!is_null($file)) {
            $this->output->writeLn("Applying migration for <info>$file</info>");
            $command = sprintf("%s db import %s", $this->getWpCliPath(), $file);
            system($command);
            return;
        }

        $this->output->writeLn("<error>We could not find a valid SQL file.</error>");
    }
777241
public void moveThisFile(File file)
    {
        String strDestName = file.getName();
        boolean bMoveFile = true;
        String extension = this.getProperty(EXTENSION);
        String filter = this.getProperty(FILTER);
    	if (extension != null)
    	{
    		bMoveFile = false;
            int iJava = strDestName.lastIndexOf(extension);
            if (iJava != -1) if (iJava == strDestName.length() - extension.length())
            	bMoveFile = true;
    	}
    	if (filter != null)
    	{
            bMoveFile = strDestName.matches(filter);
    	}
    	if ((bMoveFile) && (this.getScanListener() != null))
    		bMoveFile = this.getScanListener().filterFile(file);
        if (bMoveFile)
        {
            String strParentSource = file.getParent();
            this.moveThisFile(file, strDestName, strParentSource);
        }
    }
1019267
public static void addFile(State state, String file) {
    state.setProp(ADD_FILES, state.getProp(ADD_FILES, "") + "," + file);
  }
589639
public static void deleteAllFiles(final File file) throws IOException
	{
		String error = null;
		if (!file.exists())
		{
			return;
		}
		final Exception ex = checkFile(file);
		if (ex != null)
		{
			try
			{
				throw ex;
			}
			catch (final Exception e)
			{
				e.printStackTrace();
			}
		}
		DeleteFileExtensions.deleteFiles(file);
		if (!file.delete())
		{
			error = "Cannot delete the File " + file.getAbsolutePath() + ".";

			throw new IOException(error);

		}
	}
1166670
public void addFile(ISO9660File file) {
        file.setParentDirectory(this);
        files.add(file);
        sorted = false;
    }
1232242
private void addFileToList(final CmsFileInfo file, boolean invalid, boolean existingDeleted, boolean isTooLarge) {

        CmsListInfoBean infoBean = createInfoBean(file);
        CmsListItemWidget listItemWidget = new CmsListItemWidget(infoBean);
        listItemWidget.setIcon(CmsCoreProvider.get().getResourceTypeIcon(file));
        CmsCheckBox check = new CmsCheckBox();
        check.setChecked(false);
        if (!invalid && !isTooLarge && !existingDeleted) {
            if (file.getFileSize() == 0) {
                check.setChecked(false);
            }
            check.setChecked(m_filesToUpload.containsKey(file.getFileName()));
            check.setTitle(file.getFileName());
            if (!m_selectionDone && file.getFileName().toLowerCase().endsWith(".zip")) {
                final Widget unzip = createUnzipCheckBox(file);
                addClickHandlerToCheckBox(check, unzip, file);
                listItemWidget.addButton(unzip);
            } else {
                addClickHandlerToCheckBox(check, null, file);
            }
        } else if (existingDeleted) {
            // is invalid
            String message = Messages.get().key(Messages.GUI_UPLOAD_FILE_EXISTING_DELETED_1, file.getFileName());
            check.disable(message);
            listItemWidget.setBackground(Background.RED);
            listItemWidget.setSubtitleLabel(message);
        } else if (isTooLarge) {
            String message = getFileSizeTooLargeMessage(file);
            check.disable(message);
            listItemWidget.setBackground(Background.RED);
            listItemWidget.setSubtitleLabel(message);
        } else {
            // is invalid
            String message = Messages.get().key(
                Messages.GUI_UPLOAD_FILE_INVALID_NAME_2,
                file.getFileName(),
                CmsUploadButton.formatBytes(file.getFileSize()));
            check.disable(message);
            listItemWidget.setBackground(Background.RED);
            listItemWidget.setSubtitleLabel(message);
        }

        CmsListItem listItem = new CmsListItem(check, listItemWidget);
        m_fileList.addItem(listItem);
        m_listItems.put(file.getFileName(), listItem);
        doResize();
    }