Class ProjectManager
a manager/factory class for creating new projects, for retrieving existing ones or for accessing the loaded projects
Apart from project factoring, The ProjectManager allows to specify the ACL (Access Control List) and to administer the online status of each project.
The ACL is described by the ProjectACL class, and provides information about which
ProjectConsumers can access to this project, and which grants they have. Specifically, for each
project, it contains the following descriptions:
- a list of
ProjectConsumers, together with their access permissionsProjectACL.AccessLevel. - a "lockable" property, telling if the project associated to this ACL, can be locked for use by a
ProjectConsumer, and by which modality
the online status of each project reports:
- the list of its consumers, together with the
for each of them - the
ProjectManager.OpenProjectsHolder.LockStatus, which is represented by a <ProjectACL.LockLevel,ProjectConsumer&rt;
TODO We should split ProjectManager into two classes: the real ProjectManager, and a ProjectFactory. ProjectManager should not deal with things like having "hands-in-the-details" of how a project is structured. ProjectFactory should do this.
- Author:
- Armando Stellato
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic interfacestatic enumstatic enum -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaccessProject(ProjectConsumer consumer, String projectName, ProjectACL.AccessLevel requestedAccessLevel, ProjectACL.LockLevel requestedLockLevel) ProjectConsumers may request access to a project through this method.checkAccessibility(ProjectConsumer consumer, Project project, ProjectACL.AccessLevel requestedAccessLevel, ProjectACL.LockLevel requestedLockLevel) voidcloneProjectToNewProject(String projectName, String newProjectName) this method copies a project to another location.createProject(ProjectConsumer consumer, String projectName, org.eclipse.rdf4j.model.Literal label, org.eclipse.rdf4j.model.IRI model, org.eclipse.rdf4j.model.IRI lexicalizationModel, String baseURI, String defaultNamespace, boolean historyEnabled, boolean validationEnabled, boolean blacklistingEnabled, RepositoryAccess repositoryAccess, String shardName, String coreRepoID, PluginSpecification coreRepoSailConfigurerSpecification, String coreBackendType, String supportRepoID, PluginSpecification supportRepoSailConfigurerSpecification, String supportBackendType, PluginSpecification uriGeneratorSpecification, PluginSpecification renderingEngineSpecification, List<Pair<RDFResourceRole, String>> resourceMetadataAssociations, File preloadedDataFile, org.eclipse.rdf4j.rio.RDFFormat preloadedDataFormat, boolean flattenGraphs, TransitiveImportMethodAllowance transitiveImportAllowance, Set<org.eclipse.rdf4j.model.IRI> failedImports, String leftDataset, String rightDataset, String refDataset, String docSet, boolean shaclEnabled, SHACLSettings shaclSettings, boolean trivialInferenceEnabled, boolean openAtStartup, ProjectACL.AccessLevel universalAccess, ProjectVisibility visibility, boolean undoEnabled, String description, Consumer<Project> callbackBeforeReturning) voiddeleteProject(String projectName) voiddisconnectFromProject(ProjectConsumer consumer, String projectName) this method allowsProjectConsumerconsumerto be disconnected from theProjectidentified byprojectName.
If the consumer isProjectConsumer.SYSTEM, thenprojectNameis disconnected in turn from the projects it consumes.booleanexistsProject(String projectName) voidexportProject(String projectName, File semTurkeyProjectFile) getAccessedLevel(String projectName, ProjectConsumer consumer) Return the access level with which the consumer is accessing the project.getLockingConsumer(String projectName) Returns the ProjectConsumer that is locking the given project.getLockingLevel(String projectName, ProjectConsumer consumer) Returns the LockLevel which with the project is locked by the consumer.getProject(String projectName) returns theProjectwith name =projectName.getProject(String projectName, boolean descriptionAllowed) getProjectBaseURI(String projectName) gets the baseuri of the project with nameprojectName.getProjectConsumer(String consumerName) returns a project consumer from its string description.getProjectCreatedAt(String projectName) gets the created_at of the project with nameprojectName.getProjectDefaultNamespace(String projectName) gets the default namespace of the project with nameprojectName.getProjectDescription(String projectName) returns a instance of a concrete implementation of classProject, with the sole exception that the project is not activated (no data is loaded)getProjectDir(String projectName) This method: invokesresolveProjectNameToDir(String)and gets the project dir associated to that name returns the directory if the project exists, otherwise throws aProjectInexistentExceptionstatic ProjectManagergetProjectProperty(String projectName, String property) gets the value of the given propertypropertyfor project with nameprojectNamegetProjectPropertyFileContent(String projectName) gets the project.info file content for project with nameprojectNamegetProjectPropertyMap(String projectName) gets name-value pairs for each property of project with nameprojectNamelonggetProjectTimeStamp(String projectName) gets the timestamp of the project with nameprojectName.getProjectVisibility(String projectName) getRequiredProjectProperty(String projectName, String property) getSearchStatusForProject(String projectId) static ProjectManagerstatic ProjectManagervoidhandleProjectExclusively(String projectName, Consumer<Project> projectConsumer) booleanbooleanlistOpenProjects(ProjectConsumer consumer) lists the open projects.listProjects(ProjectConsumer consumer) lists the projects available (stored in the projects directory of Semantic Turkey).booleanprojectExists(String projectName) static voidregisterProjectEventHandler(ProjectManager.ProjectEventHandler handler, boolean includeSystem) voidremoveSearchStatusForProject(String projectId) resolveProjectNameToDir(String projectName) returns the directory of a project given its name.static ProjectresolveProjectReference(String projectReference) static ProjectresolveProjectReference(String projectReference, boolean descriptionAllowed) voidsaveProjectPropertyFileContent(String projectName, String content) saves the project.info file content for project with nameprojectNamestatic voidsetExtensionPointManager(ExtensionPointManager exptManager) voidsetProjectProperty(String projectName, String property, String propValue) sets the value of the given propertypropertyfor project with nameprojectNamevoidsetSearchStatus(String projectId, ProjectManager.SearchStatusValues searchStatusValues) static voidunregisterProjectEventHandler(ProjectManager.ProjectEventHandler handler, boolean includeSystem)
-
Field Details
-
logger
protected static org.slf4j.Logger logger
-
-
Constructor Details
-
ProjectManager
-
-
Method Details
-
setExtensionPointManager
-
registerProjectEventHandler
public static void registerProjectEventHandler(ProjectManager.ProjectEventHandler handler, boolean includeSystem) -
unregisterProjectEventHandler
public static void unregisterProjectEventHandler(ProjectManager.ProjectEventHandler handler, boolean includeSystem) -
getUserProjectManager
-
getSystemProjectManager
-
getProjectManager
-
resolveProjectReference
-
resolveProjectReference
-
setSearchStatus
-
getSearchStatusForProject
-
removeSearchStatusForProject
-
listProjects
public Collection<AbstractProject> listProjects(ProjectConsumer consumer) throws ProjectAccessException lists the projects available (stored in the projects directory of Semantic Turkey). Ifconsumeris not null, filters the list by reporting only the projects which containconsumerin their ACL- Parameters:
consumer- ifnull, all the projects in the projects folder are listed. Corrupted projects are also listed in this case.- Returns:
- Throws:
ProjectAccessException
-
listProjects
- Throws:
ProjectAccessException
-
listOpenProjects
lists the open projects. Ifconsumeris not null, filters the list by reporting only the projects which containconsumerin their ACL- Parameters:
consumer- ifnull, all the open projects- Returns:
- Throws:
ProjectAccessException
-
deleteProject
public void deleteProject(String projectName) throws ProjectDeletionException, ProjectAccessException, ProjectUpdateException, ReservedPropertyUpdateException, InvalidProjectNameException, ProjectInexistentException - Parameters:
projectName-- Throws:
ProjectDeletionExceptionProjectAccessExceptionProjectUpdateExceptionReservedPropertyUpdateExceptionInvalidProjectNameExceptionProjectInexistentException
-
getProject
returns theProjectwith name =projectName. In case no project with that name is open,nullis returned.- Parameters:
projectName-- Returns:
-
getProject
public Project getProject(String projectName, boolean descriptionAllowed) throws ProjectAccessException, InvalidProjectNameException, ProjectInexistentException -
existsProject
- Throws:
InvalidProjectNameException
-
getProjectConsumer
returns a project consumer from its string description. A valid project consumer is eitherProjectConsumer.SYSTEMor an open project. IfconsumerName- Parameters:
consumerName-- Returns:
-
cloneProjectToNewProject
public void cloneProjectToNewProject(String projectName, String newProjectName) throws InvalidProjectNameException, DuplicatedResourceException, IOException, ProjectInexistentException, ProjectAccessException this method copies a project to another location. The project identified byprojectNamemust not be open.- Parameters:
projectName-newProjectName-- Throws:
InvalidProjectNameExceptionDuplicatedResourceExceptionIOExceptionProjectInexistentExceptionProjectAccessException
-
getProjectDir
public File getProjectDir(String projectName) throws InvalidProjectNameException, ProjectInexistentException This method:- invokes
resolveProjectNameToDir(String)and gets the project dir associated to that name - returns the directory if the project exists, otherwise throws a
ProjectInexistentException
- Parameters:
projectName-- Returns:
- Throws:
InvalidProjectNameExceptionProjectInexistentException
- invokes
-
projectExists
- Throws:
InvalidProjectNameException
-
resolveProjectNameToDir
returns the directory of a project given its name. This is based on the assumption that the project directory is assigned on the basis of project's name (as done by the ProjectManager).
Note that this method does not guarantees that the project dir (and thus the project) exists- Parameters:
projectName-- Returns:
- Throws:
InvalidProjectNameException
-
exportProject
public void exportProject(String projectName, File semTurkeyProjectFile) throws IOException, ProjectAccessException - Throws:
IOExceptionProjectAccessException
-
getProjectDescription
public Project getProjectDescription(String projectName) throws InvalidProjectNameException, ProjectInexistentException, ProjectAccessException returns a instance of a concrete implementation of classProject, with the sole exception that the project is not activated (no data is loaded)- Parameters:
projectName-- Returns:
- Throws:
InvalidProjectNameExceptionProjectInexistentExceptionProjectAccessException
-
setProjectProperty
public void setProjectProperty(String projectName, String property, String propValue) throws IOException, InvalidProjectNameException, ProjectInexistentException sets the value of the given propertypropertyfor project with nameprojectNameuse specific get methods for standard project properties; this method is left public to support customized properties defined over projects
- Parameters:
projectName-property-propValue-- Throws:
IOExceptionInvalidProjectNameExceptionProjectInexistentException
-
getProjectProperty
public String getProjectProperty(String projectName, String property) throws IOException, InvalidProjectNameException, ProjectInexistentException gets the value of the given propertypropertyfor project with nameprojectNameuse specific get methods for standard project properties; this method is left public to support customized properties defined over projects
- Parameters:
projectName-property-- Returns:
- Throws:
IOExceptionInvalidProjectNameExceptionProjectInexistentException
-
getProjectPropertyMap
public Map<String,String> getProjectPropertyMap(String projectName) throws IOException, InvalidProjectNameException, ProjectInexistentException gets name-value pairs for each property of project with nameprojectName- Parameters:
projectName-- Returns:
- Throws:
IOExceptionInvalidProjectNameExceptionProjectInexistentException
-
getProjectPropertyFileContent
public String getProjectPropertyFileContent(String projectName) throws IOException, InvalidProjectNameException, ProjectInexistentException gets the project.info file content for project with nameprojectName- Parameters:
projectName-- Returns:
- Throws:
IOExceptionInvalidProjectNameExceptionProjectInexistentException
-
saveProjectPropertyFileContent
public void saveProjectPropertyFileContent(String projectName, String content) throws IOException, InvalidProjectNameException, ProjectInexistentException saves the project.info file content for project with nameprojectName- Parameters:
projectName-content-- Throws:
IOExceptionInvalidProjectNameExceptionProjectInexistentException
-
getRequiredProjectProperty
public String getRequiredProjectProperty(String projectName, String property) throws ProjectInconsistentException, IOException, InvalidProjectNameException, ProjectInexistentException - Parameters:
projectName-property-- Returns:
- Throws:
ProjectInconsistentExceptionIOExceptionInvalidProjectNameExceptionProjectInexistentException
-
getProjectBaseURI
public String getProjectBaseURI(String projectName) throws IOException, InvalidProjectNameException, ProjectInexistentException gets the baseuri of the project with nameprojectName.- Parameters:
projectName-- Returns:
- Throws:
IOExceptionProjectInexistentExceptionInvalidProjectNameException
-
getProjectDefaultNamespace
public String getProjectDefaultNamespace(String projectName) throws IOException, InvalidProjectNameException, ProjectInexistentException gets the default namespace of the project with nameprojectName.- Parameters:
projectName-- Returns:
- Throws:
IOExceptionProjectInexistentExceptionInvalidProjectNameException
-
getProjectTimeStamp
public long getProjectTimeStamp(String projectName) throws IOException, InvalidProjectNameException, ProjectInexistentException gets the timestamp of the project with nameprojectName.- Parameters:
projectName-- Returns:
- Throws:
ProjectInexistentExceptionInvalidProjectNameExceptionIOExceptionIOException
-
getProjectCreatedAt
public String getProjectCreatedAt(String projectName) throws InvalidProjectNameException, ProjectInexistentException, IOException gets the created_at of the project with nameprojectName.- Parameters:
projectName-- Returns:
- Throws:
ProjectInexistentExceptionInvalidProjectNameExceptionIOExceptionIOException
-
getProjectVisibility
public String getProjectVisibility(String projectName) throws InvalidProjectNameException, ProjectInexistentException, IOException -
checkAccessibility
public ProjectManager.AccessResponse checkAccessibility(ProjectConsumer consumer, Project project, ProjectACL.AccessLevel requestedAccessLevel, ProjectACL.LockLevel requestedLockLevel) -
accessProject
public Project accessProject(ProjectConsumer consumer, String projectName, ProjectACL.AccessLevel requestedAccessLevel, ProjectACL.LockLevel requestedLockLevel) throws InvalidProjectNameException, ProjectInexistentException, ProjectAccessException, ForbiddenProjectAccessException ProjectConsumers may request access to a project through this method. TheProjectManagerverifies that the access can be granted to the requesting consumer, and in affirmative case handles all the necessary operations (verifying that the project is open, or opening it in negative case and adding it to the list of open projects, making its data available) to make the project available to the consumer.- Parameters:
consumer-projectName-requestedAccessLevel-requestedLockLevel-- Returns:
- Throws:
InvalidProjectNameExceptionProjectInexistentExceptionProjectAccessExceptionForbiddenProjectAccessExceptionProjectBindingException
-
disconnectFromProject
this method allowsProjectConsumerconsumerto be disconnected from theProjectidentified byprojectName.
If the consumer isProjectConsumer.SYSTEM, thenprojectNameis disconnected in turn from the projects it consumes.- Parameters:
consumer-projectName-
-
isOpen
-
isOpen
-
getAccessedLevel
public ProjectACL.AccessLevel getAccessedLevel(String projectName, ProjectConsumer consumer) throws InvalidProjectNameException, ProjectInexistentException, ProjectAccessException Return the access level with which the consumer is accessing the project. Null if the consumer does not access the given project.- Parameters:
projectName-consumer-- Returns:
- Throws:
ProjectAccessExceptionProjectInexistentExceptionInvalidProjectNameException
-
getLockingConsumer
public ProjectConsumer getLockingConsumer(String projectName) throws InvalidProjectNameException, ProjectInexistentException, ProjectAccessException Returns the ProjectConsumer that is locking the given project.nullif the project is not currently locked- Parameters:
projectName-- Returns:
- Throws:
InvalidProjectNameExceptionProjectInexistentExceptionProjectAccessException
-
getLockingLevel
public ProjectACL.LockLevel getLockingLevel(String projectName, ProjectConsumer consumer) throws InvalidProjectNameException, ProjectInexistentException, ProjectAccessException Returns the LockLevel which with the project is locked by the consumer.nullif the project is not locked by the given consumer.- Parameters:
projectName-consumer-- Returns:
- Throws:
InvalidProjectNameExceptionProjectInexistentExceptionProjectAccessException
-
createProject
public Project createProject(ProjectConsumer consumer, String projectName, org.eclipse.rdf4j.model.Literal label, org.eclipse.rdf4j.model.IRI model, org.eclipse.rdf4j.model.IRI lexicalizationModel, String baseURI, String defaultNamespace, boolean historyEnabled, boolean validationEnabled, boolean blacklistingEnabled, RepositoryAccess repositoryAccess, String shardName, String coreRepoID, PluginSpecification coreRepoSailConfigurerSpecification, String coreBackendType, String supportRepoID, PluginSpecification supportRepoSailConfigurerSpecification, String supportBackendType, PluginSpecification uriGeneratorSpecification, PluginSpecification renderingEngineSpecification, List<Pair<RDFResourceRole, String>> resourceMetadataAssociations, File preloadedDataFile, org.eclipse.rdf4j.rio.RDFFormat preloadedDataFormat, boolean flattenGraphs, TransitiveImportMethodAllowance transitiveImportAllowance, Set<org.eclipse.rdf4j.model.IRI> failedImports, String leftDataset, String rightDataset, String refDataset, String docSet, boolean shaclEnabled, SHACLSettings shaclSettings, boolean trivialInferenceEnabled, boolean openAtStartup, ProjectACL.AccessLevel universalAccess, ProjectVisibility visibility, boolean undoEnabled, String description, Consumer<Project> callbackBeforeReturning) throws InvalidProjectNameException, ProjectInexistentException, ProjectAccessException, ForbiddenProjectAccessException, DuplicatedResourceException, ProjectCreationException, ClassNotFoundException, WrongPropertiesException, RBACException, UnsupportedModelException, UnsupportedLexicalizationModelException, ProjectInconsistentException, InvalidConfigurationException, STPropertyAccessException, IOException, ReservedPropertyUpdateException, ProjectUpdateException, STPropertyUpdateException, NoSuchConfigurationManager- Throws:
InvalidProjectNameExceptionProjectInexistentExceptionProjectAccessExceptionForbiddenProjectAccessExceptionDuplicatedResourceExceptionProjectCreationExceptionClassNotFoundExceptionWrongPropertiesExceptionRBACExceptionUnsupportedModelExceptionUnsupportedLexicalizationModelExceptionProjectInconsistentExceptionInvalidConfigurationExceptionSTPropertyAccessExceptionIOExceptionReservedPropertyUpdateExceptionProjectUpdateExceptionSTPropertyUpdateExceptionNoSuchConfigurationManager
-
handleProjectExclusively
public void handleProjectExclusively(String projectName, Consumer<Project> projectConsumer) throws ProjectAccessException, InvalidProjectNameException, ProjectInexistentException
-