Interface MutableProject
- All Known Implementing Classes:
DesktopProject,LocalProject,ShadowProject
public interface MutableProject
Interface for Project mutability. This is an extension for Projects which allow
modification of the project data.
-
Method Summary
Modifier and TypeMethodDescriptionvoidAdd corpus folder with given namevoidAdd a new corpus with the specified name.getSessionWriteLock(Session session) Get a write lock for a session.getSessionWriteLock(String corpus, String session) Get a write lock for a session.booleanisSessionLocked(Session session) Tells whether the given session is lockedbooleanisSessionLocked(String corpus, String session) Tells wheater the given session is lockedvoidreleaseSessionWriteLock(Session session, SessionWriteLock writeLock) Release the write lock for a session.voidreleaseSessionWriteLock(String corpus, String session, SessionWriteLock writeLock) Release the write lock for a session.voidremoveCorpus(String corpus) Delete the specified corpus and all sessions it contains.voidremoveSession(Session session, SessionWriteLock writeLock) Remove a session from the project.voidremoveSession(String corpus, String session, SessionWriteLock writeLock) Remove a session from the project.voidrenameCorpus(String corpus, String newName) Rename a corpusvoidsaveSession(Session session, SessionWriteLock writeLock) Save a session with the provided writeLock.voidsaveSession(String corpus, String sessionName, Session session, SessionWriteLock writeLock) Save a session to the specified corpus and new sessionName.voidsaveSession(String corpus, String sessionName, Session session, SessionWriter writer, SessionWriteLock writeLock) Save a session writing the file using the given writer.voidsetCorpusDescription(String corpus, String description) Set the description for the specified corpus.voidSet project namevoidSet project UUID
-
Method Details
-
setName
-
setUUID
-
addCorpus
Add corpus folder with given name- Parameters:
name- the name of the corpus- Throws:
IOException
-
addCorpus
Add a new corpus with the specified name.- Parameters:
name- the name of the corpusdescription- the description of the corpus- Throws:
IOException- if the corpus could not be created
-
renameCorpus
Rename a corpus- Parameters:
corpus- the corpus to renamenewName- the new name for the corpus- Throws:
IOException- if the corpus could not be renamed
-
removeCorpus
Delete the specified corpus and all sessions it contains.- Parameters:
corpus- the corpus to delete- Throws:
IOException- if the corpus could not be deleted
-
setCorpusDescription
-
getSessionWriteLock
Get a write lock for a session. Before writing a write lock must be obtained from the project. Example:try(SessionWriteLock writeLock = project.getSessionWriteLock(session)) { // do some work with the session } catch (IOException e) { // handle exception }- Parameters:
session- the session to lock- Returns:
- the session write lock or invalid input: '<' 0 if a write lock was not obtained
- Throws:
IOException
-
getSessionWriteLock
Get a write lock for a session. Before writing a write lock must be obtained from the project. SeegetSessionWriteLock(Session)for more information on how to use the write lock.- Parameters:
corpus- the corpus namesession- the session to lock- Returns:
- the session write lock or
null - Throws:
IOException
-
releaseSessionWriteLock
Release the write lock for a session. SeegetSessionWriteLock(Session)for more information on how to use the write lock.- Parameters:
session- the session to unlockwriteLock- the write lock to release- Throws:
IOException
-
releaseSessionWriteLock
void releaseSessionWriteLock(String corpus, String session, SessionWriteLock writeLock) throws IOException Release the write lock for a session. SeereleaseSessionWriteLock(Session, SessionWriteLock)for more information on how to use the write lock.- Parameters:
session- the session to unlockwriteLock- the write lock to release- Throws:
IOException
-
isSessionLocked
Tells whether the given session is locked- Parameters:
session- the session to check- Returns:
trueif session is locked,falseotherwise
-
isSessionLocked
-
saveSession
Save a session with the provided writeLock. Example:try(SessionWriteLock writeLock = project.getSessionWriteLock(session)) { project.saveSession(session, writeLock); } catch (IOException e) { // handle exception }The write lock is auto-closeable and will be released when the try block is exited. To manually release the write lock, call thereleaseSessionWriteLock(Session, SessionWriteLock)method or use theclose()method on the write lock.- Parameters:
session- the session to savewriteLock- the write lock for the session- Throws:
IOException
-
saveSession
void saveSession(String corpus, String sessionName, Session session, SessionWriteLock writeLock) throws IOException Save a session to the specified corpus and new sessionName. SeesaveSession(Session, SessionWriteLock)for more information on how to use the write lock.- Parameters:
corpus- the corpus namesessionName- the name of the sessionsession- the session to savewriteLock- the write lock for the session- Throws:
IOException
-
saveSession
void saveSession(String corpus, String sessionName, Session session, SessionWriter writer, SessionWriteLock writeLock) throws IOException Save a session writing the file using the given writer. SeesaveSession(Session, SessionWriteLock)for more information on how to use the write lock.- Parameters:
corpus- the corpus namesessionName- the name of the sessionsession- the session to savewriter- the session writer to usewriteLock- the write lock for the session- Throws:
IOException
-
removeSession
Remove a session from the project. The writeLock for the session is also released. SeeremoveSession(Session, SessionWriteLock)for more information on how to use the write lock.- Parameters:
session- the session to removewriteLock- the write lock for the session- Throws:
IOException
-
removeSession
Remove a session from the project. The writeLock for the session is also released. SeeremoveSession(Session, SessionWriteLock)for more information on how to use the write lock.- Parameters:
session- the session to removewriteLock- the write lock for the session- Throws:
IOException
-