Codota Logo
ApplicationFile.exists
Code IndexAdd Codota to your IDE (free)

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

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

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
List l =
  • Codota Iconnew LinkedList()
  • Codota IconCollections.emptyList()
  • Codota Iconnew ArrayList()
  • Smart code suggestions by Codota
}
origin: com.yahoo.vespa/config-model

/** Returns whether a model store for this application and model name exists */
public boolean exists() {
  return application.getFile(modelFiles.storedModelReplicatedPath()).exists();
}
origin: com.yahoo.vespa/config-model

/** Reads the previously stored function expressions for these arguments */
List<Pair<String, RankingExpression>> readFunctions() {
  try {
    ApplicationFile file = application.getFile(modelFiles.functionsPath());
    if ( ! file.exists()) return Collections.emptyList();
    List<Pair<String, RankingExpression>> functions = new ArrayList<>();
    try (BufferedReader reader = new BufferedReader(file.createReader())) {
      String line;
      while (null != (line = reader.readLine())) {
        String[] parts = line.split("\t");
        String name = parts[0];
        try {
          RankingExpression expression = new RankingExpression(parts[0], parts[1]);
          functions.add(new Pair<>(name, expression));
        } catch (ParseException e) {
          throw new IllegalStateException("Could not parse " + name, e);
        }
      }
      return functions;
    }
  }
  catch (IOException e) {
    throw new UncheckedIOException(e);
  }
}
origin: com.yahoo.vespa/config-model

private Collection<Element> getPermanentServices(DeployState deployState) throws IOException, SAXException {
  List<Element> permanentServices = new ArrayList<>();
  Optional<ApplicationPackage> applicationPackage = deployState.getPermanentApplicationPackage();
  if (applicationPackage.isPresent()) {
    ApplicationFile file = applicationPackage.get().getFile(Path.fromString(ApplicationPackage.PERMANENT_SERVICES));
    if (file.exists()) {
      try (Reader reader = file.createReader()) {
        Element permanentServicesRoot = getServicesFromReader(reader);
        permanentServices.addAll(getServiceElements(permanentServicesRoot));
      }
    }
  }
  return permanentServices;
}
origin: com.yahoo.vespa/config-model

private List<Pair<String, Tensor>> readSmallConstants() {
  try {
    ApplicationFile file = application.getFile(modelFiles.smallConstantsPath());
    if ( ! file.exists()) return Collections.emptyList();
    List<Pair<String, Tensor>> constants = new ArrayList<>();
    BufferedReader reader = new BufferedReader(file.createReader());
    String line;
    while (null != (line = reader.readLine())) {
      String[] parts = line.split("\t");
      String name = parts[0];
      TensorType type = TensorType.fromSpec(parts[1]);
      Tensor tensor = Tensor.from(type, parts[2]);
      constants.add(new Pair<>(name, tensor));
    }
    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;
}
com.yahoo.config.application.apiApplicationFileexists

Javadoc

Test whether or not this file exists.

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.
  • listFiles
    List the files in this directory, optionally list files for subdirectories recursively as well.
  • appendFile
    Appends the given string to this text file.
  • writeFile
    Write the contents from this reader to this file. Any existing content will be overwritten!

Popular in Java

  • Creating JSON documents from java classes using gson
  • getExternalFilesDir (Context)
  • scheduleAtFixedRate (ScheduledExecutorService)
    Creates and executes a periodic action that becomes enabled first after the given initial delay, and
  • onRequestPermissionsResult (Fragment)
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • Permission (java.security)
    Abstract class for representing access to a system resource. All permissions have a name (whose inte
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • Collectors (java.util.stream)
  • Logger (org.slf4j)
    The main user interface to logging. It is expected that logging takes place through concrete impleme
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now