Package org.opencms.importexport
Class CmsImportHelper
java.lang.Object
org.opencms.importexport.CmsImportHelper
Import helper.
- Since:
- 7.0.4
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
cacheDtdSystemId
(String dtdSystemLocation, String dtdFilename, String dtdUrlPrefix) Adds a new DTD system id prefix mapping for internal resolution of external URLs.void
Closes the zip file.protected File
Returns the file for the provided filename.byte[]
getFileBytes
(String filename) Returns a byte array containing the content of the file.long
getFileModification
(String filename) Returns the name of the import file, without zip extension.getFileStream
(String fileName) Returns a stream for the content of the file.Returns the RFS folder to import from.getLocation
(Class<?> clazz) Returns the class system location.protected ZipEntry
getZipEntry
(String filename) Returns the zip entry for a file in the archive.Returns the RFS zip file to import from.void
openFile()
Opens the import file.
-
Constructor Details
-
CmsImportHelper
Constructor.- Parameters:
parameters
- the import parameters to use
-
-
Method Details
-
cacheDtdSystemId
Adds a new DTD system id prefix mapping for internal resolution of external URLs.- Parameters:
dtdSystemLocation
- the internal system location of the DTD file, e.g.org/opencms/configuration/
dtdFilename
- the name of the DTD file, e.g.opencms-configuration.dtd
dtdUrlPrefix
- the external system id prefix of the DTD file, e.g.http://www.opencms.org/dtd/6.0/
- See Also:
-
closeFile
Closes the zip file. -
getFileBytes
Returns a byte array containing the content of the file.- Parameters:
filename
- the name of the file to read, relative to the folder or zip file- Returns:
- a byte array containing the content of the file
- Throws:
CmsImportExportException
- if something goes wrong
-
getFileModification
- Throws:
CmsImportExportException
-
getFileName
Returns the name of the import file, without zip extension.- Returns:
- the name of the import file, without zip extension
-
getFileStream
Returns a stream for the content of the file.- Parameters:
fileName
- the name of the file to stream, relative to the folder or zip file- Returns:
- an input stream for the content of the file, remember to close it after using
- Throws:
CmsImportExportException
- if something goes wrong
-
getFolder
Returns the RFS folder to import from.- Returns:
- the RFS folder to import from
-
getLocation
Returns the class system location.i.e:
org/opencms/importexport
- Parameters:
clazz
- the class to get the location for- Returns:
- the class system location
-
getZipFile
Returns the RFS zip file to import from.- Returns:
- the RFS zip file to import from
-
openFile
Opens the import file.- Throws:
IOException
- if the file could not be opened
-
getFile
Returns the file for the provided filename.- Parameters:
filename
- name of the file- Returns:
- the file.
-
getZipEntry
Returns the zip entry for a file in the archive.- Parameters:
filename
- the file name- Returns:
- the zip entry for the file with the provided name
- Throws:
ZipException
- thrown if the file is not in the zip archive
-