Package com.powsybl.afs
Class AppFileSystem
- java.lang.Object
-
- com.powsybl.afs.AppFileSystem
-
- All Implemented Interfaces:
AutoCloseable
public class AppFileSystem extends Object implements AutoCloseable
An AppFileSystem instance is a tree ofNode
objects, starting with its root folder.Node
objects may beFolder
s orFile
, or any new file type added by the user through the extension mechanism (seeFileExtension
). An application may have several instances ofAppFileSystem
, each one with a unique name. They are accessed through the parentAppData
instance.The AppFileSystem is backed by an
AppStorage
implementation, which is in charge of maintaining the state of data of the AppFileSystem. The implementation may bring additional functionalities: in-memory storage, database storage, remote storage, ...Users of an AppFileSystem should not need to interact directly with the underlying
AppStorage
.- Author:
- Geoffroy Jamgotchian
-
-
Field Summary
Fields Modifier and Type Field Description static String
FS_SEPARATOR
static String
PATH_SEPARATOR
-
Constructor Summary
Constructors Constructor Description AppFileSystem(String name, boolean remotelyAccessible, AppStorage storage)
AppFileSystem(String name, boolean remotelyAccessible, AppStorage storage, TaskMonitor taskMonitor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<FileSystemCheckIssue>
checkFileSystem(FileSystemCheckOptions options)
void
close()
Node
createNode(NodeInfo nodeInfo)
Creates a new Node in this file system.AbstractNodeBase
fetchNode(String nodeId)
Retrieve a project node with undefined classAbstractNodeBase
fetchNode(String nodeId, boolean connected)
Retrieve a project node with undefined classOptional<Project>
findProject(String projectId)
Get a project by its ID<T extends ProjectFile>
TfindProjectFile(String projectFileId, Class<T> clazz)
Get a project file by its ID.ProjectFolder
findProjectFolder(String projectFolderId)
Get a project folder by its ID.AppData
getData()
EventsBus
getEventBus()
String
getName()
Folder
getRootFolder()
TaskMonitor
getTaskMonitor()
boolean
isClosed()
boolean
isRemotelyAccessible()
-
-
-
Field Detail
-
FS_SEPARATOR
public static final String FS_SEPARATOR
- See Also:
- Constant Field Values
-
PATH_SEPARATOR
public static final String PATH_SEPARATOR
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AppFileSystem
public AppFileSystem(String name, boolean remotelyAccessible, AppStorage storage)
-
AppFileSystem
public AppFileSystem(String name, boolean remotelyAccessible, AppStorage storage, TaskMonitor taskMonitor)
-
-
Method Detail
-
getName
public String getName()
-
isRemotelyAccessible
public boolean isRemotelyAccessible()
-
getEventBus
public EventsBus getEventBus()
-
getRootFolder
public Folder getRootFolder()
-
createNode
public Node createNode(NodeInfo nodeInfo)
Creates a new Node in this file system. This is a low level method, and should seldom be used by the AFS API users.
-
findProjectFile
public <T extends ProjectFile> T findProjectFile(String projectFileId, Class<T> clazz)
Get a project file by its ID.
-
fetchNode
public AbstractNodeBase fetchNode(String nodeId, boolean connected)
Retrieve a project node with undefined class- Parameters:
nodeId
- the node Id- Returns:
- a typed node
- Throws:
AfsStorageException
- if the node not found
-
fetchNode
public AbstractNodeBase fetchNode(String nodeId)
Retrieve a project node with undefined class- Parameters:
nodeId
- the node Id- Returns:
- a typed node
-
findProject
public Optional<Project> findProject(String projectId)
Get a project by its ID- Parameters:
projectId
- projectID- Returns:
- the optionally found project
-
findProjectFolder
public ProjectFolder findProjectFolder(String projectFolderId)
Get a project folder by its ID.
-
getTaskMonitor
public TaskMonitor getTaskMonitor()
-
getData
public AppData getData()
-
isClosed
public boolean isClosed()
-
checkFileSystem
public List<FileSystemCheckIssue> checkFileSystem(FileSystemCheckOptions options)
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
-
-