Class FsAgent

java.lang.Object
org.jrd.backend.communication.FsAgent
All Implemented Interfaces:
JrdAgent

public final class FsAgent extends Object implements JrdAgent
This class is doing agent-like based operations on filesystem
  • Field Details

    • AGENTS

      private static final Map<VmInfo,FsAgent> AGENTS
    • cp

      private final List<File> cp
    • originals

      private final Map<String,String> originals
      This is exact oposite of how remote agent does this. Remote agent keeps all overrides, because when new class defintion is laoded original is plled, and is modifed (overvritten) by new deffnitio.

      On contrary, in FS, the class is after writing immediately overriden in file FileSystem. So we keep original, saved during first override. If we keep original, we know class was overwritten. The removal of of override == restore of original (and remvoal of original from map

      In addition, insted of byte[] we store base64 encoded String

  • Constructor Details

    • FsAgent

      private FsAgent(List<File> cp)
  • Method Details

    • get

      public static FsAgent get(VmInfo vmInfo)
    • getOverrides

      public List<String> getOverrides()
    • cleanOverrides

      private int cleanOverrides(Pattern pattern)
    • submitRequest

      public String submitRequest(String request)
      Opens a socket and sends the request to the agent via socket.
      Specified by:
      submitRequest in interface JrdAgent
      Parameters:
      request - either "CLASSES" or "BYTES \n className", other formats are refused
      Returns:
      agents response or null
    • uploadByteCode

      private Void uploadByteCode(String clazz, String body)
    • sendByteCode

      private String sendByteCode(String clazz)
    • readClasses

      private String readClasses(boolean details) throws IOException
      Throws:
      IOException
    • addJustClass

      private static void addJustClass(String s, List<String> classes, String root, boolean details, String detailsPath)
    • toClass

      public static String toClass(String s)
    • sanitize

      private static String sanitize(String s)