Class RemoteWorkspaceClientFactory

java.lang.Object
aQute.bnd.remoteworkspace.client.RemoteWorkspaceClientFactory

public class RemoteWorkspaceClientFactory extends Object
A class that can setup a 2-way link to a RemoteWorkspace on the same machine.
  • Field Details

    • logger

      static final org.slf4j.Logger logger
    • executorService

      static final ExecutorService executorService
  • Constructor Details

    • RemoteWorkspaceClientFactory

      public RemoteWorkspaceClientFactory()
  • Method Details

    • create

      public static RemoteWorkspace create(File dir, RemoteWorkspaceClient client)
      Create a Remote Workspace object that communicates with a Remote Workspace server on the same machine on the loopback interface.

      This class will search in the {dir}/cnf/cache/remotews directory for registered workspaces. (Multiple can be registered.) It will try to contact these remote workspace servers in order of last modified, newest first. The first one that responds will be returned.

      Parameters:
      dir - The directory of the workspace
      client - the client API
      Returns:
      a RemoteWorkspace
    • create

      public static RemoteWorkspace create(int port, RemoteWorkspaceClient client) throws IOException
      Create a Remote Workspace on a specific port.
      Parameters:
      port - the port to use
      client - the client API
      Returns:
      a Workspace
      Throws:
      IOException - when something goes wrong
    • findRemoteWorkspace

      private static RemoteWorkspace findRemoteWorkspace(File dir, FunctionWithException<Integer,RemoteWorkspace> attach)
    • getPortDirectory

      public static File getPortDirectory(File dir, File org)
      Get the directory where the ports are registered in
      Parameters:
      dir - the directory to start from.
      org - the original directory started from
      Returns:
      the directory (cnf/cache/remotews) in the first workspace encountered