Package com.powsybl.afs
Class AppData
- java.lang.Object
-
- com.powsybl.afs.AppData
-
- All Implemented Interfaces:
AutoCloseable
public class AppData extends Object implements AutoCloseable
An instance of AppData is the root of an application file system. Usually, an application will only have one instance of AppData. It is the first entrypoint of AFS, through which you can access to individualAppFileSystem
objects.//Get AppData instance. AppData appData = ... //Print file system names to console appData.getFileSystems().stream().map(AppFileSystem::getName).forEach(System.out::println); //Get file system with name "fs1" AppFileSystem fs1 = appData.getFileSystem("fs1"); //Get root folder of "fs1" Folder root = fs1.getRootFolder(); //Get the node of type Project at /folder1/folder2/my_project, if it exists. Optional<Project> project = root.getChild(Project.class, "folder1", "folder2", "my_project"); ...
- Author:
- Geoffroy Jamgotchian
-
-
Constructor Summary
Constructors Constructor Description AppData(com.powsybl.computation.ComputationManager shortTimeExecutionComputationManager, com.powsybl.computation.ComputationManager longTimeExecutionComputationManager)
AppData(com.powsybl.computation.ComputationManager shortTimeExecutionComputationManager, com.powsybl.computation.ComputationManager longTimeExecutionComputationManager, EventsBus eventsBus)
AppData(com.powsybl.computation.ComputationManager shortTimeExecutionComputationManager, com.powsybl.computation.ComputationManager longTimeExecutionComputationManager, List<AppFileSystemProvider> fileSystemProviders)
AppData(com.powsybl.computation.ComputationManager shortTimeExecutionComputationManager, com.powsybl.computation.ComputationManager longTimeExecutionComputationManager, List<AppFileSystemProvider> fileSystemProviders, EventsBus eventsBus)
AppData(com.powsybl.computation.ComputationManager shortTimeExecutionComputationManager, com.powsybl.computation.ComputationManager longTimeExecutionComputationManager, List<AppFileSystemProvider> fileSystemProviders, List<FileExtension> fileExtensions, List<ProjectFileExtension> projectFileExtensions, List<ServiceExtension> serviceExtensions)
AppData(com.powsybl.computation.ComputationManager shortTimeExecutionComputationManager, com.powsybl.computation.ComputationManager longTimeExecutionComputationManager, List<AppFileSystemProvider> fileSystemProviders, List<FileExtension> fileExtensions, List<ProjectFileExtension> projectFileExtensions, List<ServiceExtension> serviceExtensions, EventsBus eventsBus)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addFileSystem(AppFileSystem fileSystem)
void
close()
Closes any resources used by underlying file systems.<U> U
findService(Class<U> serviceClass, boolean remoteStorage)
Gets a registered service of type U.EventsBus
getEventsBus()
get the appData event Store instance.AppFileSystem
getFileSystem(String name)
Gets a file system by itsname
.Collection<AppFileSystem>
getFileSystems()
The list of available file systems.com.powsybl.computation.ComputationManager
getLongTimeExecutionComputationManager()
Optional<Node>
getNode(String pathStr)
Set<Class<? extends ProjectFile>>
getProjectFileClasses()
List<String>
getRemotelyAccessibleFileSystemNames()
Gets the list of remotely accessible file systems.AppStorage
getRemotelyAccessibleStorage(String fileSystemName)
Gets low level storage interface for remotely accessible file systems.com.powsybl.computation.ComputationManager
getShortTimeExecutionComputationManager()
void
setTokenProvider(SecurityTokenProvider tokenProvider)
-
-
-
Constructor Detail
-
AppData
public AppData(com.powsybl.computation.ComputationManager shortTimeExecutionComputationManager, com.powsybl.computation.ComputationManager longTimeExecutionComputationManager)
-
AppData
public AppData(com.powsybl.computation.ComputationManager shortTimeExecutionComputationManager, com.powsybl.computation.ComputationManager longTimeExecutionComputationManager, EventsBus eventsBus)
-
AppData
public AppData(com.powsybl.computation.ComputationManager shortTimeExecutionComputationManager, com.powsybl.computation.ComputationManager longTimeExecutionComputationManager, List<AppFileSystemProvider> fileSystemProviders)
-
AppData
public AppData(com.powsybl.computation.ComputationManager shortTimeExecutionComputationManager, com.powsybl.computation.ComputationManager longTimeExecutionComputationManager, List<AppFileSystemProvider> fileSystemProviders, EventsBus eventsBus)
-
AppData
public AppData(com.powsybl.computation.ComputationManager shortTimeExecutionComputationManager, com.powsybl.computation.ComputationManager longTimeExecutionComputationManager, List<AppFileSystemProvider> fileSystemProviders, List<FileExtension> fileExtensions, List<ProjectFileExtension> projectFileExtensions, List<ServiceExtension> serviceExtensions)
-
AppData
public AppData(com.powsybl.computation.ComputationManager shortTimeExecutionComputationManager, com.powsybl.computation.ComputationManager longTimeExecutionComputationManager, List<AppFileSystemProvider> fileSystemProviders, List<FileExtension> fileExtensions, List<ProjectFileExtension> projectFileExtensions, List<ServiceExtension> serviceExtensions, EventsBus eventsBus)
-
-
Method Detail
-
addFileSystem
public void addFileSystem(AppFileSystem fileSystem)
-
getFileSystems
public Collection<AppFileSystem> getFileSystems()
The list of available file systems.
-
getFileSystem
public AppFileSystem getFileSystem(String name)
Gets a file system by itsname
.
-
setTokenProvider
public void setTokenProvider(SecurityTokenProvider tokenProvider)
-
getProjectFileClasses
public Set<Class<? extends ProjectFile>> getProjectFileClasses()
-
getShortTimeExecutionComputationManager
public com.powsybl.computation.ComputationManager getShortTimeExecutionComputationManager()
-
getLongTimeExecutionComputationManager
public com.powsybl.computation.ComputationManager getLongTimeExecutionComputationManager()
-
getRemotelyAccessibleFileSystemNames
public List<String> getRemotelyAccessibleFileSystemNames()
Gets the list of remotely accessible file systems. Should not be used by the AFS API users.
-
getRemotelyAccessibleStorage
public AppStorage getRemotelyAccessibleStorage(String fileSystemName)
Gets low level storage interface for remotely accessible file systems. Should not be used by the AFS API users.
-
findService
public <U> U findService(Class<U> serviceClass, boolean remoteStorage)
Gets a registered service of type U. To register a service, seeServiceExtension
.- Parameters:
serviceClass
- the requested service typeremoteStorage
- iftrue
, tries to get a remote implementation first.- Throws:
AfsException
- if no service implementation is found.
-
getEventsBus
public EventsBus getEventsBus()
get the appData event Store instance.
-
close
public void close()
Closes any resources used by underlying file systems.- Specified by:
close
in interfaceAutoCloseable
-
-