Class AgentFileResourceImpl

  • All Implemented Interfaces:
    AgentFileStreamService.AgentFileResource, org.springframework.core.io.InputStreamSource, org.springframework.core.io.Resource

    public final class AgentFileResourceImpl
    extends java.lang.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 Detail

      • forAgentFile

        public static AgentFileStreamService.AgentFileResource forAgentFile​(java.net.URI uri,
                                                                            long size,
                                                                            java.time.Instant lastModifiedTime,
                                                                            java.nio.file.Path relativePath,
                                                                            java.lang.String jobId,
                                                                            java.io.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 java.net.URL getURL()
                            throws java.io.IOException
        Specified by:
        getURL in interface org.springframework.core.io.Resource
        Throws:
        java.io.IOException
      • getURI

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

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

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

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

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

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

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

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