UploadCacheListener
, java.util.EventListener
public class ActiveSessionStorageManager extends SessionStorageManager implements UploadCacheListener
Upload
to an UploadCache
.Modifier and Type | Class | Description |
---|---|---|
static class |
ActiveSessionStorageManager.Status |
Modifier and Type | Field | Description |
---|---|---|
static java.lang.String |
DEF_ANNOTATION_FILE_SUFFIX |
|
static java.lang.String |
DEF_SCRIPT_ID_FORMAT |
|
static java.lang.String |
XML_FILENAME_EXTENSION |
createScriptDir, createSpeakerDir, DEF_RECVERSION_FORMAT, DEF_SESSION_ID_FORMAT, DEF_SESSION_ID_FORMAT_DIGIT_COUNT, DEF_SPEAKER_ID_FORMAT, metadata, numLines, overwrite, recVersionFormat, scriptID, scriptIDFormat, sessionIDFormat, speakerIDFormat, storageURL, uploadType
Constructor | Description |
---|---|
ActiveSessionStorageManager() |
Create new storage manager.
|
Modifier and Type | Method | Description |
---|---|---|
void |
close() |
|
void |
close(boolean forceDelete) |
|
void |
connected() |
|
boolean |
createSessionDirectory() |
|
protected void |
deleteAllTmpDirFiles() |
|
void |
disconnected() |
|
static java.io.File |
fileURLToFile(java.net.URL url) |
|
java.net.URL |
generateAnnotationFileURL() |
Generates a dynamic annotation filename for the actual item based on the storage URL.
|
java.net.URL[] |
generateAudioFileURLs() |
generates a dynamic filename for the actual item based on the storage 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.
|
java.net.URL[] |
generateAudioFileURLs(java.lang.String promptCode,
int recVersion) |
Generates dynamic audio filename for the actual item based on the storage URL.
|
java.io.File |
getAnnoationFile() |
|
java.lang.String |
getAnnotationFileName() |
|
java.lang.String |
getAudioFileExtension() |
|
java.lang.String[] |
getAudioFileNames() |
|
java.lang.String[] |
getAudioFileNames(java.lang.String itemCode) |
|
java.lang.String[] |
getAudioFileNames(java.lang.String promptCode,
java.lang.String speakerCode,
java.lang.String extension) |
|
java.io.File[] |
getCachedInputFiles() |
Get cached storage files
|
java.io.InputStream[] |
getCachedInputStreams() |
get a stream for
|
java.net.URL[] |
getCachedInputURLs() |
Get cached storage URLs
|
java.net.URL[] |
getConvertedAudioFiles() |
|
java.io.File[] |
getCurrentItemRecordingFiles() |
|
java.net.URL |
getItemFileURL(java.lang.String suffix) |
|
java.lang.String |
getLabelFileExtension() |
|
java.lang.String |
getLabelFileName() |
|
java.net.URL |
getLogFile() |
|
java.lang.String |
getLogFileName() |
|
java.io.File[] |
getNewRecordingFiles() |
|
java.lang.String |
getNewRootFileName() |
Get root file name of current recording in progress.
|
int |
getNumLines() |
|
java.lang.String |
getPromptCode() |
|
int |
getRecordedVersions() |
Returns count of already recorded version beginning from zero.
|
int |
getRecordedVersions(java.lang.String promptCode) |
Returns count of already recorded version beginning from zero.
|
java.io.File[] |
getRecordingFiles() |
get a list of all available audio data.
|
java.net.URL |
getRecordingSessionInfoFile() |
|
java.lang.String |
getRecordingSessionInfoFileName() |
|
int |
getRecVersion() |
|
java.lang.String |
getRootFileName() |
Get root file name of last recorded.
|
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.lang.String[] |
getRootFileNames() |
|
java.lang.String |
getScriptID() |
|
int |
getSessionID() |
|
java.net.URL |
getSessionURL() |
Creates a base URL for this session, which is used to build
several individual URLs for the upload.
|
java.lang.String |
getSpeakerCode() |
|
java.net.URL |
getTimeLogFile() |
|
java.lang.Integer |
highestSessionID() |
Get highest session number in stand alone file based mode.
|
boolean |
isCreateSessionDir() |
|
boolean |
isCreateSpeakerDir() |
|
boolean |
isRecorded() |
|
boolean |
isRecorded(int sessionID,
java.lang.String speakerCode,
java.lang.String promptCode) |
Checks an item is already recorded.
|
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 |
isRecorded(java.lang.String promptCode) |
Checks if the item is already recorded.
|
boolean |
isRecorded(java.lang.String promptCode,
int recVersion) |
Checks if a particular version of an item is already recorded.
|
boolean |
isUseAsCache() |
|
java.util.List<java.lang.String> |
listLocalSessionIds_slow(boolean listEmptySessions) |
Returns list of session IDs of current project.
|
java.util.Set<java.lang.String> |
localSessionIds(boolean listEmptySessions) |
|
void |
open() |
|
void |
open(boolean force) |
Open the storage manager.
|
java.io.File |
recentRecordingFile(java.lang.String itemCode) |
|
boolean |
sessionExists() |
|
java.util.Set<RecordingFile> |
sessionRecordingFilesLazy(Session sess) |
|
java.io.File |
sessionScriptFile() |
|
java.net.URL |
sessionScriptURL() |
|
void |
setAudioFileExtension(java.lang.String string) |
|
void |
setCreateSessionDir(boolean b) |
|
void |
setCreateSpeakerDir(boolean b) |
|
void |
setLabelFileExtension(java.lang.String string) |
|
void |
setOverwrite(boolean overwrite) |
|
void |
setPromptCode(java.lang.String string) |
|
void |
setRecVersion(int recVersion) |
|
void |
setScriptID(java.lang.String scriptID) |
|
void |
setSessionID(int i) |
|
void |
setSpeakerCode(java.lang.String string) |
|
void |
setSpeakerIDFormat(java.text.DecimalFormat format) |
|
void |
setStorageURL(java.net.URL target) |
defines the target URL for uploads.
|
void |
setUploadCache(UploadCache uploadCache) |
set the upload cache thread for the StorageManager.
|
void |
setUploadType(javax.sound.sampled.AudioFileFormat.Type type) |
|
void |
setUseAsCache(boolean b) |
|
void |
stateChanged(Upload uvb) |
|
void |
storeSessionScriptFile(java.io.InputStream scriptStream) |
|
void |
tryConnect() |
|
void |
update(UploadEvent event) |
|
void |
upload() |
starts uploading of the collected data.
|
void |
uploadAnnotation() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addDirToURL, addQueryToURL, getMetadata, getRecordedVersions, getSessionIDFormat, getSessionNamePart, getSessionURL, getSpeakerIDFormat, getStorageURL, getUploadType, isUseScriptID, isUseSpeakerID, sessionDirForSessionID, sessionHasRecordingFiles, sessionIDString, sessionsLazy, setMetadata, setNumLines, setSessionIDFormat, setUseScriptID, setUseSpeakerID, updateRecFiles
public static java.lang.String DEF_SCRIPT_ID_FORMAT
public static java.lang.String XML_FILENAME_EXTENSION
public static java.lang.String DEF_ANNOTATION_FILE_SUFFIX
public ActiveSessionStorageManager()
protected void deleteAllTmpDirFiles()
public void open(boolean force) throws StorageManagerException
force
- force repairing inconsistent cache statesStorageManagerException
- if an inconsistent cache is foundpublic void close() throws StorageManagerException
StorageManagerException
public void close(boolean forceDelete) throws StorageManagerException
StorageManagerException
public void open() throws StorageManagerException
StorageManagerException
public java.lang.String getRootFileName(int sessionID, java.lang.String promptCode, java.lang.String speakerCode, int recVersion)
getRootFileName
in class SessionStorageManager
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.generateAudioFileURLs
in class SessionStorageManager
sessionID
- session IDspeakerCode
- speaker codepromptCode
- the item coderecVersion
- of the recordingStorageManagerException
public void setUploadCache(UploadCache uploadCache)
uploadCache
- public void upload() throws StorageManagerException
StorageManagerException
public void uploadAnnotation() throws StorageManagerException
StorageManagerException
public java.io.InputStream[] getCachedInputStreams() throws StorageManagerException
StorageManagerException
public java.net.URL[] getCachedInputURLs() throws StorageManagerException
StorageManagerException
public java.io.File[] getCachedInputFiles() throws StorageManagerException
StorageManagerException
public java.io.File[] getNewRecordingFiles() throws StorageManagerException
StorageManagerException
public java.io.File[] getCurrentItemRecordingFiles()
public static java.io.File fileURLToFile(java.net.URL url) throws StorageManagerException
StorageManagerException
public java.io.File[] getRecordingFiles() throws StorageManagerException
StorageManagerException
public java.net.URL getRecordingSessionInfoFile() throws StorageManagerException
java.net.MalformedURLException
StorageManagerException
public java.net.URL[] generateAudioFileURLs() throws StorageManagerException
isUseAsCache()
is true, the following
parameters are appended on the storageURL
as query string:
promptCode, speakerCode, extension, session, line
In offline mode, promt, speaker code etc. are appended on the storage URL as
directory fragments to build a valid and individual filename.StorageManagerException
public java.net.URL[] generateAudioFileURLs(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.promptCode
- the item coderecVersion
- of the recordingStorageManagerException
public java.net.URL generateAnnotationFileURL() 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.StorageManagerException
public java.net.URL[] getConvertedAudioFiles() throws StorageManagerException
StorageManagerException
public java.lang.String getLogFileName()
public java.net.URL getLogFile() throws StorageManagerException
StorageManagerException
public java.util.List<java.lang.String> listLocalSessionIds_slow(boolean listEmptySessions) throws StorageManagerException
listEmptySessions
- if set to true empty sessions (empty directories) are included in listStorageManagerException
public java.util.Set<java.lang.String> localSessionIds(boolean listEmptySessions) throws StorageManagerException
StorageManagerException
public java.lang.String getNewRootFileName()
public java.lang.String getRootFileName()
public java.lang.String[] getRootFileNames()
public java.net.URL getItemFileURL(java.lang.String suffix) throws StorageManagerException
StorageManagerException
public java.lang.String[] getAudioFileNames()
public java.lang.String[] getAudioFileNames(java.lang.String itemCode)
public java.lang.String[] getAudioFileNames(java.lang.String promptCode, java.lang.String speakerCode, java.lang.String extension)
public java.lang.String getLabelFileName()
public java.lang.String getRecordingSessionInfoFileName()
public java.io.File getAnnoationFile() throws StorageManagerException
StorageManagerException
public java.lang.String getAnnotationFileName()
public java.net.URL getSessionURL() throws StorageManagerException
StorageManagerException
public boolean isRecorded() throws StorageManagerException
StorageManagerException
public boolean isRecorded(java.lang.String promptCode) throws StorageManagerException
promptCode
- code of the itemStorageManagerException
public boolean isRecorded(java.lang.String promptCode, int recVersion) throws StorageManagerException
promptCode
- code of the itemrecVersion
- numberStorageManagerException
java.net.URISyntaxException
public boolean isRecorded(int sessionID, java.lang.String speakerCode, java.lang.String promptCode) throws StorageManagerException
promptCode
- code of the itemStorageManagerException
java.net.URISyntaxException
public boolean isRecorded(int sessionID, java.lang.String speakerCode, java.lang.String promptCode, int recVersion) throws StorageManagerException
isRecorded
in class SessionStorageManager
promptCode
- code of the itemrecVersion
- numberStorageManagerException
java.net.URISyntaxException
public int getRecordedVersions() throws StorageManagerException
StorageManagerException
public int getRecordedVersions(java.lang.String promptCode) throws StorageManagerException
promptCode
- StorageManagerException
public java.util.Set<RecordingFile> sessionRecordingFilesLazy(Session sess) throws StorageManagerException
StorageManagerException
public boolean createSessionDirectory() throws StorageManagerException
StorageManagerException
public boolean sessionExists() throws StorageManagerException
StorageManagerException
public java.lang.String getAudioFileExtension()
public boolean isCreateSessionDir()
public boolean isCreateSpeakerDir()
public java.lang.String getLabelFileExtension()
public int getNumLines()
public java.lang.String getPromptCode()
public java.lang.String getScriptID()
public int getSessionID()
public void setSpeakerIDFormat(java.text.DecimalFormat format)
format
- speaker ID formatpublic java.lang.String getSpeakerCode()
public void setSpeakerCode(java.lang.String string)
string
- speaker codepublic java.net.URL getTimeLogFile() throws StorageManagerException
StorageManagerException
public void setAudioFileExtension(java.lang.String string)
string
- audio file extensionpublic void setCreateSessionDir(boolean b)
public void setCreateSpeakerDir(boolean b)
public void setLabelFileExtension(java.lang.String string)
string
- label file extensionpublic void setPromptCode(java.lang.String string)
string
- prompt codepublic void setScriptID(java.lang.String scriptID)
scriptID
- script IDpublic void setSessionID(int i)
i
- session IDpublic void setStorageURL(java.net.URL target)
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.setStorageURL
in class SessionStorageManager
target
- any valid URLpublic void setUploadType(javax.sound.sampled.AudioFileFormat.Type type)
type
- audio upload typepublic boolean isUseAsCache()
public void setUseAsCache(boolean b)
b
- true if upload cache is usedpublic void tryConnect()
public void connected()
public void stateChanged(Upload uvb)
public void disconnected()
public int getRecVersion()
public void setRecVersion(int recVersion)
recVersion
- the recVersion to setpublic void setOverwrite(boolean overwrite)
setOverwrite
in class SessionStorageManager
overwrite
- the overwrite to setpublic void update(UploadEvent event)
update
in interface UploadCacheListener
public java.lang.Integer highestSessionID() throws StorageManagerException
StorageManagerException
public java.io.File recentRecordingFile(java.lang.String itemCode) throws StorageManagerException
StorageManagerException
public java.io.File sessionScriptFile() throws StorageManagerException
StorageManagerException
public java.net.URL sessionScriptURL() throws StorageManagerException
StorageManagerException
public void storeSessionScriptFile(java.io.InputStream scriptStream) throws StorageManagerException
StorageManagerException