Class RemoteProject

java.lang.Object
ca.phon.project.AbstractProject
ca.phon.project.RemoteProject
All Implemented Interfaces:
IExtendable, Project

public class RemoteProject extends AbstractProject
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
  • Constructor Details

  • Method Details

    • getVersion

      public String getVersion()
      Description copied from interface: Project
      Project version
      Returns:
      the project version or 'unk' if not known
    • getLocation

      public String getLocation()
      Description copied from interface: Project
      The location of the project.
      Returns:
      the project location
    • getName

      public String getName()
      Description copied from interface: Project
      The name of the project.
      Returns:
      project name
    • setName

      public void setName(String name)
      Description copied from interface: Project
      Set project name
      Parameters:
      name - must match pattern '[ \w\d-]+'
    • getUUID

      public UUID getUUID()
      Description copied from interface: Project
      Project UUID UUID for the project
      Returns:
      uuid
    • setUUID

      public void setUUID(UUID uuid)
      Description copied from interface: Project
      Set project UUID
    • getCorpora

      public List<String> 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

      public void addCorpus(String name, String description) throws IOException
      Description copied from interface: Project
      Add a new corpus with the specified name.
      Throws:
      IOException - if the corpus could not be created
    • renameCorpus

      public void renameCorpus(String corpus, String newName) throws IOException
      Description copied from interface: Project
      Rename a corpus
      Throws:
      IOException - if the corpus could not be renamed
    • removeCorpus

      public void removeCorpus(String corpus) throws IOException
      Description copied from interface: Project
      Delete the specified corpus and all sessions it contains.
      Throws:
      IOException - if the corpus could not be deleted
    • getCorpusDescription

      public String getCorpusDescription(String corpus)
      Description copied from interface: Project
      Get the description of the specified corpus.
      Parameters:
      corpus - the corpus name
    • setCorpusDescription

      public void setCorpusDescription(String corpus, String description)
      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

      public String getProjectMediaFolder()
      Description copied from interface: Project
      Get media folder for the project.
    • setProjectMediaFolder

      public void setProjectMediaFolder(String mediaFolder)
      Description copied from interface: Project
      Set media folder for project.
      Parameters:
      mediaFolder - If null sets the media folder back to default.
    • hasCustomCorpusMediaFolder

      public boolean hasCustomCorpusMediaFolder(String corpus)
      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

      public String getCorpusMediaFolder(String corpus)
      Description copied from interface: Project
      Get the media folder for the specified corpus.
      Returns:
      mediaFolder or the project media folder if not specified
    • setCorpusMediaFolder

      public void setCorpusMediaFolder(String corpus, String mediaFolder)
      Description copied from interface: Project
      Set the media folder for the specified corpus.
    • getSessionTemplate

      public Session getSessionTemplate(String corpus) throws IOException
      Description copied from interface: Project
      Get the Session template for the given corpus.
      Returns:
      session template or null if not found
      Throws:
      IOException
    • saveSessionTemplate

      public void saveSessionTemplate(String corpus, Session template) throws IOException
      Description copied from interface: Project
      Save the Session template for the given corpus.
      Throws:
      IOException
    • createSessionFromTemplate

      public Session createSessionFromTemplate(String corpus, String session) throws IOException
      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

      public List<String> getCorpusSessions(String corpus)
      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

      public String getCorpusPath(String corpus)
      Description copied from interface: Project
      Return the path to the given corpus.
    • setCorpusPath

      public void setCorpusPath(String corpus, String path)
      Description copied from interface: Project
      Set path of corpus.
    • numberOfRecordsInSession

      public int numberOfRecordsInSession(String corpus, String session) throws IOException
      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

      public Set<Participant> getParticipants(Collection<SessionPath> sessions)
      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 the ParticipantHistory 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

      public Session openSession(String corpus, String session) throws IOException
      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

      public Session openSession(String corpus, String session, SessionReader reader) throws IOException
      Description copied from interface: Project
      Open specified session using the provided reader.
      Returns:
      the session
      Throws:
      IOException
    • getSessionPath

      public String getSessionPath(Session session)
      Description copied from interface: Project
      Get path to the given session.
      Returns:
      path to given session
    • getSessionPath

      public String getSessionPath(String corpus, String session)
      Description copied from interface: Project
      Get path to the given session.
      Returns:
      path to given session
    • getSessionWriteLock

      public UUID getSessionWriteLock(Session session) throws IOException
      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

      public UUID getSessionWriteLock(String corpus, String session) throws IOException
      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

      public void releaseSessionWriteLock(Session session, UUID writeLock) throws IOException
      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

      public boolean isSessionLocked(Session session)
      Description copied from interface: Project
      Tells whether the given session is locked
      Returns:
      true if session is locked, false otherwise
    • isSessionLocked

      public boolean isSessionLocked(String corpus, String session)
      Description copied from interface: Project
      Tells wheater the given session is locked
      Returns:
      true if the session is locked, false otherwise
    • saveSession

      public void saveSession(Session session, UUID writeLock) throws IOException
      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

      public void removeSession(Session session, UUID writeLock) throws IOException
      Description copied from interface: Project
      Remove a session from the project. The writeLock for the session is also released.
      Throws:
      IOException
    • removeSession

      public void removeSession(String corpus, String session, UUID writeLock) throws IOException
      Description copied from interface: Project
      Remove a session from the project. The writeLock for the session is also released.
      Throws:
      IOException
    • getSessionModificationTime

      public ZonedDateTime getSessionModificationTime(Session session)
      Description copied from interface: Project
      Returns the modification date for the given session
      Returns:
      session modification date in system time zone
    • getSessionModificationTime

      public ZonedDateTime getSessionModificationTime(String corpus, String session)
      Description copied from interface: Project
      Returns the modification date for the specified session.
      Returns:
      session modification date in system time zone
    • getSessionByteSize

      public long getSessionByteSize(Session session)
      Description copied from interface: Project
      Returns the size on disk for the given session.
      Returns:
      session size in bytes
    • getSessionByteSize

      public long getSessionByteSize(String corpus, String session)
      Description copied from interface: Project
      Returns the size on disk for the given session.
      Returns:
      session size in bytes
    • getResourceLocation

      public String 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

      public void setResourceLocation(String location)
      Description copied from interface: Project
      Set the location of the project resources folder.
    • getResourceInputStream

      public InputStream getResourceInputStream(String resourceName) throws IOException
      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

      public OutputStream getResourceOutputStream(String resourceName) throws IOException
      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