public class ProjectManager extends Object
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:
ProjectConsumer
s, together with their access permissions ProjectACL.AccessLevel
.ProjectConsumer
, and by which modalitythe online status of each project reports:
for each of them
LockStatus
, which is represented by a <ProjectACL.LockLevel
, ProjectConsumer
&rt;Modifier and Type | Class and Description |
---|---|
static class |
ProjectManager.AccessResponse |
static class |
ProjectManager.ProjectType |
Modifier and Type | Field and Description |
---|---|
protected static org.slf4j.Logger |
logger |
static String |
triples_exchange_FileName |
Constructor and Description |
---|
ProjectManager() |
Modifier and Type | Method and Description |
---|---|
static Project<? extends RDFModel> |
accessProject(ProjectConsumer consumer,
String projectName,
ProjectACL.AccessLevel requestedAccessLevel,
ProjectACL.LockLevel requestedLockLevel)
ProjectConsumer s may request access to a project through this method. |
static ProjectManager.AccessResponse |
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 void |
closeCurrentProject() |
static Project<? extends RDFModel> |
createProject(ProjectConsumer consumer,
String projectName,
Class<? extends RDFModel> modelType,
File projectDir,
String baseURI,
String defaultNamespace,
String ontManagerFactoryID,
String modelConfigurationClassName,
Properties modelConfiguration,
String uriGeneratorFactoryID,
String uriGenConfigurationClassName,
Properties uriGenConfiguration,
String renderingEngineFactoryID,
String renderingEngineConfigurationClass,
Properties renderingEngineConfiguration)
This method sets up all the necessary files which characterize projects and then generates a new
instance on the initialized folder
Note: by using directly this method you may create projects in any place in the file system, and
Semantic Turkey won't be able to localize them.
|
static Project<? extends RDFModel> |
createProject(ProjectConsumer consumer,
String projectName,
Class<? extends RDFModel> modelType,
String baseURI,
String ontManagerFactoryID,
String modelConfigurationClass,
Properties modelConfiguration,
String uriGeneratorFactoryID,
String uriGenConfigurationClass,
Properties uriGenConfiguration,
String renderingEngineFactoryID,
String renderingEngineConfigurationClass,
Properties renderingEngineConfiguration)
a shortcut for
#createProject(ProjectConsumer, String, Class, String, String, String, String, Properties) with
defaultNamespace automatically assigned from the baseuri |
static Project<? extends RDFModel> |
createProject(ProjectConsumer consumer,
String projectName,
Class<? extends RDFModel> modelType,
String baseURI,
String defaultNamespace,
String ontManagerFactoryID,
String modelConfigurationClass,
Properties modelConfiguration,
String uriGeneratorFactoryID,
String uriGenConfigurationClass,
Properties uriGenConfiguration,
String renderingEngineFactoryID,
String renderingEngineConfigurationClass,
Properties renderingEngineConfiguration)
as for
#createProject(ProjectConsumer, String, Class, File, String, String, String, String, Properties)
but the directory of the project bears the name of the project itself and is located inside the
SemanticTurkeyData directory of your Firefox profile. |
static Project<? extends RDFModel> |
createProject(String projectName,
Class<? extends RDFModel> modelType,
String baseURI,
String ontManagerFactoryID,
String modelConfigurationClass,
Properties modelConfiguration,
String uriGeneratorFactoryID,
String uriGenConfigurationClass,
Properties uriGenConfiguration,
String renderingEngineFactoryID,
String renderingEngineConfigurationClass,
Properties renderingEngineConfiguration)
a shortcut for
#createProject(ProjectConsumer, String, Class, String, String, String, Properties) with
ProjectConsumer set to ProjectConsumer.SYSTEM |
static Project<? extends RDFModel> |
createProjectAndSetAsCurrent(String projectName,
Class<? extends RDFModel> modelType,
String baseURI,
String ontManagerFactoryID,
String modelConfigurationClass,
Properties modelConfiguration,
String uriGeneratorFactoryID,
String uriGenConfigurationClass,
Properties uriGenConfiguration,
String renderingEngineFactoryID,
String renderingEngineConfigurationClass,
Properties renderingEngineConfiguration) |
static void |
deleteProject(String projectName) |
static void |
disconnectFromProject(ProjectConsumer consumer,
String projectName)
this method allows
ProjectConsumer consumer to be disconnected from the
Project identified by projectName . |
static String |
escape(String in) |
static boolean |
existsProject(String projectName) |
static void |
exportCurrentProject(File semTurkeyProjectFile) |
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 Project<? extends RDFModel> |
getCurrentProject()
gets the currently loaded 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<? extends RDFModel> |
getProject(String projectName)
returns the
Project with name = projectName . |
static String |
getProjectBaseURI(String projectName)
gets the baseuri of the project with name
projectName . |
static ProjectConsumer |
getProjectConsumer(String consumerName)
returns a project consumer from its string description.
|
static String |
getProjectDefaultNamespace(String projectName)
gets the default namespace of the project with name
projectName . |
static <MODELTYPE extends RDFModel> |
getProjectDescription(String projectName)
returns a instance of a concrete implementation of class
Project , with the sole exception that
the project is not activated (no data is loaded) |
static File |
getProjectDir(String projectName)
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
|
static Class<? extends RDFModel> |
getProjectModelType(String projectName)
gets the model type for the project.
|
static String |
getProjectOntologyManagerID(String projectName)
return the id of the project manager implementation adopted by project
projectName |
static String |
getProjectProperty(String projectName,
String property)
gets the value of the given property
property for project with name
projectName
use specific get methods for standard project properties; this method is left public to support
customized properties defined over projects
|
static String |
getProjectPropertyFileContent(String projectName)
gets the project.info file content for project with name
projectName |
static Map<String,String> |
getProjectPropertyMap(String projectName)
gets name-value pairs for each property of project with name
projectName |
static long |
getProjectTimeStamp(String projectName)
gets the timestamp of the project with name
projectName . |
static ProjectManager.ProjectType |
getProjectType(String projectName)
gets the type fo the project.
|
static String |
getRequiredProjectProperty(String projectName,
String property)
|
static void |
importProject(File semTurkeyProjectFile,
String name) |
static boolean |
isOpen(Project<?> project) |
static boolean |
isOpen(String project) |
static Collection<AbstractProject> |
listProjects() |
static Collection<AbstractProject> |
listProjects(ProjectConsumer consumer)
lists the projects available (stored in the projects directory of Semantic Turkey).
|
static Project<? extends RDFModel> |
openProject(String projectName)
as for
#accessProject(ProjectConsumer, String, AccessLevel, LockLevel) with
ProjectConsumer set to ProjectConsumer.SYSTEM
ProjectACL.AccessLevel = ProjectACL.AccessLevel.RW
ProjectACL.LockLevel = ProjectACL.LockLevel.NO
and sets the project identified by projectName as currentProject |
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 name
projectName |
static void |
setProjectProperty(String projectName,
String property,
String propValue)
sets the value of the given property
property for project with name
projectName
use specific get methods for standard project properties; this method is left public to support
customized properties defined over projects
|
static boolean |
validProjectName(String projectName) |
public static final String triples_exchange_FileName
protected static org.slf4j.Logger logger
public static Collection<AbstractProject> listProjects(ProjectConsumer consumer) throws ProjectAccessException
consumer
is not null, filters the list by reporting only the projects which contain
consumer
in their ACLconsumer
- if null
, all the projects in the projects folder are listed. Corrupted projects
are also listed in this case.ProjectAccessException
public static Collection<AbstractProject> listProjects() throws ProjectAccessException
ProjectAccessException
public static void deleteProject(String projectName) throws ProjectDeletionException
projectName
- ProjectDeletionException
public static Project<? extends RDFModel> createProject(String projectName, Class<? extends RDFModel> modelType, String baseURI, String ontManagerFactoryID, String modelConfigurationClass, Properties modelConfiguration, String uriGeneratorFactoryID, String uriGenConfigurationClass, Properties uriGenConfiguration, String renderingEngineFactoryID, String renderingEngineConfigurationClass, Properties renderingEngineConfiguration) throws DuplicatedResourceException, InvalidProjectNameException, ProjectCreationException, ProjectInconsistentException, ProjectUpdateException
#createProject(ProjectConsumer, String, Class, String, String, String, Properties)
with
ProjectConsumer
set to ProjectConsumer.SYSTEM
projectName
- modelType
- baseURI
- ontManagerFactoryID
- modelConfigurationClass
- modelConfiguration
- uriGeneratorFactoryID
- uriGenConfigurationClassName
- uriGenConfiguration
- renderingEngineFactoryID
- renderingEngineConfigurationClass
- renderingEngineConfiguration
- DuplicatedResourceException
InvalidProjectNameException
ProjectCreationException
ProjectInconsistentException
ProjectUpdateException
public static Project<? extends RDFModel> createProject(ProjectConsumer consumer, String projectName, Class<? extends RDFModel> modelType, String baseURI, String ontManagerFactoryID, String modelConfigurationClass, Properties modelConfiguration, String uriGeneratorFactoryID, String uriGenConfigurationClass, Properties uriGenConfiguration, String renderingEngineFactoryID, String renderingEngineConfigurationClass, Properties renderingEngineConfiguration) throws DuplicatedResourceException, InvalidProjectNameException, ProjectCreationException, ProjectInconsistentException, ProjectUpdateException
#createProject(ProjectConsumer, String, Class, String, String, String, String, Properties)
with
defaultNamespace automatically assigned from the baseuriconsumer
- projectName
- modelType
- baseURI
- ontManagerFactoryID
- modelConfigurationClass
- modelConfiguration
- uriGeneratorFactoryID
- uriGenConfigurationClassName
- uriGenConfiguration
- renderingEngineFactoryID
- renderingEngineConfigurationClass
- renderingEngineConfiguration
- DuplicatedResourceException
InvalidProjectNameException
ProjectCreationException
ProjectInconsistentException
ProjectUpdateException
public static Project<? extends RDFModel> createProject(ProjectConsumer consumer, String projectName, Class<? extends RDFModel> modelType, String baseURI, String defaultNamespace, String ontManagerFactoryID, String modelConfigurationClass, Properties modelConfiguration, String uriGeneratorFactoryID, String uriGenConfigurationClass, Properties uriGenConfiguration, String renderingEngineFactoryID, String renderingEngineConfigurationClass, Properties renderingEngineConfiguration) throws DuplicatedResourceException, InvalidProjectNameException, ProjectCreationException, ProjectInconsistentException, ProjectUpdateException
#createProject(ProjectConsumer, String, Class, File, String, String, String, String, Properties)
but the directory of the project bears the name of the project itself and is located inside the
SemanticTurkeyData directory of your Firefox profile. You should normally use this method to create new
projects which are expected to be found by the main systemconsumer
- projectName
- modelType
- baseURI
- defaultNamespace
- ontManagerFactoryID
- modelConfigurationClass
- modelConfiguration
- uriGeneratorFactoryID
- uriGenConfigurationClassName
- uriGenConfiguration
- renderingEngineFactoryID
- renderingEngineConfigurationClass
- renderingEngineConfiguration
- DuplicatedResourceException
InvalidProjectNameException
ProjectCreationException
ProjectInconsistentException
ProjectUpdateException
public static Project<? extends RDFModel> createProject(ProjectConsumer consumer, String projectName, Class<? extends RDFModel> modelType, File projectDir, String baseURI, String defaultNamespace, String ontManagerFactoryID, String modelConfigurationClassName, Properties modelConfiguration, String uriGeneratorFactoryID, String uriGenConfigurationClassName, Properties uriGenConfiguration, String renderingEngineFactoryID, String renderingEngineConfigurationClass, Properties renderingEngineConfiguration) throws ProjectCreationException
Note: by using directly this method you may create projects in any place in the file system, and
Semantic Turkey won't be able to localize them. For this reason, it should only be used by Semantic
Turkey extensions which are adopting a new project folder, providing also dedicated API to
access/manage its projects.
use #createProject(String, Class, String, String, String, Properties)
or
#createProject(String, Class, String, String, String, String, Properties)
to create a new project
consumer
- projectName
- modelType
- projectDir
- baseURI
- defaultNamespace
- ontManagerFactoryID
- modelConfigurationClassName
- modelConfiguration
- uriGeneratorFactoryID
- uriGenConfigurationClassName
- uriGenConfiguration
- renderingEngineFactoryID
- renderingEngineConfigurationClass
- renderingEngineConfiguration
- ProjectCreationException
public static Project<? extends RDFModel> getProject(String projectName)
Project
with name = projectName
. In case no project with that name is
open, null
is returned.projectName
- public static boolean existsProject(String projectName) throws InvalidProjectNameException
InvalidProjectNameException
public static ProjectConsumer getProjectConsumer(String consumerName)
ProjectConsumer.SYSTEM
or an open project. If consumerName
consumerName
- public static void cloneProjectToNewProject(String projectName, String newProjectName) throws InvalidProjectNameException, DuplicatedResourceException, IOException, UnavailableResourceException, ProjectInexistentException
projectName
must not be open.projectName
- newProjectName
- InvalidProjectNameException
DuplicatedResourceException
IOException
UnavailableResourceException
ProjectInexistentException
public static File getProjectDir(String projectName) throws InvalidProjectNameException, ProjectInexistentException
resolveProjectNameToDir(String)
and gets the project dir associated to that nameProjectInexistentException
projectName
- InvalidProjectNameException
ProjectInexistentException
public static File resolveProjectNameToDir(String projectName) throws InvalidProjectNameException
projectName
- InvalidProjectNameException
public static void exportProject(String projectName, File semTurkeyProjectFile) throws IOException, ModelAccessException, UnsupportedRDFFormatException, UnavailableResourceException
public static void importProject(File semTurkeyProjectFile, String name) throws IOException, ModelAccessException, UnsupportedRDFFormatException, ProjectCreationException, DuplicatedResourceException, ProjectInconsistentException, ProjectUpdateException, ModelUpdateException, InvalidProjectNameException
public static <MODELTYPE extends RDFModel> Project<MODELTYPE> getProjectDescription(String projectName) throws InvalidProjectNameException, ProjectInexistentException, ProjectAccessException
Project
, with the sole exception that
the project is not activated (no data is loaded)projectName
- InvalidProjectNameException
ProjectInexistentException
ProjectAccessException
public static boolean validProjectName(String projectName)
public static void setProjectProperty(String projectName, String property, String propValue) throws IOException, InvalidProjectNameException, ProjectInexistentException
property
for project with name
projectName
use specific get methods for standard project properties; this method is left public to support customized properties defined over projects
projectName
- property
- propValue
- IOException
InvalidProjectNameException
ProjectInexistentException
public static String getProjectProperty(String projectName, String property) throws IOException, InvalidProjectNameException, ProjectInexistentException
property
for project with name
projectName
use specific get methods for standard project properties; this method is left public to support customized properties defined over projects
projectName
- property
- IOException
InvalidProjectNameException
ProjectInexistentException
public static Map<String,String> getProjectPropertyMap(String projectName) throws IOException, InvalidProjectNameException, ProjectInexistentException
projectName
projectName
- IOException
InvalidProjectNameException
ProjectInexistentException
public static String getProjectPropertyFileContent(String projectName) throws IOException, InvalidProjectNameException, ProjectInexistentException
projectName
projectName
- IOException
InvalidProjectNameException
ProjectInexistentException
public static void saveProjectPropertyFileContent(String projectName, String content) throws IOException, InvalidProjectNameException, ProjectInexistentException
projectName
projectName
- content
- IOException
InvalidProjectNameException
ProjectInexistentException
public static String getRequiredProjectProperty(String projectName, String property) throws ProjectInconsistentException, IOException, InvalidProjectNameException, ProjectInexistentException
projectName
- property
- ProjectInconsistentException
IOException
InvalidProjectNameException
ProjectInexistentException
public static String getProjectOntologyManagerID(String projectName) throws IOException, InvalidProjectNameException, ProjectInexistentException, ProjectInconsistentException
projectName
projectName
- IOException
ProjectInexistentException
InvalidProjectNameException
ProjectInconsistentException
public static ProjectManager.ProjectType getProjectType(String projectName) throws IOException, InvalidProjectNameException, ProjectInexistentException, ProjectInconsistentException
PersistentStoreProject
projectName
- IOException
ProjectInexistentException
InvalidProjectNameException
ProjectInconsistentException
FileNotFoundException
public static Class<? extends RDFModel> getProjectModelType(String projectName) throws InvalidProjectNameException, ProjectInexistentException, ProjectAccessException, ProjectInconsistentException
OWLModel
projectName
- IOException
ClassNotFoundException
IllegalClassFormatException
ProjectInexistentException
InvalidProjectNameException
ProjectAccessException
ProjectInconsistentException
FileNotFoundException
public static String getProjectBaseURI(String projectName) throws IOException, InvalidProjectNameException, ProjectInexistentException
projectName
.projectName
- IOException
ProjectInexistentException
InvalidProjectNameException
public static String getProjectDefaultNamespace(String projectName) throws IOException, InvalidProjectNameException, ProjectInexistentException
projectName
.projectName
- IOException
ProjectInexistentException
InvalidProjectNameException
public static long getProjectTimeStamp(String projectName) throws IOException, InvalidProjectNameException, ProjectInexistentException
projectName
.projectName
- ProjectInexistentException
InvalidProjectNameException
IOException
IOException
public static ProjectManager.AccessResponse checkAccessibility(ProjectConsumer consumer, Project<?> project, ProjectACL.AccessLevel requestedAccessLevel, ProjectACL.LockLevel requestedLockLevel)
public static Project<? extends RDFModel> 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. The
ProjectManager
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.consumer
- projectName
- requestedAccessLevel
- requestedLockLevel
- InvalidProjectNameException
ProjectInexistentException
ProjectAccessException
ForbiddenProjectAccessException
public static void disconnectFromProject(ProjectConsumer consumer, String projectName) throws ModelUpdateException
ProjectConsumer
consumer
to be disconnected from the
Project
identified by projectName
.ProjectConsumer.SYSTEM
, then projectName
is disconnected in
turn from the projects it consumes.consumer
- projectName
- ModelUpdateException
public static boolean isOpen(Project<?> project)
public static boolean isOpen(String project)
public static ProjectACL.AccessLevel getAccessedLevel(String projectName, ProjectConsumer consumer) throws InvalidProjectNameException, ProjectInexistentException, ProjectAccessException
project
- consumer
- ProjectAccessException
ProjectInexistentException
InvalidProjectNameException
public static ProjectConsumer getLockingConsumer(String projectName) throws InvalidProjectNameException, ProjectInexistentException, ProjectAccessException
null
if the project is not
currently lockedprojectName
- consumer
- InvalidProjectNameException
ProjectInexistentException
ProjectAccessException
public static ProjectACL.LockLevel getLockingLevel(String projectName, ProjectConsumer consumer) throws InvalidProjectNameException, ProjectInexistentException, ProjectAccessException
null
if the
project is not locked by the given consumer.projectName
- consumer
- InvalidProjectNameException
ProjectInexistentException
ProjectAccessException
public static Project<? extends RDFModel> getCurrentProject()
public static Project<? extends RDFModel> openProject(String projectName) throws ProjectAccessException, ProjectInexistentException, InvalidProjectNameException, ForbiddenProjectAccessException
#accessProject(ProjectConsumer, String, AccessLevel, LockLevel)
with
ProjectConsumer
set to ProjectConsumer.SYSTEM
ProjectACL.AccessLevel
= ProjectACL.AccessLevel.RW
ProjectACL.LockLevel
= ProjectACL.LockLevel.NO
projectName
as currentProject
projectName
- ProjectAccessException
ProjectInexistentException
ForbiddenProjectAccessException
InvalidProjectNameException
public static void closeCurrentProject() throws ModelUpdateException
ModelUpdateException
public static void exportCurrentProject(File semTurkeyProjectFile) throws IOException, ModelAccessException, UnsupportedRDFFormatException, UnavailableResourceException
public static Project<? extends RDFModel> createProjectAndSetAsCurrent(String projectName, Class<? extends RDFModel> modelType, String baseURI, String ontManagerFactoryID, String modelConfigurationClass, Properties modelConfiguration, String uriGeneratorFactoryID, String uriGenConfigurationClass, Properties uriGenConfiguration, String renderingEngineFactoryID, String renderingEngineConfigurationClass, Properties renderingEngineConfiguration) throws DuplicatedResourceException, InvalidProjectNameException, ProjectCreationException, ProjectInconsistentException, ProjectUpdateException
Copyright © 2016 ART Group, University of Rome, Tor Vergata. All rights reserved.