Backend API

public class Workspace

A workspace corresponds to one project, so one flow. It can have several kernels and connected users. One flow is represented by one JSON, containing all the vue structure.

Created by antoine on 25/05/2017.

public void newClientConnection (ServerSocket client)

public void clientDeconnection (ServerSocket client)

public void startNewKernel (String nodeId)

Should be used each time a new Simulation or Processing block is created

public void stopKernel (String nodeId)

Commonly used when a node is removed

public boolean stopKernels () throws InterruptedException

Stop all the kernels. Use only when all users have stopped the connexion or when you stop the server.

public void startGraph (String graph) throws NotExistingGraphException

Start the execution of a given graph.

public void stopGraph (String graph)

Stop a running graph

public boolean graphRunning (String graph)

Is a graph running ?

public void executeNode (Node node)

Launch the execution of a given node.

public void errorExecutingNode (String nodeId)

Broadcast the information that the given node throws an error while executing in the kernel.

public void stopNode (Node node)

Stop the execution of a given node.

public boolean isNodeRunning (String nodeId)

Is a given node running ?

public void errorFromKernel (String error)

Handle an error returned by the Jupyter kernel. It sends an error message to the connected UIs.

public void save ()

Save the workspace, storing the full flow as a json file in the workspace folder on the HD. Each workspace has its own folder on the HD.

public void sendUpdateNodeMessage (Node node)

Send a message to the UI containing the modifications done on the given node.

public String getName ()

Get the name of the workspace. The name is defined by the end-user.

public void setName(String name)

Change the name of the workspace to the given value.

public ArrayList getConnectedClients()

Get the list of the connected clients.

public String getLibrary()

Get the library of components used in this workspace.

public String getUuid()

Get the unique id of the workspace.

public Flow getFlow()

Get the flow designed by the user. The flow is the bunch of components (nodes), linked with edges that described the process the user wants to study/simulate.

public Kernel getKernel (String nodeId)

Get the Kernel (so the Docker container) that corresponds and execute the given node.

public Path getPathToWorkspaceFolder()

Get the absolute path to the workspace folder on the machine.

public String getNodeIdForKernel (Kernel k)

Get the node associated to a kernel

private JSONObject importFlowJSON (Path pathToFolder)

Import a flow as a JSONObject from the given folder. The flow file must be named flow.json

private boolean createFolder (Path path)

Create the folder of the workspace.

public class NotExistingGraphException extends Exception

Exception indicating that the graph to run doesn’t exist.