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
ProjectConsumer
s can access to this project, and which grants they have. Specifically, for each
project, it contains the following descriptions:
- a list of
ProjectConsumer
s, 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;
- Author:
- Armando Stellato
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static class
static interface
static enum
static enum
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Project
accessProject
(ProjectConsumer consumer, String projectName, ProjectACL.AccessLevel requestedAccessLevel, ProjectACL.LockLevel requestedLockLevel) ProjectConsumer
s may request access to a project through this method.checkAccessibility
(ProjectConsumer consumer, Project project, ProjectACL.AccessLevel requestedAccessLevel, ProjectACL.LockLevel requestedLockLevel) static void
cloneProjectToNewProject
(String projectName, String newProjectName) this method copies a project to another location.static 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, boolean historyEnabled, boolean validationEnabled, boolean blacklistingEnabled, RepositoryAccess repositoryAccess, 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, TransitiveImportMethodAllowance transitiveImportAllowance, Set<org.eclipse.rdf4j.model.IRI> failedImports, String leftDataset, String rightDataset, boolean shaclEnabled, SHACLSettings shaclSettings, boolean trivialInferenceEnabled, boolean openAtStartup, ProjectACL.AccessLevel universalAccess, boolean undoEnabled) static void
deleteProject
(String projectName) static void
disconnectFromProject
(ProjectConsumer consumer, String projectName) this method allowsProjectConsumer
consumer
to be disconnected from theProject
identified byprojectName
.
If the consumer isProjectConsumer.SYSTEM
, thenprojectName
is disconnected in turn from the projects it consumes.static boolean
existsProject
(String projectName) static void
exportProject
(String projectName, File semTurkeyProjectFile) static ProjectACL.AccessLevel
getAccessedLevel
(String projectName, ProjectConsumer consumer) Return the access level with which the consumer is accessing the project.static ProjectConsumer
getLockingConsumer
(String projectName) Returns the ProjectConsumer that is locking the given project.static ProjectACL.LockLevel
getLockingLevel
(String projectName, ProjectConsumer consumer) Returns the LockLevel which with the project is locked by the consumer.static Project
getProject
(String projectName) returns theProject
with name =projectName
.static Project
getProject
(String projectName, boolean descriptionAllowed) static String
getProjectBaseURI
(String projectName) gets the baseuri of the project with nameprojectName
.static ProjectConsumer
getProjectConsumer
(String consumerName) returns a project consumer from its string description.static String
getProjectCreatedAt
(String projectName) gets the created_at of the project with nameprojectName
.static String
getProjectDefaultNamespace
(String projectName) gets the default namespace of the project with nameprojectName
.static Project
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)static File
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 aProjectInexistentException
static String
getProjectProperty
(String projectName, String property) gets the value of the given propertyproperty
for project with nameprojectName
static String
getProjectPropertyFileContent
(String projectName) gets the project.info file content for project with nameprojectName
getProjectPropertyMap
(String projectName) gets name-value pairs for each property of project with nameprojectName
static long
getProjectTimeStamp
(String projectName) gets the timestamp of the project with nameprojectName
.static String
getRequiredProjectProperty
(String projectName, String property) getSearchStatusForProject
(String projectId) static void
handleProjectExclusively
(String projectName, Consumer<Project> projectConsumer) static void
importProject
(File semTurkeyProjectFile, String name) static boolean
static boolean
static Collection<Project>
static Collection<Project>
listOpenProjects
(ProjectConsumer consumer) lists the open projects.static Collection<AbstractProject>
static Collection<AbstractProject>
listProjects
(ProjectConsumer consumer) lists the projects available (stored in the projects directory of Semantic Turkey).static boolean
projectExists
(String projectName) static void
static void
removeSearchStatusForProject
(String projectId) static File
resolveProjectNameToDir
(String projectName) returns the directory of a project given its name.static void
saveProjectPropertyFileContent
(String projectName, String content) saves the project.info file content for project with nameprojectName
static void
setExtensionPointManager
(ExtensionPointManager exptManager) static void
setProjectProperty
(String projectName, String property, String propValue) sets the value of the given propertyproperty
for project with nameprojectName
static void
setSearchStatus
(String projectId, ProjectManager.SearchStatusValues searchStatusValues) static void
-
Field Details
-
triples_exchange_FileName
- See Also:
-
logger
protected static org.slf4j.Logger logger
-
-
Constructor Details
-
ProjectManager
public ProjectManager()
-
-
Method Details
-
setSearchStatus
public static void setSearchStatus(String projectId, ProjectManager.SearchStatusValues searchStatusValues) -
getSearchStatusForProject
-
removeSearchStatusForProject
-
setExtensionPointManager
-
registerProjectEventHandler
-
unregisterProjectEventHandler
-
listProjects
public static Collection<AbstractProject> listProjects(ProjectConsumer consumer) throws ProjectAccessException lists the projects available (stored in the projects directory of Semantic Turkey). Ifconsumer
is not null, filters the list by reporting only the projects which containconsumer
in 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. Ifconsumer
is not null, filters the list by reporting only the projects which containconsumer
in their ACL- Parameters:
consumer
- ifnull
, all the open projects- Returns:
- Throws:
ProjectAccessException
-
listOpenProjects
-
deleteProject
public static void deleteProject(String projectName) throws ProjectDeletionException, ProjectAccessException, ProjectUpdateException, ReservedPropertyUpdateException, InvalidProjectNameException, ProjectInexistentException - Parameters:
projectName
-- Throws:
ProjectDeletionException
ProjectAccessException
ProjectUpdateException
ReservedPropertyUpdateException
InvalidProjectNameException
ProjectInexistentException
-
getProject
returns theProject
with name =projectName
. In case no project with that name is open,null
is returned.- Parameters:
projectName
-- Returns:
-
getProject
public static 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.SYSTEM
or an open project. IfconsumerName
- Parameters:
consumerName
-- Returns:
-
cloneProjectToNewProject
public static void cloneProjectToNewProject(String projectName, String newProjectName) throws InvalidProjectNameException, DuplicatedResourceException, IOException, ProjectInexistentException, ProjectAccessException this method copies a project to another location. The project identified byprojectName
must not be open.- Parameters:
projectName
-newProjectName
-- Throws:
InvalidProjectNameException
DuplicatedResourceException
IOException
ProjectInexistentException
ProjectAccessException
-
getProjectDir
public static 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:
InvalidProjectNameException
ProjectInexistentException
- 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 static void exportProject(String projectName, File semTurkeyProjectFile) throws IOException, ProjectAccessException - Throws:
IOException
ProjectAccessException
-
importProject
public static void importProject(File semTurkeyProjectFile, String name) throws IOException, ProjectCreationException, DuplicatedResourceException, ProjectUpdateException, InvalidProjectNameException -
getProjectDescription
public static 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:
InvalidProjectNameException
ProjectInexistentException
ProjectAccessException
-
setProjectProperty
public static void setProjectProperty(String projectName, String property, String propValue) throws IOException, InvalidProjectNameException, ProjectInexistentException sets the value of the given propertyproperty
for project with nameprojectName
use specific get methods for standard project properties; this method is left public to support customized properties defined over projects
- Parameters:
projectName
-property
-propValue
-- Throws:
IOException
InvalidProjectNameException
ProjectInexistentException
-
getProjectProperty
public static String getProjectProperty(String projectName, String property) throws IOException, InvalidProjectNameException, ProjectInexistentException gets the value of the given propertyproperty
for project with nameprojectName
use specific get methods for standard project properties; this method is left public to support customized properties defined over projects
- Parameters:
projectName
-property
-- Returns:
- Throws:
IOException
InvalidProjectNameException
ProjectInexistentException
-
getProjectPropertyMap
public static 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:
IOException
InvalidProjectNameException
ProjectInexistentException
-
getProjectPropertyFileContent
public static String getProjectPropertyFileContent(String projectName) throws IOException, InvalidProjectNameException, ProjectInexistentException gets the project.info file content for project with nameprojectName
- Parameters:
projectName
-- Returns:
- Throws:
IOException
InvalidProjectNameException
ProjectInexistentException
-
saveProjectPropertyFileContent
public static void saveProjectPropertyFileContent(String projectName, String content) throws IOException, InvalidProjectNameException, ProjectInexistentException saves the project.info file content for project with nameprojectName
- Parameters:
projectName
-content
-- Throws:
IOException
InvalidProjectNameException
ProjectInexistentException
-
getRequiredProjectProperty
public static String getRequiredProjectProperty(String projectName, String property) throws ProjectInconsistentException, IOException, InvalidProjectNameException, ProjectInexistentException - Parameters:
projectName
-property
-- Returns:
- Throws:
ProjectInconsistentException
IOException
InvalidProjectNameException
ProjectInexistentException
-
getProjectBaseURI
public static String getProjectBaseURI(String projectName) throws IOException, InvalidProjectNameException, ProjectInexistentException gets the baseuri of the project with nameprojectName
.- Parameters:
projectName
-- Returns:
- Throws:
IOException
ProjectInexistentException
InvalidProjectNameException
-
getProjectDefaultNamespace
public static String getProjectDefaultNamespace(String projectName) throws IOException, InvalidProjectNameException, ProjectInexistentException gets the default namespace of the project with nameprojectName
.- Parameters:
projectName
-- Returns:
- Throws:
IOException
ProjectInexistentException
InvalidProjectNameException
-
getProjectTimeStamp
public static long getProjectTimeStamp(String projectName) throws IOException, InvalidProjectNameException, ProjectInexistentException gets the timestamp of the project with nameprojectName
.- Parameters:
projectName
-- Returns:
- Throws:
ProjectInexistentException
InvalidProjectNameException
IOException
IOException
-
getProjectCreatedAt
public static String getProjectCreatedAt(String projectName) throws InvalidProjectNameException, ProjectInexistentException, IOException gets the created_at of the project with nameprojectName
.- Parameters:
projectName
-- Returns:
- Throws:
ProjectInexistentException
InvalidProjectNameException
IOException
IOException
-
checkAccessibility
public static ProjectManager.AccessResponse checkAccessibility(ProjectConsumer consumer, Project project, ProjectACL.AccessLevel requestedAccessLevel, ProjectACL.LockLevel requestedLockLevel) -
accessProject
public static Project accessProject(ProjectConsumer consumer, String projectName, ProjectACL.AccessLevel requestedAccessLevel, ProjectACL.LockLevel requestedLockLevel) throws InvalidProjectNameException, ProjectInexistentException, ProjectAccessException, ForbiddenProjectAccessException ProjectConsumer
s may request access to a project through this method. TheProjectManager
verifies 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:
InvalidProjectNameException
ProjectInexistentException
ProjectAccessException
ForbiddenProjectAccessException
ProjectBindingException
-
disconnectFromProject
this method allowsProjectConsumer
consumer
to be disconnected from theProject
identified byprojectName
.
If the consumer isProjectConsumer.SYSTEM
, thenprojectName
is disconnected in turn from the projects it consumes.- Parameters:
consumer
-projectName
-
-
isOpen
-
isOpen
-
getAccessedLevel
public static 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:
ProjectAccessException
ProjectInexistentException
InvalidProjectNameException
-
getLockingConsumer
public static ProjectConsumer getLockingConsumer(String projectName) throws InvalidProjectNameException, ProjectInexistentException, ProjectAccessException Returns the ProjectConsumer that is locking the given project.null
if the project is not currently locked- Parameters:
projectName
-- Returns:
- Throws:
InvalidProjectNameException
ProjectInexistentException
ProjectAccessException
-
getLockingLevel
public static ProjectACL.LockLevel getLockingLevel(String projectName, ProjectConsumer consumer) throws InvalidProjectNameException, ProjectInexistentException, ProjectAccessException Returns the LockLevel which with the project is locked by the consumer.null
if the project is not locked by the given consumer.- Parameters:
projectName
-consumer
-- Returns:
- Throws:
InvalidProjectNameException
ProjectInexistentException
ProjectAccessException
-
createProject
public static 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, boolean historyEnabled, boolean validationEnabled, boolean blacklistingEnabled, RepositoryAccess repositoryAccess, 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, TransitiveImportMethodAllowance transitiveImportAllowance, Set<org.eclipse.rdf4j.model.IRI> failedImports, String leftDataset, String rightDataset, boolean shaclEnabled, SHACLSettings shaclSettings, boolean trivialInferenceEnabled, boolean openAtStartup, ProjectACL.AccessLevel universalAccess, boolean undoEnabled) throws InvalidProjectNameException, ProjectInexistentException, ProjectAccessException, ForbiddenProjectAccessException, DuplicatedResourceException, ProjectCreationException, ClassNotFoundException, WrongPropertiesException, RBACException, UnsupportedModelException, UnsupportedLexicalizationModelException, ProjectInconsistentException, InvalidConfigurationException, STPropertyAccessException, IOException, ReservedPropertyUpdateException, ProjectUpdateException, STPropertyUpdateException, NoSuchConfigurationManager- Throws:
InvalidProjectNameException
ProjectInexistentException
ProjectAccessException
ForbiddenProjectAccessException
DuplicatedResourceException
ProjectCreationException
ClassNotFoundException
WrongPropertiesException
RBACException
UnsupportedModelException
UnsupportedLexicalizationModelException
ProjectInconsistentException
InvalidConfigurationException
STPropertyAccessException
IOException
ReservedPropertyUpdateException
ProjectUpdateException
STPropertyUpdateException
NoSuchConfigurationManager
-
handleProjectExclusively
public static void handleProjectExclusively(String projectName, Consumer<Project> projectConsumer) throws ProjectAccessException, InvalidProjectNameException, ProjectInexistentException
-