Package ca.phon.project
Class RemoteProject
java.lang.Object
ca.phon.project.AbstractProject
ca.phon.project.RemoteProject
- All Implemented Interfaces:
IExtendable
,Project
Access remote project using https
URI provided to constructor may have https or phon scheme
e.g., https://www.phon.ca/project/MyProject
or phon://www.phon.ca/project/MyProject
-
Field Summary
Fields inherited from class ca.phon.project.AbstractProject
PROJECT_XML_FILE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a new corpus with the specified name.createSessionFromTemplate
(String corpus, String session) Create a new session from the corpus template (if it exists) This method will also add the session to the specified corpus.Get the list of corpora in this project.getCorpusDescription
(String corpus) Get the description of the specified corpus.getCorpusMediaFolder
(String corpus) Get the media folder for the specified corpus.getCorpusPath
(String corpus) Return the path to the given corpus.getCorpusSessions
(String corpus) Get the session names contained in a corpus in alphabetical order.The location of the project.getName()
The name of the project.getParticipants
(Collection<SessionPath> sessions) Return a set of participants which are found in the given collection of Sessions.Get media folder for the project.getResourceInputStream
(String resourceName) Get an input stream for the specified project resource.Get the location of the project resources folder.getResourceOutputStream
(String resourceName) Get an output stream for the specified resource.long
getSessionByteSize
(Session session) Returns the size on disk for the given session.long
getSessionByteSize
(String corpus, String session) Returns the size on disk for the given session.getSessionModificationTime
(Session session) Returns the modification date for the given sessiongetSessionModificationTime
(String corpus, String session) Returns the modification date for the specified session.getSessionPath
(Session session) Get path to the given session.getSessionPath
(String corpus, String session) Get path to the given session.getSessionTemplate
(String corpus) Get the Session template for the given corpus.getSessionWriteLock
(Session session) Get a write lock for a session.getSessionWriteLock
(String corpus, String session) Get a write lock for a session.getUUID()
Project UUID UUID for the projectProject versionboolean
hasCustomCorpusMediaFolder
(String corpus) Has a custom corpus media folder been assignedboolean
Has a custom project media folder been assignedboolean
isSessionLocked
(Session session) Tells whether the given session is lockedboolean
isSessionLocked
(String corpus, String session) Tells wheater the given session is lockedint
numberOfRecordsInSession
(String corpus, String session) Returns the number of records in a session w/o opening the session.openSession
(String corpus, String session) Open the specified session.openSession
(String corpus, String session, SessionReader reader) Open specified session using the provided reader.void
releaseSessionWriteLock
(Session session, UUID writeLock) Release the write lock for a session.void
releaseSessionWriteLock
(String corpus, String session, UUID writeLock) Release the write lock for a session.void
removeCorpus
(String corpus) Delete the specified corpus and all sessions it contains.void
removeSession
(Session session, UUID writeLock) Remove a session from the project.void
removeSession
(String corpus, String session, UUID writeLock) Remove a session from the project.void
renameCorpus
(String corpus, String newName) Rename a corpusvoid
saveSession
(Session session, UUID writeLock) Save a sessionvoid
saveSession
(String corpus, String sessionName, Session session, SessionWriter writer, UUID writeLock) Save a session writing the file using the given writer.void
saveSession
(String corpus, String sessionName, Session session, UUID writeLock) Save a session to the specified corpus and new sessionName.void
saveSessionTemplate
(String corpus, Session template) Save the Session template for the given corpus.void
setCorpusDescription
(String corpus, String description) Set the description for the specified corpus.void
setCorpusMediaFolder
(String corpus, String mediaFolder) Set the media folder for the specified corpus.void
setCorpusPath
(String corpus, String path) Set path of corpus.void
Set project namevoid
setProjectMediaFolder
(String mediaFolder) Set media folder for project.void
setResourceLocation
(String location) Set the location of the project resources folder.void
Set project UUIDMethods inherited from class ca.phon.project.AbstractProject
addProjectListener, fireProjectDataChanged, fireProjectStructureChanged, fireProjectWriteLocksChanged, getExtension, getExtensions, getProjectListeners, loadProjectData, putExtension, removeExtension, removeProjectListener
-
Constructor Details
-
RemoteProject
- Throws:
ProjectConfigurationException
-
-
Method Details
-
getVersion
Description copied from interface:Project
Project version- Returns:
- the project version or 'unk' if not known
-
getLocation
Description copied from interface:Project
The location of the project.- Returns:
- the project location
-
getName
Description copied from interface:Project
The name of the project.- Returns:
- project name
-
setName
Description copied from interface:Project
Set project name- Parameters:
name
- must match pattern '[ \w\d-]+'
-
getUUID
Description copied from interface:Project
Project UUID UUID for the project- Returns:
- uuid
-
setUUID
Description copied from interface:Project
Set project UUID -
getCorpora
Description copied from interface:Project
Get the list of corpora in this project. Corpus names are returned in alphabetical order.- Returns:
- list of corpora
-
addCorpus
Description copied from interface:Project
Add a new corpus with the specified name.- Throws:
IOException
- if the corpus could not be created
-
renameCorpus
Description copied from interface:Project
Rename a corpus- Throws:
IOException
- if the corpus could not be renamed
-
removeCorpus
Description copied from interface:Project
Delete the specified corpus and all sessions it contains.- Throws:
IOException
- if the corpus could not be deleted
-
getCorpusDescription
Description copied from interface:Project
Get the description of the specified corpus.- Parameters:
corpus
- the corpus name
-
setCorpusDescription
Description copied from interface:Project
Set the description for the specified corpus. -
hasCustomProjectMediaFolder
public boolean hasCustomProjectMediaFolder()Description copied from interface:Project
Has a custom project media folder been assigned- Returns:
true
if project folder has been customized
-
getProjectMediaFolder
Description copied from interface:Project
Get media folder for the project. -
setProjectMediaFolder
Description copied from interface:Project
Set media folder for project.- Parameters:
mediaFolder
- Ifnull
sets the media folder back to default.
-
hasCustomCorpusMediaFolder
Description copied from interface:Project
Has a custom corpus media folder been assigned- Returns:
true
if a custom media folder is assigned for the given corpus
-
getCorpusMediaFolder
Description copied from interface:Project
Get the media folder for the specified corpus.- Returns:
- mediaFolder or the project media folder if not specified
-
setCorpusMediaFolder
Description copied from interface:Project
Set the media folder for the specified corpus. -
getSessionTemplate
Description copied from interface:Project
Get the Session template for the given corpus.- Returns:
- session template or
null
if not found - Throws:
IOException
-
saveSessionTemplate
Description copied from interface:Project
Save the Session template for the given corpus.- Throws:
IOException
-
createSessionFromTemplate
Description copied from interface:Project
Create a new session from the corpus template (if it exists) This method will also add the session to the specified corpus.- Returns:
- new Session object
- Throws:
IOException
-
getCorpusSessions
Description copied from interface:Project
Get the session names contained in a corpus in alphabetical order.- Returns:
- the list of sessions in the specified corpus
-
getCorpusPath
Description copied from interface:Project
Return the path to the given corpus. -
setCorpusPath
Description copied from interface:Project
Set path of corpus. -
numberOfRecordsInSession
Description copied from interface:Project
Returns the number of records in a session w/o opening the session. This method is faster than using openSession(corpus, session).numberOfRecords()- Returns:
- number of records in the session
- Throws:
IOException
-
getParticipants
Description copied from interface:Project
Return a set of participants which are found in the given collection of Sessions. The participant objects returned by this method will include theParticipantHistory
extension. Participants from two sessions are considered to be the same if their ids, names and roles match. If the speaker for some records is unidenified, a clone of Participant.UNKOWN will be added in the returned set.- Returns:
- a set of participants
-
openSession
Description copied from interface:Project
Open the specified session. This will create a new session object with the data currently on the storage device.- Returns:
- the session
- Throws:
IOException
-
openSession
Description copied from interface:Project
Open specified session using the provided reader.- Returns:
- the session
- Throws:
IOException
-
getSessionPath
Description copied from interface:Project
Get path to the given session.- Returns:
- path to given session
-
getSessionPath
Description copied from interface:Project
Get path to the given session.- Returns:
- path to given session
-
getSessionWriteLock
Description copied from interface:Project
Get a write lock for a session. Before writing a write lock must be obtained from the project.- Returns:
- the session write lock or invalid input: '<' 0 if a write lock was not obtained
- Throws:
IOException
-
getSessionWriteLock
Description copied from interface:Project
Get a write lock for a session. Before writing a write lock must be obtained from the project.- Returns:
- the session write lock or
null
- Throws:
IOException
-
releaseSessionWriteLock
Description copied from interface:Project
Release the write lock for a session.- Throws:
IOException
-
releaseSessionWriteLock
public void releaseSessionWriteLock(String corpus, String session, UUID writeLock) throws IOException Description copied from interface:Project
Release the write lock for a session.- Throws:
IOException
-
isSessionLocked
Description copied from interface:Project
Tells whether the given session is locked- Returns:
true
if session is locked,false
otherwise
-
isSessionLocked
Description copied from interface:Project
Tells wheater the given session is locked- Returns:
true
if the session is locked,false
otherwise
-
saveSession
Description copied from interface:Project
Save a session- Throws:
IOException
-
saveSession
public void saveSession(String corpus, String sessionName, Session session, UUID writeLock) throws IOException Description copied from interface:Project
Save a session to the specified corpus and new sessionName.- Throws:
IOException
-
saveSession
public void saveSession(String corpus, String sessionName, Session session, SessionWriter writer, UUID writeLock) throws IOException Description copied from interface:Project
Save a session writing the file using the given writer.- Throws:
IOException
-
removeSession
Description copied from interface:Project
Remove a session from the project. The writeLock for the session is also released.- Throws:
IOException
-
removeSession
Description copied from interface:Project
Remove a session from the project. The writeLock for the session is also released.- Throws:
IOException
-
getSessionModificationTime
Description copied from interface:Project
Returns the modification date for the given session- Returns:
- session modification date in system time zone
-
getSessionModificationTime
Description copied from interface:Project
Returns the modification date for the specified session.- Returns:
- session modification date in system time zone
-
getSessionByteSize
Description copied from interface:Project
Returns the size on disk for the given session.- Returns:
- session size in bytes
-
getSessionByteSize
Description copied from interface:Project
Returns the size on disk for the given session.- Returns:
- session size in bytes
-
getResourceLocation
Description copied from interface:Project
Get the location of the project resources folder.- Returns:
- location of the resources folder (default:
project_folder/__res
)
-
setResourceLocation
Description copied from interface:Project
Set the location of the project resources folder. -
getResourceInputStream
Description copied from interface:Project
Get an input stream for the specified project resource. The resource name should be a relative path including filename. E.g., 'ca.phon.myplugin/module/corpus/session.dat'- Returns:
- an input stream for the specified resource
- Throws:
IOException
-
getResourceOutputStream
Description copied from interface:Project
Get an output stream for the specified resource. If the resource does not exist it is created. If the resource already exists it is overwritten.- Returns:
- output stream for the specified resource
- Throws:
IOException
-