org.mycore.datamodel.ifs
Class MCRFileImportExport
java.lang.Object
org.mycore.datamodel.ifs.MCRFileImportExport
public class MCRFileImportExport
- extends Object
Imports or exports complete directory trees with all contained files and subdirectories between the local host's filesystem and the internal MCRDirectory
structures.
- Version:
- $Revision: 13744 $ $Date: 2008-07-14 15:05:49 +0200 (Mo, 14 Jul 2008) $
- Author:
- Frank Lützenkirchen
|
Method Summary |
static MCRDirectory |
addFiles(File local,
String ownerID)
Imports the contents of a local file or directory into an existing MCRDirectory that is owned by the given owner ID. |
static void |
exportFiles(MCRDirectory dir,
File local)
Exports all contents of the given MCRDirectory to the local filesystem, including all subdirectories and stored files. |
static void |
importFiles(File local,
MCRDirectory dir)
Imports the contents of a local file or directory into the MyCoRe Internal Filesystem. |
static MCRDirectory |
importFiles(File local,
String ownerID)
Imports the contents of a local file or directory into a newly created MCRDirectory that is owned by the given owner ID. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MCRFileImportExport
public MCRFileImportExport()
importFiles
public static MCRDirectory importFiles(File local,
String ownerID)
- Imports the contents of a local file or directory into a newly created MCRDirectory that is owned by the given owner ID. The new MCRDirectory will have
the same name as the owner ID. If the local object is a file, a MCRFile with the same name will be created or updated in that MCRDirectory. If the local
object is a directory, all contained subdirectories and files will be imported into the newly created MCRDirectory. That means that after finishing this
method, the complete directory structure will have been imported and mapped from the local filesystem's structure. The method checks the contents of each
local file to be imported. If the file's content has not changed for existing files, the internal MCRFile will not be updated. If there is any exception
while importing the local contents, the system will try to undo this operation by completely deleting all content that was imported so far.
- Parameters:
local - the local file or directory to be importedownerID - the ID of the logical owner of the content that will be stored
- Returns:
- a new MCRDirectory that will contain all imported files and directories as instances of MCRFilesystemNode children.
addFiles
public static MCRDirectory addFiles(File local,
String ownerID)
- Imports the contents of a local file or directory into an existing MCRDirectory that is owned by the given owner ID. The new MCRDirectory will have the
same name as the owner ID. If the local object is a file, a MCRFile with the same name will be created or updated in that MCRDirectory. If the local
object is a directory, all contained subdirectories and files will be imported into the newly created MCRDirectory. That means that after finishing this
method, the complete directory structure will have been imported and mapped from the local filesystem's structure. The method checks the contents of each
local file to be imported. If the file's content has not changed for existing files, the internal MCRFile will not be updated. If there is any exception
while importing the local contents, the system will stop with the last state and break the work.
- Parameters:
local - the local file or directory to be importedownerID - the ID of the logical owner of the content that will be stored
- Returns:
- a new MCRDirectory that will contain all imported files and directories as instances of MCRFilesystemNode children.
importFiles
public static void importFiles(File local,
MCRDirectory dir)
- Imports the contents of a local file or directory into the MyCoRe Internal Filesystem. If the local object is a file, a MCRFile with the same name will
be created or updated in the given MCRDirectory. If the local object is a directory, all contained subdirectories and files will be imported into the
given MCRDirectory. That means that after finishing this method, the complete directory structure will have been imported and mapped from the local
filesystem's structure. The method checks the contents of each local file to be imported. If the file's content has not changed for existing files, the
internal MCRFile will not be updated. If an internal directory is updated from a local directory, new files will be added, existing files will be updated
if necessary, but files that already exist in the given MCRDirectory but not in the local filesystem will be kept and will not be deleted.
- Parameters:
local - the local file or directorydir - an existing MCRDirectory where to store the imported contents of the local filesystem.
exportFiles
public static void exportFiles(MCRDirectory dir,
File local)
throws MCRException
- Exports all contents of the given MCRDirectory to the local filesystem, including all subdirectories and stored files. If the local object is a file, the
parent directory of that file will be used for exporting.
- Parameters:
local - the local directory where to export the contents todir - the directory thats contents should be exported
- Throws:
MCRException