public class ODSFilenameHandler extends java.lang.Object implements FilenameHandlerExtIF
Property Keyword | Datatype | Default | Description |
---|---|---|---|
ODSFilenameHandler.URLPrefix | String | file:// | This is the prefix that the file handler uses to create the URL of the file. |
ODSFilenameHandler.FileRoot | String | FILE_ROOT_EXTREF | This is the symbol of the ODS Server where the files will be stored. |
ODSFilenameHandler.UseSessionCache | boolean | true | Use a cache for the ODSFilenameURL, the cache will reduce the requests from FilenameHandler to the ODS Server. Without a cache for each file, handled in the same session, the symbols are loaded from the ODS server. With the cache the symbols are loaded only once. When the symbols changes during the session , you can not use the cache. This property is obsolete, because caching leads to synchronization issues. |
ODSFilenameHandler.CheckPath | boolean | false | Check the path of the resulting file is a (sub)directory of one of the given symbols. This check can only be done in case the FILE_MODE is MULTI_VOLUME or SINGLE_VOLUME. An exception will be thrown when the files are not part of the symbols. |
Modifier and Type | Field and Description |
---|---|
protected static java.lang.String |
BinPath |
protected static java.lang.String |
BinSubDir |
protected static java.lang.String |
FileRootExtRefName |
protected static java.lang.String |
FileRootName |
protected static java.lang.String |
FileSymbols |
protected OdsFilenameURL |
odsFilename |
Constructor and Description |
---|
ODSFilenameHandler()
The filename handler
|
Modifier and Type | Method and Description |
---|---|
protected java.lang.String |
aoExceptionToString(AoException aoException)
String formatter for AoException.
|
void |
delete(java.io.File file)
Delete an unused file.
|
java.io.File |
getFile(AoSession aoSession,
java.lang.String name,
java.lang.String subdir)
Get a file for the given initial name.
|
java.io.File |
getFileForInstance(AoSession aoSession,
java.lang.String name,
java.lang.String subDir,
T_LONGLONG aid,
T_LONGLONG iid)
Create a file for the given initial name and depending on the given ids.
|
java.io.File |
getFileForInstanceName(AoSession aoSession,
java.lang.String name,
java.lang.String subDir,
java.lang.String aeName,
java.lang.String ieName)
Create a file for the given initial name and depending on the given names.
|
java.io.File |
getFileFromURL(AoSession aoSession,
java.lang.String url)
Get the file from the storage location
|
java.io.File |
getFileFromURL(java.lang.String urlStr)
Get the local file from given URL string.
|
protected OdsFilenameURL |
getOdsFilenameURL(AoSession aoSession,
java.lang.String fileRoot)
Get the ODSFilenameURL to get the URL and the File.
|
static java.lang.String |
getRootDirectory()
Get the root directory according to the defined properties.
|
java.lang.String |
getURLFromFile(AoSession aoSession,
java.io.File file)
Get the URL from the file.
|
java.lang.String |
getURLFromFile(java.io.File file)
Create a URL string used by the ASAM ODS client to store into the AoExternalReference url value.
|
static java.lang.String |
getWasteDirectory()
Get the waste directory according to the defined properties.
|
static void |
main(java.lang.String[] arg) |
java.io.File |
move(java.io.File file)
Move an unused file.
|
protected java.lang.String |
severityFlagToString(SeverityFlag sevFlag)
String formatter for the severity flags
|
protected static java.lang.String FileRootName
protected static java.lang.String FileRootExtRefName
protected static java.lang.String FileSymbols
protected static java.lang.String BinPath
protected static java.lang.String BinSubDir
protected OdsFilenameURL odsFilename
protected java.lang.String aoExceptionToString(AoException aoException)
aoException
- the exceptionprotected java.lang.String severityFlagToString(SeverityFlag sevFlag)
sevFlag
- the severity flagpublic java.io.File getFile(AoSession aoSession, java.lang.String name, java.lang.String subdir) throws CORBAFileServerException
getFile
in interface FilenameHandlerIF
aoSession
- the ASAM ODS session.name
- the name of the file.subdir
- the subdirectory, if the filename should not be used to get the subfolder.CORBAFileServerException
- with the following possible error codes:
FILESERVER_CONNECT_FAILED
FILESERVER_BAD_PARAMETER
FILESERVER_CONNECTION_LOST
FILESERVER_IMPLEMENTATION_PROBLEM
FILESERVER_NOT_IMPLEMENTED
FILESERVER_NO_MEMORYpublic java.io.File getFileForInstance(AoSession aoSession, java.lang.String name, java.lang.String subDir, T_LONGLONG aid, T_LONGLONG iid) throws CORBAFileServerException
getFileForInstance
in interface FilenameHandlerIF
name
- the name of the file.subDir
- the subdirectory, if the filename should not be used to get the subfolder.aid
- the application element id.iid
- the instance element id.aoSession
- the ASAM ODS SessionCORBAFileServerException
- with the following possible error codes:
FILESERVER_CONNECT_FAILED
FILESERVER_BAD_PARAMETER
FILESERVER_CONNECTION_LOST
FILESERVER_IMPLEMENTATION_PROBLEM
FILESERVER_NOT_IMPLEMENTED
FILESERVER_NO_MEMORYpublic java.io.File getFileForInstanceName(AoSession aoSession, java.lang.String name, java.lang.String subDir, java.lang.String aeName, java.lang.String ieName) throws CORBAFileServerException
getFileForInstanceName
in interface FilenameHandlerIF
name
- the name of the file.subDir
- the subdirectory, if the filename should not be used to get the subfolder.aeName
- the application element name.ieName
- the instance element name.aoSession
- the ASAM ODS SessionCORBAFileServerException
- with the following possible error codes:
FILESERVER_CONNECT_FAILED
FILESERVER_BAD_PARAMETER
FILESERVER_CONNECTION_LOST
FILESERVER_IMPLEMENTATION_PROBLEM
FILESERVER_NOT_IMPLEMENTED
FILESERVER_NO_MEMORYpublic java.lang.String getURLFromFile(java.io.File file) throws java.io.IOException, CORBAFileServerException
getURLFromFile
in interface FilenameHandlerIF
file
- the local filejava.io.IOException
CORBAFileServerException
public java.io.File getFileFromURL(java.lang.String urlStr) throws java.io.IOException, java.net.UnknownHostException, CORBAFileServerException
getFileFromURL
in interface FilenameHandlerIF
urlStr
- the url stringjava.io.IOException
java.net.UnknownHostException
CORBAFileServerException
public void delete(java.io.File file)
delete
in interface FilenameHandlerIF
file
- the file that may be deleted.public static java.lang.String getRootDirectory()
public static java.lang.String getWasteDirectory()
public java.io.File move(java.io.File file) throws java.io.IOException
move
in interface FilenameHandlerIF
file
- the result file.java.io.IOException
public static void main(java.lang.String[] arg)
protected OdsFilenameURL getOdsFilenameURL(AoSession aoSession, java.lang.String fileRoot)
aoSession
- the current asam ods session.fileRoot
- the file root variable.public java.lang.String getURLFromFile(AoSession aoSession, java.io.File file) throws CORBAFileServerException
getURLFromFile
in interface FilenameHandlerExtIF
aoSession
- the ASAM ODS sessionthe
- fileCORBAFileServerException
- with the following possible error codes:
FILESERVER_CONNECT_FAILED
FILESERVER_BAD_PARAMETER
FILESERVER_CONNECTION_LOST
FILESERVER_IMPLEMENTATION_PROBLEM
FILESERVER_NOT_IMPLEMENTED
FILESERVER_NO_MEMORY
FILESERVER_ASAMODS_EXCEPTIONpublic java.io.File getFileFromURL(AoSession aoSession, java.lang.String url) throws CORBAFileServerException
getFileFromURL
in interface FilenameHandlerExtIF
aoSession
- the ASAM ODS sessionurl
- the URL or storage locationCORBAFileServerException
- with the following possible error codes:
FILESERVER_CONNECT_FAILED
FILESERVER_BAD_PARAMETER
FILESERVER_CONNECTION_LOST
FILESERVER_IMPLEMENTATION_PROBLEM
FILESERVER_NOT_IMPLEMENTED
FILESERVER_NO_MEMORY
FILESERVER_ASAMODS_EXCEPTION