ActiveSessionStorageManager
public class SessionStorageManager
extends java.lang.Object
Modifier and Type | Field | Description |
---|---|---|
protected boolean |
createScriptDir |
|
protected boolean |
createSpeakerDir |
|
static java.lang.String |
DEF_RECVERSION_FORMAT |
|
static java.lang.String |
DEF_SESSION_ID_FORMAT |
|
protected static int |
DEF_SESSION_ID_FORMAT_DIGIT_COUNT |
|
static java.lang.String |
DEF_SPEAKER_ID_FORMAT |
|
protected MetaData |
metadata |
|
protected int |
numLines |
|
protected boolean |
overwrite |
|
protected java.text.DecimalFormat |
recVersionFormat |
|
protected java.lang.String |
scriptID |
|
protected java.text.DecimalFormat |
scriptIDFormat |
|
protected java.text.NumberFormat |
sessionIDFormat |
|
protected java.text.DecimalFormat |
speakerIDFormat |
|
protected java.net.URL |
storageURL |
|
protected javax.sound.sampled.AudioFileFormat.Type |
uploadType |
Constructor | Description |
---|---|
SessionStorageManager() |
Modifier and Type | Method | Description |
---|---|---|
protected java.net.URL |
addDirToURL(java.net.URL baseURL,
java.lang.String dir) |
appends a path fragment on a URL.
|
protected java.net.URL |
addQueryToURL(java.net.URL baseURL,
java.lang.String name,
java.lang.String value) |
adds (or extends) a query string to a URL.
|
java.net.URL[] |
generateAudioFileURLs(int sessionID,
java.lang.String speakerCode,
java.lang.String promptCode,
int recVersion) |
Generates dynamic audio filename for the actual item based on the storage URL.
|
MetaData |
getMetadata() |
|
int |
getRecordedVersions(int sessionId,
java.lang.String sessionCode,
java.lang.String itemcode) |
|
java.lang.String |
getRootFileName(int sessionID,
java.lang.String promptCode,
java.lang.String speakerCode,
int recVersion) |
Computes a root file name, subject to several options.
|
java.text.NumberFormat |
getSessionIDFormat() |
|
protected java.lang.String |
getSessionNamePart(int sessionID,
java.lang.String speakerCode) |
Computes a file name fragment for this session.
|
java.net.URL |
getSessionURL(int sessionID) |
Creates a base URL for this session, which is used to build
several individual URLs for the upload.
|
java.text.DecimalFormat |
getSpeakerIDFormat() |
|
java.net.URL |
getStorageURL() |
|
javax.sound.sampled.AudioFileFormat.Type |
getUploadType() |
|
boolean |
isRecorded(int sessionID,
java.lang.String speakerCode,
java.lang.String promptCode,
int recVersion) |
Checks if a particular version of an item is already recorded.
|
boolean |
isUseScriptID() |
|
boolean |
isUseSpeakerID() |
|
java.io.File |
sessionDirForSessionID(int sessionID) |
|
boolean |
sessionHasRecordingFiles(Session sess) |
|
java.lang.String |
sessionIDString(int sessionID) |
|
java.util.Set<Session> |
sessionsLazy(Project prj,
Script script) |
|
void |
setMetadata(MetaData metadata) |
|
void |
setNumLines(int i) |
|
void |
setOverwrite(boolean overwrite) |
|
void |
setSessionIDFormat(java.text.NumberFormat format) |
|
void |
setStorageURL(java.net.URL storageURL) |
defines the target URL for uploads.
|
void |
setUseScriptID(boolean b) |
|
void |
setUseSpeakerID(boolean b) |
|
void |
updateRecFiles(Session sess,
boolean recentVersionsOnly) |
protected static final int DEF_SESSION_ID_FORMAT_DIGIT_COUNT
public static java.lang.String DEF_SESSION_ID_FORMAT
public static java.lang.String DEF_SPEAKER_ID_FORMAT
public static java.lang.String DEF_RECVERSION_FORMAT
protected java.net.URL storageURL
protected java.text.DecimalFormat speakerIDFormat
protected java.text.NumberFormat sessionIDFormat
protected java.text.DecimalFormat scriptIDFormat
protected int numLines
protected javax.sound.sampled.AudioFileFormat.Type uploadType
protected java.text.DecimalFormat recVersionFormat
protected boolean createSpeakerDir
protected boolean createScriptDir
protected MetaData metadata
protected java.lang.String scriptID
protected boolean overwrite
public java.net.URL getStorageURL()
public void setStorageURL(java.net.URL storageURL)
http://OurAppServer/DemoApplication/RecordingData/StoreServlet.xml
If the protocol of the given URL is file, the storageManager
switches to local mode. Otherwise it switches to remote mode.target
- any valid URLpublic void setNumLines(int i)
i
- number of linespublic void setOverwrite(boolean overwrite)
overwrite
- the overwrite to setpublic javax.sound.sampled.AudioFileFormat.Type getUploadType()
public java.text.DecimalFormat getSpeakerIDFormat()
protected java.net.URL addQueryToURL(java.net.URL baseURL, java.lang.String name, java.lang.String value) throws java.net.MalformedURLException, java.io.UnsupportedEncodingException
name
already exists in the query.the
- URL to be extendedthe
- variable name for the query string without initial delimiterthe
- variable value for the query string without initial delimiterjava.net.MalformedURLException
java.io.UnsupportedEncodingException
protected java.net.URL addDirToURL(java.net.URL baseURL, java.lang.String dir) throws StorageManagerException
baseURL
- dir
- java.net.MalformedURLException
StorageManagerException
public java.net.URL getSessionURL(int sessionID) throws StorageManagerException
StorageManagerException
public java.lang.String sessionIDString(int sessionID)
public java.io.File sessionDirForSessionID(int sessionID) throws StorageManagerException
StorageManagerException
protected java.lang.String getSessionNamePart(int sessionID, java.lang.String speakerCode)
sessionID
- session IDspeakerCode
- speaker codepublic java.lang.String getRootFileName(int sessionID, java.lang.String promptCode, java.lang.String speakerCode, int recVersion)
promptCode
- speakerCode
- #getSessionNamePart(String speakerCode)
public java.net.URL[] generateAudioFileURLs(int sessionID, java.lang.String speakerCode, java.lang.String promptCode, int recVersion) throws StorageManagerException
isUseAsCache()
is true, the following
parameters are appended on the storageURL
as query string:
promptCode, speakerCode, extension, session, line
In offline mode, prompt, speaker code etc. are appended on the storage URL as
directory fragments to build a valid and individual filename.sessionID
- session IDspeakerCode
- speaker codepromptCode
- the item coderecVersion
- of the recordingStorageManagerException
public boolean isRecorded(int sessionID, java.lang.String speakerCode, java.lang.String promptCode, int recVersion) throws StorageManagerException
promptCode
- code of the itemrecVersion
- numberStorageManagerException
java.net.URISyntaxException
public boolean sessionHasRecordingFiles(Session sess) throws StorageManagerException
StorageManagerException
public int getRecordedVersions(int sessionId, java.lang.String sessionCode, java.lang.String itemcode) throws StorageManagerException
StorageManagerException
public void updateRecFiles(Session sess, boolean recentVersionsOnly) throws StorageManagerException
StorageManagerException
public java.util.Set<Session> sessionsLazy(Project prj, Script script) throws StorageManagerException
StorageManagerException
public java.text.NumberFormat getSessionIDFormat()
public void setSessionIDFormat(java.text.NumberFormat format)
format
- session ID formatpublic MetaData getMetadata()
public void setMetadata(MetaData metadata)
metadata
- The metadata to set.public boolean isUseScriptID()
public boolean isUseSpeakerID()
public void setUseScriptID(boolean b)
public void setUseSpeakerID(boolean b)