public class FilenameHandler extends java.lang.Object implements FilenameHandlerIF
Property Keyword | Datatype | Default | Description |
---|---|---|---|
CORBAFileServer.URLPrefix | String | file://"+Helper.getHostname().toUpperCase() | This is the prefix that the file handler uses to create the URL of the file. |
Constructor and Description |
---|
FilenameHandler() |
Modifier and Type | Method and Description |
---|---|
void |
delete(java.io.File file)
Delete an unused file.
|
protected void |
deleteEmptyDirs(java.io.File dir)
Delete empty dirs recursivily to root, util the root dir is reached.
|
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(java.lang.String urlStr)
Get the local file from given URL string.
|
static java.lang.String |
getRootDirectory()
Get the root directory according to the defined properties.
|
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.
|
java.io.File |
move(java.io.File file)
Move an unused file.
|
public 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
getURLFromFile
in interface FilenameHandlerIF
file
- the local filejava.io.IOException
public java.io.File getFileFromURL(java.lang.String urlStr) throws java.io.IOException, java.net.UnknownHostException
getFileFromURL
in interface FilenameHandlerIF
urlStr
- the url stringjava.io.IOException
java.net.UnknownHostException
public void delete(java.io.File file)
delete
in interface FilenameHandlerIF
file
- the file that may be deleted.protected void deleteEmptyDirs(java.io.File dir)
dir
- the starting directory.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