Class AgentFileResourceImpl

java.lang.Object
com.netflix.genie.web.agent.resources.AgentFileResourceImpl
All Implemented Interfaces:
AgentFileStreamService.AgentFileResource, org.springframework.core.io.InputStreamSource, org.springframework.core.io.Resource

public final class AgentFileResourceImpl extends Object implements AgentFileStreamService.AgentFileResource
Implementation of Resource for files local to an agent running a job that can be requested and streamed to the server (so they can be served via API).
Since:
4.0.0
  • Method Details

    • forNonExistingResource

      public static AgentFileResourceImpl forNonExistingResource()
      Factory method to create a placeholder resource for a remote file that does not exist.
      Returns:
      a AgentFileStreamService.AgentFileResource
    • forAgentFile

      public static AgentFileStreamService.AgentFileResource forAgentFile(URI uri, long size, Instant lastModifiedTime, Path relativePath, String jobId, InputStream inputStream)
      Factory method to create a resource for a remote file.
      Parameters:
      uri - the resource URI
      size - the size of the file, as per latest manifest
      lastModifiedTime - the last modification time, as per latest manifest
      relativePath - the path of the file relative to the root of the job directory
      jobId - the id of the job this file belongs to
      inputStream - the input stream to read this file content
      Returns:
      a AgentFileStreamService.AgentFileResource
    • exists

      public boolean exists()
      Specified by:
      exists in interface org.springframework.core.io.Resource
    • isOpen

      public boolean isOpen()
      Specified by:
      isOpen in interface org.springframework.core.io.Resource
    • getURL

      public URL getURL() throws IOException
      Specified by:
      getURL in interface org.springframework.core.io.Resource
      Throws:
      IOException
    • getURI

      public URI getURI() throws IOException
      Specified by:
      getURI in interface org.springframework.core.io.Resource
      Throws:
      IOException
    • getFile

      public File getFile() throws IOException
      Specified by:
      getFile in interface org.springframework.core.io.Resource
      Throws:
      IOException
    • contentLength

      public long contentLength() throws IOException
      Specified by:
      contentLength in interface org.springframework.core.io.Resource
      Throws:
      IOException
    • lastModified

      public long lastModified() throws IOException
      Specified by:
      lastModified in interface org.springframework.core.io.Resource
      Throws:
      IOException
    • createRelative

      public org.springframework.core.io.Resource createRelative(String relativePath) throws IOException
      Specified by:
      createRelative in interface org.springframework.core.io.Resource
      Throws:
      IOException
    • getFilename

      public String getFilename()
      Specified by:
      getFilename in interface org.springframework.core.io.Resource
    • getDescription

      public String getDescription()
      Specified by:
      getDescription in interface org.springframework.core.io.Resource
    • getInputStream

      public InputStream getInputStream() throws IOException
      Specified by:
      getInputStream in interface org.springframework.core.io.InputStreamSource
      Throws:
      IOException