Tabnine Logo
ApplicationFile.listFiles
Code IndexAdd Tabnine to your IDE (free)

How to use
listFiles
method
in
com.yahoo.config.application.api.ApplicationFile

Best Java code snippets using com.yahoo.config.application.api.ApplicationFile.listFiles (Showing top 5 results out of 315)

origin: com.yahoo.vespa/config-model-api

/**
 * List the files under this directory. If this is file, an empty list is returned.
 * Only immediate files/subdirectories are returned.
 *
 * @return a list of files in this directory.
 */
public List<ApplicationFile> listFiles() {
  return listFiles(defaultFilter);
}
origin: com.yahoo.vespa/config-model-api

/**
 * List the files in this directory, optionally list files for subdirectories recursively as well.
 *
 * @param recurse Set to true if all files in the directory tree should be returned.
 * @return a list of files in this directory.
 */
public List<ApplicationFile> listFiles(boolean recurse) {
  List<ApplicationFile> ret = new ArrayList<>();
  List<ApplicationFile> files = listFiles();
  ret.addAll(files);
  if (recurse) {
    for (ApplicationFile file : files) {
      if (file.isDirectory()) {
        ret.addAll(file.listFiles(recurse));
      }
    }
  }
  return ret;
}
origin: com.yahoo.vespa/config-model

/**
 * Reads the information about all the large (aka ranking) constants stored in the application package
 * (the constant value itself is replicated with file distribution).
 */
List<RankingConstant> readLargeConstants() {
  try {
    List<RankingConstant> constants = new ArrayList<>();
    for (ApplicationFile constantFile : application.getFile(modelFiles.largeConstantsInfoPath()).listFiles()) {
      String[] parts = IOUtils.readAll(constantFile.createReader()).split(":");
      constants.add(new RankingConstant(parts[0], TensorType.fromSpec(parts[1]), parts[2]));
    }
    return constants;
  }
  catch (IOException e) {
    throw new UncheckedIOException(e);
  }
}
origin: com.yahoo.vespa/config-model

Map<String, ExpressionFunction> readExpressions() {
  Map<String, ExpressionFunction> expressions = new HashMap<>();
  ApplicationFile expressionPath = application.getFile(modelFiles.expressionsPath());
  if ( ! expressionPath.exists() || ! expressionPath.isDirectory()) return Collections.emptyMap();
  for (ApplicationFile expressionFile : expressionPath.listFiles()) {
    try (BufferedReader reader = new BufferedReader(expressionFile.createReader())){
      String name = expressionFile.getPath().getName();
      expressions.put(name, readExpression(name, reader));
    }
    catch (IOException e) {
      throw new UncheckedIOException("Failed reading " + expressionFile.getPath(), e);
    }
    catch (ParseException e) {
      throw new IllegalStateException("Invalid stored expression in " + expressionFile, e);
    }
  }
  return expressions;
}
origin: com.yahoo.vespa/config-model

/**
 * Creates a rank profile not attached to any search definition, for each imported model in the application package,
 * and adds it to the given rank profile registry.
 */
private void createGlobalRankProfiles(DeployLogger deployLogger, ImportedMlModels importedModels,
                   RankProfileRegistry rankProfileRegistry,
                   QueryProfiles queryProfiles) {
  if ( ! importedModels.all().isEmpty()) { // models/ directory is available
    for (ImportedMlModel model : importedModels.all()) {
      RankProfile profile = new RankProfile(model.name(), this, rankProfileRegistry);
      rankProfileRegistry.add(profile);
      ConvertedModel convertedModel = ConvertedModel.fromSource(new ModelName(model.name()),
                                   model.name(), profile, queryProfiles.getRegistry(), model);
      convertedModel.expressions().values().forEach(f -> profile.addFunction(f, false));
    }
  }
  else { // generated and stored model information may be available instead
    ApplicationFile generatedModelsDir = applicationPackage.getFile(ApplicationPackage.MODELS_GENERATED_REPLICATED_DIR);
    for (ApplicationFile generatedModelDir : generatedModelsDir.listFiles()) {
      String modelName = generatedModelDir.getPath().last();
      if (modelName.contains(".")) continue; // Name space: Not a global profile
      RankProfile profile = new RankProfile(modelName, this, rankProfileRegistry);
      rankProfileRegistry.add(profile);
      ConvertedModel convertedModel = ConvertedModel.fromStore(new ModelName(modelName), modelName, profile);
      convertedModel.expressions().values().forEach(f -> profile.addFunction(f, false));
    }
  }
  new Processing().processRankProfiles(deployLogger, rankProfileRegistry, queryProfiles, true, false);
}
com.yahoo.config.application.apiApplicationFilelistFiles

Javadoc

List the files under this directory. If this is file, an empty list is returned. Only immediate files/subdirectories are returned.

Popular methods of ApplicationFile

  • createReader
    Create a Reader for the contents of this file.
  • getPath
    Get the path that this file represents.
  • isDirectory
    Check whether or not this file is a directory.
  • appendFile
    Appends the given string to this text file.
  • exists
    Test whether or not this file exists.
  • writeFile
    Write the contents from this reader to this file. Any existing content will be overwritten!

Popular in Java

  • Running tasks concurrently on multiple threads
  • setContentView (Activity)
  • compareTo (BigDecimal)
  • onCreateOptionsMenu (Activity)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • IOException (java.io)
    Signals a general, I/O-related error. Error details may be specified when calling the constructor, a
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now