WorkspaceManager

io.joern.console.workspacehandling.WorkspaceManager
See theWorkspaceManager companion object
class WorkspaceManager[ProjectType <: Project](path: String, loader: WorkspaceLoader[ProjectType]) extends Reporting

WorkspaceManager: a component, which loads and maintains the list of projects made accessible via Ocular/Joern.

Value parameters

path

path to to workspace.

Attributes

Companion
object
Graph
Supertypes
trait Reporting
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def closeProject(name: String): Option[Project]

Free up resources occupied by this project but do not remove project from disk.

Free up resources occupied by this project but do not remove project from disk.

Attributes

def cpg: Cpg

Obtain the cpg that was last loaded. Throws a runtime exception if no CPG has been loaded.

Obtain the cpg that was last loaded. Throws a runtime exception if no CPG has been loaded.

Attributes

def cpgExists(inputPath: String, isLegacy: Boolean): Boolean

Indicates whether a base CPG exists for @inputPath.

Indicates whether a base CPG exists for @inputPath.

Attributes

def createProject(inputPath: String, projectName: String): Option[Path]

Create project for code stored at inputPath with the project name name. If name is empty, the project name is derived from inputPath. If a project for this name already exists, it is deleted from the workspace first. If no file or directory exists at inputPath, then no project is created. Returns the path to the project directory as an optional String, and None if there was an error.

Create project for code stored at inputPath with the project name name. If name is empty, the project name is derived from inputPath. If a project for this name already exists, it is deleted from the workspace first. If no file or directory exists at inputPath, then no project is created. Returns the path to the project directory as an optional String, and None if there was an error.

Attributes

def deleteCurrentProject(): Unit

Remove currently active project from workspace and delete all associated workspace files from disk.

Remove currently active project from workspace and delete all associated workspace files from disk.

Attributes

def deleteProject(name: String): Option[Unit]

Remove project with name name from workspace and delete all associated workspace files from disk.

Remove project with name name from workspace and delete all associated workspace files from disk.

Value parameters

name

the name of the project that should be removed

Attributes

def getActiveProject: Option[Project]

Retrieve the currently active project. If no project is active, None is returned.

Retrieve the currently active project. If no project is active, None is returned.

Attributes

def getNextOverlayDirName(baseCpg: Cpg, overlayName: String): String
def getPath: String
def loadedCpgs: List[Cpg]

A sorted list of all loaded CPGs

A sorted list of all loaded CPGs

Attributes

def numberOfProjects: Int

Return the number of projects currently present in this workspace.

Return the number of projects currently present in this workspace.

Attributes

def openProject(name: String, loader: String => Option[Cpg]): Option[Project]

Open project by name and return it. If a project with this name does not exist, None is returned. If the CPG of this project is loaded, it is unloaded first and then reloaded. Returns project or None on error.

Open project by name and return it. If a project with this name does not exist, None is returned. If the CPG of this project is loaded, it is unloaded first and then reloaded. Returns project or None on error.

Value parameters

loader

function to perform CPG loading. This parameter only exists for testing purposes.

name

of the project to load

Attributes

def overlayDir(inputPath: String): String

Overlay directory for CPG with given @inputPath

Overlay directory for CPG with given @inputPath

Attributes

def overlayDirByProjectName(name: String): String
def project(name: String): Option[Project]
def projectByCpg(baseCpg: Cpg): Option[ProjectType]

Workspace record for the CPG, or none, if the CPG is not in the workspace

Workspace record for the CPG, or none, if the CPG is not in the workspace

Attributes

def projectExists(inputPath: String): Boolean

Indicates whether a workspace record exists for @inputPath.

Indicates whether a workspace record exists for @inputPath.

Attributes

def projectExistsForCpg(baseCpg: Cpg): Boolean
def projects: List[Project]
def reloadCpgByName(name: String, loadCpg: String => Option[Cpg]): Option[Cpg]
def removeProject(name: String): Unit

Remove project named name from disk

Remove project named name from disk

Value parameters

name

name of the project

Attributes

def reset: Unit

Delete the workspace from disk, then initialize it again.

Delete the workspace from disk, then initialize it again.

Attributes

def setActiveProject(name: String): Option[ProjectType]

Set active project to project with name name. If a project with this name does not exist, does nothing.

Set active project to project with name name. If a project with this name does not exist, does nothing.

Attributes

override def toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
Any
def unloadCpgByProjectName(name: String): Unit

Deprecated methods

def baseCpgExists(inputPath: String, isLegacy: Boolean): Boolean

Attributes

Deprecated
true
def recordExists(inputPath: String): Boolean

Attributes

Deprecated
true

Inherited methods

def report(string: String): Unit

Attributes

Inherited from:
Reporting
def reportOutStream: OutputStream

Attributes

Inherited from:
Reporting