Class RemoteSource

  • All Implemented Interfaces:
    Source

    public class RemoteSource
    extends java.lang.Object
    implements Source
    Controls a different file system trough a Sink. It can translate files with local absolute file paths to remote absolute file paths (also if it is a windows system). It also detects changes in the local file system and will update the remote. Updates are checked for SHAs so we only transfer the files when they really are not there, even allowing a remote SHA cache to do its magic.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) java.lang.String areaId  
      (package private) java.io.File cwd  
      (package private) SourceFS fsync  
      (package private) java.util.concurrent.atomic.AtomicBoolean running  
      private Sink sink  
      private java.lang.Appendable stderr  
      private java.lang.Appendable stdout  
      private java.lang.Thread thread  
      (package private) Welcome welcome  
    • Constructor Summary

      Constructors 
      Constructor Description
      RemoteSource()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(java.io.File file)  
      void cancel()  
      void close()
      Close
      void event​(Event e, Area area)  
      private void exit()  
      byte[] getData​(java.lang.String sha)
      Called from the remote sink to get the data when it lacks the given sha.
      Sink getSink()  
      void join()  
      void launch​(java.util.Map<java.lang.String,​java.lang.String> env, java.util.List<java.lang.String> args, java.io.InputStream stdin, java.lang.Appendable stdout, java.lang.Appendable stderr)  
      void open​(Sink sink, java.io.File cwd, java.lang.String areaId)  
      void output​(java.lang.String areaId, java.lang.CharSequence text, boolean err)  
      void sync()  
      void update​(java.io.File f)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • sink

        private Sink sink
      • stdout

        private java.lang.Appendable stdout
      • stderr

        private java.lang.Appendable stderr
      • thread

        private java.lang.Thread thread
      • running

        volatile java.util.concurrent.atomic.AtomicBoolean running
      • areaId

        java.lang.String areaId
      • cwd

        java.io.File cwd
    • Constructor Detail

      • RemoteSource

        public RemoteSource()
    • Method Detail

      • open

        public void open​(Sink sink,
                         java.io.File cwd,
                         java.lang.String areaId)
      • getData

        public byte[] getData​(java.lang.String sha)
                       throws java.lang.Exception
        Called from the remote sink to get the data when it lacks the given sha.
        Specified by:
        getData in interface Source
        Throws:
        java.lang.Exception
      • close

        public void close()
                   throws java.io.IOException
        Close
        Throws:
        java.io.IOException
      • event

        public void event​(Event e,
                          Area area)
                   throws java.lang.Exception
        Specified by:
        event in interface Source
        Throws:
        java.lang.Exception
      • exit

        private void exit()
      • output

        public void output​(java.lang.String areaId,
                           java.lang.CharSequence text,
                           boolean err)
                    throws java.io.IOException
        Specified by:
        output in interface Source
        Throws:
        java.io.IOException
      • getSink

        public Sink getSink()
      • launch

        public void launch​(java.util.Map<java.lang.String,​java.lang.String> env,
                           java.util.List<java.lang.String> args,
                           java.io.InputStream stdin,
                           java.lang.Appendable stdout,
                           java.lang.Appendable stderr)
                    throws java.lang.Exception
        Throws:
        java.lang.Exception
      • cancel

        public void cancel()
                    throws java.lang.Exception
        Throws:
        java.lang.Exception
      • update

        public void update​(java.io.File f)
                    throws java.lang.Exception
        Throws:
        java.lang.Exception
      • sync

        public void sync()
                  throws java.lang.Exception
        Throws:
        java.lang.Exception
      • add

        public void add​(java.io.File file)
                 throws java.lang.Exception
        Throws:
        java.lang.Exception
      • join

        public void join()
                  throws java.lang.InterruptedException
        Throws:
        java.lang.InterruptedException